From 4e0f8df77385ef6e6a85753ffeb9f2e896892b41 Mon Sep 17 00:00:00 2001 From: WetHat Date: Mon, 25 Apr 2022 08:42:38 +0200 Subject: [PATCH] Issue #65: Empty title added to untitled pages to address use-model issue with quicknotes getting 'Untitled Page' as default title. --- OneNoteTaggingKit/PageBuilder/OneNotePage.cs | 8 ++++++-- OneNoteTaggingKit/Properties/Resources.Designer.cs | 9 +++++++++ OneNoteTaggingKit/Properties/Resources.resx | 3 +++ OneNoteTaggingKit/Properties/Resources.zh.resx | 3 +++ OneNoteTaggingKit/find/FindTaggedPages.xaml.cs | 2 +- 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/OneNoteTaggingKit/PageBuilder/OneNotePage.cs b/OneNoteTaggingKit/PageBuilder/OneNotePage.cs index bed51a7c..3a29a990 100644 --- a/OneNoteTaggingKit/PageBuilder/OneNotePage.cs +++ b/OneNoteTaggingKit/PageBuilder/OneNotePage.cs @@ -169,7 +169,11 @@ where t.TagType < PageTagType.HashTag /// /// The OneNote application object. /// The page ID. - internal OneNotePage(OneNoteProxy onenoteApp, string pageID) : base(onenoteApp.GetPage(pageID).Root) { + /// + /// The default title to use if the page does not already have a title. + /// + 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 @@ -184,7 +188,7 @@ internal OneNotePage(OneNoteProxy onenoteApp, string pageID) : base(onenoteApp.G 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 diff --git a/OneNoteTaggingKit/Properties/Resources.Designer.cs b/OneNoteTaggingKit/Properties/Resources.Designer.cs index a6b7e23a..c5fe3168 100644 --- a/OneNoteTaggingKit/Properties/Resources.Designer.cs +++ b/OneNoteTaggingKit/Properties/Resources.Designer.cs @@ -152,6 +152,15 @@ public static System.Drawing.Icon kit { } } + /// + /// Looks up a localized string similar to Untitled Search. + /// + public static string NewSavedSearchPage_Title { + get { + return ResourceManager.GetString("NewSavedSearchPage_Title", resourceCulture); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/OneNoteTaggingKit/Properties/Resources.resx b/OneNoteTaggingKit/Properties/Resources.resx index 1b498e21..b9f34565 100644 --- a/OneNoteTaggingKit/Properties/Resources.resx +++ b/OneNoteTaggingKit/Properties/Resources.resx @@ -584,4 +584,7 @@ Tap or click link to navigate to page. https://wethat.github.io/OnenoteTaggingKit/v4.0/Home.html + + Untitled Search + \ No newline at end of file diff --git a/OneNoteTaggingKit/Properties/Resources.zh.resx b/OneNoteTaggingKit/Properties/Resources.zh.resx index eb55f8b4..59ebfbc6 100644 --- a/OneNoteTaggingKit/Properties/Resources.zh.resx +++ b/OneNoteTaggingKit/Properties/Resources.zh.resx @@ -584,4 +584,7 @@ https://wethat.github.io/OnenoteTaggingKit/v4.0/Home.html + + 无标题搜索 + \ No newline at end of file diff --git a/OneNoteTaggingKit/find/FindTaggedPages.xaml.cs b/OneNoteTaggingKit/find/FindTaggedPages.xaml.cs index e647ad28..1c9e9c83 100644 --- a/OneNoteTaggingKit/find/FindTaggedPages.xaml.cs +++ b/OneNoteTaggingKit/find/FindTaggedPages.xaml.cs @@ -205,7 +205,7 @@ private async void Page_MenuItem_Click(object sender, RoutedEventArgs e) { } 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