mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 19:49:20 +03:00
OpenPGP (Compose) (#53) UNSTABLE
This commit is contained in:
parent
2bf7c2e033
commit
67b5a72a71
22 changed files with 496 additions and 247 deletions
64
dev/ViewModels/PopupsComposeOpenPgpViewModel.js
Normal file
64
dev/ViewModels/PopupsComposeOpenPgpViewModel.js
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractViewModel
|
||||
*/
|
||||
function PopupsComposeOpenPgpViewModel()
|
||||
{
|
||||
KnoinAbstractViewModel.call(this, 'Popups', 'PopupsComposeOpenPgp');
|
||||
|
||||
this.notification = ko.observable('');
|
||||
|
||||
this.sign = ko.observable(true);
|
||||
this.encrypt = ko.observable(true);
|
||||
|
||||
this.password = ko.observable('');
|
||||
this.password.focus = ko.observable(true);
|
||||
|
||||
// commands
|
||||
this.doCommand = Utils.createCommand(this, function () {
|
||||
|
||||
this.cancelCommand();
|
||||
|
||||
}, function () {
|
||||
return '' === this.notification();
|
||||
});
|
||||
|
||||
Knoin.constructorEnd(this);
|
||||
}
|
||||
|
||||
Utils.extendAsViewModel('PopupsComposeOpenPgpViewModel', PopupsComposeOpenPgpViewModel);
|
||||
|
||||
PopupsComposeOpenPgpViewModel.prototype.clearPopup = function ()
|
||||
{
|
||||
this.notification('');
|
||||
|
||||
this.password('');
|
||||
this.password.focus(false);
|
||||
};
|
||||
|
||||
PopupsComposeOpenPgpViewModel.prototype.onHide = function ()
|
||||
{
|
||||
this.clearPopup();
|
||||
};
|
||||
|
||||
PopupsComposeOpenPgpViewModel.prototype.onShow = function (fCallback, sText, sFromEmail, sTo, sCc, sBcc)
|
||||
{
|
||||
this.clearPopup();
|
||||
|
||||
if ('' === sTo + sCc + sBcc)
|
||||
{
|
||||
this.notification('Please specify at least one recipient');
|
||||
}
|
||||
|
||||
// TODO
|
||||
};
|
||||
|
||||
PopupsComposeOpenPgpViewModel.prototype.onFocus = function ()
|
||||
{
|
||||
if (this.sign())
|
||||
{
|
||||
this.password.focus(true);
|
||||
}
|
||||
};
|
||||
|
|
@ -28,6 +28,8 @@ function PopupsComposeViewModel()
|
|||
}
|
||||
;
|
||||
|
||||
this.allowOpenPGP = oRainLoopData.allowOpenPGP;
|
||||
|
||||
this.resizer = ko.observable(false).extend({'throttle': 50});
|
||||
|
||||
this.to = ko.observable('');
|
||||
|
|
@ -37,6 +39,7 @@ function PopupsComposeViewModel()
|
|||
|
||||
this.replyTo = ko.observable('');
|
||||
this.subject = ko.observable('');
|
||||
this.isHtml = ko.observable(false);
|
||||
|
||||
this.requestReadReceipt = ko.observable(false);
|
||||
|
||||
|
|
@ -355,6 +358,23 @@ function PopupsComposeViewModel()
|
|||
|
||||
Utils.extendAsViewModel('PopupsComposeViewModel', PopupsComposeViewModel);
|
||||
|
||||
PopupsComposeViewModel.prototype.openOpenPgpPopup = function ()
|
||||
{
|
||||
if (this.allowOpenPGP() && this.oEditor && !this.oEditor.isHtml())
|
||||
{
|
||||
kn.showScreenPopup(PopupsComposeOpenPgpViewModel, [
|
||||
function () {
|
||||
|
||||
},
|
||||
this.oEditor.getData(),
|
||||
this.currentIdentityResultEmail(),
|
||||
this.to(),
|
||||
this.cc(),
|
||||
this.bcc()
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
||||
PopupsComposeViewModel.prototype.reloadDraftFolder = function ()
|
||||
{
|
||||
var sDraftFolder = RL.data().draftFolder();
|
||||
|
|
@ -597,6 +617,8 @@ PopupsComposeViewModel.prototype.editor = function (fOnInit)
|
|||
_.delay(function () {
|
||||
self.oEditor = new NewHtmlEditorWrapper(self.composeEditorArea(), null, function () {
|
||||
fOnInit(self.oEditor);
|
||||
}, function (bHtml) {
|
||||
self.isHtml(!!bHtml);
|
||||
});
|
||||
}, 300);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue