From d69743cee5570aa8d6d783c08e9ec201626d9096 Mon Sep 17 00:00:00 2001 From: djmaze Date: Fri, 16 Jul 2021 09:11:10 +0200 Subject: [PATCH] Cleanup closeCommand & cancelCommand because both are defined for popups --- dev/Knoin/AbstractViews.js | 10 +++++----- dev/View/Popup/AddOpenPgpKey.js | 2 +- dev/View/Popup/Filter.js | 2 +- dev/View/Popup/NewOpenPgpKey.js | 2 +- dev/View/Popup/Plugin.js | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dev/Knoin/AbstractViews.js b/dev/Knoin/AbstractViews.js index 42df779c0..4affd299e 100644 --- a/dev/Knoin/AbstractViews.js +++ b/dev/Knoin/AbstractViews.js @@ -38,9 +38,6 @@ class AbstractView { keyScope(this.sCurrentScope); } - cancelCommand() {} - closeCommand() {} - querySelector(selectors) { return this.viewModelDom.querySelector(selectors); } @@ -68,7 +65,10 @@ export class AbstractViewPopup extends AbstractView this.sDefaultScope = Scope[name]; } } - +/* + cancelCommand() {} + closeCommand() {} +*/ /** * @returns {void} */ @@ -76,7 +76,7 @@ export class AbstractViewPopup extends AbstractView addEventListener('keydown', event => { if (event && this.modalVisibility && this.modalVisibility()) { if (!this.bDisabeCloseOnEsc && 'Escape' == event.key) { - this.cancelCommand && this.cancelCommand(); + this.cancelCommand(); return false; } else if ('Backspace' == event.key && !inFocus()) { return false; diff --git a/dev/View/Popup/AddOpenPgpKey.js b/dev/View/Popup/AddOpenPgpKey.js index 1ed1b1238..b4bf0e733 100644 --- a/dev/View/Popup/AddOpenPgpKey.js +++ b/dev/View/Popup/AddOpenPgpKey.js @@ -78,7 +78,7 @@ class AddOpenPgpKeyPopupView extends AbstractViewPopup { return false; } - this.cancelCommand && this.cancelCommand(); + this.cancelCommand(); return true; } diff --git a/dev/View/Popup/Filter.js b/dev/View/Popup/Filter.js index 88da060d0..64b387f93 100644 --- a/dev/View/Popup/Filter.js +++ b/dev/View/Popup/Filter.js @@ -54,7 +54,7 @@ class FilterPopupView extends AbstractViewPopup { this.fTrueCallback && this.fTrueCallback(this.filter()); - this.modalVisibility() && this.closeCommand && this.closeCommand(); + this.modalVisibility() && this.closeCommand(); } return true; diff --git a/dev/View/Popup/NewOpenPgpKey.js b/dev/View/Popup/NewOpenPgpKey.js index efdabbb2d..98f57ac34 100644 --- a/dev/View/Popup/NewOpenPgpKey.js +++ b/dev/View/Popup/NewOpenPgpKey.js @@ -63,7 +63,7 @@ class NewOpenPgpKeyPopupView extends AbstractViewPopup { openpgpKeyring.store(); rl.app.reloadOpenPgpKeys(); - this.cancelCommand && this.cancelCommand(); + this.cancelCommand(); } }) .catch((e) => { diff --git a/dev/View/Popup/Plugin.js b/dev/View/Popup/Plugin.js index f1cb19fd0..12ce2e6f8 100644 --- a/dev/View/Popup/Plugin.js +++ b/dev/View/Popup/Plugin.js @@ -85,7 +85,7 @@ class PluginPopupView extends AbstractViewPopup { if (!isPopupVisible(AskPopupView)) { showScreenPopup(AskPopupView, [ i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), - () => this.modalVisibility() && this.cancelCommand && this.cancelCommand() + () => this.modalVisibility() && this.cancelCommand() ]); } }