diff --git a/dev/View/Popup/Account.js b/dev/View/Popup/Account.js index 292fbc24b..f9fd501dc 100644 --- a/dev/View/Popup/Account.js +++ b/dev/View/Popup/Account.js @@ -61,10 +61,14 @@ class AccountPopupView extends AbstractViewPopup { return true; } - clearPopup() { - this.isNew(true); - - this.email(''); + onShow(account) { + if (account && account.canBeEdit()) { + this.isNew(false); + this.email(account.email); + } else { + this.isNew(true); + this.email(''); + } this.password(''); this.emailError(false); @@ -74,14 +78,6 @@ class AccountPopupView extends AbstractViewPopup { this.submitError(''); this.submitErrorAdditional(''); } - - onShow(account) { - this.clearPopup(); - if (account && account.canBeEdit()) { - this.isNew(false); - this.email(account.email); - } - } } export { AccountPopupView, AccountPopupView as default }; diff --git a/dev/View/Popup/AddOpenPgpKey.js b/dev/View/Popup/AddOpenPgpKey.js index b4bf0e733..3855df629 100644 --- a/dev/View/Popup/AddOpenPgpKey.js +++ b/dev/View/Popup/AddOpenPgpKey.js @@ -82,15 +82,11 @@ class AddOpenPgpKeyPopupView extends AbstractViewPopup { return true; } - clearPopup() { + onShow() { this.key(''); this.keyError(false); this.keyErrorMessage(''); } - - onShow() { - this.clearPopup(); - } } export { AddOpenPgpKeyPopupView, AddOpenPgpKeyPopupView as default }; diff --git a/dev/View/Popup/AdvancedSearch.js b/dev/View/Popup/AdvancedSearch.js index 5cdb5963c..4f2eae169 100644 --- a/dev/View/Popup/AdvancedSearch.js +++ b/dev/View/Popup/AdvancedSearch.js @@ -114,7 +114,7 @@ class AdvancedSearchPopupView extends AbstractViewPopup { return result.replace(/^&+/, ''); } - clearPopup() { + onShow(search) { this.from(''); this.to(''); this.subject(''); @@ -124,10 +124,7 @@ class AdvancedSearchPopupView extends AbstractViewPopup { this.hasAttachment(false); this.starred(false); this.unseen(false); - } - onShow(search) { - this.clearPopup(); this.parseSearchStringValue(search); } } diff --git a/dev/View/Popup/Ask.js b/dev/View/Popup/Ask.js index 41d505697..87b7e64e5 100644 --- a/dev/View/Popup/Ask.js +++ b/dev/View/Popup/Ask.js @@ -21,15 +21,6 @@ class AskPopupView extends AbstractViewPopup { this.bDisabeCloseOnEsc = true; } - clearPopup() { - this.askDesc(''); - this.yesButton(i18n('POPUPS_ASK/BUTTON_YES')); - this.noButton(i18n('POPUPS_ASK/BUTTON_NO')); - - this.fYesAction = null; - this.fNoAction = null; - } - yesClick() { this.cancelCommand(); @@ -52,21 +43,11 @@ class AskPopupView extends AbstractViewPopup { * @returns {void} */ onShow(askDesc, fYesFunc = null, fNoFunc = null, yesButton = '', noButton = '', isFocusYesOnShow = true) { - this.clearPopup(); - - this.fYesAction = fYesFunc || null; - this.fNoAction = fNoFunc || null; - this.askDesc(askDesc || ''); - - if (yesButton) { - this.yesButton(yesButton); - } - - if (noButton) { - this.noButton(noButton); - } - + this.yesButton(yesButton || i18n('POPUPS_ASK/BUTTON_YES')); + this.noButton(noButton || i18n('POPUPS_ASK/BUTTON_NO')); + this.fYesAction = fYesFunc; + this.fNoAction = fNoFunc; this.bFocusYesOnShow = !!isFocusYesOnShow; } diff --git a/dev/View/Popup/Filter.js b/dev/View/Popup/Filter.js index 55a4613fb..6d9c31d28 100644 --- a/dev/View/Popup/Filter.js +++ b/dev/View/Popup/Filter.js @@ -147,15 +147,8 @@ class FilterPopupView extends AbstractViewPopup { } } - clearPopup() { - this.isNew(true); - - this.fTrueCallback = null; - this.filter(null); - } - onShow(oFilter, fTrueCallback, bEdit) { - this.clearPopup(); + this.isNew(!bEdit); this.fTrueCallback = fTrueCallback; this.filter(oFilter); @@ -164,8 +157,6 @@ class FilterPopupView extends AbstractViewPopup { this.selectedFolderValue(oFilter.actionValue()); } - this.isNew(!bEdit); - if (!bEdit && oFilter) { oFilter.nameFocused(true); } diff --git a/dev/View/Popup/FolderClear.js b/dev/View/Popup/FolderClear.js index ce5ccd57c..058b8b328 100644 --- a/dev/View/Popup/FolderClear.js +++ b/dev/View/Popup/FolderClear.js @@ -65,16 +65,9 @@ class FolderClearPopupView extends AbstractViewPopup { } } - clearPopup() { - this.clearingProcess(false); - this.selectedFolder(null); - } - onShow(folder) { - this.clearPopup(); - if (folder) { - this.selectedFolder(folder); - } + this.clearingProcess(false); + this.selectedFolder(folder || null); } } diff --git a/dev/View/Popup/FolderCreate.js b/dev/View/Popup/FolderCreate.js index 8783186c9..a3c2ec337 100644 --- a/dev/View/Popup/FolderCreate.js +++ b/dev/View/Popup/FolderCreate.js @@ -60,14 +60,10 @@ class FolderCreatePopupView extends AbstractViewPopup { return /^[^\\/]+$/g.test(sName); } - clearPopup() { + onShow() { this.folderName(''); this.selectedParentValue(''); } - - onShow() { - this.clearPopup(); - } } export { FolderCreatePopupView, FolderCreatePopupView as default }; diff --git a/dev/View/Popup/NewOpenPgpKey.js b/dev/View/Popup/NewOpenPgpKey.js index 98f57ac34..e12748652 100644 --- a/dev/View/Popup/NewOpenPgpKey.js +++ b/dev/View/Popup/NewOpenPgpKey.js @@ -86,7 +86,7 @@ class NewOpenPgpKeyPopupView extends AbstractViewPopup { } } - clearPopup() { + onShow() { this.name(''); this.password(''); @@ -96,10 +96,6 @@ class NewOpenPgpKeyPopupView extends AbstractViewPopup { this.submitError(''); } - - onShow() { - this.clearPopup(); - } } export { NewOpenPgpKeyPopupView, NewOpenPgpKeyPopupView as default }; diff --git a/dev/View/Popup/ViewOpenPgpKey.js b/dev/View/Popup/ViewOpenPgpKey.js index 5dcbbc289..215c165f4 100644 --- a/dev/View/Popup/ViewOpenPgpKey.js +++ b/dev/View/Popup/ViewOpenPgpKey.js @@ -12,10 +12,6 @@ class ViewOpenPgpKeyPopupView extends AbstractViewPopup { }); } - clearPopup() { - this.key(''); - } - selectKey() { const el = this.keyDom(); if (el) { @@ -28,11 +24,7 @@ class ViewOpenPgpKeyPopupView extends AbstractViewPopup { } onShow(openPgpKey) { - this.clearPopup(); - - if (openPgpKey) { - this.key(openPgpKey.armor); - } + this.key(openPgpKey ? openPgpKey.armor : ''); } onBuild() {