Convert user stores to single object instances

Removed unused ContactUserStore.exportingCsv and ContactUserStore.exportingVcf
This commit is contained in:
djmaze 2021-03-10 22:41:35 +01:00
parent 914c6e8d14
commit 6a454ec624
46 changed files with 671 additions and 710 deletions

View file

@ -1,4 +1,4 @@
import PgpStore from 'Stores/User/Pgp';
import { PgpUserStore } from 'Stores/User/Pgp';
import { decorateKoCommands } from 'Knoin/Knoin';
import { AbstractViewPopup } from 'Knoin/AbstractViews';
@ -26,7 +26,7 @@ class AddOpenPgpKeyPopupView extends AbstractViewPopup {
addOpenPgpKeyCommand() {
// eslint-disable-next-line max-len
const reg = /[-]{3,6}BEGIN[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[-]{3,6}[\s\S]+?[-]{3,6}END[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[-]{3,6}/gi,
openpgpKeyring = PgpStore.openpgpKeyring;
openpgpKeyring = PgpUserStore.openpgpKeyring;
let keyTrimmed = this.key().trim();

View file

@ -2,7 +2,7 @@ import ko from 'ko';
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
import MessageStore from 'Stores/User/Message';
import { MessageUserStore } from 'Stores/User/Message';
import { decorateKoCommands } from 'Knoin/Knoin';
import { AbstractViewPopup } from 'Knoin/AbstractViews';
@ -47,7 +47,7 @@ class AdvancedSearchPopupView extends AbstractViewPopup {
searchCommand() {
const search = this.buildSearchString();
if (search) {
MessageStore.mainMessageListSearch(search);
MessageUserStore.mainMessageListSearch(search);
}
this.cancelCommand();

View file

@ -24,13 +24,13 @@ import { timestampToString } from 'Common/Momentor';
import { MessageFlagsCache, setFolderHash } from 'Common/Cache';
import { Settings, SettingsGet } from 'Common/Globals';
import AppStore from 'Stores/User/App';
import SettingsStore from 'Stores/User/Settings';
import { AppUserStore } from 'Stores/User/App';
import { SettingsUserStore } from 'Stores/User/Settings';
import { IdentityUserStore } from 'Stores/User/Identity';
import AccountStore from 'Stores/User/Account';
import FolderStore from 'Stores/User/Folder';
import PgpStore from 'Stores/User/Pgp';
import MessageStore from 'Stores/User/Message';
import { AccountUserStore } from 'Stores/User/Account';
import { FolderUserStore } from 'Stores/User/Folder';
import { PgpUserStore } from 'Stores/User/Pgp';
import { MessageUserStore } from 'Stores/User/Message';
import Remote from 'Remote/User/Fetch';
@ -126,13 +126,13 @@ class ComposePopupView extends AbstractViewPopup {
this.sLastFocusedField = 'to';
this.allowContacts = !!AppStore.contactsIsAllowed();
this.allowContacts = !!AppUserStore.contactsIsAllowed();
this.bSkipNextHide = false;
this.composeInEdit = AppStore.composeInEdit;
this.editorDefaultType = SettingsStore.editorDefaultType;
this.composeInEdit = AppUserStore.composeInEdit;
this.editorDefaultType = SettingsUserStore.editorDefaultType;
this.capaOpenPGP = PgpStore.capaOpenPGP;
this.capaOpenPGP = PgpUserStore.capaOpenPGP;
this.identities = IdentityUserStore;
@ -319,8 +319,8 @@ class ComposePopupView extends AbstractViewPopup {
setInterval(() => {
if (
this.modalVisibility() &&
!FolderStore.draftFolderNotEnabled() &&
SettingsStore.allowDraftAutosave() &&
!FolderUserStore.draftFolderNotEnabled() &&
SettingsUserStore.allowDraftAutosave() &&
!this.isEmptyForm(false) &&
!this.saving() &&
!this.sending() &&
@ -365,7 +365,7 @@ class ComposePopupView extends AbstractViewPopup {
}
sendCommand() {
let sSentFolder = FolderStore.sentFolder();
let sSentFolder = FolderUserStore.sentFolder();
this.attachmentsInProcessError(false);
this.attachmentsInErrorError(false);
@ -384,7 +384,7 @@ class ComposePopupView extends AbstractViewPopup {
}
if (!this.emptyToError() && !this.attachmentsInErrorError() && !this.attachmentsInProcessError()) {
if (SettingsStore.replySameFolder()) {
if (SettingsUserStore.replySameFolder()) {
if (
isArray(this.aDraftInfo) &&
3 === this.aDraftInfo.length &&
@ -430,7 +430,7 @@ class ComposePopupView extends AbstractViewPopup {
}
saveCommand() {
if (FolderStore.draftFolderNotEnabled()) {
if (FolderUserStore.draftFolderNotEnabled()) {
showScreenPopup(FolderSystemPopupView, [SetSystemFoldersNotification.Draft]);
} else {
this.savedError(false);
@ -438,11 +438,11 @@ class ComposePopupView extends AbstractViewPopup {
this.autosaveStart();
setFolderHash(FolderStore.draftFolder(), '');
setFolderHash(FolderUserStore.draftFolder(), '');
Remote.saveMessage(
this.saveMessageResponse.bind(this),
this.getMessageRequestParams(FolderStore.draftFolder())
this.getMessageRequestParams(FolderUserStore.draftFolder())
);
}
@ -470,8 +470,8 @@ class ComposePopupView extends AbstractViewPopup {
this.modalVisibility() &&
!this.saving() &&
!this.sending() &&
!FolderStore.draftFolderNotEnabled() &&
SettingsStore.allowDraftAutosave()
!FolderUserStore.draftFolderNotEnabled() &&
SettingsUserStore.allowDraftAutosave()
) {
this.saveCommand();
}
@ -491,8 +491,8 @@ class ComposePopupView extends AbstractViewPopup {
autosaveFunction() {
if (
this.modalVisibility() &&
!FolderStore.draftFolderNotEnabled() &&
SettingsStore.allowDraftAutosave() &&
!FolderUserStore.draftFolderNotEnabled() &&
SettingsUserStore.allowDraftAutosave() &&
!this.isEmptyForm(false) &&
!this.saving() &&
!this.sending() &&
@ -518,7 +518,7 @@ class ComposePopupView extends AbstractViewPopup {
}
openOpenPgpPopup() {
if (PgpStore.capaOpenPGP() && this.oEditor && !this.oEditor.isHtml()) {
if (PgpUserStore.capaOpenPGP() && this.oEditor && !this.oEditor.isHtml()) {
showScreenPopup(ComposeOpenPgpPopupView, [
result => this.editor(editor => editor.setPlain(result)),
this.oEditor.getData(false),
@ -531,10 +531,10 @@ class ComposePopupView extends AbstractViewPopup {
}
reloadDraftFolder() {
const draftFolder = FolderStore.draftFolder();
const draftFolder = FolderUserStore.draftFolder();
if (draftFolder && UNUSED_OPTION_VALUE !== draftFolder) {
setFolderHash(draftFolder, '');
if (FolderStore.currentFolderFullNameRaw() === draftFolder) {
if (FolderUserStore.currentFolderFullNameRaw() === draftFolder) {
rl.app.reloadMessageList(true);
} else {
rl.app.folderInformation(draftFolder);
@ -627,9 +627,9 @@ class ComposePopupView extends AbstractViewPopup {
result = true;
if (this.bFromDraft) {
const message = MessageStore.message();
const message = MessageUserStore.message();
if (message && this.draftFolder() === message.folder && this.draftUid() === message.uid) {
MessageStore.message(null);
MessageUserStore.message(null);
}
}
@ -656,7 +656,7 @@ class ComposePopupView extends AbstractViewPopup {
this.autosaveStop();
if (!this.bSkipNextHide) {
AppStore.composeInEdit(false);
AppUserStore.composeInEdit(false);
this.reset();
}
@ -738,7 +738,7 @@ class ComposePopupView extends AbstractViewPopup {
this.autosaveStart();
if (AppStore.composeInEdit()) {
if (AppUserStore.composeInEdit()) {
type = type || ComposeType.Empty;
if (ComposeType.Empty !== type) {
showScreenPopup(AskPopupView, [
@ -811,7 +811,7 @@ class ComposePopupView extends AbstractViewPopup {
* @param {string=} sCustomPlainText = null
*/
initOnShow(sType, oMessageOrArray, aToEmails, aCcEmails, aBccEmails, sCustomSubject, sCustomPlainText) {
AppStore.composeInEdit(true);
AppUserStore.composeInEdit(true);
let sFrom = '',
sTo = '',
@ -825,7 +825,7 @@ class ComposePopupView extends AbstractViewPopup {
message = null;
const excludeEmail = {},
mEmail = AccountStore.email(),
mEmail = AccountUserStore.email(),
lineComposeType = sType || ComposeType.Empty;
oMessageOrArray = oMessageOrArray || null;

View file

@ -5,7 +5,7 @@ import { pString, defaultOptionsAfterRender } from 'Common/Utils';
import { KeyState } from 'Common/Enums';
import { i18n } from 'Common/Translator';
import PgpStore from 'Stores/User/Pgp';
import { PgpUserStore } from 'Stores/User/Pgp';
import { EmailModel } from 'Model/Email';
@ -44,7 +44,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
encryptKeysView: () => this.encryptKeys.map(oKey => (oKey ? oKey.key : null)).filter(v => v),
privateKeysOptions: () => {
const opts = PgpStore.openpgpkeysPrivate().map(oKey => {
const opts = PgpUserStore.openpgpkeysPrivate().map(oKey => {
if (this.signKey() && this.signKey().key.id === oKey.id) {
return null;
}
@ -59,7 +59,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
},
publicKeysOptions: () => {
const opts = PgpStore.openpgpkeysPublic().map(oKey => {
const opts = PgpUserStore.openpgpkeysPublic().map(oKey => {
if (this.encryptKeysView().includes(oKey)) {
return null;
}
@ -176,19 +176,19 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
try {
if (aPublicKeys.length) {
if (privateKey) {
pgpPromise = PgpStore.openpgp.encrypt({
pgpPromise = PgpUserStore.openpgp.encrypt({
data: this.text(),
publicKeys: aPublicKeys,
privateKeys: [privateKey]
});
} else {
pgpPromise = PgpStore.openpgp.encrypt({
pgpPromise = PgpUserStore.openpgp.encrypt({
data: this.text(),
publicKeys: aPublicKeys
});
}
} else if (privateKey) {
pgpPromise = PgpStore.openpgp.sign({
pgpPromise = PgpUserStore.openpgp.sign({
data: this.text(),
privateKeys: [privateKey]
});
@ -342,7 +342,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
emailLine = identity.email();
rec.unshift(emailLine);
const keys = PgpStore.findAllPrivateKeysByEmailNotNative(emailLine);
const keys = PgpUserStore.findAllPrivateKeysByEmailNotNative(emailLine);
if (keys && keys[0]) {
this.signKey({
'users': keys[0].users || [emailLine],
@ -359,7 +359,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
if (rec.length) {
this.encryptKeys(
rec.map(recEmail => {
const keys = PgpStore.findAllPublicKeysByEmailNotNative(recEmail);
const keys = PgpUserStore.findAllPublicKeysByEmailNotNative(recEmail);
return keys
? keys.map(publicKey => ({
'empty': !publicKey,

View file

@ -16,8 +16,8 @@ import { Selector } from 'Common/Selector';
import { serverRequestRaw, serverRequest } from 'Common/Links';
import { i18n, getNotification } from 'Common/Translator';
import SettingsStore from 'Stores/User/Settings';
import ContactStore from 'Stores/User/Contact';
import { SettingsUserStore } from 'Stores/User/Settings';
import { ContactUserStore } from 'Stores/User/Contact';
import Remote from 'Remote/User/Fetch';
@ -39,8 +39,8 @@ class ContactsPopupView extends AbstractViewPopup {
this.bBackToCompose = false;
this.sLastComposeFocusedField = '';
this.allowContactsSync = ContactStore.allowContactsSync;
this.enableContactsSync = ContactStore.enableContactsSync;
this.allowContactsSync = ContactUserStore.allowSync;
this.enableContactsSync = ContactUserStore.enableSync;
this.addObservables({
search: '',
@ -66,14 +66,14 @@ class ContactsPopupView extends AbstractViewPopup {
watchHash: false
});
this.contacts = ContactStore.contacts;
this.contacts = ContactUserStore;
this.viewProperties = ko.observableArray();
this.useCheckboxesInList = SettingsStore.useCheckboxesInList;
this.useCheckboxesInList = SettingsUserStore.useCheckboxesInList;
this.selector = new Selector(
this.contacts,
ContactUserStore,
this.currentContact,
null,
'.e-contact-item .actionHandle',
@ -119,7 +119,7 @@ class ContactsPopupView extends AbstractViewPopup {
contactHasValidName: () => !!this.viewProperties.find(prop => propertyIsName(prop) && prop.isValid()),
contactsCheckedOrSelected: () => {
const checked = this.contacts.filter(item => item.checked && item.checked()),
const checked = ContactUserStore.filter(item => item.checked && item.checked()),
selected = this.currentContact();
return selected
@ -347,9 +347,9 @@ class ContactsPopupView extends AbstractViewPopup {
if (j) {
j.on('onStart', () => {
this.contacts.importing(true);
ContactUserStore.importing(true);
}).on('onComplete', (id, result, data) => {
this.contacts.importing(false);
ContactUserStore.importing(false);
this.reloadContactList();
if (!id || !result || !data || !data.Result) {
alert(i18n('CONTACTS/ERROR_IMPORT_FILE'));
@ -360,11 +360,10 @@ class ContactsPopupView extends AbstractViewPopup {
}
removeCheckedOrSelectedContactsFromList() {
const koContacts = this.contacts,
contacts = this.contactsCheckedOrSelected();
const contacts = this.contactsCheckedOrSelected();
let currentContact = this.currentContact(),
count = this.contacts.length;
count = ContactUserStore.length;
if (contacts.length) {
contacts.forEach(contact => {
@ -383,7 +382,7 @@ class ContactsPopupView extends AbstractViewPopup {
setTimeout(() => {
contacts.forEach(contact => {
koContacts.remove(contact);
ContactUserStore.remove(contact);
delegateRunOnDestroy(contact);
});
}, 500);
@ -459,7 +458,7 @@ class ContactsPopupView extends AbstractViewPopup {
offset = 0;
}
this.contacts.loading(true);
ContactUserStore.loading(true);
Remote.contacts(
(result, data) => {
let count = 0,
@ -479,10 +478,10 @@ class ContactsPopupView extends AbstractViewPopup {
this.contactsCount(count);
delegateRunOnDestroy(this.contacts());
this.contacts(list);
delegateRunOnDestroy(ContactUserStore());
ContactUserStore(list);
this.contacts.loading(false);
ContactUserStore.loading(false);
this.viewClearSearch(!!this.search());
},
offset,
@ -533,8 +532,8 @@ class ContactsPopupView extends AbstractViewPopup {
this.search('');
this.contactsCount(0);
delegateRunOnDestroy(this.contacts());
this.contacts([]);
delegateRunOnDestroy(ContactUserStore());
ContactUserStore([]);
this.sLastComposeFocusedField = '';

View file

@ -5,7 +5,7 @@ import { FilterConditionField, FilterConditionType } from 'Model/FilterCondition
import { defaultOptionsAfterRender } from 'Common/Utils';
import { i18n, initOnStartOrLangChange } from 'Common/Translator';
import FolderStore from 'Stores/User/Folder';
import { FolderUserStore } from 'Stores/User/Folder';
import { SieveUserStore } from 'Stores/User/Sieve';
import { decorateKoCommands } from 'Knoin/Knoin';
@ -25,7 +25,7 @@ class FilterPopupView extends AbstractViewPopup {
this.fTrueCallback = null;
this.defaultOptionsAfterRender = defaultOptionsAfterRender;
this.folderSelectList = FolderStore.folderMenuForFilters;
this.folderSelectList = FolderUserStore.folderMenuForFilters;
this.selectedFolderValue.subscribe(() => this.filter() && this.filter().actionValueError(false));

View file

@ -2,7 +2,7 @@ import { StorageResultType, Notification } from 'Common/Enums';
import { i18n, getNotification } from 'Common/Translator';
import { setFolderHash } from 'Common/Cache';
import MessageStore from 'Stores/User/Message';
import { MessageUserStore } from 'Stores/User/Message';
import Remote from 'Remote/User/Fetch';
@ -44,8 +44,8 @@ class FolderClearPopupView extends AbstractViewPopup {
clearCommand() {
const folderToClear = this.selectedFolder();
if (folderToClear) {
MessageStore.message(null);
MessageStore.messageList([]);
MessageUserStore.message(null);
MessageUserStore.messageList([]);
this.clearingProcess(true);

View file

@ -5,7 +5,7 @@ import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { defaultOptionsAfterRender } from 'Common/Utils';
import { folderListOptionsBuilder } from 'Common/UtilsUser';
import FolderStore from 'Stores/User/Folder';
import { FolderUserStore } from 'Stores/User/Folder';
import Remote from 'Remote/User/Fetch';
@ -25,17 +25,15 @@ class FolderCreatePopupView extends AbstractViewPopup {
this.parentFolderSelectList = ko.computed(() => {
const top = [],
list = FolderStore.folderList(),
fRenameCallback = (oItem) =>
list = FolderUserStore.folderList(),
fDisableCallback = FolderUserStore.namespace
? item => FolderUserStore.namespace !== item.fullNameRaw.substr(0, FolderUserStore.namespace.length)
: null,
fRenameCallback = oItem =>
oItem ? (oItem.isSystemFolder() ? oItem.name() + ' ' + oItem.manageFolderSystemName() : oItem.name()) : '';
top.push(['', '']);
let fDisableCallback = null;
if (FolderStore.namespace) {
fDisableCallback = (item) => FolderStore.namespace !== item.fullNameRaw.substr(0, FolderStore.namespace.length);
}
return folderListOptionsBuilder([], list, [], top, null, fDisableCallback, null, fRenameCallback);
});
@ -48,8 +46,8 @@ class FolderCreatePopupView extends AbstractViewPopup {
createFolderCommand() {
let parentFolderName = this.selectedParentValue();
if (!parentFolderName && 1 < FolderStore.namespace.length) {
parentFolderName = FolderStore.namespace.substr(0, FolderStore.namespace.length - 1);
if (!parentFolderName && 1 < FolderUserStore.namespace.length) {
parentFolderName = FolderUserStore.namespace.substr(0, FolderUserStore.namespace.length - 1);
}
rl.app.foldersPromisesActionHelper(

View file

@ -7,7 +7,7 @@ import { defaultOptionsAfterRender } from 'Common/Utils';
import { folderListOptionsBuilder } from 'Common/UtilsUser';
import { initOnStartOrLangChange, i18n } from 'Common/Translator';
import FolderStore from 'Stores/User/Folder';
import { FolderUserStore } from 'Stores/User/Folder';
import Remote from 'Remote/User/Fetch';
@ -30,8 +30,8 @@ class FolderSystemPopupView extends AbstractViewPopup {
this.folderSelectList = ko.computed(() =>
folderListOptionsBuilder(
[],
FolderStore.folderList(),
FolderStore.folderListSystemNames(),
FolderUserStore.folderList(),
FolderUserStore.folderListSystemNames(),
[
['', this.sChooseOnText],
[UNUSED_OPTION_VALUE, this.sUnuseText]
@ -45,28 +45,28 @@ class FolderSystemPopupView extends AbstractViewPopup {
)
);
this.sentFolder = FolderStore.sentFolder;
this.draftFolder = FolderStore.draftFolder;
this.spamFolder = FolderStore.spamFolder;
this.trashFolder = FolderStore.trashFolder;
this.archiveFolder = FolderStore.archiveFolder;
this.sentFolder = FolderUserStore.sentFolder;
this.draftFolder = FolderUserStore.draftFolder;
this.spamFolder = FolderUserStore.spamFolder;
this.trashFolder = FolderUserStore.trashFolder;
this.archiveFolder = FolderUserStore.archiveFolder;
const settingsSet = Settings.set,
fSetSystemFolders = () => {
settingsSet('SentFolder', FolderStore.sentFolder());
settingsSet('DraftFolder', FolderStore.draftFolder());
settingsSet('SpamFolder', FolderStore.spamFolder());
settingsSet('TrashFolder', FolderStore.trashFolder());
settingsSet('ArchiveFolder', FolderStore.archiveFolder());
settingsSet('SentFolder', FolderUserStore.sentFolder());
settingsSet('DraftFolder', FolderUserStore.draftFolder());
settingsSet('SpamFolder', FolderUserStore.spamFolder());
settingsSet('TrashFolder', FolderUserStore.trashFolder());
settingsSet('ArchiveFolder', FolderUserStore.archiveFolder());
},
fSaveSystemFolders = (()=>{
fSetSystemFolders();
Remote.saveSystemFolders(()=>{}, {
SentFolder: FolderStore.sentFolder(),
DraftFolder: FolderStore.draftFolder(),
SpamFolder: FolderStore.spamFolder(),
TrashFolder: FolderStore.trashFolder(),
ArchiveFolder: FolderStore.archiveFolder(),
SentFolder: FolderUserStore.sentFolder(),
DraftFolder: FolderUserStore.draftFolder(),
SpamFolder: FolderUserStore.spamFolder(),
TrashFolder: FolderUserStore.trashFolder(),
ArchiveFolder: FolderUserStore.archiveFolder(),
NullFolder: 'NullFolder'
});
}).debounce(1000),
@ -75,7 +75,7 @@ class FolderSystemPopupView extends AbstractViewPopup {
fSaveSystemFolders();
};
ko.addSubscribablesTo(FolderStore, {
ko.addSubscribablesTo(FolderUserStore, {
sentFolder: fCallback,
draftFolder: fCallback,
spamFolder: fCallback,

View file

@ -1,6 +1,6 @@
import { pInt } from 'Common/Utils';
import PgpStore from 'Stores/User/Pgp';
import { PgpUserStore } from 'Stores/User/Pgp';
import { decorateKoCommands } from 'Knoin/Knoin';
import { AbstractViewPopup } from 'Knoin/AbstractViews';
@ -31,7 +31,7 @@ class NewOpenPgpKeyPopupView extends AbstractViewPopup {
generateOpenPgpKeyCommand() {
const userId = {},
openpgpKeyring = PgpStore.openpgpKeyring;
openpgpKeyring = PgpUserStore.openpgpKeyring;
this.emailError(!this.email().trim());
if (!openpgpKeyring || this.emailError()) {
@ -48,7 +48,7 @@ class NewOpenPgpKeyPopupView extends AbstractViewPopup {
setTimeout(() => {
try {
PgpStore.openpgp
PgpUserStore.openpgp
.generateKey({
userIds: [userId],
numBits: pInt(this.keyBitLength()),

View file

@ -1,6 +1,6 @@
import AppStore from 'Stores/User/App';
import AccountStore from 'Stores/User/Account';
import MessageStore from 'Stores/User/Message';
import { AppUserStore } from 'Stores/User/App';
import { AccountUserStore } from 'Stores/User/Account';
import { MessageUserStore } from 'Stores/User/Message';
import { Capa, KeyState } from 'Common/Enums';
import { settings } from 'Common/Links';
@ -23,24 +23,25 @@ export class AbstractSystemDropDownUserView extends AbstractViewRight {
this.allowSettings = Settings.capa(Capa.Settings);
this.allowHelp = Settings.capa(Capa.Help);
this.currentAudio = AppStore.currentAudio;
this.currentAudio = AppUserStore.currentAudio;
this.accountEmail = AccountStore.email;
this.accountEmail = AccountUserStore.email;
this.accounts = AccountStore.accounts;
this.accountsUnreadCount = AccountStore.accountsUnreadCount;
this.accounts = AccountUserStore.accounts;
this.accountsLoading = AccountUserStore.loading;
this.accountsUnreadCount = AccountUserStore.accountsUnreadCount;
this.addObservables({
accountMenuDropdownTrigger: false,
capaAdditionalAccounts: Settings.capa(Capa.AdditionalAccounts)
});
this.allowContacts = !!AppStore.contactsIsAllowed();
this.allowContacts = !!AppUserStore.contactsIsAllowed();
this.addAccountClick = this.addAccountClick.bind(this);
addEventListener('audio.stop', () => AppStore.currentAudio(''));
addEventListener('audio.start', e => AppStore.currentAudio(e.detail));
addEventListener('audio.stop', () => AppUserStore.currentAudio(''));
addEventListener('audio.start', e => AppUserStore.currentAudio(e.detail));
}
stopPlay() {
@ -49,15 +50,15 @@ export class AbstractSystemDropDownUserView extends AbstractViewRight {
accountClick(account, event) {
if (account && 0 === event.button) {
AccountStore.accounts.loading(true);
setTimeout(() => AccountStore.accounts.loading(false), 1000);
AccountUserStore.loading(true);
setTimeout(() => AccountUserStore.loading(false), 1000);
}
return true;
}
emailTitle() {
return AccountStore.email();
return AccountUserStore.email();
}
settingsClick() {
@ -107,7 +108,7 @@ export class AbstractSystemDropDownUserView extends AbstractViewRight {
onBuild() {
shortcuts.add('m,contextmenu', '', [KeyState.MessageList, KeyState.MessageView, KeyState.Settings], () => {
if (this.viewModelVisible) {
MessageStore.messageFullScreenMode(false);
MessageUserStore.messageFullScreenMode(false);
this.accountMenuDropdownTrigger(true);
return false;
}

View file

@ -9,7 +9,7 @@ import { ClientSideKeyName } from 'Common/EnumsUser';
import { getNotification, getNotificationFromResponse, reload as translatorReload, convertLangName } from 'Common/Translator';
import AppStore from 'Stores/User/App';
import { AppUserStore } from 'Stores/User/App';
import { LanguageStore } from 'Stores/Language';
import * as Local from 'Storage/Client';
@ -233,8 +233,8 @@ class LoginUserView extends AbstractViewCenter {
break;
}
this.email(AppStore.devEmail);
this.password(AppStore.devPassword);
this.email(AppUserStore.devEmail);
this.password(AppUserStore.devPassword);
setTimeout(() => {
LanguageStore.language.subscribe((value) => {

View file

@ -6,10 +6,10 @@ import { leftPanelDisabled, moveAction, Settings } from 'Common/Globals';
import { mailBox, settings } from 'Common/Links';
import { setFolderHash } from 'Common/Cache';
import AppStore from 'Stores/User/App';
import SettingsStore from 'Stores/User/Settings';
import FolderStore from 'Stores/User/Folder';
import MessageStore from 'Stores/User/Message';
import { AppUserStore } from 'Stores/User/App';
import { SettingsUserStore } from 'Stores/User/Settings';
import { FolderUserStore } from 'Stores/User/Folder';
import { MessageUserStore } from 'Stores/User/Message';
import { ThemeStore } from 'Stores/Theme';
import { showScreenPopup } from 'Knoin/Knoin';
@ -25,29 +25,29 @@ export class FolderListMailBoxUserView extends AbstractViewLeft {
this.oContentScrollable = null;
this.composeInEdit = AppStore.composeInEdit;
this.composeInEdit = AppUserStore.composeInEdit;
this.messageList = MessageStore.messageList;
this.folderList = FolderStore.folderList;
this.folderListSystem = FolderStore.folderListSystem;
this.foldersChanging = FolderStore.foldersChanging;
this.messageList = MessageUserStore.messageList;
this.folderList = FolderUserStore.folderList;
this.folderListSystem = FolderUserStore.folderListSystem;
this.foldersChanging = FolderUserStore.foldersChanging;
this.moveAction = moveAction;
this.foldersListWithSingleInboxRootFolder = FolderStore.foldersListWithSingleInboxRootFolder;
this.foldersListWithSingleInboxRootFolder = FolderUserStore.foldersListWithSingleInboxRootFolder;
this.leftPanelDisabled = leftPanelDisabled;
this.allowComposer = Settings.capa(Capa.Composer);
this.allowContacts = !!AppStore.contactsIsAllowed();
this.allowContacts = !!AppUserStore.contactsIsAllowed();
this.folderListFocused = ko.computed(() => Focused.FolderList === AppStore.focusedState());
this.folderListFocused = ko.computed(() => Focused.FolderList === AppUserStore.focusedState());
this.isInboxStarred = ko.computed(
() =>
FolderStore.currentFolder() &&
FolderStore.currentFolder().isInbox() &&
MessageStore.messageListSearch().trim().includes('is:flagged')
FolderUserStore.currentFolder() &&
FolderUserStore.currentFolder().isInbox() &&
MessageUserStore.messageListSearch().trim().includes('is:flagged')
);
}
@ -69,17 +69,17 @@ export class FolderListMailBoxUserView extends AbstractViewLeft {
if (isMove) {
moveAction(false);
rl.app.moveMessagesToFolder(
FolderStore.currentFolderFullNameRaw(),
MessageStore.messageListCheckedOrSelectedUidsWithSubMails(),
FolderUserStore.currentFolderFullNameRaw(),
MessageUserStore.messageListCheckedOrSelectedUidsWithSubMails(),
folder.fullNameRaw,
event.ctrlKey
);
} else {
if (!SettingsStore.usePreviewPane()) {
MessageStore.message(null);
if (!SettingsUserStore.usePreviewPane()) {
MessageUserStore.message(null);
}
if (folder.fullNameRaw === FolderStore.currentFolderFullNameRaw()) {
if (folder.fullNameRaw === FolderUserStore.currentFolderFullNameRaw()) {
setFolderHash(folder.fullNameRaw, '');
}
@ -89,7 +89,7 @@ export class FolderListMailBoxUserView extends AbstractViewLeft {
);
}
AppStore.focusedState(Focused.MessageList);
AppUserStore.focusedState(Focused.MessageList);
}
};
@ -144,7 +144,7 @@ export class FolderListMailBoxUserView extends AbstractViewLeft {
shortcuts.add('enter,open', '', KeyState.FolderList, () => {
const item = qs('.b-folders .e-item .e-link:not(.hidden).focused');
if (item) {
AppStore.focusedState(Focused.MessageList);
AppUserStore.focusedState(Focused.MessageList);
item.click();
}
@ -165,12 +165,12 @@ export class FolderListMailBoxUserView extends AbstractViewLeft {
// shortcuts.add('tab', 'shift', KeyState.FolderList, () => {
shortcuts.add('escape,tab,arrowright', '', KeyState.FolderList, () => {
AppStore.focusedState(Focused.MessageList);
AppUserStore.focusedState(Focused.MessageList);
moveAction(false);
return false;
});
AppStore.focusedState.subscribe(value => {
AppUserStore.focusedState.subscribe(value => {
let el = qs('.b-folders .e-item .e-link.focused');
el && qs('.b-folders .e-item .e-link.focused').classList.remove('focused');
if (Focused.FolderList === value) {

View file

@ -32,11 +32,11 @@ import {
addRequestedMessage
} from 'Common/Cache';
import AppStore from 'Stores/User/App';
import QuotaStore from 'Stores/User/Quota';
import SettingsStore from 'Stores/User/Settings';
import FolderStore from 'Stores/User/Folder';
import MessageStore from 'Stores/User/Message';
import { AppUserStore } from 'Stores/User/App';
import { QuotaUserStore } from 'Stores/User/Quota';
import { SettingsUserStore } from 'Stores/User/Settings';
import { FolderUserStore } from 'Stores/User/Folder';
import { MessageUserStore } from 'Stores/User/Message';
import { ThemeStore } from 'Stores/Theme';
import Remote from 'Remote/User/Fetch';
@ -48,7 +48,7 @@ import { FolderClearPopupView } from 'View/Popup/FolderClear';
import { AdvancedSearchPopupView } from 'View/Popup/AdvancedSearch';
const
canBeMovedHelper = () => MessageStore.hasCheckedOrSelected();
canBeMovedHelper = () => MessageUserStore.hasCheckedOrSelected();
export class MessageListMailBoxUserView extends AbstractViewRight {
constructor() {
@ -71,39 +71,40 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
this.popupVisibility = popupVisibility;
this.message = MessageStore.message;
this.messageList = MessageStore.messageList;
this.messageListDisableAutoSelect = MessageStore.messageListDisableAutoSelect;
this.message = MessageUserStore.message;
this.messageList = MessageUserStore.messageList;
this.messageListDisableAutoSelect = MessageUserStore.messageListDisableAutoSelect;
this.folderList = FolderStore.folderList;
this.folderList = FolderUserStore.folderList;
this.composeInEdit = AppStore.composeInEdit;
this.composeInEdit = AppUserStore.composeInEdit;
this.leftPanelDisabled = leftPanelDisabled;
this.selectorMessageSelected = MessageStore.selectorMessageSelected;
this.selectorMessageFocused = MessageStore.selectorMessageFocused;
this.isMessageSelected = MessageStore.isMessageSelected;
this.messageListSearch = MessageStore.messageListSearch;
this.messageListThreadUid = MessageStore.messageListThreadUid;
this.messageListError = MessageStore.messageListError;
this.folderMenuForMove = FolderStore.folderMenuForMove;
this.selectorMessageSelected = MessageUserStore.selectorMessageSelected;
this.selectorMessageFocused = MessageUserStore.selectorMessageFocused;
this.isMessageSelected = MessageUserStore.isMessageSelected;
this.messageListSearch = MessageUserStore.messageListSearch;
this.messageListThreadUid = MessageUserStore.messageListThreadUid;
this.messageListError = MessageUserStore.messageListError;
this.folderMenuForMove = FolderUserStore.folderMenuForMove;
this.useCheckboxesInList = SettingsStore.useCheckboxesInList;
this.useCheckboxesInList = SettingsUserStore.useCheckboxesInList;
this.mainMessageListSearch = MessageStore.mainMessageListSearch;
this.messageListEndFolder = MessageStore.messageListEndFolder;
this.messageListEndThreadUid = MessageStore.messageListEndThreadUid;
this.mainMessageListSearch = MessageUserStore.mainMessageListSearch;
this.messageListEndFolder = MessageUserStore.messageListEndFolder;
this.messageListEndThreadUid = MessageUserStore.messageListEndThreadUid;
this.messageListCheckedOrSelected = MessageStore.messageListCheckedOrSelected;
this.messageListCheckedOrSelectedUidsWithSubMails = MessageStore.messageListCheckedOrSelectedUidsWithSubMails;
this.messageListCompleteLoadingThrottle = MessageStore.messageListCompleteLoadingThrottle;
this.messageListCompleteLoadingThrottleForAnimation = MessageStore.messageListCompleteLoadingThrottleForAnimation;
this.messageListCheckedOrSelected = MessageUserStore.messageListCheckedOrSelected;
this.messageListCheckedOrSelectedUidsWithSubMails = MessageUserStore.messageListCheckedOrSelectedUidsWithSubMails;
this.messageListCompleteLoadingThrottle = MessageUserStore.messageListCompleteLoadingThrottle;
this.messageListCompleteLoadingThrottleForAnimation =
MessageUserStore.messageListCompleteLoadingThrottleForAnimation;
initOnStartOrLangChange(() => this.emptySubjectValue = i18n('MESSAGE_LIST/EMPTY_SUBJECT_TEXT'));
this.userQuota = QuotaStore.quota;
this.userUsageSize = QuotaStore.usage;
this.userUsageProc = QuotaStore.percentage;
this.userQuota = QuotaUserStore.quota;
this.userUsageSize = QuotaUserStore.usage;
this.userUsageProc = QuotaUserStore.percentage;
this.addObservables({
moveDropdownTrigger: false,
@ -123,17 +124,18 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
this.addComputables({
messageListSearchDesc: () => {
const value = MessageStore.messageListEndSearch();
const value = MessageUserStore.messageListEndSearch();
return value ? i18n('MESSAGE_LIST/SEARCH_RESULT_FOR', { 'SEARCH': value }) : ''
},
messageListPaginator: computedPaginatorHelper(MessageStore.messageListPage, MessageStore.messageListPageCount),
messageListPaginator: computedPaginatorHelper(MessageUserStore.messageListPage,
MessageUserStore.messageListPageCount),
checkAll: {
read: () => 0 < MessageStore.messageListChecked().length,
read: () => 0 < MessageUserStore.messageListChecked().length,
write: (value) => {
value = !!value;
MessageStore.messageList.forEach(message => message.checked(value));
MessageUserStore.messageList.forEach(message => message.checked(value));
}
},
@ -143,25 +145,25 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
},
isIncompleteChecked: () => {
const c = MessageStore.messageListChecked().length;
return c && MessageStore.messageList.length > c;
const c = MessageUserStore.messageListChecked().length;
return c && MessageUserStore.messageList.length > c;
},
hasMessages: () => 0 < this.messageList.length,
isSpamFolder: () => FolderStore.spamFolder() === this.messageListEndFolder() && FolderStore.spamFolder(),
isSpamFolder: () => (FolderUserStore.spamFolder() || 0) === this.messageListEndFolder(),
isSpamDisabled: () => UNUSED_OPTION_VALUE === FolderStore.spamFolder(),
isSpamDisabled: () => UNUSED_OPTION_VALUE === FolderUserStore.spamFolder(),
isTrashFolder: () => FolderStore.trashFolder() === this.messageListEndFolder() && FolderStore.trashFolder(),
isTrashFolder: () => (FolderUserStore.trashFolder() || 0) === this.messageListEndFolder(),
isDraftFolder: () => FolderStore.draftFolder() === this.messageListEndFolder() && FolderStore.draftFolder(),
isDraftFolder: () => (FolderUserStore.draftFolder() || 0) === this.messageListEndFolder(),
isSentFolder: () => FolderStore.sentFolder() === this.messageListEndFolder() && FolderStore.sentFolder(),
isSentFolder: () => (FolderUserStore.sentFolder() || 0) === this.messageListEndFolder(),
isArchiveFolder: () => FolderStore.archiveFolder() === this.messageListEndFolder() && FolderStore.archiveFolder(),
isArchiveFolder: () => (FolderUserStore.archiveFolder() || 0) === this.messageListEndFolder(),
isArchiveDisabled: () => UNUSED_OPTION_VALUE === FolderStore.archiveFolder(),
isArchiveDisabled: () => UNUSED_OPTION_VALUE === FolderUserStore.archiveFolder(),
isArchiveVisible: () => !this.isArchiveFolder() && !this.isArchiveDisabled() && !this.isDraftFolder(),
@ -171,16 +173,16 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
isUnSpamVisible: () =>
this.isSpamFolder() && !this.isSpamDisabled() && !this.isDraftFolder() && !this.isSentFolder(),
mobileCheckedStateShow: () => ThemeStore.isMobile() ? 0 < MessageStore.messageListChecked().length : true,
mobileCheckedStateShow: () => ThemeStore.isMobile() ? 0 < MessageUserStore.messageListChecked().length : true,
mobileCheckedStateHide: () => ThemeStore.isMobile() ? !MessageStore.messageListChecked().length : true,
mobileCheckedStateHide: () => ThemeStore.isMobile() ? !MessageUserStore.messageListChecked().length : true,
messageListFocused: () => Focused.MessageList === AppStore.focusedState()
messageListFocused: () => Focused.MessageList === AppUserStore.focusedState()
});
// this.messageListChecked = MessageStore.messageListChecked;
// this.messageListChecked = MessageUserStore.messageListChecked;
this.hasCheckedOrSelectedLines = MessageStore.hasCheckedOrSelected,
this.hasCheckedOrSelectedLines = MessageUserStore.hasCheckedOrSelected,
this.quotaTooltip = this.quotaTooltip.bind(this);
@ -194,7 +196,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
'.messageListItem.focused'
);
this.selector.on('onItemSelect', message => MessageStore.selectMessage(message));
this.selector.on('onItemSelect', message => MessageUserStore.selectMessage(message));
this.selector.on('onItemGetUid', message => (message ? message.generateUid() : ''));
@ -228,11 +230,11 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
rl.route.setHash(mailBox(sFolder, 1));
}
MessageStore.selectMessageByFolderAndUid(sFolder, sUid);
MessageUserStore.selectMessageByFolderAndUid(sFolder, sUid);
}
});
MessageStore.messageListEndHash.subscribe((() =>
MessageUserStore.messageListEndHash.subscribe((() =>
this.selector.scrollToFocused()
).throttle(50));
@ -252,12 +254,12 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
clearCommand() {
if (Settings.capa(Capa.DangerousActions)) {
showScreenPopup(FolderClearPopupView, [FolderStore.currentFolder()]);
showScreenPopup(FolderClearPopupView, [FolderUserStore.currentFolder()]);
}
}
reloadCommand() {
if (!MessageStore.messageListCompleteLoadingThrottleForAnimation() && this.allowReload) {
if (!MessageUserStore.messageListCompleteLoadingThrottleForAnimation() && this.allowReload) {
rl.app.reloadMessageList(false, true);
}
}
@ -265,7 +267,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
multyForwardCommand() {
showMessageComposer([
ComposeType.ForwardAsAttachment,
MessageStore.messageListCheckedOrSelected()
MessageUserStore.messageListCheckedOrSelected()
]);
}
@ -273,8 +275,8 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
if (Settings.capa(Capa.DangerousActions)) {
rl.app.deleteMessagesFromFolder(
FolderType.Trash,
FolderStore.currentFolderFullNameRaw(),
MessageStore.messageListCheckedOrSelectedUidsWithSubMails(),
FolderUserStore.currentFolderFullNameRaw(),
MessageUserStore.messageListCheckedOrSelectedUidsWithSubMails(),
false
);
}
@ -283,8 +285,8 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
deleteCommand() {
rl.app.deleteMessagesFromFolder(
FolderType.Trash,
FolderStore.currentFolderFullNameRaw(),
MessageStore.messageListCheckedOrSelectedUidsWithSubMails(),
FolderUserStore.currentFolderFullNameRaw(),
MessageUserStore.messageListCheckedOrSelectedUidsWithSubMails(),
true
);
}
@ -292,8 +294,8 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
archiveCommand() {
rl.app.deleteMessagesFromFolder(
FolderType.Archive,
FolderStore.currentFolderFullNameRaw(),
MessageStore.messageListCheckedOrSelectedUidsWithSubMails(),
FolderUserStore.currentFolderFullNameRaw(),
MessageUserStore.messageListCheckedOrSelectedUidsWithSubMails(),
true
);
}
@ -301,8 +303,8 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
spamCommand() {
rl.app.deleteMessagesFromFolder(
FolderType.Spam,
FolderStore.currentFolderFullNameRaw(),
MessageStore.messageListCheckedOrSelectedUidsWithSubMails(),
FolderUserStore.currentFolderFullNameRaw(),
MessageUserStore.messageListCheckedOrSelectedUidsWithSubMails(),
true
);
}
@ -310,8 +312,8 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
notSpamCommand() {
rl.app.deleteMessagesFromFolder(
FolderType.NotSpam,
FolderStore.currentFolderFullNameRaw(),
MessageStore.messageListCheckedOrSelectedUidsWithSubMails(),
FolderUserStore.currentFolderFullNameRaw(),
MessageUserStore.messageListCheckedOrSelectedUidsWithSubMails(),
true
);
}
@ -326,7 +328,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
}
let b = moveAction();
AppStore.focusedState(b ? Focused.MessageList : Focused.FolderList);
AppUserStore.focusedState(b ? Focused.MessageList : Focused.FolderList);
moveAction(!b);
}
}
@ -350,7 +352,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
}
goToUpUpOrDownDown(up) {
if (MessageStore.messageListChecked().length) {
if (MessageUserStore.messageListChecked().length) {
return false;
}
@ -379,7 +381,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
return false;
});
if (!SettingsStore.usePreviewPane() && !this.message()) {
if (!SettingsUserStore.usePreviewPane() && !this.message()) {
this.selector.iFocusedNextHelper = up ? -1 : 1;
} else {
this.selector.iSelectNextHelper = up ? -1 : 1;
@ -397,7 +399,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
useAutoSelect() {
return !this.messageListDisableAutoSelect()
&& !/is:unseen/.test(this.mainMessageListSearch())
&& SettingsStore.usePreviewPane();
&& SettingsUserStore.usePreviewPane();
}
searchEnterAction() {
@ -413,9 +415,9 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
cancelThreadUid() {
rl.route.setHash(
mailBox(
FolderStore.currentFolderFullNameHash(),
MessageStore.messageListPageBeforeThread(),
MessageStore.messageListSearch()
FolderUserStore.currentFolderFullNameHash(),
MessageUserStore.messageListPageBeforeThread(),
MessageUserStore.messageListSearch()
)
);
}
@ -426,10 +428,10 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
* @returns {boolean}
*/
moveSelectedMessagesToFolder(sToFolderFullNameRaw, bCopy) {
if (MessageStore.hasCheckedOrSelected()) {
if (MessageUserStore.hasCheckedOrSelected()) {
rl.app.moveMessagesToFolder(
FolderStore.currentFolderFullNameRaw(),
MessageStore.messageListCheckedOrSelectedUidsWithSubMails(),
FolderUserStore.currentFolderFullNameRaw(),
MessageUserStore.messageListCheckedOrSelectedUidsWithSubMails(),
sToFolderFullNameRaw,
bCopy
);
@ -441,11 +443,11 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
getDragData(event) {
const item = ko.dataFor(doc.elementFromPoint(event.clientX, event.clientY));
item && item.checked && item.checked(true);
const uids = MessageStore.messageListCheckedOrSelectedUidsWithSubMails();
const uids = MessageUserStore.messageListCheckedOrSelectedUidsWithSubMails();
item && !uids.includes(item.uid) && uids.push(item.uid);
return uids.length ? {
copy: event.ctrlKey,
folder: FolderStore.currentFolderFullNameRaw(),
folder: FolderUserStore.currentFolderFullNameRaw(),
uids: uids
} : null;
}
@ -477,7 +479,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
case MessageSetAction.SetSeen:
folder = getFolderFromCacheList(sFolderFullNameRaw);
if (folder) {
MessageStore.messageList.forEach(message => {
MessageUserStore.messageList.forEach(message => {
if (message.isUnseen()) {
++cnt;
}
@ -503,7 +505,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
case MessageSetAction.UnsetSeen:
folder = getFolderFromCacheList(sFolderFullNameRaw);
if (folder) {
MessageStore.messageList.forEach(message => {
MessageUserStore.messageList.forEach(message => {
if (!message.isUnseen()) {
++cnt;
}
@ -536,15 +538,15 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
listSetSeen() {
this.setAction(
FolderStore.currentFolderFullNameRaw(),
FolderUserStore.currentFolderFullNameRaw(),
MessageSetAction.SetSeen,
MessageStore.messageListCheckedOrSelected()
MessageUserStore.messageListCheckedOrSelected()
);
}
listSetAllSeen() {
this.setActionForAll(
FolderStore.currentFolderFullNameRaw(),
FolderUserStore.currentFolderFullNameRaw(),
MessageSetAction.SetSeen,
this.messageListEndThreadUid()
);
@ -552,25 +554,25 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
listUnsetSeen() {
this.setAction(
FolderStore.currentFolderFullNameRaw(),
FolderUserStore.currentFolderFullNameRaw(),
MessageSetAction.UnsetSeen,
MessageStore.messageListCheckedOrSelected()
MessageUserStore.messageListCheckedOrSelected()
);
}
listSetFlags() {
this.setAction(
FolderStore.currentFolderFullNameRaw(),
FolderUserStore.currentFolderFullNameRaw(),
MessageSetAction.SetFlag,
MessageStore.messageListCheckedOrSelected()
MessageUserStore.messageListCheckedOrSelected()
);
}
listUnsetFlags() {
this.setAction(
FolderStore.currentFolderFullNameRaw(),
FolderUserStore.currentFolderFullNameRaw(),
MessageSetAction.UnsetFlag,
MessageStore.messageListCheckedOrSelected()
MessageUserStore.messageListCheckedOrSelected()
);
}
@ -637,20 +639,20 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
gotoPage(page) {
page && rl.route.setHash(
mailBox(
FolderStore.currentFolderFullNameHash(),
FolderUserStore.currentFolderFullNameHash(),
page.value,
MessageStore.messageListSearch(),
MessageStore.messageListThreadUid()
MessageUserStore.messageListSearch(),
MessageUserStore.messageListThreadUid()
)
);
}
gotoThread(message) {
if (message && 0 < message.threadsLen()) {
MessageStore.messageListPageBeforeThread(MessageStore.messageListPage());
MessageUserStore.messageListPageBeforeThread(MessageUserStore.messageListPage());
rl.route.setHash(
mailBox(FolderStore.currentFolderFullNameHash(), 1, MessageStore.messageListSearch(), message.uid)
mailBox(FolderUserStore.currentFolderFullNameHash(), 1, MessageUserStore.messageListSearch(), message.uid)
);
}
}
@ -673,8 +675,8 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
dom.addEventListener('click', event => {
ThemeStore.isMobile() && leftPanelDisabled(true);
if (eqs(event, '.messageList .b-message-list-wrapper') && Focused.MessageView === AppStore.focusedState()) {
AppStore.focusedState(Focused.MessageList);
if (eqs(event, '.messageList .b-message-list-wrapper') && Focused.MessageView === AppUserStore.focusedState()) {
AppUserStore.focusedState(Focused.MessageList);
}
let el = eqs(event, '.e-paginator .e-page');
@ -721,12 +723,12 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
// delete
shortcuts.add('delete', 'shift', KeyState.MessageList, () => {
MessageStore.messageListCheckedOrSelected().length && this.deleteWithoutMoveCommand();
MessageUserStore.messageListCheckedOrSelected().length && this.deleteWithoutMoveCommand();
return false;
});
// shortcuts.add('3', 'shift', KeyState.MessageList, () => {
shortcuts.add('delete', '', KeyState.MessageList, () => {
MessageStore.messageListCheckedOrSelected().length && this.deleteCommand();
MessageUserStore.messageListCheckedOrSelected().length && this.deleteCommand();
return false;
});
}
@ -827,15 +829,15 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
// change focused state
shortcuts.add('tab', 'shift', KeyState.MessageList, () => {
AppStore.focusedState(Focused.FolderList);
AppUserStore.focusedState(Focused.FolderList);
return false;
});
shortcuts.add('arrowleft', '', KeyState.MessageList, () => {
AppStore.focusedState(Focused.FolderList);
AppUserStore.focusedState(Focused.FolderList);
return false;
});
shortcuts.add('tab,arrowright', '', KeyState.MessageList, () => {
this.message() && AppStore.focusedState(Focused.MessageView);
this.message() && AppUserStore.focusedState(Focused.MessageView);
return false;
});
@ -892,7 +894,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
queueSize: 1,
multipleSizeLimit: 1,
hidden: {
Folder: () => FolderStore.currentFolderFullNameRaw()
Folder: () => FolderUserStore.currentFolderFullNameRaw()
},
dragAndDropElement: this.dragOverArea(),
dragAndDropBodyElement: this.dragOverBodyArea()
@ -907,7 +909,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
.on('onBodyDragLeave', () => this.dragOver(false))
.on('onSelect', (sUid, oData) => {
if (sUid && oData && 'message/rfc822' === oData.Type) {
MessageStore.messageListLoading(true);
MessageUserStore.messageListLoading(true);
return true;
}

View file

@ -20,18 +20,18 @@ import { doc, $htmlCL, leftPanelDisabled, keyScopeReal, moveAction, Settings } f
import { inFocus } from 'Common/Utils';
import { mailToHelper, showMessageComposer } from 'Common/UtilsUser';
import Audio from 'Common/Audio';
import { SMAudio } from 'Common/Audio';
import { i18n } from 'Common/Translator';
import { attachmentDownload } from 'Common/Links';
import { MessageFlagsCache } from 'Common/Cache';
import AppStore from 'Stores/User/App';
import SettingsStore from 'Stores/User/Settings';
import AccountStore from 'Stores/User/Account';
import FolderStore from 'Stores/User/Folder';
import MessageStore from 'Stores/User/Message';
import { AppUserStore } from 'Stores/User/App';
import { SettingsUserStore } from 'Stores/User/Settings';
import { AccountUserStore } from 'Stores/User/Account';
import { FolderUserStore } from 'Stores/User/Folder';
import { MessageUserStore } from 'Stores/User/Message';
import { ThemeStore } from 'Stores/Theme';
import * as Local from 'Storage/Client';
@ -84,22 +84,22 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
this.allowMessageActions = Settings.capa(Capa.MessageActions);
this.allowMessageListActions = Settings.capa(Capa.MessageListActions);
this.attachmentsActions = AppStore.attachmentsActions;
this.attachmentsActions = AppUserStore.attachmentsActions;
this.message = MessageStore.message;
// this.messageListChecked = MessageStore.messageListChecked;
this.hasCheckedMessages = MessageStore.hasCheckedMessages;
this.messageListCheckedOrSelectedUidsWithSubMails = MessageStore.messageListCheckedOrSelectedUidsWithSubMails;
this.messageLoadingThrottle = MessageStore.messageLoadingThrottle;
this.messagesBodiesDom = MessageStore.messagesBodiesDom;
this.useThreads = SettingsStore.useThreads;
this.replySameFolder = SettingsStore.replySameFolder;
this.layout = SettingsStore.layout;
this.isMessageSelected = MessageStore.isMessageSelected;
this.messageActiveDom = MessageStore.messageActiveDom;
this.messageError = MessageStore.messageError;
this.message = MessageUserStore.message;
// this.messageListChecked = MessageUserStore.messageListChecked;
this.hasCheckedMessages = MessageUserStore.hasCheckedMessages;
this.messageListCheckedOrSelectedUidsWithSubMails = MessageUserStore.messageListCheckedOrSelectedUidsWithSubMails;
this.messageLoadingThrottle = MessageUserStore.messageLoadingThrottle;
this.messagesBodiesDom = MessageUserStore.messagesBodiesDom;
this.useThreads = SettingsUserStore.useThreads;
this.replySameFolder = SettingsUserStore.replySameFolder;
this.layout = SettingsUserStore.layout;
this.isMessageSelected = MessageUserStore.isMessageSelected;
this.messageActiveDom = MessageUserStore.messageActiveDom;
this.messageError = MessageUserStore.messageError;
this.fullScreenMode = MessageStore.messageFullScreenMode;
this.fullScreenMode = MessageUserStore.messageFullScreenMode;
this.messageListOfThreadsLoading = ko.observable(false).extend({ rateLimit: 1 });
this.highlightUnselectedAttachments = ko.observable(false).extend({ falseTimeout: 2000 });
@ -191,10 +191,10 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
return '';
},
messageFocused: () => Focused.MessageView === AppStore.focusedState(),
messageFocused: () => Focused.MessageView === AppUserStore.focusedState(),
messageListAndMessageViewLoading:
() => MessageStore.messageListCompleteLoadingThrottle() || MessageStore.messageLoadingThrottle()
() => MessageUserStore.messageListCompleteLoadingThrottle() || MessageUserStore.messageLoadingThrottle()
});
this.addSubscribables({
@ -241,7 +241,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
this.viewIsImportant(message.isImportant());
this.viewIsFlagged(message.isFlagged());
} else {
MessageStore.selectorMessageSelected(null);
MessageUserStore.selectorMessageSelected(null);
this.viewFolder = '';
this.viewUid = '';
@ -260,7 +260,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
}
});
MessageStore.messageViewTrigger.subscribe(() => {
MessageUserStore.messageViewTrigger.subscribe(() => {
const message = this.message();
message ? this.viewIsFlagged(message.isFlagged()) : this.viewIsFlagged(false);
});
@ -281,7 +281,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
}
closeMessageCommand() {
MessageStore.message(null);
MessageUserStore.message(null);
}
messageVisibilityCommand() {}
@ -292,19 +292,19 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
goUpCommand() {
dispatchEvent(new CustomEvent('mailbox.message-list.selector.go-up',
{detail:SettingsStore.usePreviewPane() || !!this.message()} // bForceSelect
{detail:SettingsUserStore.usePreviewPane() || !!this.message()} // bForceSelect
));
}
goDownCommand() {
dispatchEvent(new CustomEvent('mailbox.message-list.selector.go-down',
{detail:SettingsStore.usePreviewPane() || !!this.message()} // bForceSelect
{detail:SettingsUserStore.usePreviewPane() || !!this.message()} // bForceSelect
));
}
detectDomBackgroundColor(dom) {
let color = '';
if (dom && !SettingsStore.removeColors()) {
if (dom && !SettingsUserStore.removeColors()) {
let limit = 5,
aC = dom;
while (!color && aC && limit--) {
@ -336,7 +336,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
* @returns {void}
*/
replyOrforward(sType) {
showMessageComposer([sType, MessageStore.message()]);
showMessageComposer([sType, MessageUserStore.message()]);
}
checkHeaderHeight() {
@ -395,7 +395,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
}
onBuild(dom) {
this.fullScreenMode.subscribe(value => value && this.message() && AppStore.focusedState(Focused.MessageView));
this.fullScreenMode.subscribe(value => value && this.message() && AppUserStore.focusedState(Focused.MessageView));
this.showFullInfo.subscribe(value => Local.set(ClientSideKeyName.MessageHeaderFullInfo, value ? '1' : '0'));
@ -446,16 +446,16 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
if (el) {
event.stopPropagation();
const attachment = ko.dataFor(el); // eslint-disable-line no-invalid-this
if (attachment && Audio.supported) {
if (attachment && SMAudio.supported) {
switch (true) {
case Audio.supportedMp3 && attachment.isMp3():
Audio.playMp3(attachment.linkDownload(), attachment.fileName);
case SMAudio.supportedMp3 && attachment.isMp3():
SMAudio.playMp3(attachment.linkDownload(), attachment.fileName);
break;
case Audio.supportedOgg && attachment.isOgg():
Audio.playOgg(attachment.linkDownload(), attachment.fileName);
case SMAudio.supportedOgg && attachment.isOgg():
SMAudio.playOgg(attachment.linkDownload(), attachment.fileName);
break;
case Audio.supportedWav && attachment.isWav():
Audio.playWav(attachment.linkDownload(), attachment.fileName);
case SMAudio.supportedWav && attachment.isWav():
SMAudio.playWav(attachment.linkDownload(), attachment.fileName);
break;
// no default
}
@ -494,7 +494,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
}
});
AppStore.focusedState.subscribe((value) => {
AppUserStore.focusedState.subscribe((value) => {
if (Focused.MessageView !== value) {
this.scrollMessageToTop();
this.scrollMessageToLeft();
@ -513,17 +513,17 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
*/
escShortcuts() {
if (this.viewModelVisible && this.message()) {
const preview = SettingsStore.usePreviewPane();
const preview = SettingsUserStore.usePreviewPane();
if (this.fullScreenMode()) {
this.fullScreenMode(false);
if (preview) {
AppStore.focusedState(Focused.MessageList);
AppUserStore.focusedState(Focused.MessageList);
}
} else if (!preview) {
this.message(null);
} else {
AppStore.focusedState(Focused.MessageList);
AppUserStore.focusedState(Focused.MessageList);
}
return false;
@ -544,7 +544,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
// reply
shortcuts.add('r,mailreply', '', [KeyState.MessageList, KeyState.MessageView], () => {
if (MessageStore.message()) {
if (MessageUserStore.message()) {
this.replyCommand();
return false;
}
@ -553,14 +553,14 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
// replaAll
shortcuts.add('a', '', [KeyState.MessageList, KeyState.MessageView], () => {
if (MessageStore.message()) {
if (MessageUserStore.message()) {
this.replyAllCommand();
return false;
}
return true;
});
shortcuts.add('mailreply', 'shift', [KeyState.MessageList, KeyState.MessageView], () => {
if (MessageStore.message()) {
if (MessageUserStore.message()) {
this.replyAllCommand();
return false;
}
@ -569,7 +569,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
// forward
shortcuts.add('f,mailforward', '', [KeyState.MessageList, KeyState.MessageView], () => {
if (MessageStore.message()) {
if (MessageUserStore.message()) {
this.forwardCommand();
return false;
}
@ -579,7 +579,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
// message information
shortcuts.add('i', 'meta', [KeyState.MessageList, KeyState.MessageView], () => {
if (MessageStore.message()) {
if (MessageUserStore.message()) {
this.showFullInfo(!this.showFullInfo());
}
return false;
@ -587,7 +587,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
// toggle message blockquotes
shortcuts.add('b', '', [KeyState.MessageList, KeyState.MessageView], () => {
const message = MessageStore.message();
const message = MessageUserStore.message();
if (message && message.body) {
message.body.querySelectorAll('.rlBlockquoteSwitcher').forEach(node => node.click());
return false;
@ -623,18 +623,18 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
// change focused state
shortcuts.add('arrowleft', '', KeyState.MessageView, () => {
if (!this.fullScreenMode() && this.message() && SettingsStore.usePreviewPane()) {
if (!this.fullScreenMode() && this.message() && SettingsUserStore.usePreviewPane()) {
if (this.oMessageScrollerDom && 0 < this.oMessageScrollerDom.scrollLeft) {
return true;
}
AppStore.focusedState(Focused.MessageList);
AppUserStore.focusedState(Focused.MessageList);
return false;
}
});
// shortcuts.add('tab', 'shift', KeyState.MessageView, (event, handler) => {
shortcuts.add('tab', '', KeyState.MessageView, () => {
if (!this.fullScreenMode() && this.message() && SettingsStore.usePreviewPane()) {
AppStore.focusedState(Focused.MessageList);
if (!this.fullScreenMode() && this.message() && SettingsUserStore.usePreviewPane()) {
AppUserStore.focusedState(Focused.MessageList);
}
return false;
});
@ -644,42 +644,42 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
* @returns {boolean}
*/
isDraftFolder() {
return MessageStore.message() && FolderStore.draftFolder() === MessageStore.message().folder;
return MessageUserStore.message() && FolderUserStore.draftFolder() === MessageUserStore.message().folder;
}
/**
* @returns {boolean}
*/
isSentFolder() {
return MessageStore.message() && FolderStore.sentFolder() === MessageStore.message().folder;
return MessageUserStore.message() && FolderUserStore.sentFolder() === MessageUserStore.message().folder;
}
/**
* @returns {boolean}
*/
isSpamFolder() {
return MessageStore.message() && FolderStore.spamFolder() === MessageStore.message().folder;
return MessageUserStore.message() && FolderUserStore.spamFolder() === MessageUserStore.message().folder;
}
/**
* @returns {boolean}
*/
isSpamDisabled() {
return MessageStore.message() && FolderStore.spamFolder() === UNUSED_OPTION_VALUE;
return MessageUserStore.message() && FolderUserStore.spamFolder() === UNUSED_OPTION_VALUE;
}
/**
* @returns {boolean}
*/
isArchiveFolder() {
return MessageStore.message() && FolderStore.archiveFolder() === MessageStore.message().folder;
return MessageUserStore.message() && FolderUserStore.archiveFolder() === MessageUserStore.message().folder;
}
/**
* @returns {boolean}
*/
isArchiveDisabled() {
return MessageStore.message() && FolderStore.archiveFolder() === UNUSED_OPTION_VALUE;
return MessageUserStore.message() && FolderUserStore.archiveFolder() === UNUSED_OPTION_VALUE;
}
/**
@ -694,8 +694,8 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
}
editMessage() {
if (MessageStore.message()) {
showMessageComposer([ComposeType.Draft, MessageStore.message()]);
if (MessageUserStore.message()) {
showMessageComposer([ComposeType.Draft, MessageUserStore.message()]);
}
}
@ -766,7 +766,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
oMessage.uid,
oMessage.readReceipt(),
i18n('READ_RECEIPT/SUBJECT', { 'SUBJECT': oMessage.subject() }),
i18n('READ_RECEIPT/BODY', { 'READ-RECEIPT': AccountStore.email() })
i18n('READ_RECEIPT/BODY', { 'READ-RECEIPT': AccountUserStore.email() })
);
oMessage.isReadReceipt(true);

View file

@ -2,7 +2,7 @@ import { mailbox } from 'Common/Links';
import { getFolderInboxName } from 'Common/Cache';
import { leftPanelDisabled } from 'Common/Globals';
import MessageStore from 'Stores/User/Message';
import { MessageUserStore } from 'Stores/User/Message';
import { ThemeStore } from 'Stores/Theme';
import { AbstractViewRight } from 'Knoin/AbstractViews';
@ -15,7 +15,7 @@ export class PaneSettingsUserView extends AbstractViewRight {
}
onShow() {
MessageStore.message(null);
MessageUserStore.message(null);
}
hideLeft(item, event) {