Skip to content

Commit

Permalink
Add open to filter out tags from offline notebooks (stevencohn#1496)
Browse files Browse the repository at this point in the history
* Add open to filter out tags from offline notebooks
stevencohn#1495

* menu item translations
  • Loading branch information
stevencohn authored and weissm committed Jul 29, 2024
1 parent 5e7a76c commit 13656cc
Show file tree
Hide file tree
Showing 13 changed files with 173 additions and 7 deletions.
25 changes: 20 additions & 5 deletions OneMore/Commands/Tagging/HashtagDialog.Designer.cs

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

57 changes: 55 additions & 2 deletions OneMore/Commands/Tagging/HashtagDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ namespace River.OneMoreAddIn.Commands

internal partial class HashtagDialog : MoreForm
{
private const string SettingsKey = "Hashtags";

private const string T0 = "0001-01-01T00:00:00.0000Z";

private readonly MoreAutoCompleteList palette;
Expand Down Expand Up @@ -78,6 +80,10 @@ public HashtagDialog()
.GetCollection("GeneralSheet").Get<bool>("experimental");

ShowScanTimes();

ShowOfflineNotebooks = new SettingsProvider()
.GetCollection(SettingsKey)
.Get("showOffline", true);
}


Expand All @@ -87,6 +93,9 @@ public HashtagDialog()
public IEnumerable<string> SelectedPages => selections;


public bool ShowOfflineNotebooks { get; private set; } = true;


private void ShowScanTimes()
{
var scan = new HashtagProvider().ReadScanTime();
Expand Down Expand Up @@ -149,9 +158,10 @@ private async void DoKeyDown(object sender, KeyEventArgs e)
}


private void DoSearchTags(object sender, EventArgs e)
private async void DoSearchTags(object sender, EventArgs e)
{
Task.Run(async () => { await SearchTags(sender, e); });
await SearchTags(sender, e);
//Task.Run(async () => { await SearchTags(sender, e); });
}


Expand All @@ -178,6 +188,14 @@ private async Task SearchTags(object sender, EventArgs e)
_ => provider.SearchTags(where, out parsed)
};

if (!ShowOfflineNotebooks)
{
// must be ToList?!
var loaded = tags.Where(t => loadedBookIDs.Contains(t.NotebookID)).ToList();
tags.Clear();
tags.AddRange(loaded);
}

logger.Verbose($"found {tags.Count} tags using [{parsed}]");

var width = contextPanel.ClientSize.Width -
Expand Down Expand Up @@ -408,10 +426,45 @@ private async void ScanNow(object sender, EventArgs e)
}


private void PrepareContextMenu(object sender, System.EventArgs e)
{
if (ShowOfflineNotebooks)
{
offlineNotebooksButton.Image = Resx.e_CheckMark;
offlineNotebooksButton.Text = Resx.HashtagDialog_showOfflineMenuItem;
}
else
{
offlineNotebooksButton.Image = null;
offlineNotebooksButton.Text = Resx.HashtagDialog_hideOfflineMenuItem;
}
}


private void ToggleOfflineNotebooks(object sender, EventArgs e)
{
ShowOfflineNotebooks = !ShowOfflineNotebooks;
}


private void DoCancel(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}


private void SaveSettings(object sender, FormClosingEventArgs e)
{
var provider = new SettingsProvider();
var settings = provider.GetCollection(SettingsKey);
settings.Add("showOffline", ShowOfflineNotebooks);

if (settings.IsModified)
{
provider.SetCollection(settings);
provider.Save();
}
}
}
}
18 changes: 18 additions & 0 deletions OneMore/Properties/Resources.Designer.cs

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

