Settings.capa() to SettingsCapa()

This commit is contained in:
the-djmaze 2022-02-08 14:13:06 +01:00
parent 51e391c4d6
commit 827421e116
5 changed files with 28 additions and 27 deletions

View file

@ -1,5 +1,5 @@
import { Capa, Scope } from 'Common/Enums';
import { keyScope, leftPanelDisabled, Settings } from 'Common/Globals';
import { keyScope, leftPanelDisabled, SettingsCapa } from 'Common/Globals';
import { runSettingsViewModelHooks } from 'Common/Plugins';
import { initOnStartOrLangChange, i18n } from 'Common/Translator';
@ -32,32 +32,32 @@ export class SettingsUserScreen extends AbstractSettingsScreen {
settingsAddViewModel(ContactsUserSettings, 'SettingsContacts', 'SETTINGS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
}
if (Settings.capa(Capa.AdditionalAccounts) || Settings.capa(Capa.Identities)) {
if (SettingsCapa(Capa.AdditionalAccounts) || SettingsCapa(Capa.Identities)) {
settingsAddViewModel(
AccountsUserSettings,
'SettingsAccounts',
Settings.capa(Capa.AdditionalAccounts)
SettingsCapa(Capa.AdditionalAccounts)
? 'SETTINGS_LABELS/LABEL_ACCOUNTS_NAME'
: 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME',
'accounts'
);
}
if (Settings.capa(Capa.Sieve)) {
if (SettingsCapa(Capa.Sieve)) {
settingsAddViewModel(FiltersUserSettings, 'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
}
if (Settings.capa(Capa.AutoLogout)) {
if (SettingsCapa(Capa.AutoLogout)) {
settingsAddViewModel(SecurityUserSettings, 'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security');
}
settingsAddViewModel(FoldersUserSettings, 'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders');
if (Settings.capa(Capa.Themes)) {
if (SettingsCapa(Capa.Themes)) {
settingsAddViewModel(ThemesUserSettings, 'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes');
}
if (Settings.capa(Capa.OpenPGP) || Settings.capa(Capa.GnuPG)) {
if (SettingsCapa(Capa.OpenPGP) || SettingsCapa(Capa.GnuPG)) {
settingsAddViewModel(OpenPgpUserSettings, 'SettingsOpenPGP', 'OpenPGP', 'openpgp');
}

View file

@ -12,7 +12,7 @@ import {
} from 'Common/Utils';
import { Capa, SaveSettingsStep } from 'Common/Enums';
import { Settings, SettingsGet } from 'Common/Globals';
import { Settings, SettingsGet, SettingsCapa } from 'Common/Globals';
import { translatorReload, convertLangName } from 'Common/Translator';
import { showScreenPopup } from 'Knoin/Knoin';
@ -43,11 +43,11 @@ export class GeneralAdminSettings /*extends AbstractViewSettings*/ {
attachmentLimitTrigger: SaveSettingsStep.Idle,
languageTrigger: SaveSettingsStep.Idle,
themeTrigger: SaveSettingsStep.Idle,
capaThemes: Settings.capa(Capa.Themes),
capaUserBackground: Settings.capa(Capa.UserBackground),
capaAdditionalAccounts: Settings.capa(Capa.AdditionalAccounts),
capaIdentities: Settings.capa(Capa.Identities),
capaAttachmentThumbnails: Settings.capa(Capa.AttachmentThumbnails),
capaThemes: SettingsCapa(Capa.Themes),
capaUserBackground: SettingsCapa(Capa.UserBackground),
capaAdditionalAccounts: SettingsCapa(Capa.AdditionalAccounts),
capaIdentities: SettingsCapa(Capa.Identities),
capaAttachmentThumbnails: SettingsCapa(Capa.AttachmentThumbnails),
dataFolderAccess: false
});

View file

@ -1,7 +1,7 @@
import ko from 'ko';
import { Capa } from 'Common/Enums';
import { Settings, SettingsGet } from 'Common/Globals';
import { SettingsCapa, SettingsGet } from 'Common/Globals';
import { AccountUserStore } from 'Stores/User/Account';
import { IdentityUserStore } from 'Stores/User/Identity';
@ -14,8 +14,8 @@ import { IdentityPopupView } from 'View/Popup/Identity';
export class AccountsUserSettings /*extends AbstractViewSettings*/ {
constructor() {
this.allowAdditionalAccount = Settings.capa(Capa.AdditionalAccounts);
this.allowIdentities = Settings.capa(Capa.Identities);
this.allowAdditionalAccount = SettingsCapa(Capa.AdditionalAccounts);
this.allowIdentities = SettingsCapa(Capa.Identities);
this.accounts = AccountUserStore.accounts;
this.loading = AccountUserStore.loading;

View file

@ -13,7 +13,7 @@ import {
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { doc, leftPanelDisabled, moveAction, Settings, SettingsGet } from 'Common/Globals';
import { doc, leftPanelDisabled, moveAction, Settings, SettingsCapa, SettingsGet } from 'Common/Globals';
import { computedPaginatorHelper, showMessageComposer, folderListOptionsBuilder } from 'Common/UtilsUser';
import { FileInfo } from 'Common/File';
@ -58,9 +58,9 @@ export class MailMessageList extends AbstractViewRight {
this.newMoveToFolder = !!SettingsGet('NewMoveToFolder');
this.allowSearch = Settings.capa(Capa.Search);
this.allowSearchAdv = Settings.capa(Capa.SearchAdv);
this.allowDangerousActions = Settings.capa(Capa.DangerousActions);
this.allowSearch = SettingsCapa(Capa.Search);
this.allowSearchAdv = SettingsCapa(Capa.SearchAdv);
this.allowDangerousActions = SettingsCapa(Capa.DangerousActions);
this.messageList = MessageUserStore.list;
@ -256,7 +256,7 @@ export class MailMessageList extends AbstractViewRight {
}
clearCommand() {
if (Settings.capa(Capa.DangerousActions)) {
if (SettingsCapa(Capa.DangerousActions)) {
showScreenPopup(FolderClearPopupView, [FolderUserStore.currentFolder()]);
}
}
@ -275,7 +275,7 @@ export class MailMessageList extends AbstractViewRight {
}
deleteWithoutMoveCommand() {
if (Settings.capa(Capa.DangerousActions)) {
if (SettingsCapa(Capa.DangerousActions)) {
rl.app.deleteMessagesFromFolder(
FolderType.Trash,
FolderUserStore.currentFolderFullName(),
@ -770,7 +770,7 @@ export class MailMessageList extends AbstractViewRight {
return false;
});
if (Settings.capa(Capa.Search)) {
if (SettingsCapa(Capa.Search)) {
// search input focus
shortcuts.add('/', '', [Scope.MessageList, Scope.MessageView], () => {
this.inputMessageListSearchFocus(true);
@ -808,7 +808,7 @@ export class MailMessageList extends AbstractViewRight {
shortcuts.add('arrowleft', 'meta', Scope.MessageView, ()=>false);
shortcuts.add('arrowright', 'meta', Scope.MessageView, ()=>false);
if (!ThemeStore.isMobile() && Settings.capa(Capa.Prefetch)) {
if (!ThemeStore.isMobile() && SettingsCapa(Capa.Prefetch)) {
ifvisible.idle(this.prefetchNextTick.bind(this));
}
}
@ -839,7 +839,7 @@ export class MailMessageList extends AbstractViewRight {
}
advancedSearchClick() {
Settings.capa(Capa.SearchAdv)
SettingsCapa(Capa.SearchAdv)
&& showScreenPopup(AdvancedSearchPopupView, [MessageUserStore.mainMessageListSearch()]);
}

View file

@ -21,6 +21,7 @@ import {
keyScopeReal,
moveAction,
Settings,
SettingsCapa,
getFullscreenElement,
exitFullscreen
} from 'Common/Globals';
@ -139,7 +140,7 @@ export class MailMessageView extends AbstractViewRight {
this.moveAction = moveAction;
this.allowMessageActions = Settings.capa(Capa.MessageActions);
this.allowMessageActions = SettingsCapa(Capa.MessageActions);
const attachmentsActions = Settings.app('attachmentsActions');
this.attachmentsActions = ko.observableArray(arrayLength(attachmentsActions) ? attachmentsActions : []);
@ -179,7 +180,7 @@ export class MailMessageView extends AbstractViewRight {
this.viewHash = '';
this.addComputables({
allowAttachmentControls: () => this.attachmentsActions.length && Settings.capa(Capa.AttachmentsActions),
allowAttachmentControls: () => this.attachmentsActions.length && SettingsCapa(Capa.AttachmentsActions),
downloadAsZipAllowed: () => this.attachmentsActions.includes('zip') && this.allowAttachmentControls(),