From d70c54f87787f83f83d32e561b4a1430c3fec437 Mon Sep 17 00:00:00 2001 From: David Bannon Date: Mon, 23 Sep 2024 19:47:38 +1000 Subject: [PATCH] address #313, warn user and close notes before bulk delete --- po/tomboy-ng.es.po | 18 +++++++++++++++++- po/tomboy-ng.fr.po | 18 +++++++++++++++++- po/tomboy-ng.nl.po | 18 +++++++++++++++++- po/tomboy-ng.pot | 16 +++++++++++++++- po/tomboy-ng.uk.po | 18 +++++++++++++++++- source/resourcestr.pas | 3 ++- source/searchunit.pas | 25 ++++++++++++++++--------- 7 files changed, 101 insertions(+), 15 deletions(-) diff --git a/po/tomboy-ng.es.po b/po/tomboy-ng.es.po index 8edcecb..61792ab 100644 --- a/po/tomboy-ng.es.po +++ b/po/tomboy-ng.es.po @@ -363,6 +363,10 @@ msgctxt "resourcestr.rsname" msgid "Name" msgstr "Nombre" +#: resourcestr.rsnetworknotavailable +msgid "Network not available" +msgstr "" + #: resourcestr.rsnewerversionexits msgctxt "resourcestr.rsnewerversionexits" msgid "A newer version exists in main repo" @@ -1031,7 +1035,9 @@ msgid "Take a manual Snapshot" msgstr "Hacer una instantánea manual" #: tformrecover.buttonmakesafetysnap.hint -msgid "Take a initial snapshot of your notes and config. Overwritten each time." +#, fuzzy +#| msgid "Take a initial snapshot of your notes and config. Overwritten each time." +msgid "Take a snapshot of your notes and config. Overwritten each time." msgstr "Haga una instantánea de sus notas y configuración. Sobrescrita cada vez." #: tformrecover.buttonrecoversnap.caption @@ -1401,6 +1407,11 @@ msgstr "Opciones" msgid "tomboy-ng Search" msgstr "Búsqueda de tombo-ng" +#: tsearchform.labelsearchtitle.caption +msgctxt "tsearchform.labelsearchtitle.caption" +msgid "Search on title only" +msgstr "" + #: tsearchform.listboxnotebooks.hint msgid "Right Click to manage Notebooks" msgstr "Clic derecho para gestionar cuadernos" @@ -1442,6 +1453,11 @@ msgstr "" msgid "Open Selected Notes" msgstr "" +#: tsearchform.menuitemsearchtitleonly.caption +msgctxt "tsearchform.menuitemsearchtitleonly.caption" +msgid "Search on title only" +msgstr "" + #: tsearchform.menuitemselectall.caption #, fuzzy msgctxt "tsearchform.menuitemselectall.caption" diff --git a/po/tomboy-ng.fr.po b/po/tomboy-ng.fr.po index 10f016d..0f320ce 100644 --- a/po/tomboy-ng.fr.po +++ b/po/tomboy-ng.fr.po @@ -372,6 +372,10 @@ msgstr "L'option multi carnets est active" msgid "Name" msgstr "Nom de la note" +#: resourcestr.rsnetworknotavailable +msgid "Network not available" +msgstr "" + #: resourcestr.rsnewerversionexits msgctxt "resourcestr.rsnewerversionexits" msgid "A newer version exists in main repo" @@ -1064,7 +1068,9 @@ msgid "Take a manual Snapshot" msgstr "Prendre un snapshot" #: tformrecover.buttonmakesafetysnap.hint -msgid "Take a initial snapshot of your notes and config. Overwritten each time." +#, fuzzy +#| msgid "Take a initial snapshot of your notes and config. Overwritten each time." +msgid "Take a snapshot of your notes and config. Overwritten each time." msgstr "1er snapshot des notes & config puis remplacement à chaque màj." #: tformrecover.buttonrecoversnap.caption @@ -1451,6 +1457,11 @@ msgstr "Options" msgid "tomboy-ng Search" msgstr "Recherche tomboy-ng" +#: tsearchform.labelsearchtitle.caption +msgctxt "tsearchform.labelsearchtitle.caption" +msgid "Search on title only" +msgstr "" + #: tsearchform.listboxnotebooks.hint msgid "Right Click to manage Notebooks" msgstr "Clic Droit pour gérer les carnets" @@ -1496,6 +1507,11 @@ msgstr "" msgid "Open Selected Notes" msgstr "" +#: tsearchform.menuitemsearchtitleonly.caption +msgctxt "tsearchform.menuitemsearchtitleonly.caption" +msgid "Search on title only" +msgstr "" + #: tsearchform.menuitemselectall.caption #, fuzzy msgctxt "tsearchform.menuitemselectall.caption" diff --git a/po/tomboy-ng.nl.po b/po/tomboy-ng.nl.po index b25589e..28d152a 100644 --- a/po/tomboy-ng.nl.po +++ b/po/tomboy-ng.nl.po @@ -368,6 +368,10 @@ msgstr "Er is ondersteuning voor meerdere notitieboeken" msgid "Name" msgstr "Naam" +#: resourcestr.rsnetworknotavailable +msgid "Network not available" +msgstr "" + #: resourcestr.rsnewerversionexits msgctxt "resourcestr.rsnewerversionexits" msgid "A newer version exists in main repo" @@ -1054,7 +1058,9 @@ msgid "Take a manual Snapshot" msgstr "Reservekopie maken" #: tformrecover.buttonmakesafetysnap.hint -msgid "Take a initial snapshot of your notes and config. Overwritten each time." +#, fuzzy +#| msgid "Take a initial snapshot of your notes and config. Overwritten each time." +msgid "Take a snapshot of your notes and config. Overwritten each time." msgstr "Maak een reservekopie van uw notities en instellingen. Let op: deze wordt telkens overschreven." #: tformrecover.buttonrecoversnap.caption @@ -1431,6 +1437,11 @@ msgstr "Opties" msgid "tomboy-ng Search" msgstr "tomboy-ng_Zoeken" +#: tsearchform.labelsearchtitle.caption +msgctxt "tsearchform.labelsearchtitle.caption" +msgid "Search on title only" +msgstr "" + #: tsearchform.listboxnotebooks.hint msgid "Right Click to manage Notebooks" msgstr "Klik rechts om notitieboeken te beheren" @@ -1476,6 +1487,11 @@ msgstr "" msgid "Open Selected Notes" msgstr "" +#: tsearchform.menuitemsearchtitleonly.caption +msgctxt "tsearchform.menuitemsearchtitleonly.caption" +msgid "Search on title only" +msgstr "" + #: tsearchform.menuitemselectall.caption #, fuzzy msgctxt "tsearchform.menuitemselectall.caption" diff --git a/po/tomboy-ng.pot b/po/tomboy-ng.pot index 0773672..dae2f80 100644 --- a/po/tomboy-ng.pot +++ b/po/tomboy-ng.pot @@ -344,6 +344,10 @@ msgstr "" msgid "Name" msgstr "" +#: resourcestr.rsnetworknotavailable +msgid "Network not available" +msgstr "" + #: resourcestr.rsnewerversionexits msgctxt "resourcestr.rsnewerversionexits" msgid "A newer version exists in main repo" @@ -1001,7 +1005,7 @@ msgid "Take a manual Snapshot" msgstr "" #: tformrecover.buttonmakesafetysnap.hint -msgid "Take a initial snapshot of your notes and config. Overwritten each time." +msgid "Take a snapshot of your notes and config. Overwritten each time." msgstr "" #: tformrecover.buttonrecoversnap.caption @@ -1366,6 +1370,11 @@ msgstr "" msgid "tomboy-ng Search" msgstr "" +#: tsearchform.labelsearchtitle.caption +msgctxt "tsearchform.labelsearchtitle.caption" +msgid "Search on title only" +msgstr "" + #: tsearchform.listboxnotebooks.hint msgid "Right Click to manage Notebooks" msgstr "" @@ -1407,6 +1416,11 @@ msgstr "" msgid "Open Selected Notes" msgstr "" +#: tsearchform.menuitemsearchtitleonly.caption +msgctxt "tsearchform.menuitemsearchtitleonly.caption" +msgid "Search on title only" +msgstr "" + #: tsearchform.menuitemselectall.caption msgctxt "tsearchform.menuitemselectall.caption" msgid "Select All" diff --git a/po/tomboy-ng.uk.po b/po/tomboy-ng.uk.po index e5a4b3b..1255801 100644 --- a/po/tomboy-ng.uk.po +++ b/po/tomboy-ng.uk.po @@ -367,6 +367,10 @@ msgstr "Налаштування дозволяють багато записн msgid "Name" msgstr "Назва" +#: resourcestr.rsnetworknotavailable +msgid "Network not available" +msgstr "" + #: resourcestr.rsnewerversionexits msgctxt "resourcestr.rsnewerversionexits" msgid "A newer version exists in main repo" @@ -1053,7 +1057,9 @@ msgid "Take a manual Snapshot" msgstr "Зробити зріз вручну" #: tformrecover.buttonmakesafetysnap.hint -msgid "Take a initial snapshot of your notes and config. Overwritten each time." +#, fuzzy +#| msgid "Take a initial snapshot of your notes and config. Overwritten each time." +msgid "Take a snapshot of your notes and config. Overwritten each time." msgstr "Зробити початковий зріз ваших нотаток і налаштувань. Щоразу перезаписується." #: tformrecover.buttonrecoversnap.caption @@ -1430,6 +1436,11 @@ msgstr "Параметри" msgid "tomboy-ng Search" msgstr "tomboy-ng_Пошук" +#: tsearchform.labelsearchtitle.caption +msgctxt "tsearchform.labelsearchtitle.caption" +msgid "Search on title only" +msgstr "" + #: tsearchform.listboxnotebooks.hint msgid "Right Click to manage Notebooks" msgstr "Праве клацання для керування записниками" @@ -1475,6 +1486,11 @@ msgstr "" msgid "Open Selected Notes" msgstr "" +#: tsearchform.menuitemsearchtitleonly.caption +msgctxt "tsearchform.menuitemsearchtitleonly.caption" +msgid "Search on title only" +msgstr "" + #: tsearchform.menuitemselectall.caption #, fuzzy msgctxt "tsearchform.menuitemselectall.caption" diff --git a/source/resourcestr.pas b/source/resourcestr.pas index d5316a9..16d665b 100644 --- a/source/resourcestr.pas +++ b/source/resourcestr.pas @@ -57,7 +57,8 @@ interface rsSetupSyncFirst = 'Please config sync system first'; rsCannotFindNote = 'ERROR, cannot find '; // is followed by a filename rsSearchHint = 'Exact matches for terms between " "'; - + rsQuestionDeleteNotes='Do you wish to delete %d notes ?'; // insert a number (of notes) + rsQuestionDeleteOpenNotes='Including %d open notes ?'; // insert a number (of notes) // SyncGUI rsTestingSync = 'Testing Sync'; diff --git a/source/searchunit.pas b/source/searchunit.pas index a28408e..04307b3 100644 --- a/source/searchunit.pas +++ b/source/searchunit.pas @@ -1708,21 +1708,28 @@ procedure TSearchForm.ListViewNotesMouseDown(Sender: TObject; procedure TSearchForm.MenuItemDeleteSelectedClick(Sender: TObject); var - St : string; + St, Msg : string; + OpenNotes : integer = 0; + AForm : TForm; begin - if MessageDlg('Warning', 'Do you wish to delete ' // ToDo : i18n - + inttostr(length(NoteListRightClickSel)) + ' notes ?' - , mtConfirmation, [mbYes, mbNo],0) = mrYes then begin + MSG := format(rsQuestionDeleteNotes, [length(NoteListRightClickSel)]); + for St in NoteListRightClickSel do + if TheMainNoteLister.IsThisNoteOpen(St, AForm) then inc(OpenNotes); + if OpenNotes > 0 then + Msg := Msg + #10 + format(rsQuestionDeleteOpenNotes, [OpenNotes]); + if MessageDlg('Warning', Msg, mtConfirmation, [mbYes, mbNo],0) = mrYes then begin ListViewNotes.BeginUpdate; - for St in NoteListRightClickSel do - DeleteNote(Sett.NoteDirectory + St); - // debugln('TSearchForm.MenuItemDeleteSelectedClick Not deleting ' - // + TheMainNoteLister.GetTitle(St)); + for St in NoteListRightClickSel do begin + if TheMainNoteLister.IsThisNoteOpen(St, AForm) then + AForm.Close; // Force close any open notes on hit list + DeleteNote(Sett.NoteDirectory + St); + // debugln('TSearchForm.MenuItemDeleteSelectedClick Not deleting ' + // + TheMainNoteLister.GetTitle(St)); + end; ListViewNotes.EndUpdate; end; end; - procedure TSearchForm.MenuItemOpenSelectedClick(Sender: TObject); var St : string;