Desktop: Resolves #1502: Improved note deletion dialog

pull/1524/head
Laurent Cozic 2019-05-11 13:36:44 +01:00
parent afb375955e
commit 016ce3dd61
3 changed files with 11 additions and 6 deletions

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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;