8 changes: 8 additions & 0 deletions OneMore/Properties/Resources.ar-SA.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,10 @@
<value>تحقق من الكل</value>
<comment>link label</comment>
</data>
<data name="HashtagDialog_hideOfflineMenuItem" xml:space="preserve">
<value>إخفاء دفاتر الملاحظات غير المتصلة</value>
<comment>context menu item</comment>
</data>
<data name="HashtagDialog_introLabel.Text" xml:space="preserve">
<value>اكتب أي جزء من هاشتاج واحد أو أكثر. يتم تضمين أحرف البدل ما لم تنتهي العلامة بنقطة. يُسمح بالأقواس والعوامل المنطقية.</value>
<comment>label</comment>
Expand Down Expand Up @@ -1301,6 +1305,10 @@
هذا القسم</value>
<comment>combobox</comment>
</data>
<data name="HashtagDialog_showOfflineMenuItem" xml:space="preserve">
<value>إظهار دفاتر الملاحظات غير المتصلة</value>
<comment>context menu item</comment>
</data>
<data name="HashtagDialog_uncheckAllLink.Text" xml:space="preserve">
<value>الغاءالكل</value>
<comment>link label</comment>
Expand Down
8 changes: 8 additions & 0 deletions OneMore/Properties/Resources.de-DE.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,10 @@ Die Suche nach Hashtags ist erst möglich, wenn dies abgeschlossen ist.</value>
<value>Alle überprüfen</value>
<comment>link label</comment>
</data>
<data name="HashtagDialog_hideOfflineMenuItem" xml:space="preserve">
<value>Offline-Notizbücher ausblenden</value>
<comment>context menu item</comment>
</data>
<data name="HashtagDialog_introLabel.Text" xml:space="preserve">
<value>Geben Sie einen beliebigen Teil eines oder mehrerer Hashtags ein. Platzhalter sind impliziert, es sei denn, ein Tag endet mit einem Punkt. Klammern und logische Operatoren sind zulässig.</value>
<comment>label</comment>
Expand Down Expand Up @@ -1299,6 +1303,10 @@ Dieses Notizbuch
Diese Abteilung</value>
<comment>combobox</comment>
</data>
<data name="HashtagDialog_showOfflineMenuItem" xml:space="preserve">
<value>Offline-Notizbücher anzeigen</value>
<comment>context menu item</comment>
</data>
<data name="HashtagDialog_uncheckAllLink.Text" xml:space="preserve">
<value>Alle deaktivieren</value>
<comment>link label</comment>
Expand Down
8 changes: 8 additions & 0 deletions OneMore/Properties/Resources.es-ES.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,10 @@ La búsqueda de hashtags no estará disponible hasta que se complete.</value>
<value>Comprobar todo</value>
<comment>link label</comment>
</data>
<data name="HashtagDialog_hideOfflineMenuItem" xml:space="preserve">
<value>Ocultar cuadernos sin conexión</value>
<comment>context menu item</comment>
</data>
<data name="HashtagDialog_introLabel.Text" xml:space="preserve">
<value>Escribe cualquier parte de uno o más hashtags. Los comodines están implícitos a menos que una etiqueta termine con un punto. Se permiten paréntesis y operadores lógicos.</value>
<comment>label</comment>
Expand Down Expand Up @@ -1301,6 +1305,10 @@ este cuaderno
Esta sección</value>
<comment>combobox</comment>
</data>
<data name="HashtagDialog_showOfflineMenuItem" xml:space="preserve">
<value>Mostrar cuadernos sin conexión</value>
<comment>context menu item</comment>
</data>
<data name="HashtagDialog_uncheckAllLink.Text" xml:space="preserve">
<value>Desmarcar todo</value>
<comment>link label</comment>
Expand Down
8 changes: 8 additions & 0 deletions OneMore/Properties/Resources.fr-FR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,10 @@ La recherche de hashtags n'est pas disponible tant qu'elle n'est pas terminée.<
<value>Vérifie tout</value>
<comment>link label</comment>
</data>
<data name="HashtagDialog_hideOfflineMenuItem" xml:space="preserve">
<value>Masquer les blocs-notes hors ligne</value>
<comment>context menu item</comment>
</data>
<data name="HashtagDialog_introLabel.Text" xml:space="preserve">
<value>Tapez n’importe quelle partie d’un ou plusieurs hashtags. Les caractères génériques sont implicites, sauf si une balise se termine par un point. Les parenthèses et les opérateurs logiques sont autorisés.</value>
<comment>label</comment>
Expand Down Expand Up @@ -1301,6 +1305,10 @@ Ce carnet
Cette section</value>
<comment>combobox</comment>
</data>
<data name="HashtagDialog_showOfflineMenuItem" xml:space="preserve">
<value>Afficher les blocs-notes hors ligne</value>
<comment>context menu item</comment>
</data>
<data name="HashtagDialog_uncheckAllLink.Text" xml:space="preserve">
<value>Décocher tout</value>
<comment>link label</comment>
Expand Down
8 changes: 8 additions & 0 deletions OneMore/Properties/Resources.he-IL.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,10 @@ Total Row Font
<value>סמן הכל</value>
<comment>link label</comment>
</data>
<data name="HashtagDialog_hideOfflineMenuItem" xml:space="preserve">
<value>הסתר מחברות לא מקוונות</value>
<comment>context menu item</comment>
</data>
<data name="HashtagDialog_introLabel.Text" xml:space="preserve">
<value>הקלד כל חלק מהאשטאג אחד או יותר. תווים כלליים משתמעים אלא אם כן תג מסתיים בנקודה. מותר להשתמש בסוגריים ואופרטורים לוגיים.</value>
<comment>label</comment>
Expand Down Expand Up @@ -1310,6 +1314,10 @@ Total Row Font
הסעיף הזה</value>
<comment>combobox</comment>
</data>
<data name="HashtagDialog_showOfflineMenuItem" xml:space="preserve">
<value>הצג מחברות לא מקוונות</value>
<comment>context menu item</comment>
</data>
<data name="HashtagDialog_uncheckAllLink.Text" xml:space="preserve">
<value>בטל את הסימון של הכל</value>
<comment>link label</comment>
Expand Down
8 changes: 8 additions & 0 deletions OneMore/Properties/Resources.nl-NL.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,10 @@ Zoeken naar hashtags is pas beschikbaar als dit is voltooid.</value>
<value>Controleer alles</value>
<comment>link label</comment>
</data>
<data name="HashtagDialog_hideOfflineMenuItem" xml:space="preserve">
<value>Offline notitieblokken verbergen</value>
<comment>context menu item</comment>
</data>
<data name="HashtagDialog_introLabel.Text" xml:space="preserve">
<value>Typ een deel van een of meer hashtags. Wildcards worden geïmpliceerd, tenzij een tag wordt afgesloten met een punt. Haakjes en logische operatoren zijn toegestaan.</value>
<comment>label</comment>
Expand Down Expand Up @@ -1302,6 +1306,10 @@ Dit notitieboekje
Deze sectie</value>
<comment>combobox</comment>
</data>
<data name="HashtagDialog_showOfflineMenuItem" xml:space="preserve">
<value>Offline notitieboekjes tonen</value>
<comment>context menu item</comment>
</data>
<data name="HashtagDialog_uncheckAllLink.Text" xml:space="preserve">
<value>Schakel alles uit</value>
<comment>link label</comment>
Expand Down
8 changes: 8 additions & 0 deletions OneMore/Properties/Resources.pl-PL.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,10 @@ Wyszukiwanie hashtagów nie jest możliwe, dopóki nie zostanie zakończone.</va
<value>Zaznacz wszystkie</value>
<comment>link label</comment>
</data>
<data name="HashtagDialog_hideOfflineMenuItem" xml:space="preserve">
<value>Ukryj notesy offline</value>
<comment>context menu item</comment>
</data>
<data name="HashtagDialog_introLabel.Text" xml:space="preserve">
<value>Wpisz dowolną część jednego lub większej liczby hashtagów. Symbole wieloznaczne są dorozumiane, chyba że tag jest zakończony kropką. Dozwolone są nawiasy i operatory logiczne.</value>
<comment>label</comment>
Expand Down Expand Up @@ -1310,6 +1314,10 @@ Ten notatnik
Ta sekcja</value>
<comment>combobox</comment>
</data>
<data name="HashtagDialog_showOfflineMenuItem" xml:space="preserve">
<value>Pokaż notesy offline</value>
<comment>context menu item</comment>
</data>
<data name="HashtagDialog_uncheckAllLink.Text" xml:space="preserve">
<value>Odznacz wszystkie</value>
<comment>link label</comment>
Expand Down
8 changes: 8 additions & 0 deletions OneMore/Properties/Resources.pt-BR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,10 @@ A pesquisa de hashtags não estará disponível até que isso seja concluído.</
<value>Verifique tudo</value>
<comment>link label</comment>
</data>
<data name="HashtagDialog_hideOfflineMenuItem" xml:space="preserve">
<value>Ocultar blocos de anotações off-line</value>
<comment>context menu item</comment>
</data>
<data name="HashtagDialog_introLabel.Text" xml:space="preserve">
<value>Digite qualquer parte de uma ou mais hashtags. Os curingas estão implícitos, a menos que uma tag termine com um ponto final. Parênteses e operadores lógicos são permitidos.</value>
<comment>label</comment>
Expand Down Expand Up @@ -1302,6 +1306,10 @@ Este caderno
Esta seção</value>
<comment>combobox</comment>
</data>
<data name="HashtagDialog_showOfflineMenuItem" xml:space="preserve">
<value>Mostrar blocos de anotações off-line</value>
<comment>context menu item</comment>
</data>
<data name="HashtagDialog_uncheckAllLink.Text" xml:space="preserve">
<value>Desmarcar todos</value>
<comment>link label</comment>
Expand Down
Loading

0 comments on commit 13656cc

Please sign in to comment.