OpenPGP (Compose) (#53) UNSTABLE

This commit is contained in:
RainLoop Team 2014-03-20 02:39:36 +04:00
parent 2bf7c2e033
commit 67b5a72a71
22 changed files with 496 additions and 247 deletions

View file

@ -282,6 +282,7 @@ module.exports = function (grunt) {
"dev/ViewModels/PopupsAddOpenPgpKeyViewModel.js", "dev/ViewModels/PopupsAddOpenPgpKeyViewModel.js",
"dev/ViewModels/PopupsViewOpenPgpKeyViewModel.js", "dev/ViewModels/PopupsViewOpenPgpKeyViewModel.js",
"dev/ViewModels/PopupsGenerateNewOpenPgpKeyViewModel.js", "dev/ViewModels/PopupsGenerateNewOpenPgpKeyViewModel.js",
"dev/ViewModels/PopupsComposeOpenPgpViewModel.js",
"dev/ViewModels/PopupsIdentityViewModel.js", "dev/ViewModels/PopupsIdentityViewModel.js",
"dev/ViewModels/PopupsLanguagesViewModel.js", "dev/ViewModels/PopupsLanguagesViewModel.js",
"dev/ViewModels/PopupsAskViewModel.js", "dev/ViewModels/PopupsAskViewModel.js",

View file

@ -324,7 +324,7 @@ RainLoopApp.prototype.folders = function (fCallback)
RainLoopApp.prototype.reloadOpenPgpKeys = function () RainLoopApp.prototype.reloadOpenPgpKeys = function ()
{ {
if (Globals.bAllowOpenPGP) if (RL.data().allowOpenPGP())
{ {
var var
aKeys = [], aKeys = [],
@ -963,8 +963,8 @@ RainLoopApp.prototype.bootstart = function ()
if (window.openpgp) if (window.openpgp)
{ {
RL.data().openpgpKeyring = new window.openpgp.Keyring(new OpenPgpLocalStorageDriver()); RL.data().openpgpKeyring = new window.openpgp.Keyring(new OpenPgpLocalStorageDriver());
RL.data().allowOpenPGP(true);
Globals.bAllowOpenPGP = true;
RL.pub('openpgp.init'); RL.pub('openpgp.init');
RL.reloadOpenPgpKeys(); RL.reloadOpenPgpKeys();
@ -974,7 +974,7 @@ RainLoopApp.prototype.bootstart = function ()
} }
else else
{ {
Globals.bAllowOpenPGP = false; RL.data().allowOpenPGP(false);
} }
kn.startScreens([MailBoxScreen, SettingsScreen]); kn.startScreens([MailBoxScreen, SettingsScreen]);

View file

@ -65,11 +65,6 @@ Globals.bDisableNanoScroll = Globals.bMobileDevice;
*/ */
Globals.bAllowPdfPreview = !Globals.bMobileDevice; Globals.bAllowPdfPreview = !Globals.bMobileDevice;
/**
* @type {boolean}
*/
Globals.bAllowOpenPGP = false;
/** /**
* @type {boolean} * @type {boolean}
*/ */

View file

@ -456,7 +456,11 @@ ko.bindingHandlers.emailsTags = {
'parseHook': function (aInput) { 'parseHook': function (aInput) {
return _.map(aInput, function (sInputValue) { return _.map(aInput, function (sInputValue) {
var sValue = Utils.trim(sInputValue), oEmail = null; var
sValue = Utils.trim(sInputValue),
oEmail = null
;
if ('' !== sValue) if ('' !== sValue)
{ {
oEmail = new EmailModel(); oEmail = new EmailModel();

View file

@ -4,14 +4,16 @@
* @param {Object} oElement * @param {Object} oElement
* @param {Function=} fOnBlur * @param {Function=} fOnBlur
* @param {Function=} fOnReady * @param {Function=} fOnReady
* @param {Function=} fOnModeChange
*/ */
function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady) function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady, fOnModeChange)
{ {
var self = this; var self = this;
self.editor = null; self.editor = null;
self.iBlurTimer = 0; self.iBlurTimer = 0;
self.fOnBlur = fOnBlur || null; self.fOnBlur = fOnBlur || null;
self.fOnReady = fOnReady || null; self.fOnReady = fOnReady || null;
self.fOnModeChange = fOnModeChange || null;
self.$element = $(oElement); self.$element = $(oElement);
@ -162,6 +164,11 @@ NewHtmlEditorWrapper.prototype.init = function ()
self.editor.on('mode', function() { self.editor.on('mode', function() {
self.blurTrigger(); self.blurTrigger();
if (self.fOnModeChange)
{
self.fOnModeChange('plain' !== self.editor.mode);
}
}); });
self.editor.on('focus', function() { self.editor.on('focus', function() {

View file

@ -359,7 +359,7 @@ MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
this.sInReplyTo = oJsonMessage.InReplyTo; this.sInReplyTo = oJsonMessage.InReplyTo;
this.sReferences = oJsonMessage.References; this.sReferences = oJsonMessage.References;
if (Globals.bAllowOpenPGP) if (RL.data().allowOpenPGP())
{ {
this.isPgpSigned(!!oJsonMessage.PgpSigned); this.isPgpSigned(!!oJsonMessage.PgpSigned);
this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted); this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted);

View file

@ -344,6 +344,7 @@ function WebMailDataStorage()
// other // other
this.useKeyboardShortcuts = ko.observable(true); this.useKeyboardShortcuts = ko.observable(true);
this.allowOpenPGP = ko.observable(false);
this.openpgpkeys = ko.observableArray([]); this.openpgpkeys = ko.observableArray([]);
this.openpgpKeyring = null; this.openpgpKeyring = null;
@ -868,7 +869,8 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached)
bIsHtml = false; bIsHtml = false;
sPlain = oData.Result.Plain.toString(); 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)) Utils.isNormal(oData.Result.PlainRaw))
{ {
bPgpEncrypted = /---BEGIN PGP MESSAGE---/.test(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.isPgpSigned(!!oMessage.body.data('rl-plain-pgp-signed'));
oMessage.isPgpEncrypted(!!oMessage.body.data('rl-plain-pgp-encrypted')); oMessage.isPgpEncrypted(!!oMessage.body.data('rl-plain-pgp-encrypted'));

View file

@ -1,5 +1,5 @@
.popups { .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 { .modal-header {
background-color: #fff; background-color: #fff;

View file

@ -55,6 +55,10 @@ select {
padding-right: 12px; padding-right: 12px;
} }
.btn-group.btn-group-custom-margin > .btn + .btn {
margin-left: 0px;
}
.dropdown-menu { .dropdown-menu {
.border-radius(@btnBorderRadius); .border-radius(@btnBorderRadius);
} }

View 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);
}
};

View file

@ -28,6 +28,8 @@ function PopupsComposeViewModel()
} }
; ;
this.allowOpenPGP = oRainLoopData.allowOpenPGP;
this.resizer = ko.observable(false).extend({'throttle': 50}); this.resizer = ko.observable(false).extend({'throttle': 50});
this.to = ko.observable(''); this.to = ko.observable('');
@ -37,6 +39,7 @@ function PopupsComposeViewModel()
this.replyTo = ko.observable(''); this.replyTo = ko.observable('');
this.subject = ko.observable(''); this.subject = ko.observable('');
this.isHtml = ko.observable(false);
this.requestReadReceipt = ko.observable(false); this.requestReadReceipt = ko.observable(false);
@ -355,6 +358,23 @@ function PopupsComposeViewModel()
Utils.extendAsViewModel('PopupsComposeViewModel', 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 () PopupsComposeViewModel.prototype.reloadDraftFolder = function ()
{ {
var sDraftFolder = RL.data().draftFolder(); var sDraftFolder = RL.data().draftFolder();
@ -597,6 +617,8 @@ PopupsComposeViewModel.prototype.editor = function (fOnInit)
_.delay(function () { _.delay(function () {
self.oEditor = new NewHtmlEditorWrapper(self.composeEditorArea(), null, function () { self.oEditor = new NewHtmlEditorWrapper(self.composeEditorArea(), null, function () {
fOnInit(self.oEditor); fOnInit(self.oEditor);
}, function (bHtml) {
self.isHtml(!!bHtml);
}); });
}, 300); }, 300);
} }

View file

@ -21,12 +21,11 @@
</ul> </ul>
</div> </div>
<div class="btn-group">&nbsp;</div> <div class="btn-group">&nbsp;</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'"> <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> <i class="icon-trash icon-white"></i>
<span data-bind="text: 1 < messageListCheckedOrSelectedUidsWithSubMails().length ? ' (' + messageListCheckedOrSelectedUidsWithSubMails().length + ')' : ''"></span> <span data-bind="text: 1 < messageListCheckedOrSelectedUidsWithSubMails().length ? ' (' + messageListCheckedOrSelectedUidsWithSubMails().length + ')' : ''"></span>
</a> </a>
<!--<span style="font-size:10px;" data-bind="visible: !isSpamFolder() && !isSpamDisabled()">&nbsp;</span>-->
<a class="btn buttonSpam" data-placement="bottom" data-bind="visible: !isSpamFolder() && !isSpamDisabled(), command: spamCommand, tooltip: 'MESSAGE_LIST/BUTTON_SPAM'"> <a class="btn buttonSpam" data-placement="bottom" data-bind="visible: !isSpamFolder() && !isSpamDisabled(), command: spamCommand, tooltip: 'MESSAGE_LIST/BUTTON_SPAM'">
<i class="icon-bug"></i> <i class="icon-bug"></i>
</a> </a>

View file

@ -25,11 +25,10 @@
</a> </a>
</div> </div>
<div class="btn-group">&nbsp;</div> <div class="btn-group">&nbsp;</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'"> <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> <i class="icon-trash icon-white"></i>
</a> </a>
<!--<span style="font-size:10px;" data-bind="visible: !$root.isDraftFolder()">&nbsp;</span>-->
<a class="btn buttonSpam" data-placement="bottom" data-bind="visible: !$root.isDraftFolder(), command: $root.spamCommand, tooltip: 'MESSAGE/BUTTON_SPAM'"> <a class="btn buttonSpam" data-placement="bottom" data-bind="visible: !$root.isDraftFolder(), command: $root.spamCommand, tooltip: 'MESSAGE/BUTTON_SPAM'">
<i class="icon-bug"></i> <i class="icon-bug"></i>
</a> </a>

View file

@ -119,6 +119,14 @@
<span class="i18n" data-i18n-text="COMPOSE/BUTTON_REQUEST_READ_RECEIPT"></span> <span class="i18n" data-i18n-text="COMPOSE/BUTTON_REQUEST_READ_RECEIPT"></span>
</a> </a>
</li> </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>
&nbsp;&nbsp;
OpenPGP (Plain Text Only)
</a>
</li>
</ul> </ul>
</div> </div>
<div class="btn-group pull-right">&nbsp;</div> <div class="btn-group pull-right">&nbsp;</div>

View file

@ -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">&times;</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>
&nbsp;&nbsp;
<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>
&nbsp;&nbsp;
<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>
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="POPUPS_COMPOSE_OPEN_PGP/BUTTON_DO"></span>
</a>
</div>
</div>
</div>
</div>

View file

@ -637,7 +637,7 @@
border-radius: 8px; border-radius: 8px;
} }
/*! normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */ /*! normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */
/* ============================================================================= /* =============================================================================
@ -1142,7 +1142,7 @@ table {
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0; border-spacing: 0;
} }
@charset "UTF-8"; @charset "UTF-8";
@font-face { @font-face {
@ -1474,7 +1474,7 @@ table {
.icon-mail:before { .icon-mail:before {
content: "\e062"; content: "\e062";
} }
/** initial setup **/ /** initial setup **/
.nano { .nano {
/* /*
@ -1591,7 +1591,7 @@ table {
.nano > .pane2:hover > .slider2, .nano > .pane2.active > .slider2 { .nano > .pane2:hover > .slider2, .nano > .pane2.active > .slider2 {
background-color: rgba(0, 0, 0, 0.4); background-color: rgba(0, 0, 0, 0.4);
} }
/* Magnific Popup CSS */ /* Magnific Popup CSS */
.mfp-bg { .mfp-bg {
top: 0; top: 0;
@ -1956,7 +1956,7 @@ img.mfp-img {
right: 0; right: 0;
padding-top: 0; } padding-top: 0; }
/* overlay at start */ /* overlay at start */
.mfp-fade.mfp-bg { .mfp-fade.mfp-bg {
@ -2002,7 +2002,7 @@ img.mfp-img {
-moz-transform: translateX(50px); -moz-transform: translateX(50px);
transform: translateX(50px); transform: translateX(50px);
} }
.simple-pace { .simple-pace {
-webkit-pointer-events: none; -webkit-pointer-events: none;
pointer-events: none; pointer-events: none;
@ -2073,7 +2073,7 @@ img.mfp-img {
@keyframes simple-pace-stripe-animation { @keyframes simple-pace-stripe-animation {
0% { transform: none; transform: none; } 0% { transform: none; transform: none; }
100% { transform: translate(-32px, 0); transform: translate(-32px, 0); } 100% { transform: translate(-32px, 0); transform: translate(-32px, 0); }
} }
.inputosaurus-container { .inputosaurus-container {
background-color:#fff; background-color:#fff;
border:1px solid #bcbec0; border:1px solid #bcbec0;
@ -2141,7 +2141,7 @@ img.mfp-img {
box-shadow:none; box-shadow:none;
} }
.inputosaurus-input-hidden { display:none; } .inputosaurus-input-hidden { display:none; }
.flag-wrapper { .flag-wrapper {
width: 24px; width: 24px;
height: 16px; height: 16px;
@ -2184,7 +2184,7 @@ img.mfp-img {
.flag.flag-pt-br {background-position: -192px -11px} .flag.flag-pt-br {background-position: -192px -11px}
.flag.flag-cn, .flag.flag-zh-tw, .flag.flag-zh-cn, .flag.flag-zh-hk {background-position: -208px -22px} .flag.flag-cn, .flag.flag-zh-tw, .flag.flag-zh-cn, .flag.flag-zh-hk {background-position: -208px -22px}
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
.clearfix { .clearfix {
*zoom: 1; *zoom: 1;
@ -5438,6 +5438,9 @@ select {
padding-left: 12px; padding-left: 12px;
padding-right: 12px; padding-right: 12px;
} }
.btn-group.btn-group-custom-margin > .btn + .btn {
margin-left: 0px;
}
.dropdown-menu { .dropdown-menu {
-webkit-border-radius: 2px; -webkit-border-radius: 2px;
-moz-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-view-content .modal-header,
.popups .b-open-pgp-key-generate-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; background-color: #fff;
} }
.popups .b-open-pgp-key-view-content.modal, .popups .b-open-pgp-key-view-content.modal,
.popups .b-open-pgp-key-generate-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; width: 570px;
} }
.popups .b-open-pgp-key-view-content .inputKey, .popups .b-open-pgp-key-view-content .inputKey,
.popups .b-open-pgp-key-generate-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; font-family: Monaco, Menlo, Consolas, "Courier New", monospace;
} }
.popups .b-open-pgp-key-view-content .key-viewer, .popups .b-open-pgp-key-view-content .key-viewer,
.popups .b-open-pgp-key-generate-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; max-height: 500px;
overflow: auto; overflow: auto;
} }

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/*! RainLoop Webmail Admin Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ /*! RainLoop Webmail Admin Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (window, $, ko, crossroads, hasher, _) { (function (window, $, ko, crossroads, hasher, _) {
'use strict'; 'use strict';
@ -70,14 +70,14 @@ var
$document = $(window.document), $document = $(window.document),
NotificationClass = window.Notification && window.Notification.requestPermission ? window.Notification : null NotificationClass = window.Notification && window.Notification.requestPermission ? window.Notification : null
; ;
/*jshint onevar: false*/ /*jshint onevar: false*/
/** /**
* @type {?AdminApp} * @type {?AdminApp}
*/ */
var RL = null; var RL = null;
/*jshint onevar: true*/ /*jshint onevar: true*/
/** /**
* @type {?} * @type {?}
*/ */
@ -143,11 +143,6 @@ Globals.bDisableNanoScroll = Globals.bMobileDevice;
*/ */
Globals.bAllowPdfPreview = !Globals.bMobileDevice; Globals.bAllowPdfPreview = !Globals.bMobileDevice;
/**
* @type {boolean}
*/
Globals.bAllowOpenPGP = false;
/** /**
* @type {boolean} * @type {boolean}
*/ */
@ -226,7 +221,7 @@ if (Globals.bAllowPdfPreview && navigator && navigator.mimeTypes)
return oType && 'application/pdf' === oType.type; return oType && 'application/pdf' === oType.type;
}); });
} }
Consts.Defaults = {}; Consts.Defaults = {};
Consts.Values = {}; Consts.Values = {};
Consts.DataImages = {}; Consts.DataImages = {};
@ -344,7 +339,7 @@ Consts.DataImages.UserDotPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA
* @type {string} * @type {string}
*/ */
Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII='; Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=';
/** /**
* @enum {string} * @enum {string}
*/ */
@ -688,7 +683,7 @@ Enums.Notification = {
'UnknownNotification': 999, 'UnknownNotification': 999,
'UnknownError': 999 'UnknownError': 999
}; };
Utils.trim = $.trim; Utils.trim = $.trim;
Utils.inArray = $.inArray; Utils.inArray = $.inArray;
Utils.isArray = _.isArray; Utils.isArray = _.isArray;
@ -2405,7 +2400,7 @@ Utils.selectElement = function (element)
} }
/* jshint onevar: true */ /* jshint onevar: true */
}; };
// Base64 encode / decode // Base64 encode / decode
// http://www.webtoolkit.info/ // http://www.webtoolkit.info/
@ -2568,7 +2563,7 @@ Base64 = {
} }
}; };
/*jslint bitwise: false*/ /*jslint bitwise: false*/
ko.bindingHandlers.tooltip = { ko.bindingHandlers.tooltip = {
'init': function (oElement, fValueAccessor) { 'init': function (oElement, fValueAccessor) {
if (!Globals.bMobileDevice) if (!Globals.bMobileDevice)
@ -3025,7 +3020,11 @@ ko.bindingHandlers.emailsTags = {
'parseHook': function (aInput) { 'parseHook': function (aInput) {
return _.map(aInput, function (sInputValue) { return _.map(aInput, function (sInputValue) {
var sValue = Utils.trim(sInputValue), oEmail = null; var
sValue = Utils.trim(sInputValue),
oEmail = null
;
if ('' !== sValue) if ('' !== sValue)
{ {
oEmail = new EmailModel(); oEmail = new EmailModel();
@ -3213,7 +3212,7 @@ ko.observable.fn.validateFunc = function (fFunc)
return this; return this;
}; };
/** /**
* @constructor * @constructor
*/ */
@ -3511,7 +3510,7 @@ LinkBuilder.prototype.socialFacebook = function ()
{ {
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : ''); return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
}; };
/** /**
* @type {Object} * @type {Object}
*/ */
@ -3605,7 +3604,7 @@ Plugins.settingsGet = function (sPluginSection, sName)
}; };
/** /**
* @constructor * @constructor
*/ */
@ -3679,7 +3678,7 @@ CookieDriver.prototype.get = function (sKey)
return mResult; return mResult;
}; };
/** /**
* @constructor * @constructor
*/ */
@ -3750,7 +3749,7 @@ LocalStorageDriver.prototype.get = function (sKey)
return mResult; return mResult;
}; };
/** /**
* @constructor * @constructor
*/ */
@ -3793,7 +3792,7 @@ LocalStorage.prototype.get = function (iKey)
{ {
return this.oDriver ? this.oDriver.get('p' + iKey) : null; return this.oDriver ? this.oDriver.get('p' + iKey) : null;
}; };
/** /**
* @constructor * @constructor
*/ */
@ -3806,7 +3805,7 @@ KnoinAbstractBoot.prototype.bootstart = function ()
{ {
}; };
/** /**
* @param {string=} sPosition = '' * @param {string=} sPosition = ''
* @param {string=} sTemplate = '' * @param {string=} sTemplate = ''
@ -3881,7 +3880,7 @@ KnoinAbstractViewModel.prototype.registerPopupEscapeKey = function ()
return true; return true;
}); });
}; };
/** /**
* @param {string} sScreenName * @param {string} sScreenName
* @param {?=} aViewModels = [] * @param {?=} aViewModels = []
@ -3957,7 +3956,7 @@ KnoinAbstractScreen.prototype.__start = function ()
this.oCross = oRoute; this.oCross = oRoute;
} }
}; };
/** /**
* @constructor * @constructor
*/ */
@ -4350,7 +4349,7 @@ Knoin.prototype.bootstart = function ()
}; };
kn = new Knoin(); kn = new Knoin();
/** /**
* @param {string=} sEmail * @param {string=} sEmail
* @param {string=} sName * @param {string=} sName
@ -4714,7 +4713,7 @@ EmailModel.prototype.inputoTagLine = function ()
{ {
return 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email; return 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email;
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -4932,7 +4931,7 @@ PopupsDomainViewModel.prototype.clearForm = function ()
this.smtpAuth(true); this.smtpAuth(true);
this.whiteList(''); this.whiteList('');
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -5071,7 +5070,7 @@ PopupsPluginViewModel.prototype.onBuild = function ()
return bResult; return bResult;
}); });
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -5187,7 +5186,7 @@ PopupsActivateViewModel.prototype.validateSubscriptionKey = function ()
{ {
var sValue = this.key(); var sValue = this.key();
return '' === sValue || !!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(Utils.trim(sValue)); return '' === sValue || !!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(Utils.trim(sValue));
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -5247,7 +5246,7 @@ PopupsLanguagesViewModel.prototype.changeLanguage = function (sLang)
RL.data().mainLanguage(sLang); RL.data().mainLanguage(sLang);
this.cancelCommand(); this.cancelCommand();
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -5367,7 +5366,7 @@ PopupsAskViewModel.prototype.onBuild = function ()
}); });
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -5454,7 +5453,7 @@ AdminLoginViewModel.prototype.onHide = function ()
{ {
this.loginFocus(false); this.loginFocus(false);
}; };
/** /**
* @param {?} oScreen * @param {?} oScreen
* *
@ -5476,7 +5475,7 @@ AdminMenuViewModel.prototype.link = function (sRoute)
{ {
return '#/' + sRoute; return '#/' + sRoute;
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -5498,7 +5497,7 @@ AdminPaneViewModel.prototype.logoutClick = function ()
RL.remote().adminLogout(function () { RL.remote().adminLogout(function () {
RL.loginAndLogoutReload(); RL.loginAndLogoutReload();
}); });
}; };
/** /**
* @constructor * @constructor
*/ */
@ -5598,7 +5597,7 @@ AdminGeneral.prototype.selectLanguage = function ()
{ {
kn.showScreenPopup(PopupsLanguagesViewModel); kn.showScreenPopup(PopupsLanguagesViewModel);
}; };
/** /**
* @constructor * @constructor
*/ */
@ -5650,7 +5649,7 @@ AdminLogin.prototype.onBuild = function ()
}, 50); }, 50);
}; };
/** /**
* @constructor * @constructor
*/ */
@ -5719,7 +5718,7 @@ AdminBranding.prototype.onBuild = function ()
}, 50); }, 50);
}; };
/** /**
* @constructor * @constructor
*/ */
@ -5939,7 +5938,7 @@ AdminContacts.prototype.onBuild = function ()
}, 50); }, 50);
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6028,7 +6027,7 @@ AdminDomains.prototype.onDomainListChangeRequest = function ()
{ {
RL.reloadDomainList(); RL.reloadDomainList();
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6116,7 +6115,7 @@ AdminSecurity.prototype.phpInfoLink = function ()
{ {
return RL.link().phpInfo(); return RL.link().phpInfo();
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6232,7 +6231,7 @@ AdminSocial.prototype.onBuild = function ()
}, 50); }, 50);
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6329,7 +6328,7 @@ AdminPlugins.prototype.onPluginDisableRequest = function (sResult, oData)
RL.reloadPluginList(); RL.reloadPluginList();
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6433,7 +6432,7 @@ AdminPackages.prototype.installPackage = function (oPackage)
RL.remote().packageInstall(this.requestHelper(oPackage, true), oPackage); RL.remote().packageInstall(this.requestHelper(oPackage, true), oPackage);
} }
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6484,7 +6483,7 @@ AdminLicensing.prototype.licenseExpiredMomentValue = function ()
{ {
var oDate = moment.unix(this.licenseExpired()); var oDate = moment.unix(this.licenseExpired());
return oDate.format('LL') + ' (' + oDate.from(moment()) + ')'; return oDate.format('LL') + ' (' + oDate.from(moment()) + ')';
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6559,7 +6558,7 @@ AbstractData.prototype.populateDataOnStart = function()
this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed')); this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed'));
}; };
/** /**
* @constructor * @constructor
* @extends AbstractData * @extends AbstractData
@ -6593,7 +6592,7 @@ _.extend(AdminDataStorage.prototype, AbstractData.prototype);
AdminDataStorage.prototype.populateDataOnStart = function() AdminDataStorage.prototype.populateDataOnStart = function()
{ {
AbstractData.prototype.populateDataOnStart.call(this); AbstractData.prototype.populateDataOnStart.call(this);
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6867,7 +6866,7 @@ AbstractAjaxRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
'Version': sVersion 'Version': sVersion
}); });
}; };
/** /**
* @constructor * @constructor
* @extends AbstractAjaxRemoteStorage * @extends AbstractAjaxRemoteStorage
@ -7111,7 +7110,7 @@ AdminAjaxRemoteStorage.prototype.adminPing = function (fCallback)
{ {
this.defaultRequest(fCallback, 'AdminPing'); this.defaultRequest(fCallback, 'AdminPing');
}; };
/** /**
* @constructor * @constructor
*/ */
@ -7177,7 +7176,7 @@ AbstractCacheStorage.prototype.setEmailsPicsHashesData = function (oData)
{ {
this.oEmailsPicsHashes = oData; this.oEmailsPicsHashes = oData;
}; };
/** /**
* @constructor * @constructor
* @extends AbstractCacheStorage * @extends AbstractCacheStorage
@ -7188,7 +7187,7 @@ function AdminCacheStorage()
} }
_.extend(AdminCacheStorage.prototype, AbstractCacheStorage.prototype); _.extend(AdminCacheStorage.prototype, AbstractCacheStorage.prototype);
/** /**
* @param {Array} aViewModels * @param {Array} aViewModels
* @constructor * @constructor
@ -7366,7 +7365,7 @@ AbstractSettings.prototype.routes = function ()
['', oRules] ['', oRules]
]; ];
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractScreen * @extends KnoinAbstractScreen
@ -7381,7 +7380,7 @@ _.extend(AdminLoginScreen.prototype, KnoinAbstractScreen.prototype);
AdminLoginScreen.prototype.onShow = function () AdminLoginScreen.prototype.onShow = function ()
{ {
RL.setTitle(''); RL.setTitle('');
}; };
/** /**
* @constructor * @constructor
* @extends AbstractSettings * @extends AbstractSettings
@ -7401,7 +7400,7 @@ AdminSettingsScreen.prototype.onShow = function ()
// AbstractSettings.prototype.onShow.call(this); // AbstractSettings.prototype.onShow.call(this);
RL.setTitle(''); RL.setTitle('');
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractBoot * @extends KnoinAbstractBoot
@ -7717,7 +7716,7 @@ AbstractApp.prototype.bootstart = function ()
ssm.ready(); ssm.ready();
}; };
/** /**
* @constructor * @constructor
* @extends AbstractApp * @extends AbstractApp
@ -7956,7 +7955,7 @@ AdminApp.prototype.bootstart = function ()
* @type {AdminApp} * @type {AdminApp}
*/ */
RL = new AdminApp(); RL = new AdminApp();
$html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile'); $html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
$window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS); $window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
@ -8003,9 +8002,9 @@ window['__RLBOOT'] = function (fCall) {
window['__RLBOOT'] = null; window['__RLBOOT'] = null;
}); });
}; };
if (window.SimplePace) { if (window.SimplePace) {
window.SimplePace.add(10); window.SimplePace.add(10);
} }
}(window, jQuery, ko, crossroads, hasher, _)); }(window, jQuery, ko, crossroads, hasher, _));

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/*! RainLoop Webmail Main Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ /*! RainLoop Webmail Main Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (window, $, ko, crossroads, hasher, moment, Jua, _, ifvisible) { (function (window, $, ko, crossroads, hasher, moment, Jua, _, ifvisible) {
'use strict'; 'use strict';
@ -70,14 +70,14 @@ var
$document = $(window.document), $document = $(window.document),
NotificationClass = window.Notification && window.Notification.requestPermission ? window.Notification : null NotificationClass = window.Notification && window.Notification.requestPermission ? window.Notification : null
; ;
/*jshint onevar: false*/ /*jshint onevar: false*/
/** /**
* @type {?RainLoopApp} * @type {?RainLoopApp}
*/ */
var RL = null; var RL = null;
/*jshint onevar: true*/ /*jshint onevar: true*/
/** /**
* @type {?} * @type {?}
*/ */
@ -143,11 +143,6 @@ Globals.bDisableNanoScroll = Globals.bMobileDevice;
*/ */
Globals.bAllowPdfPreview = !Globals.bMobileDevice; Globals.bAllowPdfPreview = !Globals.bMobileDevice;
/**
* @type {boolean}
*/
Globals.bAllowOpenPGP = false;
/** /**
* @type {boolean} * @type {boolean}
*/ */
@ -226,7 +221,7 @@ if (Globals.bAllowPdfPreview && navigator && navigator.mimeTypes)
return oType && 'application/pdf' === oType.type; return oType && 'application/pdf' === oType.type;
}); });
} }
Consts.Defaults = {}; Consts.Defaults = {};
Consts.Values = {}; Consts.Values = {};
Consts.DataImages = {}; Consts.DataImages = {};
@ -344,7 +339,7 @@ Consts.DataImages.UserDotPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA
* @type {string} * @type {string}
*/ */
Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII='; Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=';
/** /**
* @enum {string} * @enum {string}
*/ */
@ -688,7 +683,7 @@ Enums.Notification = {
'UnknownNotification': 999, 'UnknownNotification': 999,
'UnknownError': 999 'UnknownError': 999
}; };
Utils.trim = $.trim; Utils.trim = $.trim;
Utils.inArray = $.inArray; Utils.inArray = $.inArray;
Utils.isArray = _.isArray; Utils.isArray = _.isArray;
@ -2405,7 +2400,7 @@ Utils.selectElement = function (element)
} }
/* jshint onevar: true */ /* jshint onevar: true */
}; };
// Base64 encode / decode // Base64 encode / decode
// http://www.webtoolkit.info/ // http://www.webtoolkit.info/
@ -2568,7 +2563,7 @@ Base64 = {
} }
}; };
/*jslint bitwise: false*/ /*jslint bitwise: false*/
ko.bindingHandlers.tooltip = { ko.bindingHandlers.tooltip = {
'init': function (oElement, fValueAccessor) { 'init': function (oElement, fValueAccessor) {
if (!Globals.bMobileDevice) if (!Globals.bMobileDevice)
@ -3025,7 +3020,11 @@ ko.bindingHandlers.emailsTags = {
'parseHook': function (aInput) { 'parseHook': function (aInput) {
return _.map(aInput, function (sInputValue) { return _.map(aInput, function (sInputValue) {
var sValue = Utils.trim(sInputValue), oEmail = null; var
sValue = Utils.trim(sInputValue),
oEmail = null
;
if ('' !== sValue) if ('' !== sValue)
{ {
oEmail = new EmailModel(); oEmail = new EmailModel();
@ -3213,7 +3212,7 @@ ko.observable.fn.validateFunc = function (fFunc)
return this; return this;
}; };
/** /**
* @constructor * @constructor
*/ */
@ -3511,7 +3510,7 @@ LinkBuilder.prototype.socialFacebook = function ()
{ {
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : ''); return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
}; };
/** /**
* @type {Object} * @type {Object}
*/ */
@ -3605,14 +3604,15 @@ Plugins.settingsGet = function (sPluginSection, sName)
}; };
function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady) function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady, fOnModeChange)
{ {
var self = this; var self = this;
self.editor = null; self.editor = null;
self.iBlurTimer = 0; self.iBlurTimer = 0;
self.fOnBlur = fOnBlur || null; self.fOnBlur = fOnBlur || null;
self.fOnReady = fOnReady || null; self.fOnReady = fOnReady || null;
self.fOnModeChange = fOnModeChange || null;
self.$element = $(oElement); self.$element = $(oElement);
@ -3763,6 +3763,11 @@ NewHtmlEditorWrapper.prototype.init = function ()
self.editor.on('mode', function() { self.editor.on('mode', function() {
self.blurTrigger(); self.blurTrigger();
if (self.fOnModeChange)
{
self.fOnModeChange('plain' !== self.editor.mode);
}
}); });
self.editor.on('focus', function() { self.editor.on('focus', function() {
@ -3811,7 +3816,7 @@ NewHtmlEditorWrapper.prototype.clear = function (bFocus)
this.setHtml('', bFocus); this.setHtml('', bFocus);
}; };
/** /**
* @constructor * @constructor
* @param {koProperty} oKoList * @param {koProperty} oKoList
@ -4352,7 +4357,7 @@ Selector.prototype.on = function (sEventName, fCallback)
{ {
this.oCallbacks[sEventName] = fCallback; this.oCallbacks[sEventName] = fCallback;
}; };
/** /**
* @constructor * @constructor
*/ */
@ -4426,7 +4431,7 @@ CookieDriver.prototype.get = function (sKey)
return mResult; return mResult;
}; };
/** /**
* @constructor * @constructor
*/ */
@ -4497,7 +4502,7 @@ LocalStorageDriver.prototype.get = function (sKey)
return mResult; return mResult;
}; };
/** /**
* @constructor * @constructor
*/ */
@ -4556,7 +4561,7 @@ OpenPgpLocalStorageDriver.prototype.store = function (aKeys)
window.localStorage.setItem(this.item, JSON.stringify(aArmoredKeys)); window.localStorage.setItem(this.item, JSON.stringify(aArmoredKeys));
}; };
/** /**
* @constructor * @constructor
*/ */
@ -4599,7 +4604,7 @@ LocalStorage.prototype.get = function (iKey)
{ {
return this.oDriver ? this.oDriver.get('p' + iKey) : null; return this.oDriver ? this.oDriver.get('p' + iKey) : null;
}; };
/** /**
* @constructor * @constructor
*/ */
@ -4612,7 +4617,7 @@ KnoinAbstractBoot.prototype.bootstart = function ()
{ {
}; };
/** /**
* @param {string=} sPosition = '' * @param {string=} sPosition = ''
* @param {string=} sTemplate = '' * @param {string=} sTemplate = ''
@ -4687,7 +4692,7 @@ KnoinAbstractViewModel.prototype.registerPopupEscapeKey = function ()
return true; return true;
}); });
}; };
/** /**
* @param {string} sScreenName * @param {string} sScreenName
* @param {?=} aViewModels = [] * @param {?=} aViewModels = []
@ -4763,7 +4768,7 @@ KnoinAbstractScreen.prototype.__start = function ()
this.oCross = oRoute; this.oCross = oRoute;
} }
}; };
/** /**
* @constructor * @constructor
*/ */
@ -5156,7 +5161,7 @@ Knoin.prototype.bootstart = function ()
}; };
kn = new Knoin(); kn = new Knoin();
/** /**
* @param {string=} sEmail * @param {string=} sEmail
* @param {string=} sName * @param {string=} sName
@ -5520,7 +5525,7 @@ EmailModel.prototype.inputoTagLine = function ()
{ {
return 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email; return 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email;
}; };
/** /**
* @constructor * @constructor
*/ */
@ -5642,7 +5647,7 @@ ContactModel.prototype.lineAsCcc = function ()
return aResult.join(' '); return aResult.join(' ');
}; };
/** /**
* @param {number=} iType = Enums.ContactPropertyType.Unknown * @param {number=} iType = Enums.ContactPropertyType.Unknown
* @param {string=} sValue = '' * @param {string=} sValue = ''
@ -5664,7 +5669,7 @@ function ContactPropertyModel(iType, sValue, bFocused, sPlaceholder)
return sPlaceholder ? Utils.i18n(sPlaceholder) : ''; return sPlaceholder ? Utils.i18n(sPlaceholder) : '';
}, this); }, this);
} }
/** /**
* @constructor * @constructor
*/ */
@ -5900,7 +5905,7 @@ AttachmentModel.prototype.iconClass = function ()
return sClass; return sClass;
}; };
/** /**
* @constructor * @constructor
* @param {string} sId * @param {string} sId
@ -5961,7 +5966,7 @@ ComposeAttachmentModel.prototype.initByUploadJson = function (oJsonAttachment)
} }
return bResult; return bResult;
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6321,7 +6326,7 @@ MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
this.sInReplyTo = oJsonMessage.InReplyTo; this.sInReplyTo = oJsonMessage.InReplyTo;
this.sReferences = oJsonMessage.References; this.sReferences = oJsonMessage.References;
if (Globals.bAllowOpenPGP) if (RL.data().allowOpenPGP())
{ {
this.isPgpSigned(!!oJsonMessage.PgpSigned); this.isPgpSigned(!!oJsonMessage.PgpSigned);
this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted); this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted);
@ -6943,7 +6948,7 @@ MessageModel.prototype.showInternalImages = function (bLazy)
Utils.windowResize(500); Utils.windowResize(500);
} }
}; };
/** /**
* @constructor * @constructor
*/ */
@ -7277,7 +7282,7 @@ FolderModel.prototype.printableFullName = function ()
{ {
return this.fullName.split(this.delimiter).join(' / '); return this.fullName.split(this.delimiter).join(' / ');
}; };
/** /**
* @param {string} sEmail * @param {string} sEmail
* @param {boolean=} bCanBeDelete = true * @param {boolean=} bCanBeDelete = true
@ -7298,7 +7303,7 @@ AccountModel.prototype.email = '';
AccountModel.prototype.changeAccountLink = function () AccountModel.prototype.changeAccountLink = function ()
{ {
return RL.link().change(this.email); return RL.link().change(this.email);
}; };
/** /**
* @param {string} sId * @param {string} sId
* @param {string} sEmail * @param {string} sEmail
@ -7334,7 +7339,7 @@ IdentityModel.prototype.formattedNameForEmail = function ()
var sName = this.name(); var sName = this.name();
return '' === sName ? this.email() : '"' + Utils.quoteName(sName) + '" <' + this.email() + '>'; return '' === sName ? this.email() : '"' + Utils.quoteName(sName) + '" <' + this.email() + '>';
}; };
/** /**
* @param {string} iIndex * @param {string} iIndex
* @param {string} sID * @param {string} sID
@ -7359,7 +7364,7 @@ OpenPgpKeyModel.prototype.id = '';
OpenPgpKeyModel.prototype.user = ''; OpenPgpKeyModel.prototype.user = '';
OpenPgpKeyModel.prototype.armor = ''; OpenPgpKeyModel.prototype.armor = '';
OpenPgpKeyModel.prototype.isPrivate = false; OpenPgpKeyModel.prototype.isPrivate = false;
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -7455,7 +7460,7 @@ PopupsFolderClearViewModel.prototype.onShow = function (oFolder)
this.selectedFolder(oFolder); this.selectedFolder(oFolder);
} }
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -7565,7 +7570,7 @@ PopupsFolderCreateViewModel.prototype.onFocus = function ()
{ {
this.folderName.focused(true); this.folderName.focused(true);
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -7670,7 +7675,7 @@ PopupsFolderSystemViewModel.prototype.onShow = function (iNotificationType)
this.notification(sNotification); this.notification(sNotification);
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -7699,6 +7704,8 @@ function PopupsComposeViewModel()
} }
; ;
this.allowOpenPGP = oRainLoopData.allowOpenPGP;
this.resizer = ko.observable(false).extend({'throttle': 50}); this.resizer = ko.observable(false).extend({'throttle': 50});
this.to = ko.observable(''); this.to = ko.observable('');
@ -7708,6 +7715,7 @@ function PopupsComposeViewModel()
this.replyTo = ko.observable(''); this.replyTo = ko.observable('');
this.subject = ko.observable(''); this.subject = ko.observable('');
this.isHtml = ko.observable(false);
this.requestReadReceipt = ko.observable(false); this.requestReadReceipt = ko.observable(false);
@ -8026,6 +8034,23 @@ function PopupsComposeViewModel()
Utils.extendAsViewModel('PopupsComposeViewModel', 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 () PopupsComposeViewModel.prototype.reloadDraftFolder = function ()
{ {
var sDraftFolder = RL.data().draftFolder(); var sDraftFolder = RL.data().draftFolder();
@ -8268,6 +8293,8 @@ PopupsComposeViewModel.prototype.editor = function (fOnInit)
_.delay(function () { _.delay(function () {
self.oEditor = new NewHtmlEditorWrapper(self.composeEditorArea(), null, function () { self.oEditor = new NewHtmlEditorWrapper(self.composeEditorArea(), null, function () {
fOnInit(self.oEditor); fOnInit(self.oEditor);
}, function (bHtml) {
self.isHtml(!!bHtml);
}); });
}, 300); }, 300);
} }
@ -9133,7 +9160,7 @@ PopupsComposeViewModel.prototype.triggerForResize = function ()
this.editorResizeThrottle(); this.editorResizeThrottle();
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -9754,7 +9781,7 @@ PopupsContactsViewModel.prototype.onHide = function ()
oItem.checked(false); oItem.checked(false);
}); });
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -9884,7 +9911,7 @@ PopupsAdvancedSearchViewModel.prototype.onFocus = function ()
{ {
this.fromFocus(true); this.fromFocus(true);
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -10001,7 +10028,7 @@ PopupsAddAccountViewModel.prototype.onBuild = function ()
{ {
this.allowCustomLogin(!!RL.settingsGet('AllowCustomLogin')); this.allowCustomLogin(!!RL.settingsGet('AllowCustomLogin'));
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -10061,7 +10088,7 @@ PopupsAddOpenPgpKeyViewModel.prototype.onFocus = function ()
{ {
this.key.focus(true); this.key.focus(true);
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -10101,7 +10128,7 @@ PopupsViewOpenPgpKeyViewModel.prototype.onShow = function (oOpenPgpKey)
this.key(oOpenPgpKey.armor); this.key(oOpenPgpKey.armor);
} }
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -10190,7 +10217,70 @@ PopupsGenerateNewOpenPgpKeyViewModel.prototype.onFocus = function ()
{ {
this.email.focus(true); 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 * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -10338,7 +10428,7 @@ PopupsIdentityViewModel.prototype.onFocus = function ()
this.email.focused(true); this.email.focused(true);
} }
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -10398,7 +10488,7 @@ PopupsLanguagesViewModel.prototype.changeLanguage = function (sLang)
RL.data().mainLanguage(sLang); RL.data().mainLanguage(sLang);
this.cancelCommand(); this.cancelCommand();
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -10518,7 +10608,7 @@ PopupsAskViewModel.prototype.onBuild = function ()
}); });
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -10790,7 +10880,7 @@ LoginViewModel.prototype.selectLanguage = function ()
kn.showScreenPopup(PopupsLanguagesViewModel); kn.showScreenPopup(PopupsLanguagesViewModel);
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -10857,7 +10947,7 @@ AbstractSystemDropDownViewModel.prototype.logoutClick = function ()
RL.loginAndLogoutReload(true, RL.settingsGet('ParentEmail') && 0 < RL.settingsGet('ParentEmail').length); RL.loginAndLogoutReload(true, RL.settingsGet('ParentEmail') && 0 < RL.settingsGet('ParentEmail').length);
}); });
}; };
/** /**
* @constructor * @constructor
* @extends AbstractSystemDropDownViewModel * @extends AbstractSystemDropDownViewModel
@ -10869,7 +10959,7 @@ function MailBoxSystemDropDownViewModel()
} }
Utils.extendAsViewModel('MailBoxSystemDropDownViewModel', MailBoxSystemDropDownViewModel, AbstractSystemDropDownViewModel); Utils.extendAsViewModel('MailBoxSystemDropDownViewModel', MailBoxSystemDropDownViewModel, AbstractSystemDropDownViewModel);
/** /**
* @constructor * @constructor
* @extends AbstractSystemDropDownViewModel * @extends AbstractSystemDropDownViewModel
@ -10881,7 +10971,7 @@ function SettingsSystemDropDownViewModel()
} }
Utils.extendAsViewModel('SettingsSystemDropDownViewModel', SettingsSystemDropDownViewModel, AbstractSystemDropDownViewModel); Utils.extendAsViewModel('SettingsSystemDropDownViewModel', SettingsSystemDropDownViewModel, AbstractSystemDropDownViewModel);
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -11010,7 +11100,7 @@ MailBoxFolderListViewModel.prototype.contactsClick = function ()
kn.showScreenPopup(PopupsContactsViewModel); kn.showScreenPopup(PopupsContactsViewModel);
} }
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -11716,7 +11806,7 @@ MailBoxMessageListViewModel.prototype.initUploaderForAppend = function ()
; ;
return !!oJua; return !!oJua;
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -12089,7 +12179,7 @@ MailBoxMessageViewViewModel.prototype.readReceipt = function (oMessage)
RL.reloadFlagsCurrentMessageListAndMessageFromCache(); RL.reloadFlagsCurrentMessageListAndMessageFromCache();
} }
}; };
/** /**
* @param {?} oScreen * @param {?} oScreen
* *
@ -12116,7 +12206,7 @@ SettingsMenuViewModel.prototype.backToMailBoxClick = function ()
{ {
kn.setHash(RL.link().inbox()); kn.setHash(RL.link().inbox());
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -12139,7 +12229,7 @@ SettingsPaneViewModel.prototype.backToMailBoxClick = function ()
{ {
kn.setHash(RL.link().inbox()); kn.setHash(RL.link().inbox());
}; };
/** /**
* @constructor * @constructor
*/ */
@ -12299,7 +12389,7 @@ SettingsGeneral.prototype.selectLanguage = function ()
{ {
kn.showScreenPopup(PopupsLanguagesViewModel); kn.showScreenPopup(PopupsLanguagesViewModel);
}; };
/** /**
* @constructor * @constructor
*/ */
@ -12337,7 +12427,7 @@ SettingsContacts.prototype.onShow = function ()
{ {
this.showPassword(false); this.showPassword(false);
}; };
/** /**
* @constructor * @constructor
*/ */
@ -12418,7 +12508,7 @@ SettingsAccounts.prototype.deleteAccount = function (oAccountToRemove)
} }
} }
}; };
/** /**
* @constructor * @constructor
*/ */
@ -12506,7 +12596,7 @@ SettingsIdentity.prototype.onBuild = function ()
}, 50); }, 50);
}; };
/** /**
* @constructor * @constructor
*/ */
@ -12664,7 +12754,7 @@ SettingsIdentities.prototype.onBuild = function (oDom)
}); });
}, 50); }, 50);
}; };
/** /**
* @constructor * @constructor
*/ */
@ -12731,7 +12821,7 @@ function SettingsSocialScreen()
} }
Utils.addSettingsViewModel(SettingsSocialScreen, 'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social'); Utils.addSettingsViewModel(SettingsSocialScreen, 'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social');
/** /**
* @constructor * @constructor
*/ */
@ -12812,7 +12902,7 @@ SettingsOpenPGP.prototype.deleteOpenPgpKey = function (oOpenPgpKeyToRemove)
RL.reloadOpenPgpKeys(); RL.reloadOpenPgpKeys();
} }
} }
}; };
/** /**
* @constructor * @constructor
*/ */
@ -12876,7 +12966,7 @@ SettingsChangePasswordScreen.prototype.onChangePasswordResponse = function (sRes
this.passwordUpdateError(true); this.passwordUpdateError(true);
} }
}; };
/** /**
* @constructor * @constructor
*/ */
@ -13071,7 +13161,7 @@ SettingsFolders.prototype.unSubscribeFolder = function (oFolder)
oFolder.subScribed(false); oFolder.subScribed(false);
}; };
/** /**
* @constructor * @constructor
*/ */
@ -13296,7 +13386,7 @@ SettingsThemes.prototype.initCustomThemeUploader = function ()
return false; return false;
}; };
/** /**
* @constructor * @constructor
*/ */
@ -13371,7 +13461,7 @@ AbstractData.prototype.populateDataOnStart = function()
this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed')); this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed'));
}; };
/** /**
* @constructor * @constructor
* @extends AbstractData * @extends AbstractData
@ -13716,6 +13806,7 @@ function WebMailDataStorage()
// other // other
this.useKeyboardShortcuts = ko.observable(true); this.useKeyboardShortcuts = ko.observable(true);
this.allowOpenPGP = ko.observable(false);
this.openpgpkeys = ko.observableArray([]); this.openpgpkeys = ko.observableArray([]);
this.openpgpKeyring = null; this.openpgpKeyring = null;
@ -14240,7 +14331,8 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached)
bIsHtml = false; bIsHtml = false;
sPlain = oData.Result.Plain.toString(); 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)) Utils.isNormal(oData.Result.PlainRaw))
{ {
bPgpEncrypted = /---BEGIN PGP MESSAGE---/.test(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.isPgpSigned(!!oMessage.body.data('rl-plain-pgp-signed'));
oMessage.isPgpEncrypted(!!oMessage.body.data('rl-plain-pgp-encrypted')); oMessage.isPgpEncrypted(!!oMessage.body.data('rl-plain-pgp-encrypted'));
@ -14508,7 +14600,7 @@ WebMailDataStorage.prototype.setMessageList = function (oData, bCached)
)); ));
} }
}; };
/** /**
* @constructor * @constructor
*/ */
@ -14782,7 +14874,7 @@ AbstractAjaxRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
'Version': sVersion 'Version': sVersion
}); });
}; };
/** /**
* @constructor * @constructor
* @extends AbstractAjaxRemoteStorage * @extends AbstractAjaxRemoteStorage
@ -15482,7 +15574,7 @@ WebMailAjaxRemoteStorage.prototype.socialUsers = function (fCallback)
this.defaultRequest(fCallback, 'SocialUsers'); this.defaultRequest(fCallback, 'SocialUsers');
}; };
/** /**
* @constructor * @constructor
*/ */
@ -15548,7 +15640,7 @@ AbstractCacheStorage.prototype.setEmailsPicsHashesData = function (oData)
{ {
this.oEmailsPicsHashes = oData; this.oEmailsPicsHashes = oData;
}; };
/** /**
* @constructor * @constructor
* @extends AbstractCacheStorage * @extends AbstractCacheStorage
@ -15866,7 +15958,7 @@ WebMailCacheStorage.prototype.storeMessageFlagsToCacheByFolderAndUid = function
this.setMessageFlagsToCache(sFolder, sUid, aFlags); this.setMessageFlagsToCache(sFolder, sUid, aFlags);
} }
}; };
/** /**
* @param {Array} aViewModels * @param {Array} aViewModels
* @constructor * @constructor
@ -16044,7 +16136,7 @@ AbstractSettings.prototype.routes = function ()
['', oRules] ['', oRules]
]; ];
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractScreen * @extends KnoinAbstractScreen
@ -16059,7 +16151,7 @@ _.extend(LoginScreen.prototype, KnoinAbstractScreen.prototype);
LoginScreen.prototype.onShow = function () LoginScreen.prototype.onShow = function ()
{ {
RL.setTitle(''); RL.setTitle('');
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractScreen * @extends KnoinAbstractScreen
@ -16240,7 +16332,7 @@ MailBoxScreen.prototype.routes = function ()
[/^([^\/]*)$/, {'normalize_': fNormS}] [/^([^\/]*)$/, {'normalize_': fNormS}]
]; ];
}; };
/** /**
* @constructor * @constructor
* @extends AbstractSettings * @extends AbstractSettings
@ -16268,7 +16360,7 @@ SettingsScreen.prototype.onShow = function ()
RL.setTitle(this.sSettingsTitle); RL.setTitle(this.sSettingsTitle);
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractBoot * @extends KnoinAbstractBoot
@ -16584,7 +16676,7 @@ AbstractApp.prototype.bootstart = function ()
ssm.ready(); ssm.ready();
}; };
/** /**
* @constructor * @constructor
* @extends AbstractApp * @extends AbstractApp
@ -16909,7 +17001,7 @@ RainLoopApp.prototype.folders = function (fCallback)
RainLoopApp.prototype.reloadOpenPgpKeys = function () RainLoopApp.prototype.reloadOpenPgpKeys = function ()
{ {
if (Globals.bAllowOpenPGP) if (RL.data().allowOpenPGP())
{ {
var var
aKeys = [], aKeys = [],
@ -17548,8 +17640,8 @@ RainLoopApp.prototype.bootstart = function ()
if (window.openpgp) if (window.openpgp)
{ {
RL.data().openpgpKeyring = new window.openpgp.Keyring(new OpenPgpLocalStorageDriver()); RL.data().openpgpKeyring = new window.openpgp.Keyring(new OpenPgpLocalStorageDriver());
RL.data().allowOpenPGP(true);
Globals.bAllowOpenPGP = true;
RL.pub('openpgp.init'); RL.pub('openpgp.init');
RL.reloadOpenPgpKeys(); RL.reloadOpenPgpKeys();
@ -17559,7 +17651,7 @@ RainLoopApp.prototype.bootstart = function ()
} }
else else
{ {
Globals.bAllowOpenPGP = false; RL.data().allowOpenPGP(false);
} }
kn.startScreens([MailBoxScreen, SettingsScreen]); kn.startScreens([MailBoxScreen, SettingsScreen]);
@ -17695,7 +17787,7 @@ RainLoopApp.prototype.bootstart = function ()
* @type {RainLoopApp} * @type {RainLoopApp}
*/ */
RL = new RainLoopApp(); RL = new RainLoopApp();
$html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile'); $html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
$window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS); $window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
@ -17742,9 +17834,9 @@ window['__RLBOOT'] = function (fCall) {
window['__RLBOOT'] = null; window['__RLBOOT'] = null;
}); });
}; };
if (window.SimplePace) { if (window.SimplePace) {
window.SimplePace.add(10); window.SimplePace.add(10);
} }
}(window, jQuery, ko, crossroads, hasher, moment, Jua, _, ifvisible)); }(window, jQuery, ko, crossroads, hasher, moment, Jua, _, ifvisible));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long