mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 07:35:55 +08:00
Drop Capa enums
This commit is contained in:
parent
f44507a69b
commit
874f2592ca
|
@ -1,37 +1,23 @@
|
|||
/* eslint quote-props: 0 */
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
export const Capa = {
|
||||
AdditionalAccounts: 'AdditionalAccounts',
|
||||
AutoLogout: 'AutoLogout',
|
||||
DangerousActions: 'DangerousActions',
|
||||
GnuPG: 'GnuPG',
|
||||
Identities: 'Identities',
|
||||
OpenPGP: 'OpenPGP',
|
||||
Search: 'Search',
|
||||
SearchAdv: 'SearchAdv',
|
||||
Themes: 'Themes',
|
||||
UserBackground: 'UserBackground'
|
||||
};
|
||||
export const
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
export const Scope = {
|
||||
Scope = {
|
||||
All: 'all',
|
||||
None: 'none',
|
||||
MessageList: 'MessageList',
|
||||
FolderList: 'FolderList',
|
||||
MessageView: 'MessageView',
|
||||
Settings: 'Settings'
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
export const UploadErrorCode = {
|
||||
UploadErrorCode = {
|
||||
Normal: 0,
|
||||
FileIsTooBig: 1,
|
||||
FilePartiallyUploaded: 3,
|
||||
|
@ -40,22 +26,22 @@ export const UploadErrorCode = {
|
|||
OnSavingFile: 7,
|
||||
FileType: 98,
|
||||
Unknown: 99
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
export const SaveSettingsStep = {
|
||||
SaveSettingsStep = {
|
||||
Animate: -2,
|
||||
Idle: -1,
|
||||
TrueResult: 1,
|
||||
FalseResult: 0
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
export const Notification = {
|
||||
Notification = {
|
||||
RequestError: 1,
|
||||
RequestAborted: 2,
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Capa, Scope } from 'Common/Enums';
|
||||
import { Scope } from 'Common/Enums';
|
||||
import { keyScope, leftPanelDisabled, SettingsCapa } from 'Common/Globals';
|
||||
import { runSettingsViewModelHooks } from 'Common/Plugins';
|
||||
import { initOnStartOrLangChange, i18n } from 'Common/Translator';
|
||||
|
@ -32,11 +32,11 @@ export class SettingsUserScreen extends AbstractSettingsScreen {
|
|||
settingsAddViewModel(ContactsUserSettings, 'SettingsContacts', 'SETTINGS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
|
||||
}
|
||||
|
||||
if (SettingsCapa(Capa.AdditionalAccounts) || SettingsCapa(Capa.Identities)) {
|
||||
if (SettingsCapa('AdditionalAccounts') || SettingsCapa('Identities')) {
|
||||
settingsAddViewModel(
|
||||
AccountsUserSettings,
|
||||
'SettingsAccounts',
|
||||
SettingsCapa(Capa.AdditionalAccounts)
|
||||
SettingsCapa('AdditionalAccounts')
|
||||
? 'SETTINGS_LABELS/LABEL_ACCOUNTS_NAME'
|
||||
: 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME',
|
||||
'accounts'
|
||||
|
@ -47,17 +47,17 @@ export class SettingsUserScreen extends AbstractSettingsScreen {
|
|||
settingsAddViewModel(FiltersUserSettings, 'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
|
||||
}
|
||||
|
||||
if (SettingsCapa(Capa.AutoLogout)) {
|
||||
if (SettingsCapa('AutoLogout')) {
|
||||
settingsAddViewModel(SecurityUserSettings, 'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security');
|
||||
}
|
||||
|
||||
settingsAddViewModel(FoldersUserSettings, 'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders');
|
||||
|
||||
if (SettingsCapa(Capa.Themes)) {
|
||||
if (SettingsCapa('Themes')) {
|
||||
settingsAddViewModel(ThemesUserSettings, 'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes');
|
||||
}
|
||||
|
||||
if (SettingsCapa(Capa.OpenPGP) || SettingsCapa(Capa.GnuPG)) {
|
||||
if (SettingsCapa('OpenPGP') || SettingsCapa('GnuPG')) {
|
||||
settingsAddViewModel(OpenPgpUserSettings, 'SettingsOpenPGP', 'OpenPGP', 'openpgp');
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
|
||||
import { addObservablesTo, addSubscribablesTo, addComputablesTo } from 'External/ko';
|
||||
|
||||
import { Capa, SaveSettingsStep } from 'Common/Enums';
|
||||
import { SaveSettingsStep } from 'Common/Enums';
|
||||
import { Settings, SettingsGet, SettingsCapa } from 'Common/Globals';
|
||||
import { translatorReload, convertLangName } from 'Common/Translator';
|
||||
|
||||
|
@ -42,10 +42,10 @@ export class GeneralAdminSettings extends AbstractViewSettings {
|
|||
addObservablesTo(this, {
|
||||
attachmentLimitTrigger: SaveSettingsStep.Idle,
|
||||
themeTrigger: SaveSettingsStep.Idle,
|
||||
capaThemes: SettingsCapa(Capa.Themes),
|
||||
capaUserBackground: SettingsCapa(Capa.UserBackground),
|
||||
capaAdditionalAccounts: SettingsCapa(Capa.AdditionalAccounts),
|
||||
capaIdentities: SettingsCapa(Capa.Identities),
|
||||
capaThemes: SettingsCapa('Themes'),
|
||||
capaUserBackground: SettingsCapa('UserBackground'),
|
||||
capaAdditionalAccounts: SettingsCapa('AdditionalAccounts'),
|
||||
capaIdentities: SettingsCapa('Identities'),
|
||||
capaAttachmentThumbnails: SettingsCapa('AttachmentThumbnails'),
|
||||
dataFolderAccess: false
|
||||
});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { Capa } from 'Common/Enums';
|
||||
import { SettingsGet, SettingsCapa } from 'Common/Globals';
|
||||
import { addObservablesTo, addSubscribablesTo } from 'External/ko';
|
||||
|
||||
|
@ -27,7 +26,7 @@ export class SecurityAdminSettings extends AbstractViewSettings {
|
|||
adminPasswordUpdateError: false,
|
||||
adminPasswordUpdateSuccess: false,
|
||||
|
||||
capaOpenPGP: SettingsCapa(Capa.OpenPGP)
|
||||
capaOpenPGP: SettingsCapa('OpenPGP')
|
||||
});
|
||||
|
||||
const reset = () => {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { Capa } from 'Common/Enums';
|
||||
import { SettingsCapa, SettingsGet } from 'Common/Globals';
|
||||
|
||||
import { AccountUserStore } from 'Stores/User/Account';
|
||||
|
@ -14,8 +13,8 @@ import { IdentityPopupView } from 'View/Popup/Identity';
|
|||
|
||||
export class AccountsUserSettings /*extends AbstractViewSettings*/ {
|
||||
constructor() {
|
||||
this.allowAdditionalAccount = SettingsCapa(Capa.AdditionalAccounts);
|
||||
this.allowIdentities = SettingsCapa(Capa.Identities);
|
||||
this.allowAdditionalAccount = SettingsCapa('AdditionalAccounts');
|
||||
this.allowIdentities = SettingsCapa('Identities');
|
||||
|
||||
this.accounts = AccountUserStore.accounts;
|
||||
this.loading = AccountUserStore.loading;
|
||||
|
|
|
@ -9,7 +9,6 @@ import { showScreenPopup } from 'Knoin/Knoin';
|
|||
import { OpenPgpImportPopupView } from 'View/Popup/OpenPgpImport';
|
||||
import { OpenPgpGeneratePopupView } from 'View/Popup/OpenPgpGenerate';
|
||||
|
||||
import { Capa } from 'Common/Enums';
|
||||
import { SettingsCapa } from 'Common/Globals';
|
||||
|
||||
export class OpenPgpUserSettings /*extends AbstractViewSettings*/ {
|
||||
|
@ -20,7 +19,7 @@ export class OpenPgpUserSettings /*extends AbstractViewSettings*/ {
|
|||
this.openpgpkeysPublic = OpenPGPUserStore.publicKeys;
|
||||
this.openpgpkeysPrivate = OpenPGPUserStore.privateKeys;
|
||||
|
||||
this.canOpenPGP = SettingsCapa(Capa.OpenPGP);
|
||||
this.canOpenPGP = SettingsCapa('OpenPGP');
|
||||
this.canGnuPG = GnuPGUserStore.isSupported();
|
||||
this.canMailvelope = !!window.mailvelope;
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { koComputable } from 'External/ko';
|
||||
|
||||
import { Capa } from 'Common/Enums';
|
||||
import { SettingsCapa } from 'Common/Globals';
|
||||
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
|
||||
|
||||
|
@ -12,7 +11,7 @@ export class SecurityUserSettings extends AbstractViewSettings {
|
|||
constructor() {
|
||||
super();
|
||||
|
||||
this.capaAutoLogout = SettingsCapa(Capa.AutoLogout);
|
||||
this.capaAutoLogout = SettingsCapa('AutoLogout');
|
||||
|
||||
this.autoLogout = SettingsUserStore.autoLogout;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { addObservablesTo } from 'External/ko';
|
||||
|
||||
import { SaveSettingsStep, UploadErrorCode, Capa } from 'Common/Enums';
|
||||
import { SaveSettingsStep, UploadErrorCode } from 'Common/Enums';
|
||||
import { changeTheme, convertThemeName } from 'Common/Utils';
|
||||
import { themePreviewLink, serverRequest } from 'Common/Links';
|
||||
import { i18n } from 'Common/Translator';
|
||||
|
@ -26,7 +26,7 @@ export class ThemesUserSettings /*extends AbstractViewSettings*/ {
|
|||
this.themes = ThemeStore.themes;
|
||||
this.themesObjects = ko.observableArray();
|
||||
|
||||
themeBackground.enabled = SettingsCapa(Capa.UserBackground);
|
||||
themeBackground.enabled = SettingsCapa('UserBackground');
|
||||
this.background = themeBackground;
|
||||
|
||||
this.themeTrigger = ko.observable(SaveSettingsStep.Idle).extend({ debounce: 100 });
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { Scope } from 'Common/Enums';
|
||||
import { keyScope, leftPanelDisabled, SettingsGet, elementById } from 'Common/Globals';
|
||||
import { addObservablesTo } from 'External/ko';
|
||||
import { ThemeStore } from 'Stores/Theme';
|
||||
|
@ -8,7 +7,7 @@ export const AppUserStore = {
|
|||
};
|
||||
|
||||
addObservablesTo(AppUserStore, {
|
||||
focusedState: Scope.None,
|
||||
focusedState: 'none',
|
||||
|
||||
threadsAllowed: false,
|
||||
|
||||
|
@ -19,7 +18,7 @@ AppUserStore.focusedState.subscribe(value => {
|
|||
['FolderList','MessageList','MessageView'].forEach(name => {
|
||||
if (name === value) {
|
||||
keyScope(value);
|
||||
ThemeStore.isMobile() && leftPanelDisabled(Scope.FolderList !== value);
|
||||
ThemeStore.isMobile() && leftPanelDisabled('FolderList' !== value);
|
||||
}
|
||||
let dom = elementById('V-Mail'+name);
|
||||
dom && dom.classList.toggle('focused', name === value);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { Capa } from 'Common/Enums';
|
||||
import { SettingsCapa } from 'Common/Globals';
|
||||
|
||||
//import { EmailModel } from 'Model/Email';
|
||||
|
@ -102,7 +101,7 @@ export const GnuPGUserStore = new class {
|
|||
* @returns {boolean}
|
||||
*/
|
||||
isSupported() {
|
||||
return SettingsCapa(Capa.GnuPG);
|
||||
return SettingsCapa('GnuPG');
|
||||
}
|
||||
|
||||
importKey(key, callback) {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { Capa } from 'Common/Enums';
|
||||
import { doc, createElement, SettingsCapa, SettingsGet } from 'Common/Globals';
|
||||
import { staticLink } from 'Common/Links';
|
||||
|
||||
|
@ -22,7 +21,7 @@ export const
|
|||
}
|
||||
|
||||
init() {
|
||||
if (SettingsCapa(Capa.OpenPGP) && window.crypto && crypto.getRandomValues) {
|
||||
if (SettingsCapa('OpenPGP') && window.crypto && crypto.getRandomValues) {
|
||||
const script = createElement('script', {src:staticLink('js/min/openpgp.min.js')});
|
||||
script.onload = () => this.loadKeyrings();
|
||||
script.onerror = () => {
|
||||
|
@ -61,7 +60,7 @@ export const
|
|||
OpenPGPUserStore.loadKeyrings();
|
||||
}
|
||||
|
||||
if (SettingsCapa(Capa.GnuPG)) {
|
||||
if (SettingsCapa('GnuPG')) {
|
||||
GnuPGUserStore.loadKeyrings();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import { IdentityUserStore } from 'Stores/User/Identity';
|
|||
|
||||
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
||||
|
||||
import { Capa } from 'Common/Enums';
|
||||
import { SettingsCapa } from 'Common/Globals';
|
||||
|
||||
export class OpenPgpGeneratePopupView extends AbstractViewPopup {
|
||||
|
@ -34,7 +33,7 @@ export class OpenPgpGeneratePopupView extends AbstractViewPopup {
|
|||
saveGnuPGPrivate: false
|
||||
});
|
||||
|
||||
this.canGnuPG = SettingsCapa(Capa.GnuPG);
|
||||
this.canGnuPG = SettingsCapa('GnuPG');
|
||||
|
||||
this.email.subscribe(() => this.emailError(false));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { Capa, Scope } from 'Common/Enums';
|
||||
import { Scope } from 'Common/Enums';
|
||||
|
||||
import { ComposeType, FolderType, MessageSetAction } from 'Common/EnumsUser';
|
||||
|
||||
|
@ -67,9 +67,9 @@ export class MailMessageList extends AbstractViewRight {
|
|||
|
||||
this.newMoveToFolder = !!SettingsGet('NewMoveToFolder');
|
||||
|
||||
this.allowSearch = SettingsCapa(Capa.Search);
|
||||
this.allowSearchAdv = SettingsCapa(Capa.SearchAdv);
|
||||
this.allowDangerousActions = SettingsCapa(Capa.DangerousActions);
|
||||
this.allowSearch = SettingsCapa('Search');
|
||||
this.allowSearchAdv = SettingsCapa('SearchAdv');
|
||||
this.allowDangerousActions = SettingsCapa('DangerousActions');
|
||||
|
||||
this.messageList = MessagelistUserStore;
|
||||
|
||||
|
@ -277,7 +277,7 @@ export class MailMessageList extends AbstractViewRight {
|
|||
}
|
||||
|
||||
clear() {
|
||||
if (SettingsCapa(Capa.DangerousActions)) {
|
||||
if (SettingsCapa('DangerousActions')) {
|
||||
showScreenPopup(FolderClearPopupView, [FolderUserStore.currentFolder()]);
|
||||
}
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ export class MailMessageList extends AbstractViewRight {
|
|||
}
|
||||
|
||||
deleteWithoutMoveCommand() {
|
||||
if (SettingsCapa(Capa.DangerousActions)) {
|
||||
if (SettingsCapa('DangerousActions')) {
|
||||
rl.app.deleteMessagesFromFolder(
|
||||
FolderType.Trash,
|
||||
FolderUserStore.currentFolderFullName(),
|
||||
|
@ -787,7 +787,7 @@ export class MailMessageList extends AbstractViewRight {
|
|||
return false;
|
||||
});
|
||||
|
||||
if (SettingsCapa(Capa.Search)) {
|
||||
if (SettingsCapa('Search')) {
|
||||
// search input focus
|
||||
shortcuts.add('/', '', [Scope.MessageList, Scope.MessageView], () => {
|
||||
this.inputMessageListSearchFocus(true);
|
||||
|
@ -856,7 +856,7 @@ export class MailMessageList extends AbstractViewRight {
|
|||
}
|
||||
|
||||
advancedSearchClick() {
|
||||
SettingsCapa(Capa.SearchAdv)
|
||||
SettingsCapa('SearchAdv')
|
||||
&& showScreenPopup(AdvancedSearchPopupView, [MessagelistUserStore.mainSearch()]);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import { AccountUserStore } from 'Stores/User/Account';
|
|||
import { MessageUserStore } from 'Stores/User/Message';
|
||||
//import { FolderUserStore } from 'Stores/User/Folder';
|
||||
|
||||
import { Capa, Scope } from 'Common/Enums';
|
||||
import { Scope } from 'Common/Enums';
|
||||
import { settings } from 'Common/Links';
|
||||
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
|
@ -26,7 +26,7 @@ export class SystemDropDownUserView extends AbstractViewRight {
|
|||
constructor() {
|
||||
super('SystemDropDown');
|
||||
|
||||
this.allowAccounts = SettingsCapa(Capa.AdditionalAccounts);
|
||||
this.allowAccounts = SettingsCapa('AdditionalAccounts');
|
||||
|
||||
this.accountEmail = AccountUserStore.email;
|
||||
|
||||
|
|
Loading…
Reference in a new issue