From 016ce3dd6140b676b6541e618d8ece832a222f6f Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Sat, 11 May 2019 13:36:44 +0100 Subject: [PATCH] Desktop: Resolves #1502: Improved note deletion dialog --- ElectronClient/app/bridge.js | 9 ++++++--- ElectronClient/app/gui/utils/NoteListUtils.js | 6 +++++- ReactNativeClient/lib/services/ExternalEditWatcher.js | 2 -- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ElectronClient/app/bridge.js b/ElectronClient/app/bridge.js index ac2a122eb1..16c14368e6 100644 --- a/ElectronClient/app/bridge.js +++ b/ElectronClient/app/bridge.js @@ -77,13 +77,16 @@ class Bridge { }); } - showConfirmMessageBox(message) { - const result = this.showMessageBox_(this.window(), { + showConfirmMessageBox(message, options = null) { + if (options === null) options = {}; + + const result = this.showMessageBox_(this.window(), Object.assign({}, { type: 'question', message: message, cancelId: 1, buttons: [_('OK'), _('Cancel')], - }); + }, options)); + return result === 0; } diff --git a/ElectronClient/app/gui/utils/NoteListUtils.js b/ElectronClient/app/gui/utils/NoteListUtils.js index bf5f718dda..73aa78831a 100644 --- a/ElectronClient/app/gui/utils/NoteListUtils.js +++ b/ElectronClient/app/gui/utils/NoteListUtils.js @@ -127,7 +127,11 @@ class NoteListUtils { msg = _('Delete these %d notes?', noteIds.length); } - const ok = bridge().showConfirmMessageBox(msg); + const ok = bridge().showConfirmMessageBox(msg, { + buttons: [_('Delete'), _('Cancel')], + defaultId: 1, + }); + if (!ok) return; await Note.batchDelete(noteIds); } diff --git a/ReactNativeClient/lib/services/ExternalEditWatcher.js b/ReactNativeClient/lib/services/ExternalEditWatcher.js index 7a5244345b..bd5365f099 100644 --- a/ReactNativeClient/lib/services/ExternalEditWatcher.js +++ b/ReactNativeClient/lib/services/ExternalEditWatcher.js @@ -139,8 +139,6 @@ class ExternalEditWatcher { const watchedPaths = this.watcher_.getWatched(); - console.info(noteFilename, watchedPaths); - for (let dirName in watchedPaths) { if (!watchedPaths.hasOwnProperty(dirName)) continue;