mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-04 05:52:44 +08:00
06274c6a7c
Fixed owncloud password encoder/decoder (#291) Fixed ckeditor in ownCloud iframe (Closes #302) Release commit
103 lines
No EOL
2.2 KiB
JavaScript
103 lines
No EOL
2.2 KiB
JavaScript
|
|
(function () {
|
|
|
|
'use strict';
|
|
|
|
var
|
|
_ = require('_'),
|
|
ko = require('ko'),
|
|
|
|
Enums = require('Common/Enums'),
|
|
Utils = require('Common/Utils'),
|
|
HtmlEditor = require('Common/HtmlEditor'),
|
|
|
|
Data = require('Storage/App/Data'),
|
|
Remote = require('Storage/App/Remote')
|
|
;
|
|
|
|
/**
|
|
* @constructor
|
|
*/
|
|
function IdentityAppSetting()
|
|
{
|
|
this.editor = null;
|
|
|
|
this.displayName = Data.displayName;
|
|
this.signature = Data.signature;
|
|
this.signatureToAll = Data.signatureToAll;
|
|
this.replyTo = Data.replyTo;
|
|
|
|
this.signatureDom = ko.observable(null);
|
|
|
|
this.displayNameTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
this.replyTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
this.signatureTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
}
|
|
|
|
IdentityAppSetting.prototype.onFocus = function ()
|
|
{
|
|
if (!this.editor && this.signatureDom())
|
|
{
|
|
var
|
|
self = this,
|
|
sSignature = Data.signature()
|
|
;
|
|
|
|
this.editor = new HtmlEditor(self.signatureDom(), function () {
|
|
Data.signature(
|
|
(self.editor.isHtml() ? ':HTML:' : '') + self.editor.getData()
|
|
);
|
|
}, function () {
|
|
if (':HTML:' === sSignature.substr(0, 6))
|
|
{
|
|
self.editor.setHtml(sSignature.substr(6), false);
|
|
}
|
|
else
|
|
{
|
|
self.editor.setPlain(sSignature, false);
|
|
}
|
|
});
|
|
}
|
|
};
|
|
|
|
IdentityAppSetting.prototype.onBuild = function ()
|
|
{
|
|
var self = this;
|
|
_.delay(function () {
|
|
|
|
var
|
|
f1 = Utils.settingsSaveHelperSimpleFunction(self.displayNameTrigger, self),
|
|
f2 = Utils.settingsSaveHelperSimpleFunction(self.replyTrigger, self),
|
|
f3 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self)
|
|
;
|
|
|
|
Data.displayName.subscribe(function (sValue) {
|
|
Remote.saveSettings(f1, {
|
|
'DisplayName': sValue
|
|
});
|
|
});
|
|
|
|
Data.replyTo.subscribe(function (sValue) {
|
|
Remote.saveSettings(f2, {
|
|
'ReplyTo': sValue
|
|
});
|
|
});
|
|
|
|
Data.signature.subscribe(function (sValue) {
|
|
Remote.saveSettings(f3, {
|
|
'Signature': sValue
|
|
});
|
|
});
|
|
|
|
Data.signatureToAll.subscribe(function (bValue) {
|
|
Remote.saveSettings(null, {
|
|
'SignatureToAll': bValue ? '1' : '0'
|
|
});
|
|
});
|
|
|
|
}, 50);
|
|
};
|
|
|
|
module.exports = IdentityAppSetting;
|
|
|
|
}()); |