OpenPGP (#53) Beta

Archive  (Closes #110)
Delete, Spam and Archive button in mail view when preview pane is off  (Closes #72)
Small fixes  (Closes #101)
This commit is contained in:
RainLoop Team 2014-04-02 03:58:24 +04:00
parent ab817e1396
commit cae0cc2f77
45 changed files with 1390 additions and 172 deletions

View file

@ -109,15 +109,26 @@ function MailBoxMessageListViewModel()
}, this);
this.isSpamFolder = ko.computed(function () {
return RL.data().spamFolder() === this.messageListEndFolder();
return oData.spamFolder() === this.messageListEndFolder() &&
'' !== oData.spamFolder();
}, this);
this.isSpamDisabled = ko.computed(function () {
return Consts.Values.UnuseOptionValue === RL.data().spamFolder();
return Consts.Values.UnuseOptionValue === oData.spamFolder();
}, this);
this.isTrashFolder = ko.computed(function () {
return RL.data().trashFolder() === this.messageListEndFolder();
return oData.trashFolder() === this.messageListEndFolder() &&
'' !== oData.trashFolder();
}, this);
this.isArchiveFolder = ko.computed(function () {
return oData.archiveFolder() === this.messageListEndFolder() &&
'' !== oData.archiveFolder();
}, this);
this.isArchiveDisabled = ko.computed(function () {
return Consts.Values.UnuseOptionValue === RL.data().archiveFolder();
}, this);
this.canBeMoved = this.hasCheckedOrSelectedLines;
@ -141,6 +152,12 @@ function MailBoxMessageListViewModel()
RL.data().currentFolderFullNameRaw(),
RL.data().messageListCheckedOrSelectedUidsWithSubMails(), true);
}, this.canBeMoved);
this.archiveCommand = Utils.createCommand(this, function () {
RL.deleteMessagesFromFolder(Enums.FolderType.Archive,
RL.data().currentFolderFullNameRaw(),
RL.data().messageListCheckedOrSelectedUidsWithSubMails(), true);
}, this.canBeMoved);
this.spamCommand = Utils.createCommand(this, function () {
RL.deleteMessagesFromFolder(Enums.FolderType.Spam,
@ -219,6 +236,15 @@ MailBoxMessageListViewModel.prototype.searchEnterAction = function ()
this.inputMessageListSearchFocus(false);
};
/**
* @returns {string}
*/
MailBoxMessageListViewModel.prototype.printableMessageCountForDeletion = function ()
{
var iCnt = this.messageListCheckedOrSelectedUidsWithSubMails().length;
return 1 < iCnt ? ' (' + (100 > iCnt ? iCnt : '99+') + ')' : '';
};
MailBoxMessageListViewModel.prototype.cancelSearch = function ()
{
this.mainMessageListSearch('');

View file

@ -36,8 +36,6 @@ function MailBoxMessageViewViewModel()
this.fullScreenMode = oData.messageFullScreenMode;
this.showFullInfo = ko.observable(false);
this.openPGPInformation = ko.observable('');
this.openPGPInformation.isError = ko.observable(false);
this.messageVisibility = ko.computed(function () {
return !this.messageLoadingThrottle() && !!this.message();
@ -80,6 +78,17 @@ function MailBoxMessageViewViewModel()
}, this.messageVisibility);
this.archiveCommand = Utils.createCommand(this, function () {
if (this.message())
{
RL.deleteMessagesFromFolder(Enums.FolderType.Archive,
this.message().folderFullNameRaw,
[this.message().uid], true);
}
}, this.messageVisibility);
this.spamCommand = Utils.createCommand(this, function () {
if (this.message())
@ -107,6 +116,7 @@ function MailBoxMessageViewViewModel()
this.viewUserPic = ko.observable(Consts.DataImages.UserDotPic);
this.viewUserPicVisible = ko.observable(false);
this.viewPgpPassword = ko.observable('');
this.viewPgpSignedVerifyStatus = ko.computed(function () {
return this.message() ? this.message().pgpSignedVerifyStatus() : Enums.SignedVerifyStatus.None;
}, this);
@ -114,11 +124,14 @@ function MailBoxMessageViewViewModel()
this.viewPgpSignedVerifyUser = ko.computed(function () {
return this.message() ? this.message().pgpSignedVerifyUser() : '';
}, this);
this.message.subscribe(function (oMessage) {
this.messageActiveDom(null);
this.viewPgpPassword('');
if (oMessage)
{
this.viewSubject(oMessage.subject());
@ -207,6 +220,12 @@ MailBoxMessageViewViewModel.prototype.pgpStatusVerifyMessage = function ()
switch (this.viewPgpSignedVerifyStatus())
{
// TODO i18n
case Enums.SignedVerifyStatus.UnknownPublicKeys:
sResult = 'No public keys found';
break;
case Enums.SignedVerifyStatus.UnknownPrivateKey:
sResult = 'No private key found';
break;
case Enums.SignedVerifyStatus.Unverified:
sResult = 'Unverified signature';
break;
@ -359,6 +378,38 @@ MailBoxMessageViewViewModel.prototype.isSentFolder = function ()
return RL.data().message() && RL.data().sentFolder() === RL.data().message().folderFullNameRaw;
};
/**
* @return {boolean}
*/
MailBoxMessageViewViewModel.prototype.isSpamFolder = function ()
{
return RL.data().message() && RL.data().spamFolder() === RL.data().message().folderFullNameRaw;
};
/**
* @return {boolean}
*/
MailBoxMessageViewViewModel.prototype.isSpamDisabled = function ()
{
return RL.data().message() && RL.data().spamFolder() === Consts.Values.UnuseOptionValue;
};
/**
* @return {boolean}
*/
MailBoxMessageViewViewModel.prototype.isArchiveFolder = function ()
{
return RL.data().message() && RL.data().archiveFolder() === RL.data().message().folderFullNameRaw;
};
/**
* @return {boolean}
*/
MailBoxMessageViewViewModel.prototype.isArchiveDisabled = function ()
{
return RL.data().message() && RL.data().archiveFolder() === Consts.Values.UnuseOptionValue;
};
/**
* @return {boolean}
*/
@ -417,7 +468,7 @@ MailBoxMessageViewViewModel.prototype.decryptPgpEncryptedMessage = function (oMe
{
if (oMessage)
{
oMessage.decryptPgpEncryptedMessage();
oMessage.decryptPgpEncryptedMessage(this.viewPgpPassword());
}
};

View file

@ -64,7 +64,8 @@ function PopupsComposeOpenPgpViewModel()
if (bResult && this.encrypt())
{
aPublicKeys = _.compact(_.union(this.to(), function (sEmail) {
aPublicKeys = [];
_.each(this.to(), function (sEmail) {
var aKeys = oData.findPublicKeysByEmail(sEmail);
if (0 === aKeys.length && bResult)
{
@ -72,11 +73,10 @@ function PopupsComposeOpenPgpViewModel()
self.notification('No public key found for "' + sEmail + '" email');
bResult = false;
}
return aKeys;
}));
aPublicKeys = aPublicKeys.concat(aKeys);
});
if (bResult && (0 === aPublicKeys.length || this.to().length !== aPublicKeys.length))
{
bResult = false;

View file

@ -33,6 +33,7 @@ function PopupsFolderSystemViewModel()
this.draftFolder = oData.draftFolder;
this.spamFolder = oData.spamFolder;
this.trashFolder = oData.trashFolder;
this.archiveFolder = oData.archiveFolder;
fSaveSystemFolders = _.debounce(function () {
@ -40,12 +41,14 @@ function PopupsFolderSystemViewModel()
RL.settingsSet('DraftFolder', self.draftFolder());
RL.settingsSet('SpamFolder', self.spamFolder());
RL.settingsSet('TrashFolder', self.trashFolder());
RL.settingsSet('ArchiveFolder', self.archiveFolder());
RL.remote().saveSystemFolders(Utils.emptyFunction, {
'SentFolder': self.sentFolder(),
'DraftFolder': self.draftFolder(),
'SpamFolder': self.spamFolder(),
'TrashFolder': self.trashFolder(),
'ArchiveFolder': self.archiveFolder(),
'NullFolder': 'NullFolder'
});
@ -57,6 +60,7 @@ function PopupsFolderSystemViewModel()
RL.settingsSet('DraftFolder', self.draftFolder());
RL.settingsSet('SpamFolder', self.spamFolder());
RL.settingsSet('TrashFolder', self.trashFolder());
RL.settingsSet('ArchiveFolder', self.archiveFolder());
fSaveSystemFolders();
};
@ -65,6 +69,7 @@ function PopupsFolderSystemViewModel()
this.draftFolder.subscribe(fCallback);
this.spamFolder.subscribe(fCallback);
this.trashFolder.subscribe(fCallback);
this.archiveFolder.subscribe(fCallback);
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
@ -99,6 +104,9 @@ PopupsFolderSystemViewModel.prototype.onShow = function (iNotificationType)
case Enums.SetSystemFoldersNotification.Trash:
sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH');
break;
case Enums.SetSystemFoldersNotification.Archive:
sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE');
break;
}
this.notification(sNotification);