mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-03 22:47:03 +03:00
Add cmd interface
Code refactoring
This commit is contained in:
parent
e6e1a19477
commit
962391e2a0
23 changed files with 180 additions and 223 deletions
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
import ko from 'ko';
|
||||
import _ from '_';
|
||||
import {Magics} from 'Common/Enums';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class AccountUserStore
|
||||
|
|
@ -12,7 +13,7 @@ class AccountUserStore
|
|||
this.signature = ko.observable('');
|
||||
|
||||
this.accounts = ko.observableArray([]);
|
||||
this.accounts.loading = ko.observable(false).extend({throttle: 100});
|
||||
this.accounts.loading = ko.observable(false).extend({throttle: Magics.Time100ms});
|
||||
|
||||
this.computers();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@
|
|||
import ko from 'ko';
|
||||
import {Focused, KeyState} from 'Common/Enums';
|
||||
import {keyScope} from 'Common/Globals';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
import {isNonEmptyArray} from 'Common/Utils';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import {AbstractAppStore} from 'Stores/AbstractApp';
|
||||
|
||||
class AppUserStore extends AbstractAppStore
|
||||
|
|
|
|||
|
|
@ -1,16 +1,17 @@
|
|||
|
||||
import ko from 'ko';
|
||||
import {Magics} from 'Common/Enums';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class ContactUserStore
|
||||
{
|
||||
constructor() {
|
||||
this.contacts = ko.observableArray([]);
|
||||
this.contacts.loading = ko.observable(false).extend({'throttle': 200});
|
||||
this.contacts.importing = ko.observable(false).extend({'throttle': 200});
|
||||
this.contacts.syncing = ko.observable(false).extend({'throttle': 200});
|
||||
this.contacts.exportingVcf = ko.observable(false).extend({'throttle': 200});
|
||||
this.contacts.exportingCsv = ko.observable(false).extend({'throttle': 200});
|
||||
this.contacts.loading = ko.observable(false).extend({throttle: Magics.Time200ms});
|
||||
this.contacts.importing = ko.observable(false).extend({throttle: Magics.Time200ms});
|
||||
this.contacts.syncing = ko.observable(false).extend({throttle: Magics.Time200ms});
|
||||
this.contacts.exportingVcf = ko.observable(false).extend({throttle: Magics.Time200ms});
|
||||
this.contacts.exportingCsv = ko.observable(false).extend({throttle: Magics.Time200ms});
|
||||
|
||||
this.allowContactsSync = ko.observable(false);
|
||||
this.enableContactsSync = ko.observable(false);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
import ko from 'ko';
|
||||
import {Magics} from 'Common/Enums';
|
||||
|
||||
class FilterUserStore
|
||||
{
|
||||
|
|
@ -9,8 +10,8 @@ class FilterUserStore
|
|||
|
||||
this.filters = ko.observableArray([]);
|
||||
|
||||
this.filters.loading = ko.observable(false).extend({throttle: 200});
|
||||
this.filters.saving = ko.observable(false).extend({throttle: 200});
|
||||
this.filters.loading = ko.observable(false).extend({throttle: Magics.Time200ms});
|
||||
this.filters.saving = ko.observable(false).extend({throttle: Magics.Time200ms});
|
||||
|
||||
this.raw = ko.observable('');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,19 +31,7 @@ class FolderUserStore
|
|||
|
||||
this.foldersInboxUnreadCount = ko.observable(0);
|
||||
|
||||
this.currentFolder = ko.observable(null).extend({toggleSubscribe: [
|
||||
null,
|
||||
(prev) => {
|
||||
if (prev) {
|
||||
prev.selected(false);
|
||||
}
|
||||
},
|
||||
(next) => {
|
||||
if (next) {
|
||||
next.selected(true);
|
||||
}
|
||||
}
|
||||
]});
|
||||
this.currentFolder = ko.observable(null).extend({toggleSubscribeProperty: [this, 'selected']});
|
||||
|
||||
this.computers();
|
||||
this.subscribers();
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
import window from 'window';
|
||||
import ko from 'ko';
|
||||
|
||||
import {Magics} from 'Common/Enums';
|
||||
|
||||
class QuotaUserStore
|
||||
{
|
||||
constructor() {
|
||||
|
|
@ -24,8 +26,8 @@ class QuotaUserStore
|
|||
* @param {number} usage
|
||||
*/
|
||||
populateData(quota, usage) {
|
||||
this.quota(quota * 1024);
|
||||
this.usage(usage * 1024);
|
||||
this.quota(quota * Magics.BitLength1024);
|
||||
this.usage(usage * Magics.BitLength1024);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class SettingsUserStore
|
|||
this.useThreads = ko.observable(false);
|
||||
this.replySameFolder = ko.observable(false);
|
||||
|
||||
this.autoLogout = ko.observable(30);
|
||||
this.autoLogout = ko.observable(Magics.Time30mInMin);
|
||||
|
||||
this.computers();
|
||||
this.subscribers();
|
||||
|
|
@ -44,11 +44,11 @@ class SettingsUserStore
|
|||
}
|
||||
|
||||
subscribers() {
|
||||
this.layout.subscribe((nValue) => {
|
||||
$html.toggleClass('rl-no-preview-pane', Layout.NoPreview === nValue);
|
||||
$html.toggleClass('rl-side-preview-pane', Layout.SidePreview === nValue);
|
||||
$html.toggleClass('rl-bottom-preview-pane', Layout.BottomPreview === nValue);
|
||||
Events.pub('layout', [nValue]);
|
||||
this.layout.subscribe((value) => {
|
||||
$html.toggleClass('rl-no-preview-pane', Layout.NoPreview === value);
|
||||
$html.toggleClass('rl-side-preview-pane', Layout.SidePreview === value);
|
||||
$html.toggleClass('rl-bottom-preview-pane', Layout.BottomPreview === value);
|
||||
Events.pub('layout', [value]);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue