Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47451c89 authored by Vincent Breitmoser's avatar Vincent Breitmoser
Browse files

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.
parent f7fb48f5
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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);
    }