mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
OpenPGP (Compose) (#53) UNSTABLE
This commit is contained in:
parent
2bf7c2e033
commit
67b5a72a71
22 changed files with 496 additions and 247 deletions
|
|
@ -282,6 +282,7 @@ module.exports = function (grunt) {
|
|||
"dev/ViewModels/PopupsAddOpenPgpKeyViewModel.js",
|
||||
"dev/ViewModels/PopupsViewOpenPgpKeyViewModel.js",
|
||||
"dev/ViewModels/PopupsGenerateNewOpenPgpKeyViewModel.js",
|
||||
"dev/ViewModels/PopupsComposeOpenPgpViewModel.js",
|
||||
"dev/ViewModels/PopupsIdentityViewModel.js",
|
||||
"dev/ViewModels/PopupsLanguagesViewModel.js",
|
||||
"dev/ViewModels/PopupsAskViewModel.js",
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ RainLoopApp.prototype.folders = function (fCallback)
|
|||
|
||||
RainLoopApp.prototype.reloadOpenPgpKeys = function ()
|
||||
{
|
||||
if (Globals.bAllowOpenPGP)
|
||||
if (RL.data().allowOpenPGP())
|
||||
{
|
||||
var
|
||||
aKeys = [],
|
||||
|
|
@ -963,8 +963,8 @@ RainLoopApp.prototype.bootstart = function ()
|
|||
if (window.openpgp)
|
||||
{
|
||||
RL.data().openpgpKeyring = new window.openpgp.Keyring(new OpenPgpLocalStorageDriver());
|
||||
RL.data().allowOpenPGP(true);
|
||||
|
||||
Globals.bAllowOpenPGP = true;
|
||||
RL.pub('openpgp.init');
|
||||
|
||||
RL.reloadOpenPgpKeys();
|
||||
|
|
@ -974,7 +974,7 @@ RainLoopApp.prototype.bootstart = function ()
|
|||
}
|
||||
else
|
||||
{
|
||||
Globals.bAllowOpenPGP = false;
|
||||
RL.data().allowOpenPGP(false);
|
||||
}
|
||||
|
||||
kn.startScreens([MailBoxScreen, SettingsScreen]);
|
||||
|
|
|
|||
|
|
@ -65,11 +65,6 @@ Globals.bDisableNanoScroll = Globals.bMobileDevice;
|
|||
*/
|
||||
Globals.bAllowPdfPreview = !Globals.bMobileDevice;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bAllowOpenPGP = false;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -456,7 +456,11 @@ ko.bindingHandlers.emailsTags = {
|
|||
'parseHook': function (aInput) {
|
||||
return _.map(aInput, function (sInputValue) {
|
||||
|
||||
var sValue = Utils.trim(sInputValue), oEmail = null;
|
||||
var
|
||||
sValue = Utils.trim(sInputValue),
|
||||
oEmail = null
|
||||
;
|
||||
|
||||
if ('' !== sValue)
|
||||
{
|
||||
oEmail = new EmailModel();
|
||||
|
|
|
|||
|
|
@ -4,14 +4,16 @@
|
|||
* @param {Object} oElement
|
||||
* @param {Function=} fOnBlur
|
||||
* @param {Function=} fOnReady
|
||||
* @param {Function=} fOnModeChange
|
||||
*/
|
||||
function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady)
|
||||
function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady, fOnModeChange)
|
||||
{
|
||||
var self = this;
|
||||
self.editor = null;
|
||||
self.iBlurTimer = 0;
|
||||
self.fOnBlur = fOnBlur || null;
|
||||
self.fOnReady = fOnReady || null;
|
||||
self.fOnModeChange = fOnModeChange || null;
|
||||
|
||||
self.$element = $(oElement);
|
||||
|
||||
|
|
@ -162,6 +164,11 @@ NewHtmlEditorWrapper.prototype.init = function ()
|
|||
|
||||
self.editor.on('mode', function() {
|
||||
self.blurTrigger();
|
||||
|
||||
if (self.fOnModeChange)
|
||||
{
|
||||
self.fOnModeChange('plain' !== self.editor.mode);
|
||||
}
|
||||
});
|
||||
|
||||
self.editor.on('focus', function() {
|
||||
|
|
|
|||
|
|
@ -359,7 +359,7 @@ MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
|
|||
this.sInReplyTo = oJsonMessage.InReplyTo;
|
||||
this.sReferences = oJsonMessage.References;
|
||||
|
||||
if (Globals.bAllowOpenPGP)
|
||||
if (RL.data().allowOpenPGP())
|
||||
{
|
||||
this.isPgpSigned(!!oJsonMessage.PgpSigned);
|
||||
this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted);
|
||||
|
|
|
|||
|
|
@ -344,6 +344,7 @@ function WebMailDataStorage()
|
|||
// other
|
||||
this.useKeyboardShortcuts = ko.observable(true);
|
||||
|
||||
this.allowOpenPGP = ko.observable(false);
|
||||
this.openpgpkeys = ko.observableArray([]);
|
||||
this.openpgpKeyring = null;
|
||||
|
||||
|
|
@ -868,7 +869,8 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached)
|
|||
bIsHtml = false;
|
||||
sPlain = oData.Result.Plain.toString();
|
||||
|
||||
if (Globals.bAllowOpenPGP && (oMessage.isPgpSigned() || oMessage.isPgpEncrypted()) &&
|
||||
if ((oMessage.isPgpSigned() || oMessage.isPgpEncrypted()) &&
|
||||
RL.data().allowOpenPGP() &&
|
||||
Utils.isNormal(oData.Result.PlainRaw))
|
||||
{
|
||||
bPgpEncrypted = /---BEGIN PGP MESSAGE---/.test(oData.Result.PlainRaw);
|
||||
|
|
@ -968,7 +970,7 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached)
|
|||
}
|
||||
}
|
||||
|
||||
if (Globals.bAllowOpenPGP && oMessage.body)
|
||||
if (oMessage.body && RL.data().allowOpenPGP())
|
||||
{
|
||||
oMessage.isPgpSigned(!!oMessage.body.data('rl-plain-pgp-signed'));
|
||||
oMessage.isPgpEncrypted(!!oMessage.body.data('rl-plain-pgp-encrypted'));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
.popups {
|
||||
.b-open-pgp-key-view-content, .b-open-pgp-key-generate-content, .b-open-pgp-key-add-content {
|
||||
.b-open-pgp-key-view-content, .b-open-pgp-key-generate-content, .b-open-pgp-key-add-content, .b-compose-open-pgp-content {
|
||||
|
||||
.modal-header {
|
||||
background-color: #fff;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@ select {
|
|||
padding-right: 12px;
|
||||
}
|
||||
|
||||
.btn-group.btn-group-custom-margin > .btn + .btn {
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
.border-radius(@btnBorderRadius);
|
||||
}
|
||||
|
|
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,12 +21,11 @@
|
|||
</ul>
|
||||
</div>
|
||||
<div class="btn-group"> </div>
|
||||
<div class="btn-group">
|
||||
<div class="btn-group btn-group-custom-margin">
|
||||
<a class="btn btn-danger buttonDelete" data-placement="bottom" data-bind="command: deleteCommand, tooltip: 'MESSAGE_LIST/BUTTON_DELETE'">
|
||||
<i class="icon-trash icon-white"></i>
|
||||
<span data-bind="text: 1 < messageListCheckedOrSelectedUidsWithSubMails().length ? ' (' + messageListCheckedOrSelectedUidsWithSubMails().length + ')' : ''"></span>
|
||||
</a>
|
||||
<!--<span style="font-size:10px;" data-bind="visible: !isSpamFolder() && !isSpamDisabled()"> </span>-->
|
||||
<a class="btn buttonSpam" data-placement="bottom" data-bind="visible: !isSpamFolder() && !isSpamDisabled(), command: spamCommand, tooltip: 'MESSAGE_LIST/BUTTON_SPAM'">
|
||||
<i class="icon-bug"></i>
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -25,11 +25,10 @@
|
|||
</a>
|
||||
</div>
|
||||
<div class="btn-group"> </div>
|
||||
<div class="btn-group">
|
||||
<div class="btn-group btn-group-custom-margin">
|
||||
<a class="btn btn-danger buttonDelete" data-placement="bottom" data-bind="command: $root.deleteCommand, tooltip: 'MESSAGE/BUTTON_DELETE'">
|
||||
<i class="icon-trash icon-white"></i>
|
||||
</a>
|
||||
<!--<span style="font-size:10px;" data-bind="visible: !$root.isDraftFolder()"> </span>-->
|
||||
<a class="btn buttonSpam" data-placement="bottom" data-bind="visible: !$root.isDraftFolder(), command: $root.spamCommand, tooltip: 'MESSAGE/BUTTON_SPAM'">
|
||||
<i class="icon-bug"></i>
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -119,6 +119,14 @@
|
|||
<span class="i18n" data-i18n-text="COMPOSE/BUTTON_REQUEST_READ_RECEIPT"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li class="e-item" data-bind="visible: allowOpenPGP, click: openOpenPgpPopup, css: {'disable': isHtml()}">
|
||||
<a class="e-link">
|
||||
<i class="icon-key"></i>
|
||||
|
||||
OpenPGP (Plain Text Only)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="btn-group pull-right"> </div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
<div class="popups">
|
||||
<div class="modal hide b-compose-open-pgp-content g-ui-user-select-none" data-bind="modal: modalVisibility">
|
||||
<div>
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-bind="command: cancelCommand">×</button>
|
||||
<h3>
|
||||
<span class="i18n" data-i18n-text="POPUPS_COMPOSE_OPEN_PGP/TITLE_COMPOSE_OPEN_PGP"></span>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-horizontal">
|
||||
<div class="alert" data-bind="visible: '' !== notification()">
|
||||
<span data-bind="text: notification"></span>
|
||||
</div>
|
||||
<br />
|
||||
<div class="control-group">
|
||||
<label data-bind="click: function () { sign(!sign()); }">
|
||||
<i data-bind="css: sign() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
|
||||
|
||||
<span class="i18n" data-i18n-text="POPUPS_COMPOSE_OPEN_PGP/LABEL_SIGN"></span>
|
||||
</label>
|
||||
<label data-bind="click: function () { encrypt(!encrypt()); }">
|
||||
<i data-bind="css: encrypt() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
|
||||
|
||||
<span class="i18n" data-i18n-text="POPUPS_COMPOSE_OPEN_PGP/LABEL_ENCRYPT"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="i18n control-label" data-i18n-text="POPUPS_COMPOSE_OPEN_PGP/LABEL_PASSWORD"></label>
|
||||
<div class="controls">
|
||||
<input class="inputPassword input-large" type="password" autocomplete="off"
|
||||
data-bind="value: password, hasfocus: password.focus" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a class="btn buttonDo" data-bind="command: doCommand">
|
||||
<i class="icon-key"></i>
|
||||
|
||||
<span class="i18n" data-i18n-text="POPUPS_COMPOSE_OPEN_PGP/BUTTON_DO"></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -5438,6 +5438,9 @@ select {
|
|||
padding-left: 12px;
|
||||
padding-right: 12px;
|
||||
}
|
||||
.btn-group.btn-group-custom-margin > .btn + .btn {
|
||||
margin-left: 0px;
|
||||
}
|
||||
.dropdown-menu {
|
||||
-webkit-border-radius: 2px;
|
||||
-moz-border-radius: 2px;
|
||||
|
|
@ -6552,22 +6555,26 @@ html.rl-no-preview-pane #rl-right .ui-resizable-handle {
|
|||
}
|
||||
.popups .b-open-pgp-key-view-content .modal-header,
|
||||
.popups .b-open-pgp-key-generate-content .modal-header,
|
||||
.popups .b-open-pgp-key-add-content .modal-header {
|
||||
.popups .b-open-pgp-key-add-content .modal-header,
|
||||
.popups .b-compose-open-pgp-content .modal-header {
|
||||
background-color: #fff;
|
||||
}
|
||||
.popups .b-open-pgp-key-view-content.modal,
|
||||
.popups .b-open-pgp-key-generate-content.modal,
|
||||
.popups .b-open-pgp-key-add-content.modal {
|
||||
.popups .b-open-pgp-key-add-content.modal,
|
||||
.popups .b-compose-open-pgp-content.modal {
|
||||
width: 570px;
|
||||
}
|
||||
.popups .b-open-pgp-key-view-content .inputKey,
|
||||
.popups .b-open-pgp-key-generate-content .inputKey,
|
||||
.popups .b-open-pgp-key-add-content .inputKey {
|
||||
.popups .b-open-pgp-key-add-content .inputKey,
|
||||
.popups .b-compose-open-pgp-content .inputKey {
|
||||
font-family: Monaco, Menlo, Consolas, "Courier New", monospace;
|
||||
}
|
||||
.popups .b-open-pgp-key-view-content .key-viewer,
|
||||
.popups .b-open-pgp-key-generate-content .key-viewer,
|
||||
.popups .b-open-pgp-key-add-content .key-viewer {
|
||||
.popups .b-open-pgp-key-add-content .key-viewer,
|
||||
.popups .b-compose-open-pgp-content .key-viewer {
|
||||
max-height: 500px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
|
|
|||
2
rainloop/v/0.0.0/static/css/app.min.css
vendored
2
rainloop/v/0.0.0/static/css/app.min.css
vendored
File diff suppressed because one or more lines are too long
|
|
@ -143,11 +143,6 @@ Globals.bDisableNanoScroll = Globals.bMobileDevice;
|
|||
*/
|
||||
Globals.bAllowPdfPreview = !Globals.bMobileDevice;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bAllowOpenPGP = false;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
|
|
@ -3025,7 +3020,11 @@ ko.bindingHandlers.emailsTags = {
|
|||
'parseHook': function (aInput) {
|
||||
return _.map(aInput, function (sInputValue) {
|
||||
|
||||
var sValue = Utils.trim(sInputValue), oEmail = null;
|
||||
var
|
||||
sValue = Utils.trim(sInputValue),
|
||||
oEmail = null
|
||||
;
|
||||
|
||||
if ('' !== sValue)
|
||||
{
|
||||
oEmail = new EmailModel();
|
||||
|
|
|
|||
8
rainloop/v/0.0.0/static/js/admin.min.js
vendored
8
rainloop/v/0.0.0/static/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -143,11 +143,6 @@ Globals.bDisableNanoScroll = Globals.bMobileDevice;
|
|||
*/
|
||||
Globals.bAllowPdfPreview = !Globals.bMobileDevice;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bAllowOpenPGP = false;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
|
|
@ -3025,7 +3020,11 @@ ko.bindingHandlers.emailsTags = {
|
|||
'parseHook': function (aInput) {
|
||||
return _.map(aInput, function (sInputValue) {
|
||||
|
||||
var sValue = Utils.trim(sInputValue), oEmail = null;
|
||||
var
|
||||
sValue = Utils.trim(sInputValue),
|
||||
oEmail = null
|
||||
;
|
||||
|
||||
if ('' !== sValue)
|
||||
{
|
||||
oEmail = new EmailModel();
|
||||
|
|
@ -3606,13 +3605,14 @@ Plugins.settingsGet = function (sPluginSection, sName)
|
|||
|
||||
|
||||
|
||||
function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady)
|
||||
function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady, fOnModeChange)
|
||||
{
|
||||
var self = this;
|
||||
self.editor = null;
|
||||
self.iBlurTimer = 0;
|
||||
self.fOnBlur = fOnBlur || null;
|
||||
self.fOnReady = fOnReady || null;
|
||||
self.fOnModeChange = fOnModeChange || null;
|
||||
|
||||
self.$element = $(oElement);
|
||||
|
||||
|
|
@ -3763,6 +3763,11 @@ NewHtmlEditorWrapper.prototype.init = function ()
|
|||
|
||||
self.editor.on('mode', function() {
|
||||
self.blurTrigger();
|
||||
|
||||
if (self.fOnModeChange)
|
||||
{
|
||||
self.fOnModeChange('plain' !== self.editor.mode);
|
||||
}
|
||||
});
|
||||
|
||||
self.editor.on('focus', function() {
|
||||
|
|
@ -6321,7 +6326,7 @@ MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
|
|||
this.sInReplyTo = oJsonMessage.InReplyTo;
|
||||
this.sReferences = oJsonMessage.References;
|
||||
|
||||
if (Globals.bAllowOpenPGP)
|
||||
if (RL.data().allowOpenPGP())
|
||||
{
|
||||
this.isPgpSigned(!!oJsonMessage.PgpSigned);
|
||||
this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted);
|
||||
|
|
@ -7699,6 +7704,8 @@ function PopupsComposeViewModel()
|
|||
}
|
||||
;
|
||||
|
||||
this.allowOpenPGP = oRainLoopData.allowOpenPGP;
|
||||
|
||||
this.resizer = ko.observable(false).extend({'throttle': 50});
|
||||
|
||||
this.to = ko.observable('');
|
||||
|
|
@ -7708,6 +7715,7 @@ function PopupsComposeViewModel()
|
|||
|
||||
this.replyTo = ko.observable('');
|
||||
this.subject = ko.observable('');
|
||||
this.isHtml = ko.observable(false);
|
||||
|
||||
this.requestReadReceipt = ko.observable(false);
|
||||
|
||||
|
|
@ -8026,6 +8034,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();
|
||||
|
|
@ -8268,6 +8293,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);
|
||||
}
|
||||
|
|
@ -10191,6 +10218,69 @@ PopupsGenerateNewOpenPgpKeyViewModel.prototype.onFocus = function ()
|
|||
this.email.focus(true);
|
||||
};
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractViewModel
|
||||
|
|
@ -13716,6 +13806,7 @@ function WebMailDataStorage()
|
|||
// other
|
||||
this.useKeyboardShortcuts = ko.observable(true);
|
||||
|
||||
this.allowOpenPGP = ko.observable(false);
|
||||
this.openpgpkeys = ko.observableArray([]);
|
||||
this.openpgpKeyring = null;
|
||||
|
||||
|
|
@ -14240,7 +14331,8 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached)
|
|||
bIsHtml = false;
|
||||
sPlain = oData.Result.Plain.toString();
|
||||
|
||||
if (Globals.bAllowOpenPGP && (oMessage.isPgpSigned() || oMessage.isPgpEncrypted()) &&
|
||||
if ((oMessage.isPgpSigned() || oMessage.isPgpEncrypted()) &&
|
||||
RL.data().allowOpenPGP() &&
|
||||
Utils.isNormal(oData.Result.PlainRaw))
|
||||
{
|
||||
bPgpEncrypted = /---BEGIN PGP MESSAGE---/.test(oData.Result.PlainRaw);
|
||||
|
|
@ -14340,7 +14432,7 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached)
|
|||
}
|
||||
}
|
||||
|
||||
if (Globals.bAllowOpenPGP && oMessage.body)
|
||||
if (oMessage.body && RL.data().allowOpenPGP())
|
||||
{
|
||||
oMessage.isPgpSigned(!!oMessage.body.data('rl-plain-pgp-signed'));
|
||||
oMessage.isPgpEncrypted(!!oMessage.body.data('rl-plain-pgp-encrypted'));
|
||||
|
|
@ -16909,7 +17001,7 @@ RainLoopApp.prototype.folders = function (fCallback)
|
|||
|
||||
RainLoopApp.prototype.reloadOpenPgpKeys = function ()
|
||||
{
|
||||
if (Globals.bAllowOpenPGP)
|
||||
if (RL.data().allowOpenPGP())
|
||||
{
|
||||
var
|
||||
aKeys = [],
|
||||
|
|
@ -17548,8 +17640,8 @@ RainLoopApp.prototype.bootstart = function ()
|
|||
if (window.openpgp)
|
||||
{
|
||||
RL.data().openpgpKeyring = new window.openpgp.Keyring(new OpenPgpLocalStorageDriver());
|
||||
RL.data().allowOpenPGP(true);
|
||||
|
||||
Globals.bAllowOpenPGP = true;
|
||||
RL.pub('openpgp.init');
|
||||
|
||||
RL.reloadOpenPgpKeys();
|
||||
|
|
@ -17559,7 +17651,7 @@ RainLoopApp.prototype.bootstart = function ()
|
|||
}
|
||||
else
|
||||
{
|
||||
Globals.bAllowOpenPGP = false;
|
||||
RL.data().allowOpenPGP(false);
|
||||
}
|
||||
|
||||
kn.startScreens([MailBoxScreen, SettingsScreen]);
|
||||
|
|
|
|||
16
rainloop/v/0.0.0/static/js/app.min.js
vendored
16
rainloop/v/0.0.0/static/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue