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 { 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 { runSettingsViewModelHooks } from 'Common/Plugins';
import { initOnStartOrLangChange, i18n } from 'Common/Translator'; import { initOnStartOrLangChange, i18n } from 'Common/Translator';
@ -32,32 +32,32 @@ export class SettingsUserScreen extends AbstractSettingsScreen {
settingsAddViewModel(ContactsUserSettings, 'SettingsContacts', 'SETTINGS_LABELS/LABEL_CONTACTS_NAME', 'contacts'); 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( settingsAddViewModel(
AccountsUserSettings, AccountsUserSettings,
'SettingsAccounts', 'SettingsAccounts',
Settings.capa(Capa.AdditionalAccounts) SettingsCapa(Capa.AdditionalAccounts)
? 'SETTINGS_LABELS/LABEL_ACCOUNTS_NAME' ? 'SETTINGS_LABELS/LABEL_ACCOUNTS_NAME'
: 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME', : 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME',
'accounts' 'accounts'
); );
} }
if (Settings.capa(Capa.Sieve)) { if (SettingsCapa(Capa.Sieve)) {
settingsAddViewModel(FiltersUserSettings, 'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters'); 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(SecurityUserSettings, 'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security');
} }
settingsAddViewModel(FoldersUserSettings, 'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders'); 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'); 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'); settingsAddViewModel(OpenPgpUserSettings, 'SettingsOpenPGP', 'OpenPGP', 'openpgp');
} }

View file

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

View file

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

View file

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

View file

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