mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-15 04:04:50 +08:00
60 lines
No EOL
1.4 KiB
JavaScript
60 lines
No EOL
1.4 KiB
JavaScript
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
|
|
(function (module) {
|
|
|
|
'use strict';
|
|
|
|
var
|
|
ko = require('../External/ko.js'),
|
|
|
|
Utils = require('../Common/Utils.js'),
|
|
|
|
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
|
|
|
|
Data = require('../Storages/WebMailDataStorage.js')
|
|
;
|
|
|
|
/**
|
|
* @constructor
|
|
*/
|
|
function SettingsContacts()
|
|
{
|
|
this.contactsAutosave = Data.contactsAutosave;
|
|
|
|
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 [
|
|
this.enableContactsSync() ? '1' : '0',
|
|
this.contactsSyncUrl(),
|
|
this.contactsSyncUser(),
|
|
this.contactsSyncPass()
|
|
].join('|');
|
|
}, this).extend({'throttle': 500});
|
|
|
|
this.saveTrigger.subscribe(function () {
|
|
Remote.saveContactsSyncData(null,
|
|
this.enableContactsSync(),
|
|
this.contactsSyncUrl(),
|
|
this.contactsSyncUser(),
|
|
this.contactsSyncPass()
|
|
);
|
|
}, this);
|
|
}
|
|
|
|
SettingsContacts.prototype.onBuild = function ()
|
|
{
|
|
Data.contactsAutosave.subscribe(function (bValue) {
|
|
Remote.saveSettings(Utils.emptyFunction, {
|
|
'ContactsAutosave': bValue ? '1' : '0'
|
|
});
|
|
});
|
|
};
|
|
|
|
module.exports = SettingsContacts;
|
|
|
|
}(module)); |