Skip to content

Commit

Permalink
Issue #65: Empty title added to untitled pages to address use-model i…
Browse files Browse the repository at this point in the history
…ssue with quicknotes getting 'Untitled Page' as default title.
  • Loading branch information
WetHat committed Apr 25, 2022
1 parent ed151f7 commit 4e0f8df
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
8 changes: 6 additions & 2 deletions OneNoteTaggingKit/PageBuilder/OneNotePage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ public class OneNotePage : PageObjectBase {
/// </summary>
/// <param name="onenoteApp">The OneNote application object.</param>
/// <param name="pageID">The page ID.</param>
internal OneNotePage(OneNoteProxy onenoteApp, string pageID) : base(onenoteApp.GetPage(pageID).Root) {
/// <param name="defaultTitle">
/// The default title to use if the page does not already have a title.
/// </param>
internal OneNotePage(OneNoteProxy onenoteApp, string pageID, string defaultTitle = "")
: base(onenoteApp.GetPage(pageID).Root) {
OneNoteApp = onenoteApp;
PageID = pageID;
Document = Element.Document; // get the page's XML document
Expand All @@ -184,7 +188,7 @@ public class OneNotePage : PageObjectBase {
XElement title = Element.Element(GetName(nameof(Title)));
if (title == null) {
// a title is required for tagging
Title = new Title(this, "Untitled Page");
Title = new Title(this, defaultTitle);
} else {
Title = new Title(this, title);
// inspect the title tags an mark collect the managed oage tags
Expand Down
9 changes: 9 additions & 0 deletions OneNoteTaggingKit/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions OneNoteTaggingKit/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -584,4 +584,7 @@ Tap or click link to navigate to page.</value>
<data name="TaggingKit_Docs_Link" xml:space="preserve">
<value>https://wethat.github.io/OnenoteTaggingKit/v4.0/Home.html</value>
</data>
<data name="NewSavedSearchPage_Title" xml:space="preserve">
<value>Untitled Search</value>
</data>
</root>
3 changes: 3 additions & 0 deletions OneNoteTaggingKit/Properties/Resources.zh.resx
Original file line number Diff line number Diff line change
Expand Up @@ -584,4 +584,7 @@
<data name="TaggingKit_Docs_Link" xml:space="preserve">
<value>https://wethat.github.io/OnenoteTaggingKit/v4.0/Home.html</value>
</data>
<data name="NewSavedSearchPage_Title" xml:space="preserve">
<value>无标题搜索</value>
</data>
</root>
2 changes: 1 addition & 1 deletion OneNoteTaggingKit/find/FindTaggedPages.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public partial class FindTaggedPages : System.Windows.Window, IOneNotePageWindow
} else {
pBarCopy.Visibility = Visibility.Visible;
var newPageID = onenote.CreateNewPage(onenote.CurrentSectionID);
var pg = new PageBuilder.OneNotePage(onenote, newPageID);
var pg = new PageBuilder.OneNotePage(onenote, newPageID, Properties.Resources.NewSavedSearchPage_Title);
SearchScope scope = scopeSelect.SelectedScope;
string searchstring = searchComboBox.Text;
var tagset = new PageTagSet(from rt in ViewModel.SelectedRefinementTags.Values
Expand Down

0 comments on commit 4e0f8df

Please sign in to comment.