mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
OpenPGP - part 3 - unstable (#53)
This commit is contained in:
parent
0bb69d4494
commit
3d3ad8d459
14 changed files with 456 additions and 206 deletions
64
dev/ViewModels/PopupsPgpKey.js
Normal file
64
dev/ViewModels/PopupsPgpKey.js
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractViewModel
|
||||
*/
|
||||
function PopupsPgpKey()
|
||||
{
|
||||
KnoinAbstractViewModel.call(this, 'Popups', 'PopupsPgpKey');
|
||||
|
||||
this.key = ko.observable('');
|
||||
this.passphrase = ko.observable('');
|
||||
|
||||
this.bPrivate = null;
|
||||
this.fCallback = null;
|
||||
|
||||
// commands
|
||||
this.sendPgp = Utils.createCommand(this, function () {
|
||||
|
||||
var sKey = Utils.trim(this.key());
|
||||
if (this.fCallback && sKey)
|
||||
{
|
||||
this.fCallback(this.passphrase(), sKey);
|
||||
}
|
||||
|
||||
this.cancelCommand();
|
||||
});
|
||||
|
||||
Knoin.constructorEnd(this);
|
||||
}
|
||||
|
||||
Utils.extendAsViewModel('PopupsPgpKey', PopupsPgpKey);
|
||||
|
||||
PopupsPgpKey.prototype.clearPopup = function ()
|
||||
{
|
||||
// this.key('');
|
||||
// this.passphrase('');
|
||||
|
||||
this.bPrivate = null;
|
||||
this.fCallback = null;
|
||||
};
|
||||
|
||||
PopupsPgpKey.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
$window.on('keydown', function (oEvent) {
|
||||
var bResult = true;
|
||||
if (oEvent && self.modalVisibility() && Enums.EventKeyCode.Esc === oEvent.keyCode)
|
||||
{
|
||||
Utils.delegateRun(self, 'closeCommand');
|
||||
bResult = false;
|
||||
}
|
||||
|
||||
return bResult;
|
||||
});
|
||||
};
|
||||
|
||||
PopupsPgpKey.prototype.onShow = function (bPrivate, fCallback)
|
||||
{
|
||||
this.clearPopup();
|
||||
|
||||
this.bPrivate = bPrivate;
|
||||
this.fCallback = fCallback;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue