Cleanup and split Enums

This commit is contained in:
djmaze 2021-01-24 22:58:06 +01:00
parent 864da66b5f
commit f3bfa0e8c1
31 changed files with 315 additions and 344 deletions

View file

@ -2,15 +2,18 @@ import { pInt, pString } from 'Common/Utils';
import { isPosNumeric, delegateRunOnDestroy, mailToHelper } from 'Common/UtilsUser'; import { isPosNumeric, delegateRunOnDestroy, mailToHelper } from 'Common/UtilsUser';
import { import {
Layout,
Capa, Capa,
StorageResultType, StorageResultType,
Notification, Notification
} from 'Common/Enums';
import {
Layout,
FolderType, FolderType,
SetSystemFoldersNotification, SetSystemFoldersNotification,
MessageSetAction, MessageSetAction,
ClientSideKeyName ClientSideKeyName
} from 'Common/Enums'; } from 'Common/EnumsUser';
import { $htmlCL, leftPanelDisabled } from 'Common/Globals'; import { $htmlCL, leftPanelDisabled } from 'Common/Globals';

View file

@ -1,4 +1,4 @@
import { MessageSetAction } from 'Common/Enums'; import { MessageSetAction } from 'Common/EnumsUser';
import { pInt } from 'Common/Utils'; import { pInt } from 'Common/Utils';
let FOLDERS_CACHE = {}, let FOLDERS_CACHE = {},

View file

@ -10,16 +10,6 @@ export const StorageResultType = {
Unload: 'unload' Unload: 'unload'
}; };
/**
* @enum {string}
*/
export const Focused = {
None: 'none',
MessageList: 'message-list',
MessageView: 'message-view',
FolderList: 'folder-list'
};
/** /**
* @enum {string} * @enum {string}
*/ */
@ -71,66 +61,6 @@ export const KeyState = {
PopupAsk: 'popup-ask' PopupAsk: 'popup-ask'
}; };
/**
* @enum {number}
*/
export const FolderType = {
Inbox: 10,
SentItems: 11,
Draft: 12,
Trash: 13,
Spam: 14,
Archive: 15,
NotSpam: 80,
User: 99
};
/**
* @enum {number}
*/
export const ServerFolderType = {
USER: 0,
INBOX: 1,
SENT: 2,
DRAFTS: 3,
JUNK: 4,
TRASH: 5,
IMPORTANT: 10,
FLAGGED: 11,
ALL: 12
};
/**
* @enum {string}
*/
export const LoginSignMeTypeAsString = {
DefaultOff: 'defaultoff',
DefaultOn: 'defaulton',
Unused: 'unused'
};
/**
* @enum {number}
*/
export const LoginSignMeType = {
DefaultOff: 0,
DefaultOn: 1,
Unused: 2
};
/**
* @enum {string}
*/
export const ComposeType = {
Empty: 'empty',
Reply: 'reply',
ReplyAll: 'replyall',
Forward: 'forward',
ForwardAsAttachment: 'forward-as-attachment',
Draft: 'draft',
EditAsNew: 'editasnew'
};
/** /**
* @enum {number} * @enum {number}
*/ */
@ -145,96 +75,6 @@ export const UploadErrorCode = {
Unknown: 99 Unknown: 99
}; };
/**
* @enum {number}
*/
export const SetSystemFoldersNotification = {
None: 0,
Sent: 1,
Draft: 2,
Spam: 3,
Trash: 4,
Archive: 5
};
/**
* @enum {number}
*/
export const ClientSideKeyName = {
FoldersLashHash: 0,
MessagesInboxLastHash: 1,
MailBoxListSize: 2,
ExpandedFolders: 3,
FolderListSize: 4,
MessageListSize: 5,
LastReplyAction: 6,
LastSignMe: 7,
ComposeLastIdentityID: 8,
MessageHeaderFullInfo: 9,
MessageAttachmentControls: 10
};
/**
* @enum {number}
*/
export const MessageSetAction = {
SetSeen: 0,
UnsetSeen: 1,
SetFlag: 2,
UnsetFlag: 3
};
/**
* @enum {number}
*/
export const MessageSelectAction = {
All: 0,
None: 1,
Invert: 2,
Unseen: 3,
Seen: 4,
Flagged: 5,
Unflagged: 6
};
/**
* @enum {number}
*/
export const MessagePriority = {
Low: 5,
Normal: 3,
High: 1
};
/**
* @enum {string}
*/
export const EditorDefaultType = {
Html: 'Html',
Plain: 'Plain',
HtmlForced: 'HtmlForced',
PlainForced: 'PlainForced'
};
/**
* @enum {number}
*/
export const ServerSecure = {
None: 0,
SSL: 1,
TLS: 2
};
/**
* @enum {number}
*/
export const SearchDateType = {
All: -1,
Days3: 3,
Days7: 7,
Month: 30
};
/** /**
* @enum {number} * @enum {number}
*/ */
@ -245,105 +85,6 @@ export const SaveSettingsStep = {
FalseResult: 0 FalseResult: 0
}; };
/**
* @enum {number}
*/
export const Layout = {
NoPreview: 0,
SidePreview: 1,
BottomPreview: 2
};
/**
* @enum {string}
*/
export const FilterConditionField = {
From: 'From',
Recipient: 'Recipient',
Subject: 'Subject',
Header: 'Header',
Body: 'Body',
Size: 'Size'
};
/**
* @enum {string}
*/
export const FilterConditionType = {
Contains: 'Contains',
NotContains: 'NotContains',
EqualTo: 'EqualTo',
NotEqualTo: 'NotEqualTo',
Regex: 'Regex',
Over: 'Over',
Under: 'Under',
Text: 'Text',
Raw: 'Raw'
};
/**
* @enum {string}
*/
export const FiltersAction = {
None: 'None',
MoveTo: 'MoveTo',
Discard: 'Discard',
Vacation: 'Vacation',
Reject: 'Reject',
Forward: 'Forward'
};
/**
* @enum {string}
*/
export const FilterRulesType = {
All: 'All',
Any: 'Any'
};
/**
* @enum {number}
*/
export const SignedVerifyStatus = {
UnknownPublicKeys: -4,
UnknownPrivateKey: -3,
Unverified: -2,
Error: -1,
None: 0,
Success: 1
};
/**
* @enum {number}
*/
export const ContactPropertyType = {
Unknown: 0,
FullName: 10,
FirstName: 15,
LastName: 16,
MiddleName: 17,
Nick: 18,
NamePrefix: 20,
NameSuffix: 21,
Email: 30,
Phone: 31,
Web: 32,
Birthday: 40,
Facebook: 90,
Skype: 91,
GitHub: 92,
Note: 110,
Custom: 250
};
/** /**
* @enum {number} * @enum {number}
*/ */

105
dev/Common/EnumsUser.js Normal file
View file

@ -0,0 +1,105 @@
/* eslint quote-props: 0 */
/**
* @enum {string}
*/
export const Focused = {
None: 'none',
MessageList: 'message-list',
MessageView: 'message-view',
FolderList: 'folder-list'
};
/**
* @enum {number}
*/
export const FolderType = {
Inbox: 10,
SentItems: 11,
Draft: 12,
Trash: 13,
Spam: 14,
Archive: 15,
NotSpam: 80,
User: 99
};
/**
* @enum {string}
*/
export const ComposeType = {
Empty: 'empty',
Reply: 'reply',
ReplyAll: 'replyall',
Forward: 'forward',
ForwardAsAttachment: 'forward-as-attachment',
Draft: 'draft',
EditAsNew: 'editasnew'
};
/**
* @enum {number}
*/
export const SetSystemFoldersNotification = {
None: 0,
Sent: 1,
Draft: 2,
Spam: 3,
Trash: 4,
Archive: 5
};
/**
* @enum {number}
*/
export const ClientSideKeyName = {
FoldersLashHash: 0,
MessagesInboxLastHash: 1,
MailBoxListSize: 2,
ExpandedFolders: 3,
FolderListSize: 4,
MessageListSize: 5,
LastReplyAction: 6,
LastSignMe: 7,
ComposeLastIdentityID: 8,
MessageHeaderFullInfo: 9,
MessageAttachmentControls: 10
};
/**
* @enum {number}
*/
export const MessageSetAction = {
SetSeen: 0,
UnsetSeen: 1,
SetFlag: 2,
UnsetFlag: 3
};
/**
* @enum {number}
*/
export const MessagePriority = {
Low: 5,
Normal: 3,
High: 1
};
/**
* @enum {string}
*/
export const EditorDefaultType = {
Html: 'Html',
Plain: 'Plain',
HtmlForced: 'HtmlForced',
PlainForced: 'PlainForced'
};
/**
* @enum {number}
*/
export const Layout = {
NoPreview: 0,
SidePreview: 1,
BottomPreview: 2
};

View file

@ -1,4 +1,4 @@
import { ComposeType, FolderType } from 'Common/Enums'; import { ComposeType, FolderType } from 'Common/EnumsUser';
const const
tpl = document.createElement('template'), tpl = document.createElement('template'),

2
dev/External/ko.js vendored
View file

@ -171,7 +171,7 @@ ko.bindingHandlers.command = {
['command-disabled','disable','disabled'].forEach(s=>cl.toggle(s, !result)); ['command-disabled','disable','disabled'].forEach(s=>cl.toggle(s, !result));
cl.toggle('no-disabled', !!result); cl.toggle('no-disabled', !!result);
if (element.nodeName.match(/INPUT|TEXTAREA|BUTTON/)) { if (element.matches('INPUT,TEXTAREA,BUTTON')) {
element.disabled = !result; element.disabled = !result;
} }
} }

View file

@ -180,12 +180,12 @@ function buildViewModel(ViewModelClass, vmScreen) {
} }
} }
return ViewModelClass ? ViewModelClass.__vm : null; return ViewModelClass && ViewModelClass.__vm;
} }
function getScreenPopupViewModel(ViewModelClassToShow) { function getScreenPopupViewModel(ViewModelClassToShow) {
const ModalView = getScreenPopup(ViewModelClassToShow); const ModalView = getScreenPopup(ViewModelClassToShow);
return (buildViewModel(ModalView) && ModalView.__dom) ? ModalView.__vm : null; return (buildViewModel(ModalView) && ModalView.__dom) && ModalView.__vm;
} }
/** /**
@ -221,7 +221,7 @@ export function warmUpScreenPopup(ViewModelClassToShow) {
*/ */
export function isPopupVisible(ViewModelClassToShow) { export function isPopupVisible(ViewModelClassToShow) {
const ModalView = getScreenPopup(ViewModelClassToShow); const ModalView = getScreenPopup(ViewModelClassToShow);
return ModalView && ModalView.__vm ? ModalView.__vm.modalVisibility() : false; return ModalView && ModalView.__vm && ModalView.__vm.modalVisibility();
} }
/** /**
@ -329,7 +329,7 @@ export function startScreens(screensClasses) {
screensClasses.forEach(CScreen => { screensClasses.forEach(CScreen => {
if (CScreen) { if (CScreen) {
const vmScreen = new CScreen(), const vmScreen = new CScreen(),
screenName = vmScreen ? vmScreen.screenName() : ''; screenName = vmScreen && vmScreen.screenName();
if (vmScreen && screenName) { if (vmScreen && screenName) {
if (!defaultScreenName) { if (!defaultScreenName) {

View file

@ -1,5 +1,4 @@
import { ContactPropertyModel } from 'Model/ContactProperty'; import { ContactPropertyModel, ContactPropertyType } from 'Model/ContactProperty';
import { ContactPropertyType } from 'Common/Enums';
import { AbstractModel } from 'Knoin/AbstractModel'; import { AbstractModel } from 'Knoin/AbstractModel';

View file

@ -1,4 +1,3 @@
import { ContactPropertyType } from 'Common/Enums';
import { pInt, pString } from 'Common/Utils'; import { pInt, pString } from 'Common/Utils';
import { i18n } from 'Common/Translator'; import { i18n } from 'Common/Translator';
@ -6,6 +5,37 @@ import { AbstractModel } from 'Knoin/AbstractModel';
const trim = text => null == text ? "" : (text + "").trim(); const trim = text => null == text ? "" : (text + "").trim();
/**
* @enum {number}
*/
export const ContactPropertyType = {
Unknown: 0,
FullName: 10,
FirstName: 15,
LastName: 16,
MiddleName: 17,
Nick: 18,
NamePrefix: 20,
NameSuffix: 21,
Email: 30,
Phone: 31,
Web: 32,
Birthday: 40,
Facebook: 90,
Skype: 91,
GitHub: 92,
Note: 110,
Custom: 250
};
export class ContactPropertyModel extends AbstractModel { export class ContactPropertyModel extends AbstractModel {
/** /**
* @param {number=} type = Enums.ContactPropertyType.Unknown * @param {number=} type = Enums.ContactPropertyType.Unknown

View file

@ -1,6 +1,5 @@
import ko from 'ko'; import ko from 'ko';
import { FilterRulesType, FiltersAction } from 'Common/Enums';
import { pString } from 'Common/Utils'; import { pString } from 'Common/Utils';
import { delegateRunOnDestroy } from 'Common/UtilsUser'; import { delegateRunOnDestroy } from 'Common/UtilsUser';
import { i18n } from 'Common/Translator'; import { i18n } from 'Common/Translator';
@ -11,6 +10,26 @@ import AccountStore from 'Stores/User/Account';
import { FilterConditionModel } from 'Model/FilterCondition'; import { FilterConditionModel } from 'Model/FilterCondition';
import { AbstractModel } from 'Knoin/AbstractModel'; import { AbstractModel } from 'Knoin/AbstractModel';
/**
* @enum {string}
*/
export const FilterAction = {
None: 'None',
MoveTo: 'MoveTo',
Discard: 'Discard',
Vacation: 'Vacation',
Reject: 'Reject',
Forward: 'Forward'
};
/**
* @enum {string}
*/
const FilterRulesType = {
All: 'All',
Any: 'Any'
};
export class FilterModel extends AbstractModel { export class FilterModel extends AbstractModel {
constructor() { constructor() {
super(); super();
@ -43,7 +62,7 @@ export class FilterModel extends AbstractModel {
actionKeep: true, actionKeep: true,
actionNoStop: false, actionNoStop: false,
actionType: FiltersAction.MoveTo actionType: FilterAction.MoveTo
}); });
this.conditions = ko.observableArray(); this.conditions = ko.observableArray();
@ -59,23 +78,23 @@ export class FilterModel extends AbstractModel {
const actionValue = this.actionValue(); const actionValue = this.actionValue();
switch (this.actionType()) { switch (this.actionType()) {
case FiltersAction.MoveTo: case FilterAction.MoveTo:
result = i18n('SETTINGS_FILTERS/SUBNAME_MOVE_TO', { result = i18n('SETTINGS_FILTERS/SUBNAME_MOVE_TO', {
FOLDER: fGetRealFolderName(actionValue) FOLDER: fGetRealFolderName(actionValue)
}); });
break; break;
case FiltersAction.Forward: case FilterAction.Forward:
result = i18n('SETTINGS_FILTERS/SUBNAME_FORWARD_TO', { result = i18n('SETTINGS_FILTERS/SUBNAME_FORWARD_TO', {
EMAIL: actionValue EMAIL: actionValue
}); });
break; break;
case FiltersAction.Vacation: case FilterAction.Vacation:
result = i18n('SETTINGS_FILTERS/SUBNAME_VACATION_MESSAGE'); result = i18n('SETTINGS_FILTERS/SUBNAME_VACATION_MESSAGE');
break; break;
case FiltersAction.Reject: case FilterAction.Reject:
result = i18n('SETTINGS_FILTERS/SUBNAME_REJECT'); result = i18n('SETTINGS_FILTERS/SUBNAME_REJECT');
break; break;
case FiltersAction.Discard: case FilterAction.Discard:
result = i18n('SETTINGS_FILTERS/SUBNAME_DISCARD'); result = i18n('SETTINGS_FILTERS/SUBNAME_DISCARD');
break; break;
// no default // no default
@ -88,24 +107,24 @@ export class FilterModel extends AbstractModel {
let result = ''; let result = '';
switch (this.actionType()) { switch (this.actionType()) {
case FiltersAction.Forward: case FilterAction.Forward:
result = 'SettingsFiltersActionForward'; result = 'SettingsFilterActionForward';
break; break;
case FiltersAction.Vacation: case FilterAction.Vacation:
result = 'SettingsFiltersActionVacation'; result = 'SettingsFilterActionVacation';
break; break;
case FiltersAction.Reject: case FilterAction.Reject:
result = 'SettingsFiltersActionReject'; result = 'SettingsFilterActionReject';
break; break;
case FiltersAction.None: case FilterAction.None:
result = 'SettingsFiltersActionNone'; result = 'SettingsFilterActionNone';
break; break;
case FiltersAction.Discard: case FilterAction.Discard:
result = 'SettingsFiltersActionDiscard'; result = 'SettingsFilterActionDiscard';
break; break;
case FiltersAction.MoveTo: case FilterAction.MoveTo:
default: default:
result = 'SettingsFiltersActionMoveToFolder'; result = 'SettingsFilterActionMoveToFolder';
break; break;
} }
@ -143,10 +162,10 @@ export class FilterModel extends AbstractModel {
if (!this.actionValue()) { if (!this.actionValue()) {
if ([ if ([
FiltersAction.MoveTo, FilterAction.MoveTo,
FiltersAction.Forward, FilterAction.Forward,
FiltersAction.Reject, FilterAction.Reject,
FiltersAction.Vacation FilterAction.Vacation
].includes(this.actionType()) ].includes(this.actionType())
) { ) {
this.actionValueError(true); this.actionValueError(true);
@ -154,13 +173,13 @@ export class FilterModel extends AbstractModel {
} }
} }
if (FiltersAction.Forward === this.actionType() && !this.actionValue().includes('@')) { if (FilterAction.Forward === this.actionType() && !this.actionValue().includes('@')) {
this.actionValueError(true); this.actionValueError(true);
return false; return false;
} }
if ( if (
FiltersAction.Vacation === this.actionType() && FilterAction.Vacation === this.actionType() &&
this.actionValueFourth() && this.actionValueFourth() &&
!this.actionValueFourth().includes('@') !this.actionValueFourth().includes('@')
) { ) {

View file

@ -1,9 +1,34 @@
import ko from 'ko'; import ko from 'ko';
import { FilterConditionField, FilterConditionType } from 'Common/Enums';
import { AbstractModel } from 'Knoin/AbstractModel'; import { AbstractModel } from 'Knoin/AbstractModel';
/**
* @enum {string}
*/
export const FilterConditionField = {
From: 'From',
Recipient: 'Recipient',
Subject: 'Subject',
Header: 'Header',
Body: 'Body',
Size: 'Size'
};
/**
* @enum {string}
*/
export const FilterConditionType = {
Contains: 'Contains',
NotContains: 'NotContains',
EqualTo: 'EqualTo',
NotEqualTo: 'NotEqualTo',
Regex: 'Regex',
Over: 'Over',
Under: 'Under',
Text: 'Text',
Raw: 'Raw'
};
export class FilterConditionModel extends AbstractModel { export class FilterConditionModel extends AbstractModel {
constructor() { constructor() {
super(); super();

View file

@ -1,6 +1,6 @@
import ko from 'ko'; import ko from 'ko';
import { FolderType } from 'Common/Enums'; import { FolderType } from 'Common/EnumsUser';
import { isPosNumeric } from 'Common/UtilsUser'; import { isPosNumeric } from 'Common/UtilsUser';
import { i18n, trigger as translatorTrigger } from 'Common/Translator'; import { i18n, trigger as translatorTrigger } from 'Common/Translator';

View file

@ -2,7 +2,7 @@ import { AbstractCollectionModel } from 'Model/AbstractCollection';
import { UNUSED_OPTION_VALUE } from 'Common/Consts'; import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { pInt } from 'Common/Utils'; import { pInt } from 'Common/Utils';
import { ClientSideKeyName, FolderType, ServerFolderType } from 'Common/Enums'; import { ClientSideKeyName, FolderType } from 'Common/EnumsUser';
import * as Cache from 'Common/Cache'; import * as Cache from 'Common/Cache';
import * as Local from 'Storage/Client'; import * as Local from 'Storage/Client';
@ -18,6 +18,18 @@ import Remote from 'Remote/User/Fetch';
const Settings = rl.settings, const Settings = rl.settings,
ServerFolderType = {
USER: 0,
INBOX: 1,
SENT: 2,
DRAFTS: 3,
JUNK: 4,
TRASH: 5,
IMPORTANT: 10,
FLAGGED: 11,
ALL: 12
},
normalizeFolder = sFolderFullNameRaw => ('' === sFolderFullNameRaw normalizeFolder = sFolderFullNameRaw => ('' === sFolderFullNameRaw
|| UNUSED_OPTION_VALUE === sFolderFullNameRaw || UNUSED_OPTION_VALUE === sFolderFullNameRaw
|| null !== Cache.getFolderFromCacheList(sFolderFullNameRaw)) || null !== Cache.getFolderFromCacheList(sFolderFullNameRaw))

View file

@ -1,6 +1,6 @@
import ko from 'ko'; import ko from 'ko';
import { MessagePriority, SignedVerifyStatus } from 'Common/Enums'; import { MessagePriority } from 'Common/EnumsUser';
import { i18n } from 'Common/Translator'; import { i18n } from 'Common/Translator';
import { encodeHtml } from 'Common/UtilsUser'; import { encodeHtml } from 'Common/UtilsUser';
@ -16,6 +16,15 @@ import { AbstractModel } from 'Knoin/AbstractModel';
const isArray = Array.isArray, const isArray = Array.isArray,
SignedVerifyStatus = {
UnknownPublicKeys: -4,
UnknownPrivateKey: -3,
Unverified: -2,
Error: -1,
None: 0,
Success: 1
},
replyHelper = (emails, unic, localEmails) => { replyHelper = (emails, unic, localEmails) => {
emails.forEach(email => { emails.forEach(email => {
if (undefined === unic[email.email]) { if (undefined === unic[email.email]) {

View file

@ -1,4 +1,5 @@
import { Focused, Capa, ClientSideKeyName } from 'Common/Enums'; import { Capa } from 'Common/Enums';
import { Focused, ClientSideKeyName } from 'Common/EnumsUser';
import { leftPanelDisabled, leftPanelType, moveAction } from 'Common/Globals'; import { leftPanelDisabled, leftPanelType, moveAction } from 'Common/Globals';
import { pString, pInt } from 'Common/Utils'; import { pString, pInt } from 'Common/Utils';
import { getFolderFromCacheList, getFolderFullNameRaw, getFolderInboxName } from 'Common/Cache'; import { getFolderFromCacheList, getFolderFullNameRaw, getFolderInboxName } from 'Common/Cache';

View file

@ -1,6 +1,7 @@
import ko from 'ko'; import ko from 'ko';
import { ClientSideKeyName, Notification } from 'Common/Enums'; import { Notification } from 'Common/Enums';
import { ClientSideKeyName } from 'Common/EnumsUser';
import { getNotification, i18n } from 'Common/Translator'; import { getNotification, i18n } from 'Common/Translator';
import { removeFolderFromCacheList } from 'Common/Cache'; import { removeFolderFromCacheList } from 'Common/Cache';

View file

@ -2,7 +2,8 @@ import ko from 'ko';
import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts'; import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
import { SaveSettingsStep, EditorDefaultType, Layout } from 'Common/Enums'; import { SaveSettingsStep } from 'Common/Enums';
import { EditorDefaultType, Layout } from 'Common/EnumsUser';
import { settingsSaveHelperSimpleFunction, convertLangName } from 'Common/Utils'; import { settingsSaveHelperSimpleFunction, convertLangName } from 'Common/Utils';

View file

@ -1,5 +1,6 @@
import ko from 'ko'; import ko from 'ko';
import { Focused, KeyState } from 'Common/Enums'; import { KeyState } from 'Common/Enums';
import { Focused } from 'Common/EnumsUser';
import { keyScope, leftPanelDisabled } from 'Common/Globals'; import { keyScope, leftPanelDisabled } from 'Common/Globals';

View file

@ -1,6 +1,6 @@
import ko from 'ko'; import ko from 'ko';
import { FolderType } from 'Common/Enums'; import { FolderType } from 'Common/EnumsUser';
import { UNUSED_OPTION_VALUE } from 'Common/Consts'; import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { folderListOptionsBuilder } from 'Common/UtilsUser'; import { folderListOptionsBuilder } from 'Common/UtilsUser';
import { getFolderInboxName, getFolderFromCacheList } from 'Common/Cache'; import { getFolderInboxName, getFolderFromCacheList } from 'Common/Cache';

View file

@ -1,6 +1,7 @@
import ko from 'ko'; import ko from 'ko';
import { Layout, Focused, MessageSetAction, StorageResultType, Notification } from 'Common/Enums'; import { StorageResultType, Notification } from 'Common/Enums';
import { Layout, Focused, MessageSetAction } from 'Common/EnumsUser';
import { pInt, pString } from 'Common/Utils'; import { pInt, pString } from 'Common/Utils';
import { plainToHtml } from 'Common/UtilsUser'; import { plainToHtml } from 'Common/UtilsUser';

View file

@ -1,7 +1,7 @@
import ko from 'ko'; import ko from 'ko';
import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts'; import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
import { Layout, EditorDefaultType } from 'Common/Enums'; import { Layout, EditorDefaultType } from 'Common/EnumsUser';
import { pInt } from 'Common/Utils'; import { pInt } from 'Common/Utils';
class SettingsUserStore { class SettingsUserStore {

View file

@ -3,14 +3,17 @@ import ko from 'ko';
import { import {
Capa, Capa,
KeyState, KeyState,
ComposeType,
StorageResultType, StorageResultType,
EditorDefaultType,
Notification, Notification,
SetSystemFoldersNotification,
UploadErrorCode UploadErrorCode
} from 'Common/Enums'; } from 'Common/Enums';
import {
ComposeType,
EditorDefaultType,
SetSystemFoldersNotification
} from 'Common/EnumsUser';
import { inFocus, pInt } from 'Common/Utils'; import { inFocus, pInt } from 'Common/Utils';
import { encodeHtml, delegateRunOnDestroy } from 'Common/UtilsUser'; import { encodeHtml, delegateRunOnDestroy } from 'Common/UtilsUser';

View file

@ -2,14 +2,14 @@ import ko from 'ko';
import { import {
SaveSettingsStep, SaveSettingsStep,
ContactPropertyType,
ComposeType,
Capa, Capa,
StorageResultType, StorageResultType,
Notification, Notification,
KeyState KeyState
} from 'Common/Enums'; } from 'Common/Enums';
import { ComposeType } from 'Common/EnumsUser';
import { pInt } from 'Common/Utils'; import { pInt } from 'Common/Utils';
import { delegateRunOnDestroy, computedPaginatorHelper } from 'Common/UtilsUser'; import { delegateRunOnDestroy, computedPaginatorHelper } from 'Common/UtilsUser';
@ -24,7 +24,7 @@ import Remote from 'Remote/User/Fetch';
import { EmailModel } from 'Model/Email'; import { EmailModel } from 'Model/Email';
import { ContactModel } from 'Model/Contact'; import { ContactModel } from 'Model/Contact';
import { ContactPropertyModel } from 'Model/ContactProperty'; import { ContactPropertyModel, ContactPropertyType } from 'Model/ContactProperty';
import { command, showScreenPopup, hideScreenPopup } from 'Knoin/Knoin'; import { command, showScreenPopup, hideScreenPopup } from 'Knoin/Knoin';
import { AbstractViewPopup } from 'Knoin/AbstractViews'; import { AbstractViewPopup } from 'Knoin/AbstractViews';

View file

@ -1,4 +1,4 @@
import { StorageResultType, ServerSecure, Notification } from 'Common/Enums'; import { StorageResultType, Notification } from 'Common/Enums';
import { pInt, pString } from 'Common/Utils'; import { pInt, pString } from 'Common/Utils';
import { i18n } from 'Common/Translator'; import { i18n } from 'Common/Translator';
@ -37,15 +37,15 @@ class DomainPopupView extends AbstractViewPopup {
imapServer: '', imapServer: '',
imapPort: '143', imapPort: '143',
imapSecure: ServerSecure.None, imapSecure: 0,
imapShortLogin: false, imapShortLogin: false,
useSieve: false, useSieve: false,
sieveServer: '', sieveServer: '',
sievePort: '4190', sievePort: '4190',
sieveSecure: ServerSecure.None, sieveSecure: 0,
smtpServer: '', smtpServer: '',
smtpPort: '25', smtpPort: '25',
smtpSecure: ServerSecure.None, smtpSecure: 0,
smtpShortLogin: false, smtpShortLogin: false,
smtpAuth: true, smtpAuth: true,
smtpPhpMail: false, smtpPhpMail: false,
@ -325,17 +325,17 @@ class DomainPopupView extends AbstractViewPopup {
this.imapServer(''); this.imapServer('');
this.imapPort('143'); this.imapPort('143');
this.imapSecure(ServerSecure.None); this.imapSecure(0);
this.imapShortLogin(false); this.imapShortLogin(false);
this.useSieve(false); this.useSieve(false);
this.sieveServer(''); this.sieveServer('');
this.sievePort('4190'); this.sievePort('4190');
this.sieveSecure(ServerSecure.None); this.sieveSecure(0);
this.smtpServer(''); this.smtpServer('');
this.smtpPort('25'); this.smtpPort('25');
this.smtpSecure(ServerSecure.None); this.smtpSecure(0);
this.smtpShortLogin(false); this.smtpShortLogin(false);
this.smtpAuth(true); this.smtpAuth(true);
this.smtpPhpMail(false); this.smtpPhpMail(false);

View file

@ -1,6 +1,7 @@
import ko from 'ko'; import ko from 'ko';
import { FiltersAction, FilterConditionField, FilterConditionType } from 'Common/Enums'; import { FilterAction } from 'Model/Filter';
import { FilterConditionField, FilterConditionType } from 'Model/FilterCondition';
import { defaultOptionsAfterRender } from 'Common/Utils'; import { defaultOptionsAfterRender } from 'Common/Utils';
import { i18n, initOnStartOrLangChange } from 'Common/Translator'; import { i18n, initOnStartOrLangChange } from 'Common/Translator';
@ -40,7 +41,7 @@ class FilterPopupView extends AbstractViewPopup {
@command() @command()
saveFilterCommand() { saveFilterCommand() {
if (this.filter()) { if (this.filter()) {
if (FiltersAction.MoveTo === this.filter().actionType()) { if (FilterAction.MoveTo === this.filter().actionType()) {
this.filter().actionValue(this.selectedFolderValue()); this.filter().actionValue(this.selectedFolderValue());
} }
@ -74,7 +75,7 @@ class FilterPopupView extends AbstractViewPopup {
{ 'id': FilterConditionType.NotEqualTo, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_NOT_EQUAL_TO') } { 'id': FilterConditionType.NotEqualTo, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_NOT_EQUAL_TO') }
]); ]);
// this.actionTypeOptions.push({'id': FiltersAction.None, // this.actionTypeOptions.push({'id': FilterAction.None,
// 'name': i18n('GLOBAL/NONE')}); // 'name': i18n('GLOBAL/NONE')});
const modules = SieveStore.capa; const modules = SieveStore.capa;
if (modules) { if (modules) {
@ -84,22 +85,22 @@ class FilterPopupView extends AbstractViewPopup {
if (modules.includes('fileinto')) { if (modules.includes('fileinto')) {
this.actionTypeOptions.push({ this.actionTypeOptions.push({
'id': FiltersAction.MoveTo, 'id': FilterAction.MoveTo,
'name': i18n('POPUPS_FILTER/SELECT_ACTION_MOVE_TO') 'name': i18n('POPUPS_FILTER/SELECT_ACTION_MOVE_TO')
}); });
this.actionTypeOptions.push({ this.actionTypeOptions.push({
'id': FiltersAction.Forward, 'id': FilterAction.Forward,
'name': i18n('POPUPS_FILTER/SELECT_ACTION_FORWARD_TO') 'name': i18n('POPUPS_FILTER/SELECT_ACTION_FORWARD_TO')
}); });
} }
if (modules.includes('reject')) { if (modules.includes('reject')) {
this.actionTypeOptions.push({ 'id': FiltersAction.Reject, 'name': i18n('POPUPS_FILTER/SELECT_ACTION_REJECT') }); this.actionTypeOptions.push({ 'id': FilterAction.Reject, 'name': i18n('POPUPS_FILTER/SELECT_ACTION_REJECT') });
} }
if (modules.includes('vacation')) { if (modules.includes('vacation')) {
this.actionTypeOptions.push({ this.actionTypeOptions.push({
'id': FiltersAction.Vacation, 'id': FilterAction.Vacation,
'name': i18n('POPUPS_FILTER/SELECT_ACTION_VACATION_MESSAGE') 'name': i18n('POPUPS_FILTER/SELECT_ACTION_VACATION_MESSAGE')
}); });
} }
@ -113,7 +114,7 @@ class FilterPopupView extends AbstractViewPopup {
} }
} }
this.actionTypeOptions.push({ 'id': FiltersAction.Discard, 'name': i18n('POPUPS_FILTER/SELECT_ACTION_DISCARD') }); this.actionTypeOptions.push({ 'id': FilterAction.Discard, 'name': i18n('POPUPS_FILTER/SELECT_ACTION_DISCARD') });
this.typeOptionsSize([ this.typeOptionsSize([
{ 'id': FilterConditionType.Over, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_OVER') }, { 'id': FilterConditionType.Over, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_OVER') },

View file

@ -1,6 +1,6 @@
import ko from 'ko'; import ko from 'ko';
import { SetSystemFoldersNotification } from 'Common/Enums'; import { SetSystemFoldersNotification } from 'Common/EnumsUser';
import { UNUSED_OPTION_VALUE } from 'Common/Consts'; import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { defaultOptionsAfterRender } from 'Common/Utils'; import { defaultOptionsAfterRender } from 'Common/Utils';
import { folderListOptionsBuilder } from 'Common/UtilsUser'; import { folderListOptionsBuilder } from 'Common/UtilsUser';

View file

@ -1,13 +1,12 @@
import ko from 'ko'; import ko from 'ko';
import { import {
LoginSignMeType,
LoginSignMeTypeAsString,
ClientSideKeyName,
StorageResultType, StorageResultType,
Notification Notification
} from 'Common/Enums'; } from 'Common/Enums';
import { ClientSideKeyName } from 'Common/EnumsUser';
import { convertLangName } from 'Common/Utils'; import { convertLangName } from 'Common/Utils';
import { getNotification, getNotificationFromResponse, reload as translatorReload } from 'Common/Translator'; import { getNotification, getNotificationFromResponse, reload as translatorReload } from 'Common/Translator';
@ -24,7 +23,20 @@ import { AbstractViewCenter } from 'Knoin/AbstractViews';
import { rootAdmin } from 'Common/Links'; import { rootAdmin } from 'Common/Links';
const Settings = rl.settings; const Settings = rl.settings,
LoginSignMeType = {
DefaultOff: 0,
DefaultOn: 1,
Unused: 2
},
LoginSignMeTypeAsString = {
DefaultOff: 'defaultoff',
DefaultOn: 'defaulton',
Unused: 'unused'
};
class LoginUserView extends AbstractViewCenter { class LoginUserView extends AbstractViewCenter {
constructor() { constructor() {

View file

@ -1,6 +1,7 @@
import ko from 'ko'; import ko from 'ko';
import { Capa, Focused, Layout, KeyState } from 'Common/Enums'; import { Capa, KeyState } from 'Common/Enums';
import { Focused, Layout } from 'Common/EnumsUser';
import { leftPanelDisabled, moveAction } from 'Common/Globals'; import { leftPanelDisabled, moveAction } from 'Common/Globals';
import { mailBox, settings } from 'Common/Links'; import { mailBox, settings } from 'Common/Links';
import { setFolderHash } from 'Common/Cache'; import { setFolderHash } from 'Common/Cache';

View file

@ -2,14 +2,17 @@ import ko from 'ko';
import { import {
Capa, Capa,
KeyState,
StorageResultType
} from 'Common/Enums';
import {
Layout, Layout,
Focused, Focused,
ComposeType, ComposeType,
FolderType, FolderType,
MessageSetAction, MessageSetAction
KeyState, } from 'Common/EnumsUser';
StorageResultType
} from 'Common/Enums';
import { UNUSED_OPTION_VALUE } from 'Common/Consts'; import { UNUSED_OPTION_VALUE } from 'Common/Consts';

View file

@ -4,14 +4,17 @@ import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { import {
Capa, Capa,
KeyState
} from 'Common/Enums';
import {
ComposeType, ComposeType,
ClientSideKeyName, ClientSideKeyName,
KeyState,
FolderType, FolderType,
Focused, Focused,
Layout, Layout,
MessageSetAction MessageSetAction
} from 'Common/Enums'; } from 'Common/EnumsUser';
import { $htmlCL, leftPanelDisabled, keyScopeReal, moveAction } from 'Common/Globals'; import { $htmlCL, leftPanelDisabled, keyScopeReal, moveAction } from 'Common/Globals';

4
dev/bootstrap.js vendored
View file

@ -13,10 +13,10 @@ export default (App) => {
if ('S' == event.key) { if ('S' == event.key) {
event.preventDefault(); event.preventDefault();
} else if ('A' == event.key) { } else if ('A' == event.key) {
const sender = event.target || event.srcElement; const sender = event.target;
if ( if (
sender && sender &&
('true' === '' + sender.contentEditable || (sender.tagName && sender.tagName.match(/INPUT|TEXTAREA/i))) ('true' === '' + sender.contentEditable || (sender.matches && sender.matches('INPUT,TEXTAREA')))
) { ) {
return; return;
} }