Skip to content

Commit

Permalink
address #313, warn user and close notes before bulk delete
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbannon committed Sep 23, 2024
1 parent 418a782 commit d70c54f
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 15 deletions.
18 changes: 17 additions & 1 deletion po/tomboy-ng.es.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
18 changes: 17 additions & 1 deletion po/tomboy-ng.fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
18 changes: 17 additions & 1 deletion po/tomboy-ng.nl.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
16 changes: 15 additions & 1 deletion po/tomboy-ng.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 ""
Expand Down Expand Up @@ -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"
Expand Down
18 changes: 17 additions & 1 deletion po/tomboy-ng.uk.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 "Праве клацання для керування записниками"
Expand Down Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion source/resourcestr.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
25 changes: 16 additions & 9 deletions source/searchunit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d70c54f

Please sign in to comment.