mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 03:29:20 +03:00
Restructure Capa
This commit is contained in:
parent
5990addfef
commit
e7c7b8ed53
15 changed files with 74 additions and 140 deletions
|
|
@ -4,23 +4,16 @@
|
|||
* @enum {string}
|
||||
*/
|
||||
export const Capa = {
|
||||
GnuPG: 'GNUPG',
|
||||
OpenPGP: 'OPEN_PGP',
|
||||
Prefetch: 'PREFETCH',
|
||||
Contacts: 'CONTACTS',
|
||||
Search: 'SEARCH',
|
||||
SearchAdv: 'SEARCH_ADV',
|
||||
MessageActions: 'MESSAGE_ACTIONS',
|
||||
AttachmentsActions: 'ATTACHMENTS_ACTIONS',
|
||||
DangerousActions: 'DANGEROUS_ACTIONS',
|
||||
Themes: 'THEMES',
|
||||
UserBackground: 'USER_BACKGROUND',
|
||||
Sieve: 'SIEVE',
|
||||
AttachmentThumbnails: 'ATTACHMENT_THUMBNAILS',
|
||||
AutoLogout: 'AUTOLOGOUT',
|
||||
Kolab: 'KOLAB',
|
||||
AdditionalAccounts: 'ADDITIONAL_ACCOUNTS',
|
||||
Identities: 'IDENTITIES'
|
||||
AdditionalAccounts: 'AdditionalAccounts',
|
||||
AutoLogout: 'AutoLogout',
|
||||
DangerousActions: 'DangerousActions',
|
||||
GnuPG: 'GnuPG',
|
||||
Identities: 'Identities',
|
||||
OpenPGP: 'OpenPGP',
|
||||
Search: 'Search',
|
||||
SearchAdv: 'SearchAdv',
|
||||
Themes: 'Themes',
|
||||
UserBackground: 'UserBackground'
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export class SettingsUserScreen extends AbstractSettingsScreen {
|
|||
);
|
||||
}
|
||||
|
||||
if (SettingsCapa(Capa.Sieve)) {
|
||||
if (SettingsCapa('Sieve')) {
|
||||
settingsAddViewModel(FiltersUserSettings, 'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ export class GeneralAdminSettings /*extends AbstractViewSettings*/ {
|
|||
capaUserBackground: SettingsCapa(Capa.UserBackground),
|
||||
capaAdditionalAccounts: SettingsCapa(Capa.AdditionalAccounts),
|
||||
capaIdentities: SettingsCapa(Capa.Identities),
|
||||
capaAttachmentThumbnails: SettingsCapa(Capa.AttachmentThumbnails),
|
||||
capaAttachmentThumbnails: SettingsCapa('AttachmentThumbnails'),
|
||||
dataFolderAccess: false
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Capa } from 'Common/Enums';
|
||||
import { Settings, SettingsGet } from 'Common/Globals';
|
||||
import { SettingsGet, SettingsCapa } from 'Common/Globals';
|
||||
import { addObservablesTo, addSubscribablesTo } from 'External/ko';
|
||||
|
||||
import Remote from 'Remote/Admin/Fetch';
|
||||
|
|
@ -27,7 +27,7 @@ export class SecurityAdminSettings /*extends AbstractViewSettings*/ {
|
|||
adminPasswordUpdateError: false,
|
||||
adminPasswordUpdateSuccess: false,
|
||||
|
||||
capaOpenPGP: Settings.capa(Capa.OpenPGP)
|
||||
capaOpenPGP: SettingsCapa(Capa.OpenPGP)
|
||||
});
|
||||
|
||||
addSubscribablesTo(this, {
|
||||
|
|
|
|||
|
|
@ -3,11 +3,10 @@ import { koComputable } from 'External/ko';
|
|||
|
||||
import { Notification } from 'Common/Enums';
|
||||
import { FolderMetadataKeys } from 'Common/EnumsUser';
|
||||
import { Settings } from 'Common/Globals';
|
||||
import { SettingsCapa } from 'Common/Globals';
|
||||
import { getNotification } from 'Common/Translator';
|
||||
|
||||
import { setFolder, getFolderFromCacheList, removeFolderFromCacheList } from 'Common/Cache';
|
||||
import { Capa } from 'Common/Enums';
|
||||
import { defaultOptionsAfterRender } from 'Common/Utils';
|
||||
import { sortFolders } from 'Common/Folders';
|
||||
import { initOnStartOrLangChange, i18n } from 'Common/Translator';
|
||||
|
|
@ -27,7 +26,7 @@ const folderForDeletion = ko.observable(null).askDeleteHelper();
|
|||
|
||||
export class FoldersUserSettings /*extends AbstractViewSettings*/ {
|
||||
constructor() {
|
||||
this.showKolab = koComputable(() => FolderUserStore.hasCapability('METADATA') && Settings.capa(Capa.Kolab));
|
||||
this.showKolab = koComputable(() => FolderUserStore.hasCapability('METADATA') && SettingsCapa('Kolab'));
|
||||
this.defaultOptionsAfterRender = defaultOptionsAfterRender;
|
||||
this.kolabTypeOptions = ko.observableArray();
|
||||
let i18nFilter = key => i18n('SETTINGS_FOLDERS/TYPE_' + key);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { koComputable } from 'External/ko';
|
|||
|
||||
import { pInt, settingsSaveHelperSimpleFunction } from 'Common/Utils';
|
||||
import { Capa, SaveSettingsStep } from 'Common/Enums';
|
||||
import { Settings } from 'Common/Globals';
|
||||
import { SettingsCapa } from 'Common/Globals';
|
||||
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
|
||||
|
||||
import { SettingsUserStore } from 'Stores/User/Settings';
|
||||
|
|
@ -12,7 +12,7 @@ import Remote from 'Remote/User/Fetch';
|
|||
|
||||
export class SecurityUserSettings /*extends AbstractViewSettings*/ {
|
||||
constructor() {
|
||||
this.capaAutoLogout = Settings.capa(Capa.AutoLogout);
|
||||
this.capaAutoLogout = SettingsCapa(Capa.AutoLogout);
|
||||
|
||||
this.autoLogout = SettingsUserStore.autoLogout;
|
||||
this.autoLogoutTrigger = ko.observable(SaveSettingsStep.Idle);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { SaveSettingsStep, UploadErrorCode, Capa } from 'Common/Enums';
|
|||
import { changeTheme, convertThemeName } from 'Common/Utils';
|
||||
import { themePreviewLink, serverRequest } from 'Common/Links';
|
||||
import { i18n } from 'Common/Translator';
|
||||
import { Settings } from 'Common/Globals';
|
||||
import { SettingsCapa } from 'Common/Globals';
|
||||
|
||||
import { ThemeStore } from 'Stores/Theme';
|
||||
|
||||
|
|
@ -26,10 +26,9 @@ export class ThemesUserSettings /*extends AbstractViewSettings*/ {
|
|||
this.themes = ThemeStore.themes;
|
||||
this.themesObjects = ko.observableArray();
|
||||
|
||||
themeBackground.enabled = SettingsCapa(Capa.UserBackground);
|
||||
this.background = themeBackground;
|
||||
|
||||
this.capaUserBackground = Settings.capa(Capa.UserBackground);
|
||||
|
||||
this.themeTrigger = ko.observable(SaveSettingsStep.Idle).extend({ debounce: 100 });
|
||||
|
||||
ThemeStore.theme.subscribe(value => {
|
||||
|
|
@ -59,7 +58,7 @@ export class ThemesUserSettings /*extends AbstractViewSettings*/ {
|
|||
|
||||
// initUploader
|
||||
|
||||
if (themeBackground.uploaderButton() && this.capaUserBackground) {
|
||||
if (themeBackground.uploaderButton() && themeBackground.enabled) {
|
||||
const oJua = new Jua({
|
||||
action: serverRequest('UploadBackground'),
|
||||
limit: 1,
|
||||
|
|
@ -112,7 +111,7 @@ export class ThemesUserSettings /*extends AbstractViewSettings*/ {
|
|||
}
|
||||
|
||||
clearBackground() {
|
||||
if (this.capaUserBackground) {
|
||||
if (themeBackground.enabled) {
|
||||
Remote.request('ClearUserBackground', () => {
|
||||
themeBackground.name('');
|
||||
themeBackground.hash('');
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { IdentityUserStore } from 'Stores/User/Identity';
|
|||
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
||||
|
||||
import { Capa } from 'Common/Enums';
|
||||
import { Settings } from 'Common/Globals';
|
||||
import { SettingsCapa } from 'Common/Globals';
|
||||
|
||||
export class OpenPgpGeneratePopupView extends AbstractViewPopup {
|
||||
constructor() {
|
||||
|
|
@ -34,7 +34,7 @@ export class OpenPgpGeneratePopupView extends AbstractViewPopup {
|
|||
saveGnuPGPrivate: false
|
||||
});
|
||||
|
||||
this.canGnuPG = Settings.capa(Capa.GnuPG);
|
||||
this.canGnuPG = SettingsCapa(Capa.GnuPG);
|
||||
|
||||
this.email.subscribe(() => this.emailError(false));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -828,7 +828,7 @@ export class MailMessageList extends AbstractViewRight {
|
|||
shortcuts.add('arrowleft', 'meta', Scope.MessageView, ()=>false);
|
||||
shortcuts.add('arrowright', 'meta', Scope.MessageView, ()=>false);
|
||||
|
||||
if (!ThemeStore.isMobile() && SettingsCapa(Capa.Prefetch)) {
|
||||
if (!ThemeStore.isMobile() && SettingsCapa('Prefetch')) {
|
||||
ifvisible.idle(this.prefetchNextTick.bind(this));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,7 @@ import ko from 'ko';
|
|||
|
||||
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
||||
|
||||
import {
|
||||
Capa,
|
||||
Scope
|
||||
} from 'Common/Enums';
|
||||
import { Scope } from 'Common/Enums';
|
||||
|
||||
import {
|
||||
ComposeType,
|
||||
|
|
@ -93,7 +90,7 @@ export class MailMessageView extends AbstractViewRight {
|
|||
|
||||
this.moveAction = moveAction;
|
||||
|
||||
this.allowMessageActions = SettingsCapa(Capa.MessageActions);
|
||||
this.allowMessageActions = SettingsCapa('MessageActions');
|
||||
|
||||
const attachmentsActions = Settings.app('attachmentsActions');
|
||||
this.attachmentsActions = ko.observableArray(arrayLength(attachmentsActions) ? attachmentsActions : []);
|
||||
|
|
@ -132,7 +129,7 @@ export class MailMessageView extends AbstractViewRight {
|
|||
this.viewHash = '';
|
||||
|
||||
this.addComputables({
|
||||
allowAttachmentControls: () => this.attachmentsActions.length && SettingsCapa(Capa.AttachmentsActions),
|
||||
allowAttachmentControls: () => this.attachmentsActions.length && SettingsCapa('AttachmentsActions'),
|
||||
|
||||
downloadAsZipAllowed: () => this.attachmentsActions.includes('zip') && this.allowAttachmentControls(),
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import { KeyboardShortcutsHelpPopupView } from 'View/Popup/KeyboardShortcutsHelp
|
|||
import { AccountPopupView } from 'View/Popup/Account';
|
||||
import { ContactsPopupView } from 'View/Popup/Contacts';
|
||||
|
||||
import { doc, Settings/*, SettingsGet*/, leftPanelDisabled, fireEvent } from 'Common/Globals';
|
||||
import { doc, leftPanelDisabled, fireEvent, SettingsCapa } from 'Common/Globals';
|
||||
|
||||
import { ThemeStore } from 'Stores/Theme';
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ export class SystemDropDownUserView extends AbstractViewRight {
|
|||
constructor() {
|
||||
super('SystemDropDown');
|
||||
|
||||
this.allowAccounts = Settings.capa(Capa.AdditionalAccounts);
|
||||
this.allowAccounts = SettingsCapa(Capa.AdditionalAccounts);
|
||||
|
||||
this.accountEmail = AccountUserStore.email;
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ win.rl = {
|
|||
get: name => RL_APP_DATA[name],
|
||||
set: (name, value) => RL_APP_DATA[name] = value,
|
||||
app: name => RL_APP_DATA.System[name],
|
||||
capa: name => name && (RL_APP_DATA.Capa || []).includes(name)
|
||||
capa: name => name && !!(RL_APP_DATA.Capa || {})[name]
|
||||
},
|
||||
setWindowTitle: title =>
|
||||
doc.title = RL_APP_DATA.Title ? (title ? title + ' - ' : '') + RL_APP_DATA.Title : (title ? '' + title : ''),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue