Loading k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java +2 −2 Original line number Diff line number Diff line Loading @@ -966,11 +966,11 @@ public class MessageCompose extends K9Activity implements OnClickListener, recipientPresenter.onMenuAddFromContacts(); break; case R.id.openpgp_encrypt_disable: recipientPresenter.onMenuSetEnableEncryption(false); recipientPresenter.onMenuToggleEncryption(); updateMessageFormat(); break; case R.id.openpgp_encrypt_enable: recipientPresenter.onMenuSetEnableEncryption(true); recipientPresenter.onMenuToggleEncryption(); updateMessageFormat(); break; case R.id.openpgp_inline_enable: Loading k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java +42 −61 Original line number Diff line number Diff line Loading @@ -618,6 +618,20 @@ public class RecipientPresenter { Timber.e("click on crypto status while unconfigured - this should not really happen?!"); return; case OK: toggleEncryptionState(false); return; case UI_REQUIRED: // TODO show openpgp settings PendingIntent pendingIntent = openPgpApiManager.getUserInteractionPendingIntent(); recipientMvpView.launchUserInteractionPendingIntent(pendingIntent, OPENPGP_USER_INTERACTION); break; case UNINITIALIZED: case ERROR: openPgpApiManager.refreshConnection(); } } private void toggleEncryptionState(boolean showGotIt) { ComposeCryptoStatus currentCryptoStatus = getCurrentCachedCryptoStatus(); if (currentCryptoStatus == null) { Timber.e("click on crypto status while crypto status not available - should not really happen?!"); Loading @@ -634,38 +648,25 @@ public class RecipientPresenter { return; } boolean isEncryptOnNoChoice = currentCryptoStatus.canEncryptAndIsMutualDefault() || currentCryptoStatus.isReplyToEncrypted(); if (currentCryptoMode == CryptoMode.NO_CHOICE) { if (currentCryptoStatus.hasAutocryptPendingIntent()) { recipientMvpView.launchUserInteractionPendingIntent( currentCryptoStatus.getAutocryptPendingIntent(), REQUEST_CODE_AUTOCRYPT); } else if (currentCryptoStatus.canEncryptAndIsMutualDefault()) { onCryptoModeChanged(CryptoMode.CHOICE_DISABLED); } else if (currentCryptoStatus.isReplyToEncrypted()) { // TODO warning dialog } else if (isEncryptOnNoChoice) { // TODO warning dialog if we override, especially from reply! onCryptoModeChanged(CryptoMode.CHOICE_DISABLED); } else { onCryptoModeChanged(CryptoMode.CHOICE_ENABLED); if (showGotIt) { recipientMvpView.showOpenPgpEncryptExplanationDialog(); } return; } if (currentCryptoMode == CryptoMode.CHOICE_DISABLED && !currentCryptoStatus.canEncryptAndIsMutualDefault()) { } else if (currentCryptoMode == CryptoMode.CHOICE_DISABLED && !isEncryptOnNoChoice) { onCryptoModeChanged(CryptoMode.CHOICE_ENABLED); return; } } else { onCryptoModeChanged(CryptoMode.NO_CHOICE); return; case UI_REQUIRED: // TODO show openpgp settings PendingIntent pendingIntent = openPgpApiManager.getUserInteractionPendingIntent(); recipientMvpView.launchUserInteractionPendingIntent(pendingIntent, OPENPGP_USER_INTERACTION); break; case UNINITIALIZED: case ERROR: openPgpApiManager.refreshConnection(); } } Loading Loading @@ -755,28 +756,8 @@ public class RecipientPresenter { } } public void onMenuSetEnableEncryption(boolean enableEncryption) { if (cachedCryptoStatus == null) { Timber.e("Received crypto button press while status wasn't initialized?"); return; } if (enableEncryption) { if (!cachedCryptoStatus.allRecipientsCanEncrypt()) { onCryptoModeChanged(CryptoMode.CHOICE_ENABLED); recipientMvpView.showOpenPgpEnabledErrorDialog(true); } else if (cachedCryptoStatus.canEncryptAndIsMutualDefault()) { onCryptoModeChanged(CryptoMode.NO_CHOICE); } else { recipientMvpView.showOpenPgpEncryptExplanationDialog(); onCryptoModeChanged(CryptoMode.CHOICE_ENABLED); } } else { if (cachedCryptoStatus.canEncryptAndIsMutualDefault()) { onCryptoModeChanged(CryptoMode.CHOICE_DISABLED); } else { onCryptoModeChanged(CryptoMode.NO_CHOICE); } } public void onMenuToggleEncryption() { toggleEncryptionState(true); } public void onCryptoPgpClickDisable() { Loading Loading
k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java +2 −2 Original line number Diff line number Diff line Loading @@ -966,11 +966,11 @@ public class MessageCompose extends K9Activity implements OnClickListener, recipientPresenter.onMenuAddFromContacts(); break; case R.id.openpgp_encrypt_disable: recipientPresenter.onMenuSetEnableEncryption(false); recipientPresenter.onMenuToggleEncryption(); updateMessageFormat(); break; case R.id.openpgp_encrypt_enable: recipientPresenter.onMenuSetEnableEncryption(true); recipientPresenter.onMenuToggleEncryption(); updateMessageFormat(); break; case R.id.openpgp_inline_enable: Loading
k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java +42 −61 Original line number Diff line number Diff line Loading @@ -618,6 +618,20 @@ public class RecipientPresenter { Timber.e("click on crypto status while unconfigured - this should not really happen?!"); return; case OK: toggleEncryptionState(false); return; case UI_REQUIRED: // TODO show openpgp settings PendingIntent pendingIntent = openPgpApiManager.getUserInteractionPendingIntent(); recipientMvpView.launchUserInteractionPendingIntent(pendingIntent, OPENPGP_USER_INTERACTION); break; case UNINITIALIZED: case ERROR: openPgpApiManager.refreshConnection(); } } private void toggleEncryptionState(boolean showGotIt) { ComposeCryptoStatus currentCryptoStatus = getCurrentCachedCryptoStatus(); if (currentCryptoStatus == null) { Timber.e("click on crypto status while crypto status not available - should not really happen?!"); Loading @@ -634,38 +648,25 @@ public class RecipientPresenter { return; } boolean isEncryptOnNoChoice = currentCryptoStatus.canEncryptAndIsMutualDefault() || currentCryptoStatus.isReplyToEncrypted(); if (currentCryptoMode == CryptoMode.NO_CHOICE) { if (currentCryptoStatus.hasAutocryptPendingIntent()) { recipientMvpView.launchUserInteractionPendingIntent( currentCryptoStatus.getAutocryptPendingIntent(), REQUEST_CODE_AUTOCRYPT); } else if (currentCryptoStatus.canEncryptAndIsMutualDefault()) { onCryptoModeChanged(CryptoMode.CHOICE_DISABLED); } else if (currentCryptoStatus.isReplyToEncrypted()) { // TODO warning dialog } else if (isEncryptOnNoChoice) { // TODO warning dialog if we override, especially from reply! onCryptoModeChanged(CryptoMode.CHOICE_DISABLED); } else { onCryptoModeChanged(CryptoMode.CHOICE_ENABLED); if (showGotIt) { recipientMvpView.showOpenPgpEncryptExplanationDialog(); } return; } if (currentCryptoMode == CryptoMode.CHOICE_DISABLED && !currentCryptoStatus.canEncryptAndIsMutualDefault()) { } else if (currentCryptoMode == CryptoMode.CHOICE_DISABLED && !isEncryptOnNoChoice) { onCryptoModeChanged(CryptoMode.CHOICE_ENABLED); return; } } else { onCryptoModeChanged(CryptoMode.NO_CHOICE); return; case UI_REQUIRED: // TODO show openpgp settings PendingIntent pendingIntent = openPgpApiManager.getUserInteractionPendingIntent(); recipientMvpView.launchUserInteractionPendingIntent(pendingIntent, OPENPGP_USER_INTERACTION); break; case UNINITIALIZED: case ERROR: openPgpApiManager.refreshConnection(); } } Loading Loading @@ -755,28 +756,8 @@ public class RecipientPresenter { } } public void onMenuSetEnableEncryption(boolean enableEncryption) { if (cachedCryptoStatus == null) { Timber.e("Received crypto button press while status wasn't initialized?"); return; } if (enableEncryption) { if (!cachedCryptoStatus.allRecipientsCanEncrypt()) { onCryptoModeChanged(CryptoMode.CHOICE_ENABLED); recipientMvpView.showOpenPgpEnabledErrorDialog(true); } else if (cachedCryptoStatus.canEncryptAndIsMutualDefault()) { onCryptoModeChanged(CryptoMode.NO_CHOICE); } else { recipientMvpView.showOpenPgpEncryptExplanationDialog(); onCryptoModeChanged(CryptoMode.CHOICE_ENABLED); } } else { if (cachedCryptoStatus.canEncryptAndIsMutualDefault()) { onCryptoModeChanged(CryptoMode.CHOICE_DISABLED); } else { onCryptoModeChanged(CryptoMode.NO_CHOICE); } } public void onMenuToggleEncryption() { toggleEncryptionState(true); } public void onCryptoPgpClickDisable() { Loading