Loading k9mail/src/main/java/com/fsck/k9/mailstore/CryptoResultAnnotation.java +1 −0 Original line number Diff line number Diff line Loading @@ -159,5 +159,6 @@ public final class CryptoResultAnnotation { OPENPGP_ENCRYPTED_BUT_INCOMPLETE, SIGNED_BUT_UNSUPPORTED, ENCRYPTED_BUT_UNSUPPORTED, OPENPGP_ENCRYPTED_NO_PROVIDER, } } k9mail/src/main/java/com/fsck/k9/ui/crypto/MessageCryptoSplitter.java +11 −8 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ import com.fsck.k9.crypto.MessageDecryptVerifier; import com.fsck.k9.mail.Message; import com.fsck.k9.mail.Part; import com.fsck.k9.mailstore.CryptoResultAnnotation; import com.fsck.k9.mailstore.CryptoResultAnnotation.CryptoError; public class MessageCryptoSplitter { Loading @@ -19,20 +20,21 @@ public class MessageCryptoSplitter { @Nullable public static CryptoMessageParts split(@NonNull Message message, @Nullable MessageCryptoAnnotations annotations) { if (annotations == null) { return null; } ArrayList<Part> extraParts = new ArrayList<>(); Part primaryPart = MessageDecryptVerifier.findPrimaryEncryptedOrSignedPart(message, extraParts); if (!annotations.has(primaryPart)) { if (primaryPart == null) { return null; } if (annotations == null) { CryptoResultAnnotation rootPartAnnotation = CryptoResultAnnotation.createErrorAnnotation(CryptoError.OPENPGP_ENCRYPTED_NO_PROVIDER, null); return new CryptoMessageParts(primaryPart, rootPartAnnotation, extraParts); } CryptoResultAnnotation rootPartAnnotation = annotations.get(primaryPart); Part rootPart; if (rootPartAnnotation.hasReplacementData()) { if (rootPartAnnotation != null && rootPartAnnotation.hasReplacementData()) { rootPart = rootPartAnnotation.getReplacementData(); } else { rootPart = primaryPart; Loading @@ -43,11 +45,12 @@ public class MessageCryptoSplitter { public static class CryptoMessageParts { public final Part contentPart; @Nullable public final CryptoResultAnnotation contentCryptoAnnotation; public final List<Part> extraParts; CryptoMessageParts(Part contentPart, CryptoResultAnnotation contentCryptoAnnotation, List<Part> extraParts) { CryptoMessageParts(Part contentPart, @Nullable CryptoResultAnnotation contentCryptoAnnotation, List<Part> extraParts) { this.contentPart = contentPart; this.contentCryptoAnnotation = contentCryptoAnnotation; this.extraParts = Collections.unmodifiableList(extraParts); Loading k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageCryptoPresenter.java +5 −0 Original line number Diff line number Diff line Loading @@ -116,6 +116,11 @@ public class MessageCryptoPresenter implements OnCryptoClickListener { break; } case ENCRYPTED_NO_PROVIDER: { messageView.showNoCryptoProviderConfigured(messageViewInfo); break; } case INCOMPLETE_SIGNED: case UNSUPPORTED_SIGNED: default: { Loading k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageTopView.java +15 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,21 @@ public class MessageTopView extends LinearLayout { displayViewOnLoadFinished(false); } public void showNoCryptoProviderConfigured(MessageViewInfo messageViewInfo) { resetAndPrepareMessageView(messageViewInfo); View view = mInflater.inflate(R.layout.message_content_crypto_no_provider, containerView, false); view.findViewById(R.id.crypto_settings).setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { // TODO } }); containerView.addView(view); displayViewOnLoadFinished(false); } private void setCryptoProviderIcon(Drawable openPgpApiProviderIcon, View view) { ImageView cryptoProviderIcon = (ImageView) view.findViewById(R.id.crypto_error_icon); if (openPgpApiProviderIcon != null) { Loading k9mail/src/main/java/com/fsck/k9/view/MessageCryptoDisplayStatus.java +9 −0 Original line number Diff line number Diff line Loading @@ -136,6 +136,12 @@ public enum MessageCryptoDisplayStatus { R.string.crypto_msg_signed_unencrypted, R.string.crypto_msg_sign_incomplete ), ENCRYPTED_NO_PROVIDER ( R.attr.openpgp_red, R.drawable.status_lock_error, R.string.crypto_msg_unsupported_encrypted ), UNSUPPORTED_ENCRYPTED ( R.attr.openpgp_red, R.drawable.status_lock_error, Loading Loading @@ -214,6 +220,9 @@ public enum MessageCryptoDisplayStatus { case OPENPGP_ENCRYPTED_API_ERROR: return ENCRYPTED_ERROR; case OPENPGP_ENCRYPTED_NO_PROVIDER: return ENCRYPTED_NO_PROVIDER; } throw new IllegalStateException("Unhandled case!"); } Loading Loading
k9mail/src/main/java/com/fsck/k9/mailstore/CryptoResultAnnotation.java +1 −0 Original line number Diff line number Diff line Loading @@ -159,5 +159,6 @@ public final class CryptoResultAnnotation { OPENPGP_ENCRYPTED_BUT_INCOMPLETE, SIGNED_BUT_UNSUPPORTED, ENCRYPTED_BUT_UNSUPPORTED, OPENPGP_ENCRYPTED_NO_PROVIDER, } }
k9mail/src/main/java/com/fsck/k9/ui/crypto/MessageCryptoSplitter.java +11 −8 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ import com.fsck.k9.crypto.MessageDecryptVerifier; import com.fsck.k9.mail.Message; import com.fsck.k9.mail.Part; import com.fsck.k9.mailstore.CryptoResultAnnotation; import com.fsck.k9.mailstore.CryptoResultAnnotation.CryptoError; public class MessageCryptoSplitter { Loading @@ -19,20 +20,21 @@ public class MessageCryptoSplitter { @Nullable public static CryptoMessageParts split(@NonNull Message message, @Nullable MessageCryptoAnnotations annotations) { if (annotations == null) { return null; } ArrayList<Part> extraParts = new ArrayList<>(); Part primaryPart = MessageDecryptVerifier.findPrimaryEncryptedOrSignedPart(message, extraParts); if (!annotations.has(primaryPart)) { if (primaryPart == null) { return null; } if (annotations == null) { CryptoResultAnnotation rootPartAnnotation = CryptoResultAnnotation.createErrorAnnotation(CryptoError.OPENPGP_ENCRYPTED_NO_PROVIDER, null); return new CryptoMessageParts(primaryPart, rootPartAnnotation, extraParts); } CryptoResultAnnotation rootPartAnnotation = annotations.get(primaryPart); Part rootPart; if (rootPartAnnotation.hasReplacementData()) { if (rootPartAnnotation != null && rootPartAnnotation.hasReplacementData()) { rootPart = rootPartAnnotation.getReplacementData(); } else { rootPart = primaryPart; Loading @@ -43,11 +45,12 @@ public class MessageCryptoSplitter { public static class CryptoMessageParts { public final Part contentPart; @Nullable public final CryptoResultAnnotation contentCryptoAnnotation; public final List<Part> extraParts; CryptoMessageParts(Part contentPart, CryptoResultAnnotation contentCryptoAnnotation, List<Part> extraParts) { CryptoMessageParts(Part contentPart, @Nullable CryptoResultAnnotation contentCryptoAnnotation, List<Part> extraParts) { this.contentPart = contentPart; this.contentCryptoAnnotation = contentCryptoAnnotation; this.extraParts = Collections.unmodifiableList(extraParts); Loading
k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageCryptoPresenter.java +5 −0 Original line number Diff line number Diff line Loading @@ -116,6 +116,11 @@ public class MessageCryptoPresenter implements OnCryptoClickListener { break; } case ENCRYPTED_NO_PROVIDER: { messageView.showNoCryptoProviderConfigured(messageViewInfo); break; } case INCOMPLETE_SIGNED: case UNSUPPORTED_SIGNED: default: { Loading
k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageTopView.java +15 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,21 @@ public class MessageTopView extends LinearLayout { displayViewOnLoadFinished(false); } public void showNoCryptoProviderConfigured(MessageViewInfo messageViewInfo) { resetAndPrepareMessageView(messageViewInfo); View view = mInflater.inflate(R.layout.message_content_crypto_no_provider, containerView, false); view.findViewById(R.id.crypto_settings).setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { // TODO } }); containerView.addView(view); displayViewOnLoadFinished(false); } private void setCryptoProviderIcon(Drawable openPgpApiProviderIcon, View view) { ImageView cryptoProviderIcon = (ImageView) view.findViewById(R.id.crypto_error_icon); if (openPgpApiProviderIcon != null) { Loading
k9mail/src/main/java/com/fsck/k9/view/MessageCryptoDisplayStatus.java +9 −0 Original line number Diff line number Diff line Loading @@ -136,6 +136,12 @@ public enum MessageCryptoDisplayStatus { R.string.crypto_msg_signed_unencrypted, R.string.crypto_msg_sign_incomplete ), ENCRYPTED_NO_PROVIDER ( R.attr.openpgp_red, R.drawable.status_lock_error, R.string.crypto_msg_unsupported_encrypted ), UNSUPPORTED_ENCRYPTED ( R.attr.openpgp_red, R.drawable.status_lock_error, Loading Loading @@ -214,6 +220,9 @@ public enum MessageCryptoDisplayStatus { case OPENPGP_ENCRYPTED_API_ERROR: return ENCRYPTED_ERROR; case OPENPGP_ENCRYPTED_NO_PROVIDER: return ENCRYPTED_NO_PROVIDER; } throw new IllegalStateException("Unhandled case!"); } Loading