Enable encryption if editing an encrypted draft

This commit is a hack. It assumes that if a draft is encrypted, the user
chose to encrypt at some point and sets the status based on that
assumption. This is only an assumption though, which becomes a problem
e.g. if some other MUA encrypts all drafts. At some point we should
remember the actual user choice.
This commit is contained in:
Vincent Breitmoser 2018-04-04 04:09:23 +02:00
parent f7fb48f53f
commit 47451c89fe

View file

@ -222,6 +222,7 @@ public class RecipientPresenter {
public void initFromDraftMessage(Message message) {
initRecipientsFromDraftMessage(message);
initEncryptionStatus(message);
initPgpInlineFromDraftMessage(message);
}
@ -235,6 +236,13 @@ public class RecipientPresenter {
addBccAddresses(bccRecipients);
}
private void initEncryptionStatus(Message message) {
boolean isEncryptedDraft = composePgpEnableByDefaultDecider.shouldEncryptByDefault(message);
if (isEncryptedDraft) {
currentCryptoMode = CryptoMode.CHOICE_ENABLED;
}
}
private void initPgpInlineFromDraftMessage(Message message) {
cryptoEnablePgpInline = message.isSet(Flag.X_DRAFT_OPENPGP_INLINE);
}