Remove useless clearPopup() functions

This commit is contained in:
djmaze 2021-11-03 14:58:34 +01:00
parent ba895ba887
commit 2a7348081a
9 changed files with 20 additions and 82 deletions

View file

@ -61,10 +61,14 @@ class AccountPopupView extends AbstractViewPopup {
return true; return true;
} }
clearPopup() { onShow(account) {
if (account && account.canBeEdit()) {
this.isNew(false);
this.email(account.email);
} else {
this.isNew(true); this.isNew(true);
this.email(''); this.email('');
}
this.password(''); this.password('');
this.emailError(false); this.emailError(false);
@ -74,14 +78,6 @@ class AccountPopupView extends AbstractViewPopup {
this.submitError(''); this.submitError('');
this.submitErrorAdditional(''); this.submitErrorAdditional('');
} }
onShow(account) {
this.clearPopup();
if (account && account.canBeEdit()) {
this.isNew(false);
this.email(account.email);
}
}
} }
export { AccountPopupView, AccountPopupView as default }; export { AccountPopupView, AccountPopupView as default };

View file

@ -82,15 +82,11 @@ class AddOpenPgpKeyPopupView extends AbstractViewPopup {
return true; return true;
} }
clearPopup() { onShow() {
this.key(''); this.key('');
this.keyError(false); this.keyError(false);
this.keyErrorMessage(''); this.keyErrorMessage('');
} }
onShow() {
this.clearPopup();
}
} }
export { AddOpenPgpKeyPopupView, AddOpenPgpKeyPopupView as default }; export { AddOpenPgpKeyPopupView, AddOpenPgpKeyPopupView as default };

View file

@ -114,7 +114,7 @@ class AdvancedSearchPopupView extends AbstractViewPopup {
return result.replace(/^&+/, ''); return result.replace(/^&+/, '');
} }
clearPopup() { onShow(search) {
this.from(''); this.from('');
this.to(''); this.to('');
this.subject(''); this.subject('');
@ -124,10 +124,7 @@ class AdvancedSearchPopupView extends AbstractViewPopup {
this.hasAttachment(false); this.hasAttachment(false);
this.starred(false); this.starred(false);
this.unseen(false); this.unseen(false);
}
onShow(search) {
this.clearPopup();
this.parseSearchStringValue(search); this.parseSearchStringValue(search);
} }
} }

View file

@ -21,15 +21,6 @@ class AskPopupView extends AbstractViewPopup {
this.bDisabeCloseOnEsc = true; 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() { yesClick() {
this.cancelCommand(); this.cancelCommand();
@ -52,21 +43,11 @@ class AskPopupView extends AbstractViewPopup {
* @returns {void} * @returns {void}
*/ */
onShow(askDesc, fYesFunc = null, fNoFunc = null, yesButton = '', noButton = '', isFocusYesOnShow = true) { onShow(askDesc, fYesFunc = null, fNoFunc = null, yesButton = '', noButton = '', isFocusYesOnShow = true) {
this.clearPopup();
this.fYesAction = fYesFunc || null;
this.fNoAction = fNoFunc || null;
this.askDesc(askDesc || ''); this.askDesc(askDesc || '');
this.yesButton(yesButton || i18n('POPUPS_ASK/BUTTON_YES'));
if (yesButton) { this.noButton(noButton || i18n('POPUPS_ASK/BUTTON_NO'));
this.yesButton(yesButton); this.fYesAction = fYesFunc;
} this.fNoAction = fNoFunc;
if (noButton) {
this.noButton(noButton);
}
this.bFocusYesOnShow = !!isFocusYesOnShow; this.bFocusYesOnShow = !!isFocusYesOnShow;
} }

View file

@ -147,15 +147,8 @@ class FilterPopupView extends AbstractViewPopup {
} }
} }
clearPopup() {
this.isNew(true);
this.fTrueCallback = null;
this.filter(null);
}
onShow(oFilter, fTrueCallback, bEdit) { onShow(oFilter, fTrueCallback, bEdit) {
this.clearPopup(); this.isNew(!bEdit);
this.fTrueCallback = fTrueCallback; this.fTrueCallback = fTrueCallback;
this.filter(oFilter); this.filter(oFilter);
@ -164,8 +157,6 @@ class FilterPopupView extends AbstractViewPopup {
this.selectedFolderValue(oFilter.actionValue()); this.selectedFolderValue(oFilter.actionValue());
} }
this.isNew(!bEdit);
if (!bEdit && oFilter) { if (!bEdit && oFilter) {
oFilter.nameFocused(true); oFilter.nameFocused(true);
} }

View file

@ -65,16 +65,9 @@ class FolderClearPopupView extends AbstractViewPopup {
} }
} }
clearPopup() {
this.clearingProcess(false);
this.selectedFolder(null);
}
onShow(folder) { onShow(folder) {
this.clearPopup(); this.clearingProcess(false);
if (folder) { this.selectedFolder(folder || null);
this.selectedFolder(folder);
}
} }
} }

View file

@ -60,14 +60,10 @@ class FolderCreatePopupView extends AbstractViewPopup {
return /^[^\\/]+$/g.test(sName); return /^[^\\/]+$/g.test(sName);
} }
clearPopup() { onShow() {
this.folderName(''); this.folderName('');
this.selectedParentValue(''); this.selectedParentValue('');
} }
onShow() {
this.clearPopup();
}
} }
export { FolderCreatePopupView, FolderCreatePopupView as default }; export { FolderCreatePopupView, FolderCreatePopupView as default };

View file

@ -86,7 +86,7 @@ class NewOpenPgpKeyPopupView extends AbstractViewPopup {
} }
} }
clearPopup() { onShow() {
this.name(''); this.name('');
this.password(''); this.password('');
@ -96,10 +96,6 @@ class NewOpenPgpKeyPopupView extends AbstractViewPopup {
this.submitError(''); this.submitError('');
} }
onShow() {
this.clearPopup();
}
} }
export { NewOpenPgpKeyPopupView, NewOpenPgpKeyPopupView as default }; export { NewOpenPgpKeyPopupView, NewOpenPgpKeyPopupView as default };

View file

@ -12,10 +12,6 @@ class ViewOpenPgpKeyPopupView extends AbstractViewPopup {
}); });
} }
clearPopup() {
this.key('');
}
selectKey() { selectKey() {
const el = this.keyDom(); const el = this.keyDom();
if (el) { if (el) {
@ -28,11 +24,7 @@ class ViewOpenPgpKeyPopupView extends AbstractViewPopup {
} }
onShow(openPgpKey) { onShow(openPgpKey) {
this.clearPopup(); this.key(openPgpKey ? openPgpKey.armor : '');
if (openPgpKey) {
this.key(openPgpKey.armor);
}
} }
onBuild() { onBuild() {