mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 05:29:20 +03:00
CommonJS (research/3)
This commit is contained in:
parent
586abbb802
commit
06bb124379
99 changed files with 51037 additions and 42961 deletions
|
|
@ -13,6 +13,7 @@
|
|||
Utils = require('../Common/Utils.js'),
|
||||
LinkBuilder = require('../Common/LinkBuilder.js'),
|
||||
|
||||
Data = require('../Storages/WebMailDataStorage.js'),
|
||||
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
|
||||
|
||||
kn = require('../Knoin/Knoin.js'),
|
||||
|
|
@ -24,12 +25,10 @@
|
|||
*/
|
||||
function SettingsAccounts()
|
||||
{
|
||||
var oData = RL.data();
|
||||
|
||||
this.accounts = oData.accounts;
|
||||
this.accounts = Data.accounts;
|
||||
|
||||
this.processText = ko.computed(function () {
|
||||
return oData.accountsLoading() ? Utils.i18n('SETTINGS_ACCOUNTS/LOADING_PROCESS') : '';
|
||||
return Data.accountsLoading() ? Utils.i18n('SETTINGS_ACCOUNTS/LOADING_PROCESS') : '';
|
||||
}, this);
|
||||
|
||||
this.visibility = ko.computed(function () {
|
||||
|
|
@ -51,8 +50,6 @@
|
|||
]});
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(SettingsAccounts, 'SettingsAccounts', 'SETTINGS_LABELS/LABEL_ACCOUNTS_NAME', 'accounts');
|
||||
|
||||
SettingsAccounts.prototype.addNewAccount = function ()
|
||||
{
|
||||
kn.showScreenPopup(PopupsAddAccountViewModel);
|
||||
|
|
@ -68,6 +65,7 @@
|
|||
this.accountForDeletion(null);
|
||||
|
||||
var
|
||||
RL = require('../Boots/RainLoopApp.js'),
|
||||
fRemoveAccount = function (oAccount) {
|
||||
return oAccountToRemove === oAccount;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,8 +77,6 @@
|
|||
this.onChangePasswordResponse = _.bind(this.onChangePasswordResponse, this);
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(SettingsChangePassword, 'SettingsChangePassword', 'SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME', 'change-password');
|
||||
|
||||
SettingsChangePassword.prototype.onHide = function ()
|
||||
{
|
||||
this.changeProcess(false);
|
||||
|
|
|
|||
|
|
@ -8,8 +8,10 @@
|
|||
ko = require('../External/ko.js'),
|
||||
|
||||
Utils = require('../Common/Utils.js'),
|
||||
|
||||
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
|
||||
|
||||
Remote = require('../Storages/WebMailAjaxRemoteStorage.js')
|
||||
Data = require('../Storages/WebMailDataStorage.js')
|
||||
;
|
||||
|
||||
/**
|
||||
|
|
@ -17,15 +19,13 @@
|
|||
*/
|
||||
function SettingsContacts()
|
||||
{
|
||||
var oData = RL.data();
|
||||
this.contactsAutosave = Data.contactsAutosave;
|
||||
|
||||
this.contactsAutosave = oData.contactsAutosave;
|
||||
|
||||
this.allowContactsSync = oData.allowContactsSync;
|
||||
this.enableContactsSync = oData.enableContactsSync;
|
||||
this.contactsSyncUrl = oData.contactsSyncUrl;
|
||||
this.contactsSyncUser = oData.contactsSyncUser;
|
||||
this.contactsSyncPass = oData.contactsSyncPass;
|
||||
this.allowContactsSync = Data.allowContactsSync;
|
||||
this.enableContactsSync = Data.enableContactsSync;
|
||||
this.contactsSyncUrl = Data.contactsSyncUrl;
|
||||
this.contactsSyncUser = Data.contactsSyncUser;
|
||||
this.contactsSyncPass = Data.contactsSyncPass;
|
||||
|
||||
this.saveTrigger = ko.computed(function () {
|
||||
return [
|
||||
|
|
@ -46,11 +46,9 @@
|
|||
}, this);
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(SettingsContacts, 'SettingsContacts', 'SETTINGS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
|
||||
|
||||
SettingsContacts.prototype.onBuild = function ()
|
||||
{
|
||||
RL.data().contactsAutosave.subscribe(function (bValue) {
|
||||
Data.contactsAutosave.subscribe(function (bValue) {
|
||||
Remote.saveSettings(Utils.emptyFunction, {
|
||||
'ContactsAutosave': bValue ? '1' : '0'
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
var
|
||||
ko = require('../External/ko.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
kn = require('../Knoin/Knoin.js'),
|
||||
PopupsFilterViewModel = require('../ViewModels/Popups/PopupsFilterViewModel.js')
|
||||
;
|
||||
|
||||
|
|
@ -23,8 +24,6 @@
|
|||
});
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(SettingsFilters, 'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
|
||||
|
||||
SettingsFilters.prototype.deleteFilter = function (oFilter)
|
||||
{
|
||||
this.filters.remove(oFilter);
|
||||
|
|
|
|||
|
|
@ -9,10 +9,16 @@
|
|||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
|
||||
kn = require('../Knoin/Knoin.js'),
|
||||
|
||||
AppSettings = require('../Storages/AppSettings.js'),
|
||||
LocalStorage = require('../Storages/LocalStorage.js'),
|
||||
Data = require('../Storages/WebMailDataStorage.js'),
|
||||
Cache = require('../Storages/WebMailCacheStorage.js'),
|
||||
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
|
||||
|
||||
|
||||
RL = require('../Boots/RainLoopApp.js'),
|
||||
|
||||
PopupsFolderCreateViewModel = require('../ViewModels/Popups/PopupsFolderCreateViewModel.js'),
|
||||
PopupsFolderSystemViewModel = require('../ViewModels/Popups/PopupsFolderSystemViewModel.js')
|
||||
;
|
||||
|
|
@ -22,19 +28,16 @@
|
|||
*/
|
||||
function SettingsFolders()
|
||||
{
|
||||
var oData = RL.data();
|
||||
|
||||
this.foldersListError = oData.foldersListError;
|
||||
this.folderList = oData.folderList;
|
||||
this.foldersListError = Data.foldersListError;
|
||||
this.folderList = Data.folderList;
|
||||
|
||||
this.processText = ko.computed(function () {
|
||||
|
||||
var
|
||||
oData = RL.data(),
|
||||
bLoading = oData.foldersLoading(),
|
||||
bCreating = oData.foldersCreating(),
|
||||
bDeleting = oData.foldersDeleting(),
|
||||
bRenaming = oData.foldersRenaming()
|
||||
bLoading = Data.foldersLoading(),
|
||||
bCreating = Data.foldersCreating(),
|
||||
bDeleting = Data.foldersDeleting(),
|
||||
bRenaming = Data.foldersRenaming()
|
||||
;
|
||||
|
||||
if (bCreating)
|
||||
|
|
@ -90,11 +93,9 @@
|
|||
}
|
||||
]});
|
||||
|
||||
this.useImapSubscribe = !!RL.settingsGet('UseImapSubscribe');
|
||||
this.useImapSubscribe = !!AppSettings.settingsGet('UseImapSubscribe');
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(SettingsFolders, 'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders');
|
||||
|
||||
SettingsFolders.prototype.folderEditOnEnter = function (oFolder)
|
||||
{
|
||||
var sEditName = oFolder ? Utils.trim(oFolder.nameForEdit()) : '';
|
||||
|
|
@ -102,13 +103,13 @@
|
|||
{
|
||||
LocalStorage.set(Enums.ClientSideKeyName.FoldersLashHash, '');
|
||||
|
||||
RL.data().foldersRenaming(true);
|
||||
Data.foldersRenaming(true);
|
||||
Remote.folderRename(function (sResult, oData) {
|
||||
|
||||
RL.data().foldersRenaming(false);
|
||||
Data.foldersRenaming(false);
|
||||
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
|
||||
{
|
||||
RL.data().foldersListError(
|
||||
Data.foldersListError(
|
||||
oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER'));
|
||||
}
|
||||
|
||||
|
|
@ -134,7 +135,7 @@
|
|||
|
||||
SettingsFolders.prototype.onShow = function ()
|
||||
{
|
||||
RL.data().foldersListError('');
|
||||
Data.foldersListError('');
|
||||
};
|
||||
|
||||
SettingsFolders.prototype.createFolder = function ()
|
||||
|
|
@ -171,15 +172,15 @@
|
|||
{
|
||||
LocalStorage.set(Enums.ClientSideKeyName.FoldersLashHash, '');
|
||||
|
||||
RL.data().folderList.remove(fRemoveFolder);
|
||||
Data.folderList.remove(fRemoveFolder);
|
||||
|
||||
RL.data().foldersDeleting(true);
|
||||
Data.foldersDeleting(true);
|
||||
Remote.folderDelete(function (sResult, oData) {
|
||||
|
||||
RL.data().foldersDeleting(false);
|
||||
Data.foldersDeleting(false);
|
||||
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
|
||||
{
|
||||
RL.data().foldersListError(
|
||||
Data.foldersListError(
|
||||
oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER'));
|
||||
}
|
||||
|
||||
|
|
@ -192,7 +193,7 @@
|
|||
}
|
||||
else if (0 < oFolderToRemove.privateMessageCountAll())
|
||||
{
|
||||
RL.data().foldersListError(Utils.getNotification(Enums.Notification.CantDeleteNonEmptyFolder));
|
||||
Data.foldersListError(Utils.getNotification(Enums.Notification.CantDeleteNonEmptyFolder));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
'use strict';
|
||||
|
||||
var
|
||||
$ = require('../External/jquery.js'),
|
||||
ko = require('../External/ko.js'),
|
||||
|
||||
Enums = require('../Common/Enums.js'),
|
||||
|
|
@ -13,6 +14,7 @@
|
|||
Utils = require('../Common/Utils.js'),
|
||||
LinkBuilder = require('../Common/LinkBuilder.js'),
|
||||
|
||||
Data = require('../Storages/WebMailDataStorage.js'),
|
||||
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
|
||||
|
||||
kn = require('../Knoin/Knoin.js'),
|
||||
|
|
@ -24,30 +26,28 @@
|
|||
*/
|
||||
function SettingsGeneral()
|
||||
{
|
||||
var oData = RL.data();
|
||||
|
||||
this.mainLanguage = oData.mainLanguage;
|
||||
this.mainMessagesPerPage = oData.mainMessagesPerPage;
|
||||
this.mainLanguage = Data.mainLanguage;
|
||||
this.mainMessagesPerPage = Data.mainMessagesPerPage;
|
||||
this.mainMessagesPerPageArray = Consts.Defaults.MessagesPerPageArray;
|
||||
this.editorDefaultType = oData.editorDefaultType;
|
||||
this.showImages = oData.showImages;
|
||||
this.interfaceAnimation = oData.interfaceAnimation;
|
||||
this.useDesktopNotifications = oData.useDesktopNotifications;
|
||||
this.threading = oData.threading;
|
||||
this.useThreads = oData.useThreads;
|
||||
this.replySameFolder = oData.replySameFolder;
|
||||
this.layout = oData.layout;
|
||||
this.usePreviewPane = oData.usePreviewPane;
|
||||
this.useCheckboxesInList = oData.useCheckboxesInList;
|
||||
this.allowLanguagesOnSettings = oData.allowLanguagesOnSettings;
|
||||
this.editorDefaultType = Data.editorDefaultType;
|
||||
this.showImages = Data.showImages;
|
||||
this.interfaceAnimation = Data.interfaceAnimation;
|
||||
this.useDesktopNotifications = Data.useDesktopNotifications;
|
||||
this.threading = Data.threading;
|
||||
this.useThreads = Data.useThreads;
|
||||
this.replySameFolder = Data.replySameFolder;
|
||||
this.layout = Data.layout;
|
||||
this.usePreviewPane = Data.usePreviewPane;
|
||||
this.useCheckboxesInList = Data.useCheckboxesInList;
|
||||
this.allowLanguagesOnSettings = Data.allowLanguagesOnSettings;
|
||||
|
||||
this.isDesktopNotificationsSupported = ko.computed(function () {
|
||||
return Enums.DesktopNotifications.NotSupported !== oData.desktopNotificationsPermisions();
|
||||
return Enums.DesktopNotifications.NotSupported !== Data.desktopNotificationsPermisions();
|
||||
});
|
||||
|
||||
this.isDesktopNotificationsDenied = ko.computed(function () {
|
||||
return Enums.DesktopNotifications.NotSupported === oData.desktopNotificationsPermisions() ||
|
||||
Enums.DesktopNotifications.Denied === oData.desktopNotificationsPermisions();
|
||||
return Enums.DesktopNotifications.NotSupported === Data.desktopNotificationsPermisions() ||
|
||||
Enums.DesktopNotifications.Denied === Data.desktopNotificationsPermisions();
|
||||
});
|
||||
|
||||
this.mainLanguageFullName = ko.computed(function () {
|
||||
|
|
@ -60,8 +60,6 @@
|
|||
this.isAnimationSupported = Globals.bAnimationSupported;
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(SettingsGeneral, 'SettingsGeneral', 'SETTINGS_LABELS/LABEL_GENERAL_NAME', 'general', true);
|
||||
|
||||
SettingsGeneral.prototype.toggleLayout = function ()
|
||||
{
|
||||
this.layout(Enums.Layout.NoPreview === this.layout() ? Enums.Layout.SidePreview : Enums.Layout.NoPreview);
|
||||
|
|
@ -74,11 +72,10 @@
|
|||
_.delay(function () {
|
||||
|
||||
var
|
||||
oData = RL.data(),
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.mppTrigger, self)
|
||||
;
|
||||
|
||||
oData.language.subscribe(function (sValue) {
|
||||
Data.language.subscribe(function (sValue) {
|
||||
|
||||
self.languageTrigger(Enums.SaveSettingsStep.Animate);
|
||||
|
||||
|
|
@ -102,31 +99,31 @@
|
|||
});
|
||||
});
|
||||
|
||||
oData.editorDefaultType.subscribe(function (sValue) {
|
||||
Data.editorDefaultType.subscribe(function (sValue) {
|
||||
Remote.saveSettings(Utils.emptyFunction, {
|
||||
'EditorDefaultType': sValue
|
||||
});
|
||||
});
|
||||
|
||||
oData.messagesPerPage.subscribe(function (iValue) {
|
||||
Data.messagesPerPage.subscribe(function (iValue) {
|
||||
Remote.saveSettings(f1, {
|
||||
'MPP': iValue
|
||||
});
|
||||
});
|
||||
|
||||
oData.showImages.subscribe(function (bValue) {
|
||||
Data.showImages.subscribe(function (bValue) {
|
||||
Remote.saveSettings(Utils.emptyFunction, {
|
||||
'ShowImages': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
oData.interfaceAnimation.subscribe(function (sValue) {
|
||||
Data.interfaceAnimation.subscribe(function (sValue) {
|
||||
Remote.saveSettings(Utils.emptyFunction, {
|
||||
'InterfaceAnimation': sValue
|
||||
});
|
||||
});
|
||||
|
||||
oData.useDesktopNotifications.subscribe(function (bValue) {
|
||||
Data.useDesktopNotifications.subscribe(function (bValue) {
|
||||
Utils.timeOutAction('SaveDesktopNotifications', function () {
|
||||
Remote.saveSettings(Utils.emptyFunction, {
|
||||
'DesktopNotifications': bValue ? '1' : '0'
|
||||
|
|
@ -134,7 +131,7 @@
|
|||
}, 3000);
|
||||
});
|
||||
|
||||
oData.replySameFolder.subscribe(function (bValue) {
|
||||
Data.replySameFolder.subscribe(function (bValue) {
|
||||
Utils.timeOutAction('SaveReplySameFolder', function () {
|
||||
Remote.saveSettings(Utils.emptyFunction, {
|
||||
'ReplySameFolder': bValue ? '1' : '0'
|
||||
|
|
@ -142,25 +139,25 @@
|
|||
}, 3000);
|
||||
});
|
||||
|
||||
oData.useThreads.subscribe(function (bValue) {
|
||||
Data.useThreads.subscribe(function (bValue) {
|
||||
|
||||
oData.messageList([]);
|
||||
Data.messageList([]);
|
||||
|
||||
Remote.saveSettings(Utils.emptyFunction, {
|
||||
'UseThreads': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
oData.layout.subscribe(function (nValue) {
|
||||
Data.layout.subscribe(function (nValue) {
|
||||
|
||||
oData.messageList([]);
|
||||
Data.messageList([]);
|
||||
|
||||
Remote.saveSettings(Utils.emptyFunction, {
|
||||
'Layout': nValue
|
||||
});
|
||||
});
|
||||
|
||||
oData.useCheckboxesInList.subscribe(function (bValue) {
|
||||
Data.useCheckboxesInList.subscribe(function (bValue) {
|
||||
Remote.saveSettings(Utils.emptyFunction, {
|
||||
'UseCheckboxesInList': bValue ? '1' : '0'
|
||||
});
|
||||
|
|
@ -171,7 +168,7 @@
|
|||
|
||||
SettingsGeneral.prototype.onShow = function ()
|
||||
{
|
||||
RL.data().desktopNotifications.valueHasMutated();
|
||||
Data.desktopNotifications.valueHasMutated();
|
||||
};
|
||||
|
||||
SettingsGeneral.prototype.selectLanguage = function ()
|
||||
|
|
|
|||
|
|
@ -9,9 +9,13 @@
|
|||
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
NewHtmlEditorWrapper = require('../Common/NewHtmlEditorWrapper.js'),
|
||||
|
||||
Data = require('../Storages/WebMailDataStorage.js'),
|
||||
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
|
||||
|
||||
RL = require('../Boots/RainLoopApp.js'),
|
||||
|
||||
kn = require('../Knoin/Knoin.js'),
|
||||
PopupsIdentityViewModel = require('../ViewModels/Popups/PopupsIdentityViewModel.js')
|
||||
;
|
||||
|
|
@ -21,16 +25,14 @@
|
|||
*/
|
||||
function SettingsIdentities()
|
||||
{
|
||||
var oData = RL.data();
|
||||
|
||||
this.editor = null;
|
||||
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
|
||||
|
||||
this.accountEmail = oData.accountEmail;
|
||||
this.displayName = oData.displayName;
|
||||
this.signature = oData.signature;
|
||||
this.signatureToAll = oData.signatureToAll;
|
||||
this.replyTo = oData.replyTo;
|
||||
this.accountEmail = Data.accountEmail;
|
||||
this.displayName = Data.displayName;
|
||||
this.signature = Data.signature;
|
||||
this.signatureToAll = Data.signatureToAll;
|
||||
this.replyTo = Data.replyTo;
|
||||
|
||||
this.signatureDom = ko.observable(null);
|
||||
|
||||
|
|
@ -39,8 +41,8 @@
|
|||
this.replyTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.signatureTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.identities = oData.identities;
|
||||
this.defaultIdentityID = oData.defaultIdentityID;
|
||||
this.identities = Data.identities;
|
||||
this.defaultIdentityID = Data.defaultIdentityID;
|
||||
|
||||
this.identitiesOptions = ko.computed(function () {
|
||||
|
||||
|
|
@ -77,7 +79,7 @@
|
|||
}, this);
|
||||
|
||||
this.processText = ko.computed(function () {
|
||||
return oData.identitiesLoading() ? Utils.i18n('SETTINGS_IDENTITIES/LOADING_PROCESS') : '';
|
||||
return Data.identitiesLoading() ? Utils.i18n('SETTINGS_IDENTITIES/LOADING_PROCESS') : '';
|
||||
}, this);
|
||||
|
||||
this.visibility = ko.computed(function () {
|
||||
|
|
@ -99,8 +101,6 @@
|
|||
]});
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(SettingsIdentities, 'SettingsIdentities', 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME', 'identities');
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {string}
|
||||
|
|
@ -157,11 +157,11 @@
|
|||
{
|
||||
var
|
||||
self = this,
|
||||
sSignature = RL.data().signature()
|
||||
sSignature = Data.signature()
|
||||
;
|
||||
|
||||
this.editor = new NewHtmlEditorWrapper(self.signatureDom(), function () {
|
||||
RL.data().signature(
|
||||
Data.signature(
|
||||
(self.editor.isHtml() ? ':HTML:' : '') + self.editor.getData()
|
||||
);
|
||||
}, function () {
|
||||
|
|
@ -194,38 +194,37 @@
|
|||
_.delay(function () {
|
||||
|
||||
var
|
||||
oData = RL.data(),
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.displayNameTrigger, self),
|
||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.replyTrigger, self),
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self),
|
||||
f4 = Utils.settingsSaveHelperSimpleFunction(self.defaultIdentityIDTrigger, self)
|
||||
;
|
||||
|
||||
oData.defaultIdentityID.subscribe(function (sValue) {
|
||||
Data.defaultIdentityID.subscribe(function (sValue) {
|
||||
Remote.saveSettings(f4, {
|
||||
'DefaultIdentityID': sValue
|
||||
});
|
||||
});
|
||||
|
||||
oData.displayName.subscribe(function (sValue) {
|
||||
Data.displayName.subscribe(function (sValue) {
|
||||
Remote.saveSettings(f1, {
|
||||
'DisplayName': sValue
|
||||
});
|
||||
});
|
||||
|
||||
oData.replyTo.subscribe(function (sValue) {
|
||||
Data.replyTo.subscribe(function (sValue) {
|
||||
Remote.saveSettings(f2, {
|
||||
'ReplyTo': sValue
|
||||
});
|
||||
});
|
||||
|
||||
oData.signature.subscribe(function (sValue) {
|
||||
Data.signature.subscribe(function (sValue) {
|
||||
Remote.saveSettings(f3, {
|
||||
'Signature': sValue
|
||||
});
|
||||
});
|
||||
|
||||
oData.signatureToAll.subscribe(function (bValue) {
|
||||
Data.signatureToAll.subscribe(function (bValue) {
|
||||
Remote.saveSettings(null, {
|
||||
'SignatureToAll': bValue ? '1' : '0'
|
||||
});
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@
|
|||
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
NewHtmlEditorWrapper = require('../Common/NewHtmlEditorWrapper.js'),
|
||||
|
||||
Data = require('../Storages/WebMailDataStorage.js'),
|
||||
Remote = require('../Storages/WebMailAjaxRemoteStorage.js')
|
||||
;
|
||||
|
||||
|
|
@ -18,14 +20,12 @@
|
|||
*/
|
||||
function SettingsIdentity()
|
||||
{
|
||||
var oData = RL.data();
|
||||
|
||||
this.editor = null;
|
||||
|
||||
this.displayName = oData.displayName;
|
||||
this.signature = oData.signature;
|
||||
this.signatureToAll = oData.signatureToAll;
|
||||
this.replyTo = oData.replyTo;
|
||||
this.displayName = Data.displayName;
|
||||
this.signature = Data.signature;
|
||||
this.signatureToAll = Data.signatureToAll;
|
||||
this.replyTo = Data.replyTo;
|
||||
|
||||
this.signatureDom = ko.observable(null);
|
||||
|
||||
|
|
@ -34,19 +34,17 @@
|
|||
this.signatureTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(SettingsIdentity, 'SettingsIdentity', 'SETTINGS_LABELS/LABEL_IDENTITY_NAME', 'identity');
|
||||
|
||||
SettingsIdentity.prototype.onFocus = function ()
|
||||
{
|
||||
if (!this.editor && this.signatureDom())
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
sSignature = RL.data().signature()
|
||||
sSignature = Data.signature()
|
||||
;
|
||||
|
||||
this.editor = new NewHtmlEditorWrapper(self.signatureDom(), function () {
|
||||
RL.data().signature(
|
||||
Data.signature(
|
||||
(self.editor.isHtml() ? ':HTML:' : '') + self.editor.getData()
|
||||
);
|
||||
}, function () {
|
||||
|
|
@ -68,31 +66,30 @@
|
|||
_.delay(function () {
|
||||
|
||||
var
|
||||
oData = RL.data(),
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.displayNameTrigger, self),
|
||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.replyTrigger, self),
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self)
|
||||
;
|
||||
|
||||
oData.displayName.subscribe(function (sValue) {
|
||||
Data.displayName.subscribe(function (sValue) {
|
||||
Remote.saveSettings(f1, {
|
||||
'DisplayName': sValue
|
||||
});
|
||||
});
|
||||
|
||||
oData.replyTo.subscribe(function (sValue) {
|
||||
Data.replyTo.subscribe(function (sValue) {
|
||||
Remote.saveSettings(f2, {
|
||||
'ReplyTo': sValue
|
||||
});
|
||||
});
|
||||
|
||||
oData.signature.subscribe(function (sValue) {
|
||||
Data.signature.subscribe(function (sValue) {
|
||||
Remote.saveSettings(f3, {
|
||||
'Signature': sValue
|
||||
});
|
||||
});
|
||||
|
||||
oData.signatureToAll.subscribe(function (bValue) {
|
||||
Data.signatureToAll.subscribe(function (bValue) {
|
||||
Remote.saveSettings(null, {
|
||||
'SignatureToAll': bValue ? '1' : '0'
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,7 +6,12 @@
|
|||
|
||||
var
|
||||
ko = require('../External/ko.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
|
||||
kn = require('../Knoin/Knoin.js'),
|
||||
|
||||
Data = require('../Storages/WebMailDataStorage.js'),
|
||||
|
||||
RL = require('../Boots/RainLoopApp.js'),
|
||||
|
||||
PopupsAddOpenPgpKeyViewModel = require('../ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js'),
|
||||
PopupsGenerateNewOpenPgpKeyViewModel = require('../ViewModels/Popups/PopupsGenerateNewOpenPgpKeyViewModel.js'),
|
||||
|
|
@ -18,9 +23,9 @@
|
|||
*/
|
||||
function SettingsOpenPGP()
|
||||
{
|
||||
this.openpgpkeys = RL.data().openpgpkeys;
|
||||
this.openpgpkeysPublic = RL.data().openpgpkeysPublic;
|
||||
this.openpgpkeysPrivate = RL.data().openpgpkeysPrivate;
|
||||
this.openpgpkeys = Data.openpgpkeys;
|
||||
this.openpgpkeysPublic = Data.openpgpkeysPublic;
|
||||
this.openpgpkeysPrivate = Data.openpgpkeysPrivate;
|
||||
|
||||
this.openPgpKeyForDeletion = ko.observable(null).extend({'falseTimeout': 3000}).extend({'toggleSubscribe': [this,
|
||||
function (oPrev) {
|
||||
|
|
@ -37,8 +42,6 @@
|
|||
]});
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(SettingsOpenPGP, 'SettingsOpenPGP', 'SETTINGS_LABELS/LABEL_OPEN_PGP_NAME', 'openpgp');
|
||||
|
||||
SettingsOpenPGP.prototype.addOpenPgpKey = function ()
|
||||
{
|
||||
kn.showScreenPopup(PopupsAddOpenPgpKeyViewModel);
|
||||
|
|
@ -66,16 +69,16 @@
|
|||
{
|
||||
this.openPgpKeyForDeletion(null);
|
||||
|
||||
if (oOpenPgpKeyToRemove && RL.data().openpgpKeyring)
|
||||
if (oOpenPgpKeyToRemove && Data.openpgpKeyring)
|
||||
{
|
||||
this.openpgpkeys.remove(function (oOpenPgpKey) {
|
||||
return oOpenPgpKeyToRemove === oOpenPgpKey;
|
||||
});
|
||||
|
||||
RL.data().openpgpKeyring[oOpenPgpKeyToRemove.isPrivate ? 'privateKeys' : 'publicKeys']
|
||||
Data.openpgpKeyring[oOpenPgpKeyToRemove.isPrivate ? 'privateKeys' : 'publicKeys']
|
||||
.removeForId(oOpenPgpKeyToRemove.guid);
|
||||
|
||||
RL.data().openpgpKeyring.store();
|
||||
Data.openpgpKeyring.store();
|
||||
|
||||
RL.reloadOpenPgpKeys();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
var
|
||||
ko = require('../External/ko.js'),
|
||||
|
||||
Enums = require('../Common/Utils.js'),
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Globals = require('../Common/Globals.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
|
||||
|
|
@ -50,8 +50,6 @@
|
|||
this.onSecretResult = _.bind(this.onSecretResult, this);
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(SettingsSecurity, 'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security');
|
||||
|
||||
SettingsSecurity.prototype.showSecret = function ()
|
||||
{
|
||||
this.secreting(true);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,11 @@
|
|||
'use strict';
|
||||
|
||||
var
|
||||
Utils = require('../Common/Utils.js')
|
||||
Utils = require('../Common/Utils.js'),
|
||||
|
||||
Data = require('../Storages/WebMailDataStorage.js'),
|
||||
|
||||
RL = require('../Boots/RainLoopApp.js')
|
||||
;
|
||||
|
||||
/**
|
||||
|
|
@ -13,25 +17,23 @@
|
|||
*/
|
||||
function SettingsSocial()
|
||||
{
|
||||
var oData = RL.data();
|
||||
this.googleEnable = Data.googleEnable;
|
||||
|
||||
this.googleEnable = oData.googleEnable;
|
||||
this.googleActions = Data.googleActions;
|
||||
this.googleLoggined = Data.googleLoggined;
|
||||
this.googleUserName = Data.googleUserName;
|
||||
|
||||
this.googleActions = oData.googleActions;
|
||||
this.googleLoggined = oData.googleLoggined;
|
||||
this.googleUserName = oData.googleUserName;
|
||||
this.facebookEnable = Data.facebookEnable;
|
||||
|
||||
this.facebookEnable = oData.facebookEnable;
|
||||
this.facebookActions = Data.facebookActions;
|
||||
this.facebookLoggined = Data.facebookLoggined;
|
||||
this.facebookUserName = Data.facebookUserName;
|
||||
|
||||
this.facebookActions = oData.facebookActions;
|
||||
this.facebookLoggined = oData.facebookLoggined;
|
||||
this.facebookUserName = oData.facebookUserName;
|
||||
this.twitterEnable = Data.twitterEnable;
|
||||
|
||||
this.twitterEnable = oData.twitterEnable;
|
||||
|
||||
this.twitterActions = oData.twitterActions;
|
||||
this.twitterLoggined = oData.twitterLoggined;
|
||||
this.twitterUserName = oData.twitterUserName;
|
||||
this.twitterActions = Data.twitterActions;
|
||||
this.twitterLoggined = Data.twitterLoggined;
|
||||
this.twitterUserName = Data.twitterUserName;
|
||||
|
||||
this.connectGoogle = Utils.createCommand(this, function () {
|
||||
if (!this.googleLoggined())
|
||||
|
|
@ -73,8 +75,6 @@
|
|||
});
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(SettingsSocial, 'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social');
|
||||
|
||||
module.exports = SettingsSocial;
|
||||
|
||||
}(module));
|
||||
|
|
@ -12,7 +12,8 @@
|
|||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
LinkBuilder = require('../Common/LinkBuilder.js'),
|
||||
|
||||
|
||||
Data = require('../Storages/WebMailDataStorage.js'),
|
||||
Remote = require('../Storages/WebMailAjaxRemoteStorage.js')
|
||||
;
|
||||
|
||||
|
|
@ -21,12 +22,9 @@
|
|||
*/
|
||||
function SettingsThemes()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
oData = RL.data()
|
||||
;
|
||||
var self = this;
|
||||
|
||||
this.mainTheme = oData.mainTheme;
|
||||
this.mainTheme = Data.mainTheme;
|
||||
this.themesObjects = ko.observableArray([]);
|
||||
|
||||
this.themeTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100});
|
||||
|
|
@ -34,7 +32,7 @@
|
|||
this.oLastAjax = null;
|
||||
this.iTimer = 0;
|
||||
|
||||
RL.data().theme.subscribe(function (sValue) {
|
||||
Data.theme.subscribe(function (sValue) {
|
||||
|
||||
_.each(this.themesObjects(), function (oTheme) {
|
||||
oTheme.selected(sValue === oTheme.name);
|
||||
|
|
@ -116,12 +114,10 @@
|
|||
}, this);
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(SettingsThemes, 'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes');
|
||||
|
||||
SettingsThemes.prototype.onBuild = function ()
|
||||
{
|
||||
var sCurrentTheme = RL.data().theme();
|
||||
this.themesObjects(_.map(RL.data().themes(), function (sTheme) {
|
||||
var sCurrentTheme = Data.theme();
|
||||
this.themesObjects(_.map(Data.themes(), function (sTheme) {
|
||||
return {
|
||||
'name': sTheme,
|
||||
'nameDisplay': Utils.convertThemeName(sTheme),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue