OpenPGP Sign/Encrypt improvements (Closes #126)

This commit is contained in:
RainLoop Team 2014-04-11 01:07:23 +04:00
parent bb16353c1f
commit cd6974ecd2
10 changed files with 87 additions and 48 deletions

View file

@ -14,7 +14,8 @@ function PopupsComposeOpenPgpViewModel()
this.encrypt = ko.observable(true);
this.password = ko.observable('');
this.password.focus = ko.observable(true);
this.password.focus = ko.observable(false);
this.buttonFocus = ko.observable(false);
this.from = ko.observable('');
this.to = ko.observableArray([]);
@ -129,6 +130,8 @@ function PopupsComposeOpenPgpViewModel()
return !this.submitRequest() && (this.sign() || this.encrypt());
});
this.sDefaultKeyScope = Enums.KeyState.PopupComposeOpenPGP;
Knoin.constructorEnd(this);
}
@ -140,6 +143,7 @@ PopupsComposeOpenPgpViewModel.prototype.clearPopup = function ()
this.password('');
this.password.focus(false);
this.buttonFocus(false);
this.from('');
this.to([]);
@ -150,11 +154,42 @@ PopupsComposeOpenPgpViewModel.prototype.clearPopup = function ()
this.resultCallback = null;
};
PopupsComposeOpenPgpViewModel.prototype.onBuild = function ()
{
key('tab,shift+tab', Enums.KeyState.PopupComposeOpenPGP, _.bind(function () {
switch (true)
{
case this.password.focus():
this.buttonFocus(true);
break;
case this.buttonFocus():
this.password.focus(true);
break;
}
return false;
}, this));
};
PopupsComposeOpenPgpViewModel.prototype.onHide = function ()
{
this.clearPopup();
};
PopupsComposeOpenPgpViewModel.prototype.onFocus = function ()
{
if (this.sign())
{
this.password.focus(true);
}
else
{
this.buttonFocus(true);
}
};
PopupsComposeOpenPgpViewModel.prototype.onShow = function (fCallback, sText, sFromEmail, sTo, sCc, sBcc)
{
this.clearPopup();