mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Cleanup some enums to consts
This commit is contained in:
parent
91e60c1007
commit
da2ab68fcc
13 changed files with 103 additions and 126 deletions
|
|
@ -5,12 +5,10 @@ export const
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Scope = {
|
ScopeMessageList = 'MessageList',
|
||||||
MessageList: 'MessageList',
|
ScopeFolderList = 'FolderList',
|
||||||
FolderList: 'FolderList',
|
ScopeMessageView = 'MessageView',
|
||||||
MessageView: 'MessageView',
|
ScopeSettings = 'Settings',
|
||||||
Settings: 'Settings'
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,12 @@ export const FolderType = {
|
||||||
FILES : 25;
|
FILES : 25;
|
||||||
JOURNAL : 26;
|
JOURNAL : 26;
|
||||||
*/
|
*/
|
||||||
};
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
export const FolderMetadataKeys = {
|
FolderMetadataKeys = {
|
||||||
// RFC 5464
|
// RFC 5464
|
||||||
Comment: '/private/comment',
|
Comment: '/private/comment',
|
||||||
CommentShared: '/shared/comment',
|
CommentShared: '/shared/comment',
|
||||||
|
|
@ -39,12 +39,12 @@ export const FolderMetadataKeys = {
|
||||||
// Kolab
|
// Kolab
|
||||||
KolabFolderType: '/private/vendor/kolab/folder-type',
|
KolabFolderType: '/private/vendor/kolab/folder-type',
|
||||||
KolabFolderTypeShared: '/shared/vendor/kolab/folder-type'
|
KolabFolderTypeShared: '/shared/vendor/kolab/folder-type'
|
||||||
};
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
export const ComposeType = {
|
ComposeType = {
|
||||||
Empty: 0,
|
Empty: 0,
|
||||||
Reply: 1,
|
Reply: 1,
|
||||||
ReplyAll: 2,
|
ReplyAll: 2,
|
||||||
|
|
@ -52,51 +52,32 @@ export const ComposeType = {
|
||||||
ForwardAsAttachment: 4,
|
ForwardAsAttachment: 4,
|
||||||
Draft: 5,
|
Draft: 5,
|
||||||
EditAsNew: 6
|
EditAsNew: 6
|
||||||
};
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
export const
|
ClientSideKeyNameExpandedFolders = 3,
|
||||||
ClientSideKeyNameExpandedFolders = 3,
|
ClientSideKeyNameFolderListSize = 4,
|
||||||
ClientSideKeyNameFolderListSize = 4,
|
ClientSideKeyNameMessageListSize = 5,
|
||||||
ClientSideKeyNameMessageListSize = 5,
|
ClientSideKeyNameLastSignMe = 7,
|
||||||
ClientSideKeyNameLastSignMe = 7,
|
ClientSideKeyNameMessageHeaderFullInfo = 9,
|
||||||
ClientSideKeyNameMessageHeaderFullInfo = 9,
|
ClientSideKeyNameMessageAttachmentControls = 10,
|
||||||
ClientSideKeyNameMessageAttachmentControls = 10;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
export const MessageSetAction = {
|
MessageSetAction = {
|
||||||
SetSeen: 0,
|
SetSeen: 0,
|
||||||
UnsetSeen: 1,
|
UnsetSeen: 1,
|
||||||
SetFlag: 2,
|
SetFlag: 2,
|
||||||
UnsetFlag: 3
|
UnsetFlag: 3
|
||||||
};
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
export const MessagePriority = {
|
//LayoutNoView = 0,
|
||||||
Low: 5,
|
LayoutSideView = 1,
|
||||||
Normal: 3,
|
LayoutBottomView = 2
|
||||||
High: 1
|
;
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
export const EditorDefaultType = {
|
|
||||||
Html: 'Html',
|
|
||||||
Plain: 'Plain'
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @enum {number}
|
|
||||||
*/
|
|
||||||
export const Layout = {
|
|
||||||
// NoPreview: 0,
|
|
||||||
SidePreview: 1,
|
|
||||||
BottomPreview: 2
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { MessagePriority } from 'Common/EnumsUser';
|
|
||||||
import { i18n } from 'Common/Translator';
|
import { i18n } from 'Common/Translator';
|
||||||
|
|
||||||
import { doc, SettingsGet } from 'Common/Globals';
|
import { doc, SettingsGet } from 'Common/Globals';
|
||||||
|
|
@ -87,7 +86,7 @@ export class MessageModel extends AbstractModel {
|
||||||
hasVirus: null, // or boolean when scanned
|
hasVirus: null, // or boolean when scanned
|
||||||
dateTimestamp: 0,
|
dateTimestamp: 0,
|
||||||
internalTimestamp: 0,
|
internalTimestamp: 0,
|
||||||
priority: MessagePriority.Normal,
|
priority: 3, // Normal
|
||||||
|
|
||||||
senderEmailsString: '',
|
senderEmailsString: '',
|
||||||
senderClearEmailsString: '',
|
senderClearEmailsString: '',
|
||||||
|
|
@ -237,7 +236,7 @@ export class MessageModel extends AbstractModel {
|
||||||
checked: this.checked(),
|
checked: this.checked(),
|
||||||
unseen: this.isUnseen(),
|
unseen: this.isUnseen(),
|
||||||
focused: this.focused(),
|
focused: this.focused(),
|
||||||
priorityHigh: this.priority() === MessagePriority.High,
|
priorityHigh: this.priority() === 1,
|
||||||
withAttachments: !!this.attachments().length,
|
withAttachments: !!this.attachments().length,
|
||||||
// hasChildrenMessage: 1 < this.threadsLen(),
|
// hasChildrenMessage: 1 < this.threadsLen(),
|
||||||
hasUnseenSubMessage: this.hasUnseenSubMessage(),
|
hasUnseenSubMessage: this.hasUnseenSubMessage(),
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Scope } from 'Common/Enums';
|
import { ScopeMessageList } from 'Common/Enums';
|
||||||
import { doc, createElement, Settings } from 'Common/Globals';
|
import { doc, createElement, Settings } from 'Common/Globals';
|
||||||
import { pString, pInt } from 'Common/Utils';
|
import { pString, pInt } from 'Common/Utils';
|
||||||
import { moveAction } from 'Common/UtilsUser';
|
import { moveAction } from 'Common/UtilsUser';
|
||||||
|
|
@ -57,7 +57,7 @@ export class MailBoxUserScreen extends AbstractScreen {
|
||||||
onShow() {
|
onShow() {
|
||||||
this.updateWindowTitle();
|
this.updateWindowTitle();
|
||||||
AppUserStore.focusedState('none');
|
AppUserStore.focusedState('none');
|
||||||
AppUserStore.focusedState(Scope.MessageList);
|
AppUserStore.focusedState(ScopeMessageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Scope } from 'Common/Enums';
|
import { ScopeSettings } from 'Common/Enums';
|
||||||
import { keyScope, SettingsCapa } from 'Common/Globals';
|
import { keyScope, 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';
|
||||||
|
|
@ -65,7 +65,7 @@ export class SettingsUserScreen extends AbstractSettingsScreen {
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
this.setSettingsTitle();
|
this.setSettingsTitle();
|
||||||
keyScope(Scope.Settings);
|
keyScope(ScopeSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
setSettingsTitle() {
|
setSettingsTitle() {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import ko from 'ko';
|
||||||
|
|
||||||
import { SMAudio } from 'Common/Audio';
|
import { SMAudio } from 'Common/Audio';
|
||||||
import { SaveSettingStatus } from 'Common/Enums';
|
import { SaveSettingStatus } from 'Common/Enums';
|
||||||
import { EditorDefaultType, Layout } from 'Common/EnumsUser';
|
import { LayoutSideView, LayoutBottomView } from 'Common/EnumsUser';
|
||||||
import { setRefreshFoldersInterval } from 'Common/Folders';
|
import { setRefreshFoldersInterval } from 'Common/Folders';
|
||||||
import { Settings, SettingsGet } from 'Common/Globals';
|
import { Settings, SettingsGet } from 'Common/Globals';
|
||||||
import { isArray } from 'Common/Utils';
|
import { isArray } from 'Common/Utils';
|
||||||
|
|
@ -71,8 +71,8 @@ export class UserSettingsGeneral extends AbstractViewSettings {
|
||||||
editorDefaultTypes: () => {
|
editorDefaultTypes: () => {
|
||||||
translateTrigger();
|
translateTrigger();
|
||||||
return [
|
return [
|
||||||
{ id: EditorDefaultType.Html, name: i18n('SETTINGS_GENERAL/EDITOR_HTML') },
|
{ id: 'Html', name: i18n('SETTINGS_GENERAL/EDITOR_HTML') },
|
||||||
{ id: EditorDefaultType.Plain, name: i18n('SETTINGS_GENERAL/EDITOR_PLAIN') }
|
{ id: 'Plain', name: i18n('SETTINGS_GENERAL/EDITOR_PLAIN') }
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -88,8 +88,8 @@ export class UserSettingsGeneral extends AbstractViewSettings {
|
||||||
translateTrigger();
|
translateTrigger();
|
||||||
return [
|
return [
|
||||||
{ id: 0, name: i18n('SETTINGS_GENERAL/LAYOUT_NO_SPLIT') },
|
{ id: 0, name: i18n('SETTINGS_GENERAL/LAYOUT_NO_SPLIT') },
|
||||||
{ id: Layout.SidePreview, name: i18n('SETTINGS_GENERAL/LAYOUT_VERTICAL_SPLIT') },
|
{ id: LayoutSideView, name: i18n('SETTINGS_GENERAL/LAYOUT_VERTICAL_SPLIT') },
|
||||||
{ id: Layout.BottomPreview, name: i18n('SETTINGS_GENERAL/LAYOUT_HORIZONTAL_SPLIT') }
|
{ id: LayoutBottomView, name: i18n('SETTINGS_GENERAL/LAYOUT_HORIZONTAL_SPLIT') }
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Scope } from 'Common/Enums';
|
import { ScopeMessageList, ScopeMessageView } from 'Common/Enums';
|
||||||
import { elementById } from 'Common/Globals';
|
import { elementById } from 'Common/Globals';
|
||||||
import { exitFullscreen } from 'Common/Fullscreen';
|
import { exitFullscreen } from 'Common/Fullscreen';
|
||||||
import { addObservablesTo, addSubscribablesTo } from 'External/ko';
|
import { addObservablesTo, addSubscribablesTo } from 'External/ko';
|
||||||
|
|
@ -25,9 +25,9 @@ export const MessageUserStore = new class {
|
||||||
clearTimeout(this.MessageSeenTimer);
|
clearTimeout(this.MessageSeenTimer);
|
||||||
elementById('rl-right').classList.toggle('message-selected', !!message);
|
elementById('rl-right').classList.toggle('message-selected', !!message);
|
||||||
if (message) {
|
if (message) {
|
||||||
SettingsUserStore.usePreviewPane() || AppUserStore.focusedState(Scope.MessageView);
|
SettingsUserStore.usePreviewPane() || AppUserStore.focusedState(ScopeMessageView);
|
||||||
} else {
|
} else {
|
||||||
AppUserStore.focusedState(Scope.MessageList);
|
AppUserStore.focusedState(ScopeMessageList);
|
||||||
exitFullscreen();
|
exitFullscreen();
|
||||||
}
|
}
|
||||||
[...(this.bodiesDom()?.children || [])].forEach(el => el.hidden = true);
|
[...(this.bodiesDom()?.children || [])].forEach(el => el.hidden = true);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import { koComputable, addObservablesTo } from 'External/ko';
|
import { koComputable, addObservablesTo } from 'External/ko';
|
||||||
|
|
||||||
import { Layout } from 'Common/EnumsUser';
|
import { LayoutSideView, LayoutBottomView } from 'Common/EnumsUser';
|
||||||
import { pInt } from 'Common/Utils';
|
import { pInt } from 'Common/Utils';
|
||||||
import { $htmlCL, SettingsGet, fireEvent } from 'Common/Globals';
|
import { $htmlCL, SettingsGet, fireEvent } from 'Common/Globals';
|
||||||
import { ThemeStore } from 'Stores/Theme';
|
import { ThemeStore } from 'Stores/Theme';
|
||||||
|
|
@ -54,8 +54,8 @@ export const SettingsUserStore = new class {
|
||||||
|
|
||||||
const toggleLayout = () => {
|
const toggleLayout = () => {
|
||||||
const value = self.usePreviewPane();
|
const value = self.usePreviewPane();
|
||||||
$htmlCL.toggle('sm-msgView-side', Layout.SidePreview === value);
|
$htmlCL.toggle('sm-msgView-side', LayoutSideView === value);
|
||||||
$htmlCL.toggle('sm-msgView-bottom', Layout.BottomPreview === value);
|
$htmlCL.toggle('sm-msgView-bottom', LayoutBottomView === value);
|
||||||
fireEvent('rl-layout', value);
|
fireEvent('rl-layout', value);
|
||||||
};
|
};
|
||||||
self.layout.subscribe(toggleLayout);
|
self.layout.subscribe(toggleLayout);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import {
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ComposeType,
|
ComposeType,
|
||||||
EditorDefaultType,
|
|
||||||
FolderType
|
FolderType
|
||||||
} from 'Common/EnumsUser';
|
} from 'Common/EnumsUser';
|
||||||
|
|
||||||
|
|
@ -100,7 +99,7 @@ const
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
isPlainEditor = () => EditorDefaultType.Plain === SettingsUserStore.editorDefaultType(),
|
isPlainEditor = () => 'Plain' === SettingsUserStore.editorDefaultType(),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} prefix
|
* @param {string} prefix
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { Scope } from 'Common/Enums';
|
import { ScopeFolderList, ScopeMessageList } from 'Common/Enums';
|
||||||
import { addShortcut, stopEvent } from 'Common/Globals';
|
import { addShortcut, stopEvent } from 'Common/Globals';
|
||||||
import { mailBox, settings } from 'Common/Links';
|
import { mailBox, settings } from 'Common/Links';
|
||||||
//import { setFolderETag } from 'Common/Cache';
|
//import { setFolderETag } from 'Common/Cache';
|
||||||
|
|
@ -116,12 +116,12 @@ export class MailFolderList extends AbstractViewLeft {
|
||||||
hasher.setHash(mailBox(folder.fullNameHash, 1, search));
|
hasher.setHash(mailBox(folder.fullNameHash, 1, search));
|
||||||
}
|
}
|
||||||
|
|
||||||
AppUserStore.focusedState(Scope.MessageList);
|
AppUserStore.focusedState(ScopeMessageList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addShortcut('arrowup,arrowdown', '', Scope.FolderList, event => {
|
addShortcut('arrowup,arrowdown', '', ScopeFolderList, event => {
|
||||||
let items = [], index = 0;
|
let items = [], index = 0;
|
||||||
dom.querySelectorAll('li a').forEach(node => {
|
dom.querySelectorAll('li a').forEach(node => {
|
||||||
if (node.offsetHeight || node.getClientRects().length) {
|
if (node.offsetHeight || node.getClientRects().length) {
|
||||||
|
|
@ -145,17 +145,17 @@ export class MailFolderList extends AbstractViewLeft {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
addShortcut('enter,open', '', Scope.FolderList, () => {
|
addShortcut('enter,open', '', ScopeFolderList, () => {
|
||||||
const item = qs('li a.focused');
|
const item = qs('li a.focused');
|
||||||
if (item) {
|
if (item) {
|
||||||
AppUserStore.focusedState(Scope.MessageList);
|
AppUserStore.focusedState(ScopeMessageList);
|
||||||
item.click();
|
item.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
addShortcut('space', '', Scope.FolderList, () => {
|
addShortcut('space', '', ScopeFolderList, () => {
|
||||||
const item = qs('li a.focused'),
|
const item = qs('li a.focused'),
|
||||||
folder = item && ko.dataFor(item);
|
folder = item && ko.dataFor(item);
|
||||||
if (folder) {
|
if (folder) {
|
||||||
|
|
@ -167,9 +167,9 @@ export class MailFolderList extends AbstractViewLeft {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// addShortcut('tab', 'shift', Scope.FolderList, () => {
|
// addShortcut('tab', 'shift', ScopeFolderList, () => {
|
||||||
addShortcut('escape,tab,arrowright', '', Scope.FolderList, () => {
|
addShortcut('escape,tab,arrowright', '', ScopeFolderList, () => {
|
||||||
AppUserStore.focusedState(Scope.MessageList);
|
AppUserStore.focusedState(ScopeMessageList);
|
||||||
moveAction(false);
|
moveAction(false);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import { addObservablesTo, addComputablesTo } from 'External/ko';
|
import { addObservablesTo, addComputablesTo } from 'External/ko';
|
||||||
|
|
||||||
import { Scope } from 'Common/Enums';
|
import { ScopeFolderList, ScopeMessageList, ScopeMessageView } from 'Common/Enums';
|
||||||
|
|
||||||
import { ComposeType, FolderType, MessageSetAction } from 'Common/EnumsUser';
|
import { ComposeType, FolderType, MessageSetAction } from 'Common/EnumsUser';
|
||||||
|
|
||||||
|
|
@ -45,7 +45,7 @@ import { ComposePopupView } from 'View/Popup/Compose';
|
||||||
|
|
||||||
import { MessageModel } from 'Model/Message';
|
import { MessageModel } from 'Model/Message';
|
||||||
|
|
||||||
import { Layout, ClientSideKeyNameMessageListSize } from 'Common/EnumsUser';
|
import { LayoutSideView, ClientSideKeyNameMessageListSize } from 'Common/EnumsUser';
|
||||||
import { setLayoutResizer } from 'Common/UtilsUser';
|
import { setLayoutResizer } from 'Common/UtilsUser';
|
||||||
|
|
||||||
const
|
const
|
||||||
|
|
@ -426,7 +426,7 @@ export class MailMessageList extends AbstractViewRight {
|
||||||
}
|
}
|
||||||
|
|
||||||
let b = moveAction();
|
let b = moveAction();
|
||||||
AppUserStore.focusedState(b ? Scope.MessageList : Scope.FolderList);
|
AppUserStore.focusedState(b ? ScopeMessageList : ScopeFolderList);
|
||||||
moveAction(!b);
|
moveAction(!b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -569,7 +569,7 @@ export class MailMessageList extends AbstractViewRight {
|
||||||
fToggle = () => {
|
fToggle = () => {
|
||||||
let layout = SettingsUserStore.usePreviewPane();
|
let layout = SettingsUserStore.usePreviewPane();
|
||||||
setLayoutResizer(top, ClientSideKeyNameMessageListSize,
|
setLayoutResizer(top, ClientSideKeyNameMessageListSize,
|
||||||
layout ? (Layout.SidePreview === layout ? 'Width' : 'Height') : 0
|
layout ? (LayoutSideView === layout ? 'Width' : 'Height') : 0
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
if (top) {
|
if (top) {
|
||||||
|
|
@ -578,14 +578,14 @@ export class MailMessageList extends AbstractViewRight {
|
||||||
}
|
}
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
||||||
this.selector.init(b_content, Scope.MessageList);
|
this.selector.init(b_content, ScopeMessageList);
|
||||||
|
|
||||||
addEventsListeners(dom, {
|
addEventsListeners(dom, {
|
||||||
click: event => {
|
click: event => {
|
||||||
ThemeStore.isMobile() && !eqs(event, '.toggleLeft') && leftPanelDisabled(true);
|
ThemeStore.isMobile() && !eqs(event, '.toggleLeft') && leftPanelDisabled(true);
|
||||||
|
|
||||||
if (eqs(event, '.messageList') && Scope.MessageView === AppUserStore.focusedState()) {
|
if (eqs(event, '.messageList') && ScopeMessageView === AppUserStore.focusedState()) {
|
||||||
AppUserStore.focusedState(Scope.MessageList);
|
AppUserStore.focusedState(ScopeMessageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
let el = eqs(event, '.e-paginator a');
|
let el = eqs(event, '.e-paginator a');
|
||||||
|
|
@ -667,7 +667,7 @@ export class MailMessageList extends AbstractViewRight {
|
||||||
|
|
||||||
// initShortcuts
|
// initShortcuts
|
||||||
|
|
||||||
addShortcut('enter,open', '', Scope.MessageList, () => {
|
addShortcut('enter,open', '', ScopeMessageList, () => {
|
||||||
if (formFieldFocused()) {
|
if (formFieldFocused()) {
|
||||||
MessagelistUserStore.mainSearch(sLastSearchValue);
|
MessagelistUserStore.mainSearch(sLastSearchValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -679,42 +679,42 @@ export class MailMessageList extends AbstractViewRight {
|
||||||
});
|
});
|
||||||
|
|
||||||
// archive (zip)
|
// archive (zip)
|
||||||
registerShortcut('z', '', [Scope.MessageList, Scope.MessageView], () => {
|
registerShortcut('z', '', [ScopeMessageList, ScopeMessageView], () => {
|
||||||
this.archiveCommand();
|
this.archiveCommand();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// delete
|
// delete
|
||||||
registerShortcut('delete', 'shift', Scope.MessageList, () => {
|
registerShortcut('delete', 'shift', ScopeMessageList, () => {
|
||||||
MessagelistUserStore.listCheckedOrSelected().length && this.deleteWithoutMoveCommand();
|
MessagelistUserStore.listCheckedOrSelected().length && this.deleteWithoutMoveCommand();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
// registerShortcut('3', 'shift', Scope.MessageList, () => {
|
// registerShortcut('3', 'shift', ScopeMessageList, () => {
|
||||||
registerShortcut('delete', '', Scope.MessageList, () => {
|
registerShortcut('delete', '', ScopeMessageList, () => {
|
||||||
MessagelistUserStore.listCheckedOrSelected().length && this.deleteCommand();
|
MessagelistUserStore.listCheckedOrSelected().length && this.deleteCommand();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// check mail
|
// check mail
|
||||||
addShortcut('r', 'meta', [Scope.FolderList, Scope.MessageList, Scope.MessageView], () => {
|
addShortcut('r', 'meta', [ScopeFolderList, ScopeMessageList, ScopeMessageView], () => {
|
||||||
this.reload();
|
this.reload();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// check all
|
// check all
|
||||||
registerShortcut('a', 'meta', Scope.MessageList, () => {
|
registerShortcut('a', 'meta', ScopeMessageList, () => {
|
||||||
this.checkAll(!(this.checkAll() && !this.isIncompleteChecked()));
|
this.checkAll(!(this.checkAll() && !this.isIncompleteChecked()));
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// write/compose (open compose popup)
|
// write/compose (open compose popup)
|
||||||
registerShortcut('w,c,new', '', [Scope.MessageList, Scope.MessageView], () => {
|
registerShortcut('w,c,new', '', [ScopeMessageList, ScopeMessageView], () => {
|
||||||
showMessageComposer();
|
showMessageComposer();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// important - star/flag messages
|
// important - star/flag messages
|
||||||
registerShortcut('i', '', [Scope.MessageList, Scope.MessageView], () => {
|
registerShortcut('i', '', [ScopeMessageList, ScopeMessageView], () => {
|
||||||
const checked = MessagelistUserStore.listCheckedOrSelected();
|
const checked = MessagelistUserStore.listCheckedOrSelected();
|
||||||
if (checked.length) {
|
if (checked.length) {
|
||||||
listAction(
|
listAction(
|
||||||
|
|
@ -726,7 +726,7 @@ export class MailMessageList extends AbstractViewRight {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
registerShortcut('t', '', [Scope.MessageList], () => {
|
registerShortcut('t', '', [ScopeMessageList], () => {
|
||||||
let message = MessagelistUserStore.selectedMessage() || MessagelistUserStore.focusedMessage();
|
let message = MessagelistUserStore.selectedMessage() || MessagelistUserStore.focusedMessage();
|
||||||
if (0 < message?.threadsLen()) {
|
if (0 < message?.threadsLen()) {
|
||||||
this.gotoThread(message);
|
this.gotoThread(message);
|
||||||
|
|
@ -735,38 +735,38 @@ export class MailMessageList extends AbstractViewRight {
|
||||||
});
|
});
|
||||||
|
|
||||||
// move
|
// move
|
||||||
registerShortcut('insert', '', Scope.MessageList, () => {
|
registerShortcut('insert', '', ScopeMessageList, () => {
|
||||||
this.moveCommand();
|
this.moveCommand();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// read
|
// read
|
||||||
registerShortcut('q', '', [Scope.MessageList, Scope.MessageView], () => {
|
registerShortcut('q', '', [ScopeMessageList, ScopeMessageView], () => {
|
||||||
this.seenMessagesFast(true);
|
this.seenMessagesFast(true);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// unread
|
// unread
|
||||||
registerShortcut('u', '', [Scope.MessageList, Scope.MessageView], () => {
|
registerShortcut('u', '', [ScopeMessageList, ScopeMessageView], () => {
|
||||||
this.seenMessagesFast(false);
|
this.seenMessagesFast(false);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
registerShortcut('f,mailforward', 'shift', [Scope.MessageList, Scope.MessageView], () => {
|
registerShortcut('f,mailforward', 'shift', [ScopeMessageList, ScopeMessageView], () => {
|
||||||
this.forwardCommand();
|
this.forwardCommand();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (SettingsCapa('Search')) {
|
if (SettingsCapa('Search')) {
|
||||||
// search input focus
|
// search input focus
|
||||||
addShortcut('/', '', [Scope.MessageList, Scope.MessageView], () => {
|
addShortcut('/', '', [ScopeMessageList, ScopeMessageView], () => {
|
||||||
this.focusSearch(true);
|
this.focusSearch(true);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// cancel search
|
// cancel search
|
||||||
addShortcut('escape', '', Scope.MessageList, () => {
|
addShortcut('escape', '', ScopeMessageList, () => {
|
||||||
if (this.messageListSearchDesc()) {
|
if (this.messageListSearchDesc()) {
|
||||||
this.cancelSearch();
|
this.cancelSearch();
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -777,25 +777,25 @@ export class MailMessageList extends AbstractViewRight {
|
||||||
});
|
});
|
||||||
|
|
||||||
// change focused state
|
// change focused state
|
||||||
addShortcut('tab', 'shift', Scope.MessageList, () => {
|
addShortcut('tab', 'shift', ScopeMessageList, () => {
|
||||||
AppUserStore.focusedState(Scope.FolderList);
|
AppUserStore.focusedState(ScopeFolderList);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
addShortcut('arrowleft', '', Scope.MessageList, () => {
|
addShortcut('arrowleft', '', ScopeMessageList, () => {
|
||||||
AppUserStore.focusedState(Scope.FolderList);
|
AppUserStore.focusedState(ScopeFolderList);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
addShortcut('tab,arrowright', '', Scope.MessageList, () => {
|
addShortcut('tab,arrowright', '', ScopeMessageList, () => {
|
||||||
if (MessageUserStore.message()) {
|
if (MessageUserStore.message()) {
|
||||||
AppUserStore.focusedState(Scope.MessageView);
|
AppUserStore.focusedState(ScopeMessageView);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addShortcut('arrowleft', 'meta', Scope.MessageView, ()=>false);
|
addShortcut('arrowleft', 'meta', ScopeMessageView, ()=>false);
|
||||||
addShortcut('arrowright', 'meta', Scope.MessageView, ()=>false);
|
addShortcut('arrowright', 'meta', ScopeMessageView, ()=>false);
|
||||||
|
|
||||||
addShortcut('f', 'meta', Scope.MessageList, this.advancedSearchClick);
|
addShortcut('f', 'meta', ScopeMessageList, this.advancedSearchClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
advancedSearchClick() {
|
advancedSearchClick() {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import { addObservablesTo, addComputablesTo, addSubscribablesTo } from 'External/ko';
|
import { addObservablesTo, addComputablesTo, addSubscribablesTo } from 'External/ko';
|
||||||
|
|
||||||
import { Scope } from 'Common/Enums';
|
import { ScopeMessageList, ScopeMessageView } from 'Common/Enums';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ComposeType,
|
ComposeType,
|
||||||
|
|
@ -335,23 +335,23 @@ export class MailMessageView extends AbstractViewRight {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
keyScopeReal.subscribe(value => this.messageDomFocused(Scope.MessageView === value));
|
keyScopeReal.subscribe(value => this.messageDomFocused(ScopeMessageView === value));
|
||||||
|
|
||||||
// initShortcuts
|
// initShortcuts
|
||||||
|
|
||||||
// exit fullscreen, back
|
// exit fullscreen, back
|
||||||
addShortcut('escape', '', Scope.MessageView, () => {
|
addShortcut('escape', '', ScopeMessageView, () => {
|
||||||
if (!this.viewModelDom.hidden && currentMessage()) {
|
if (!this.viewModelDom.hidden && currentMessage()) {
|
||||||
const preview = SettingsUserStore.usePreviewPane();
|
const preview = SettingsUserStore.usePreviewPane();
|
||||||
if (isFullscreen()) {
|
if (isFullscreen()) {
|
||||||
exitFullscreen();
|
exitFullscreen();
|
||||||
if (preview) {
|
if (preview) {
|
||||||
AppUserStore.focusedState(Scope.MessageList);
|
AppUserStore.focusedState(ScopeMessageList);
|
||||||
}
|
}
|
||||||
} else if (!preview) {
|
} else if (!preview) {
|
||||||
currentMessage(null);
|
currentMessage(null);
|
||||||
} else {
|
} else {
|
||||||
AppUserStore.focusedState(Scope.MessageList);
|
AppUserStore.focusedState(ScopeMessageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -359,13 +359,13 @@ export class MailMessageView extends AbstractViewRight {
|
||||||
});
|
});
|
||||||
|
|
||||||
// fullscreen
|
// fullscreen
|
||||||
addShortcut('enter,open', '', Scope.MessageView, () => {
|
addShortcut('enter,open', '', ScopeMessageView, () => {
|
||||||
isFullscreen() || toggleFullscreen();
|
isFullscreen() || toggleFullscreen();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// reply
|
// reply
|
||||||
registerShortcut('r,mailreply', '', [Scope.MessageList, Scope.MessageView], () => {
|
registerShortcut('r,mailreply', '', [ScopeMessageList, ScopeMessageView], () => {
|
||||||
if (currentMessage()) {
|
if (currentMessage()) {
|
||||||
this.replyCommand();
|
this.replyCommand();
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -374,13 +374,13 @@ export class MailMessageView extends AbstractViewRight {
|
||||||
});
|
});
|
||||||
|
|
||||||
// replyAll
|
// replyAll
|
||||||
registerShortcut('a', '', [Scope.MessageList, Scope.MessageView], () => {
|
registerShortcut('a', '', [ScopeMessageList, ScopeMessageView], () => {
|
||||||
if (currentMessage()) {
|
if (currentMessage()) {
|
||||||
this.replyAllCommand();
|
this.replyAllCommand();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerShortcut('mailreply', 'shift', [Scope.MessageList, Scope.MessageView], () => {
|
registerShortcut('mailreply', 'shift', [ScopeMessageList, ScopeMessageView], () => {
|
||||||
if (currentMessage()) {
|
if (currentMessage()) {
|
||||||
this.replyAllCommand();
|
this.replyAllCommand();
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -388,7 +388,7 @@ export class MailMessageView extends AbstractViewRight {
|
||||||
});
|
});
|
||||||
|
|
||||||
// forward
|
// forward
|
||||||
registerShortcut('f,mailforward', '', [Scope.MessageList, Scope.MessageView], () => {
|
registerShortcut('f,mailforward', '', [ScopeMessageList, ScopeMessageView], () => {
|
||||||
if (currentMessage()) {
|
if (currentMessage()) {
|
||||||
this.forwardCommand();
|
this.forwardCommand();
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -396,13 +396,13 @@ export class MailMessageView extends AbstractViewRight {
|
||||||
});
|
});
|
||||||
|
|
||||||
// message information
|
// message information
|
||||||
registerShortcut('i', 'meta', [Scope.MessageList, Scope.MessageView], () => {
|
registerShortcut('i', 'meta', [ScopeMessageList, ScopeMessageView], () => {
|
||||||
currentMessage() && this.toggleFullInfo();
|
currentMessage() && this.toggleFullInfo();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// toggle message blockquotes
|
// toggle message blockquotes
|
||||||
registerShortcut('b', '', [Scope.MessageList, Scope.MessageView], () => {
|
registerShortcut('b', '', [ScopeMessageList, ScopeMessageView], () => {
|
||||||
const message = currentMessage();
|
const message = currentMessage();
|
||||||
if (message?.body) {
|
if (message?.body) {
|
||||||
message.body.querySelectorAll('details').forEach(node => node.open = !node.open);
|
message.body.querySelectorAll('details').forEach(node => node.open = !node.open);
|
||||||
|
|
@ -410,37 +410,37 @@ export class MailMessageView extends AbstractViewRight {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addShortcut('arrowup,arrowleft', 'meta', [Scope.MessageList, Scope.MessageView], () => {
|
addShortcut('arrowup,arrowleft', 'meta', [ScopeMessageList, ScopeMessageView], () => {
|
||||||
this.goUpCommand();
|
this.goUpCommand();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
addShortcut('arrowdown,arrowright', 'meta', [Scope.MessageList, Scope.MessageView], () => {
|
addShortcut('arrowdown,arrowright', 'meta', [ScopeMessageList, ScopeMessageView], () => {
|
||||||
this.goDownCommand();
|
this.goDownCommand();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// delete
|
// delete
|
||||||
addShortcut('delete', '', Scope.MessageView, () => {
|
addShortcut('delete', '', ScopeMessageView, () => {
|
||||||
this.deleteCommand();
|
this.deleteCommand();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
addShortcut('delete', 'shift', Scope.MessageView, () => {
|
addShortcut('delete', 'shift', ScopeMessageView, () => {
|
||||||
this.deleteWithoutMoveCommand();
|
this.deleteWithoutMoveCommand();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// change focused state
|
// change focused state
|
||||||
addShortcut('arrowleft', '', Scope.MessageView, () => {
|
addShortcut('arrowleft', '', ScopeMessageView, () => {
|
||||||
if (!isFullscreen() && currentMessage() && SettingsUserStore.usePreviewPane()
|
if (!isFullscreen() && currentMessage() && SettingsUserStore.usePreviewPane()
|
||||||
&& !oMessageScrollerDom().scrollLeft) {
|
&& !oMessageScrollerDom().scrollLeft) {
|
||||||
AppUserStore.focusedState(Scope.MessageList);
|
AppUserStore.focusedState(ScopeMessageList);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addShortcut('tab', 'shift', Scope.MessageView, () => {
|
addShortcut('tab', 'shift', ScopeMessageView, () => {
|
||||||
if (!isFullscreen() && currentMessage() && SettingsUserStore.usePreviewPane()) {
|
if (!isFullscreen() && currentMessage() && SettingsUserStore.usePreviewPane()) {
|
||||||
AppUserStore.focusedState(Scope.MessageList);
|
AppUserStore.focusedState(ScopeMessageList);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { AppUserStore } from 'Stores/User/App';
|
||||||
import { AccountUserStore } from 'Stores/User/Account';
|
import { AccountUserStore } from 'Stores/User/Account';
|
||||||
//import { FolderUserStore } from 'Stores/User/Folder';
|
//import { FolderUserStore } from 'Stores/User/Folder';
|
||||||
|
|
||||||
import { Scope } from 'Common/Enums';
|
import { ScopeMessageList, ScopeMessageView, ScopeSettings } from 'Common/Enums';
|
||||||
import { settings } from 'Common/Links';
|
import { settings } from 'Common/Links';
|
||||||
|
|
||||||
import { showScreenPopup } from 'Knoin/Knoin';
|
import { showScreenPopup } from 'Knoin/Knoin';
|
||||||
|
|
@ -112,7 +112,7 @@ export class SystemDropDownUserView extends AbstractViewRight {
|
||||||
}
|
}
|
||||||
|
|
||||||
onBuild() {
|
onBuild() {
|
||||||
registerShortcut('m', '', [Scope.MessageList, Scope.MessageView, Scope.Settings], () => {
|
registerShortcut('m', '', [ScopeMessageList, ScopeMessageView, ScopeSettings], () => {
|
||||||
if (!this.viewModelDom.hidden) {
|
if (!this.viewModelDom.hidden) {
|
||||||
// exitFullscreen();
|
// exitFullscreen();
|
||||||
this.accountMenuDropdownTrigger(true);
|
this.accountMenuDropdownTrigger(true);
|
||||||
|
|
@ -121,7 +121,7 @@ export class SystemDropDownUserView extends AbstractViewRight {
|
||||||
});
|
});
|
||||||
|
|
||||||
// shortcuts help
|
// shortcuts help
|
||||||
registerShortcut('?,f1,help', '', [Scope.MessageList, Scope.MessageView, Scope.Settings], () => {
|
registerShortcut('?,f1,help', '', [ScopeMessageList, ScopeMessageView, ScopeSettings], () => {
|
||||||
if (!this.viewModelDom.hidden) {
|
if (!this.viewModelDom.hidden) {
|
||||||
showScreenPopup(KeyboardShortcutsHelpPopupView);
|
showScreenPopup(KeyboardShortcutsHelpPopupView);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue