2013-11-16 06:21:12 +08:00
|
|
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @constructor
|
|
|
|
*/
|
2013-11-19 06:29:13 +08:00
|
|
|
function SettingsIdentity()
|
2013-11-16 06:21:12 +08:00
|
|
|
{
|
|
|
|
var oData = RL.data();
|
|
|
|
|
|
|
|
this.displayName = oData.displayName;
|
|
|
|
this.signature = oData.signature;
|
2013-11-19 06:29:13 +08:00
|
|
|
this.replyTo = oData.replyTo;
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2013-11-19 06:29:13 +08:00
|
|
|
this.displayNameTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
2013-11-16 06:21:12 +08:00
|
|
|
this.replyTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
|
|
this.signatureTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
|
|
}
|
|
|
|
|
2013-11-19 06:29:13 +08:00
|
|
|
Utils.addSettingsViewModel(SettingsIdentity, 'SettingsIdentity', 'SETTINGS_LABELS/LABEL_IDENTITY_NAME', 'identity');
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2013-11-19 06:29:13 +08:00
|
|
|
SettingsIdentity.prototype.onBuild = function ()
|
2013-11-16 06:21:12 +08:00
|
|
|
{
|
|
|
|
var self = this;
|
|
|
|
_.delay(function () {
|
|
|
|
|
|
|
|
var
|
|
|
|
oData = RL.data(),
|
2013-11-19 06:29:13 +08:00
|
|
|
f1 = Utils.settingsSaveHelperSimpleFunction(self.displayNameTrigger, self),
|
2013-11-16 06:21:12 +08:00
|
|
|
f2 = Utils.settingsSaveHelperSimpleFunction(self.replyTrigger, self),
|
|
|
|
f3 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self)
|
|
|
|
;
|
|
|
|
|
|
|
|
oData.displayName.subscribe(function (sValue) {
|
|
|
|
RL.remote().saveSettings(f1, {
|
|
|
|
'DisplayName': sValue
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
oData.replyTo.subscribe(function (sValue) {
|
|
|
|
RL.remote().saveSettings(f2, {
|
|
|
|
'ReplyTo': sValue
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
oData.signature.subscribe(function (sValue) {
|
|
|
|
RL.remote().saveSettings(f3, {
|
|
|
|
'Signature': sValue
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}, 50);
|
|
|
|
};
|