From d21639cca110ed67f1d2db1e9e0b144084224ad6 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Tue, 26 Sep 2017 21:25:58 +0200 Subject: [PATCH] Show pgp inline menu item only if encryption/signing is actually enabled --- .../com/fsck/k9/activity/compose/RecipientPresenter.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java b/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java index 1b27ff637..b2496431e 100644 --- a/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java +++ b/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java @@ -273,10 +273,6 @@ public class RecipientPresenter implements PermissionPingCallback { ComposeCryptoStatus currentCryptoStatus = getCurrentCachedCryptoStatus(); boolean isCryptoConfigured = currentCryptoStatus != null && currentCryptoStatus.isProviderStateOk(); if (isCryptoConfigured) { - boolean pgpInlineModeEnabled = currentCryptoStatus.isPgpInlineModeEnabled(); - menu.findItem(R.id.openpgp_inline_enable).setVisible(!pgpInlineModeEnabled); - menu.findItem(R.id.openpgp_inline_disable).setVisible(pgpInlineModeEnabled); - boolean isEncrypting = currentCryptoStatus.isEncryptionEnabled(); menu.findItem(R.id.openpgp_encrypt_enable).setVisible(!isEncrypting); menu.findItem(R.id.openpgp_encrypt_disable).setVisible(isEncrypting); @@ -285,6 +281,11 @@ public class RecipientPresenter implements PermissionPingCallback { boolean isSignOnly = currentCryptoStatus.isSignOnly(); menu.findItem(R.id.openpgp_sign_only).setVisible(showSignOnly && !isSignOnly); menu.findItem(R.id.openpgp_sign_only_disable).setVisible(showSignOnly && isSignOnly); + + boolean pgpInlineModeEnabled = currentCryptoStatus.isPgpInlineModeEnabled(); + boolean showPgpInlineEnable = (isEncrypting || isSignOnly) && !pgpInlineModeEnabled; + menu.findItem(R.id.openpgp_inline_enable).setVisible(showPgpInlineEnable); + menu.findItem(R.id.openpgp_inline_disable).setVisible(pgpInlineModeEnabled); } else { menu.findItem(R.id.openpgp_inline_enable).setVisible(false); menu.findItem(R.id.openpgp_inline_disable).setVisible(false);