diff options
-rw-r--r-- | components/mailviewer/contents/ui/MailDataModel.qml | 39 | ||||
-rw-r--r-- | framework/src/domain/mime/partmodel.cpp | 23 |
2 files changed, 43 insertions, 19 deletions
diff --git a/components/mailviewer/contents/ui/MailDataModel.qml b/components/mailviewer/contents/ui/MailDataModel.qml index 32188a04..fa8c462b 100644 --- a/components/mailviewer/contents/ui/MailDataModel.qml +++ b/components/mailviewer/contents/ui/MailDataModel.qml | |||
@@ -43,15 +43,38 @@ DelegateModel { | |||
43 | return Kube.Colors.lightgrey | 43 | return Kube.Colors.lightgrey |
44 | } | 44 | } |
45 | 45 | ||
46 | function getDetails(signatureDetails) | 46 | function getDetails(signed, encrypted, signatureDetails) |
47 | { | 47 | { |
48 | var details = qsTr("Signature") + ":\n" | 48 | var details = ""; |
49 | details += qsTr("Key Id") + ": " + model.signatureDetails.keyId + "\n" | 49 | if (signed && encrypted) { |
50 | if (model.signatureDetails.keyMissing) { | 50 | details += qsTr("This message is signed and encrypted.") + "\n"; |
51 | details += qsTr("Key details are not available.") + "\n" | 51 | } else if (encrypted) { |
52 | details += qsTr("This message is encrypted.") + "\n"; | ||
53 | } else if (signed) { | ||
54 | details += qsTr("This message is signed.") + "\n"; | ||
52 | } | 55 | } |
53 | if (model.signatureDetails.keyIsTrusted) { | 56 | |
54 | details += qsTr("You are trusting this key.") + "\n" | 57 | if (signed) { |
58 | if (details.noSignaturesFound) { | ||
59 | details += qsTr("Failed to validate the signature.") + "\n" | ||
60 | } else if (!signatureDetails.signatureIsGood) { | ||
61 | details += qsTr("The signature is invalid.") + "\n" | ||
62 | } else if (signatureDetails.keyMissing) { | ||
63 | details += qsTr("This message has been signed using key %1.").arg(signatureDetails.keyId) + "\n"; | ||
64 | details += qsTr("The key details are not available.") + "\n"; | ||
65 | return details; | ||
66 | } else { | ||
67 | details += qsTr("This message has been signed using key %1 by %2.").arg(signatureDetails.keyId).arg(signatureDetails.signer) + "\n"; | ||
68 | if (signatureDetails.keyRevoked) { | ||
69 | details += qsTr("The key was revoked.") + "\n" | ||
70 | } | ||
71 | if (signatureDetails.keyExpired) { | ||
72 | details += qsTr("The key has expired.") + "\n" | ||
73 | } | ||
74 | if (signatureDetails.keyIsTrusted) { | ||
75 | details += qsTr("You are trusting this key.") + "\n" | ||
76 | } | ||
77 | } | ||
55 | } | 78 | } |
56 | return details | 79 | return details |
57 | } | 80 | } |
@@ -76,7 +99,7 @@ DelegateModel { | |||
76 | opacity: 0.5 | 99 | opacity: 0.5 |
77 | Kube.ToolTip { | 100 | Kube.ToolTip { |
78 | id: tooltip | 101 | id: tooltip |
79 | text: getDetails(model.signatureDetails) | 102 | text: getDetails(model.signed, model.encrypted, model.signatureDetails); |
80 | visible: mouseArea.containsMouse | 103 | visible: mouseArea.containsMouse |
81 | } | 104 | } |
82 | Kube.SelectableItem { | 105 | Kube.SelectableItem { |
diff --git a/framework/src/domain/mime/partmodel.cpp b/framework/src/domain/mime/partmodel.cpp index c4e002b7..0b95ecbd 100644 --- a/framework/src/domain/mime/partmodel.cpp +++ b/framework/src/domain/mime/partmodel.cpp | |||
@@ -242,21 +242,22 @@ QVariant PartModel::data(const QModelIndex &index, int role) const | |||
242 | case SecurityLevelRole: { | 242 | case SecurityLevelRole: { |
243 | auto signature = messagePart->signatureState(); | 243 | auto signature = messagePart->signatureState(); |
244 | auto encryption = messagePart->encryptionState(); | 244 | auto encryption = messagePart->encryptionState(); |
245 | bool signatureIsOk = signature == MimeTreeParser::KMMsgPartiallySigned || | 245 | bool messageIsSigned = signature == MimeTreeParser::KMMsgPartiallySigned || |
246 | signature == MimeTreeParser::KMMsgFullySigned; | 246 | signature == MimeTreeParser::KMMsgFullySigned; |
247 | bool encryptionIsOk = encryption == MimeTreeParser::KMMsgPartiallyEncrypted || | 247 | bool messageIsEncrypted = encryption == MimeTreeParser::KMMsgPartiallyEncrypted || |
248 | encryption == MimeTreeParser::KMMsgFullyEncrypted; | 248 | encryption == MimeTreeParser::KMMsgFullyEncrypted; |
249 | bool isSigned = signature != MimeTreeParser::KMMsgNotSigned; | 249 | |
250 | bool isEncrypted = encryption != MimeTreeParser::KMMsgNotEncrypted; | 250 | if (messageIsSigned) { |
251 | //Something is wonky | 251 | auto sigInfo = std::unique_ptr<SignatureInfo>{signatureInfo(messagePart)}; |
252 | if ((isSigned && !signatureIsOk) || (isEncrypted && !encryptionIsOk)) { | 252 | if (!sigInfo->signatureIsGood || sigInfo->keyRevoked) { |
253 | if (signature == MimeTreeParser::KMMsgSignatureProblematic || encryption == MimeTreeParser::KMMsgEncryptionProblematic) { | ||
254 | return "bad"; | 253 | return "bad"; |
255 | } | 254 | } |
256 | return "notsogood"; | 255 | if (sigInfo->keyMissing || sigInfo->keyExpired) { |
256 | return "notsogood"; | ||
257 | } | ||
257 | } | 258 | } |
258 | //All good | 259 | //All good |
259 | if (signatureIsOk || encryptionIsOk) { | 260 | if (messageIsSigned || messageIsEncrypted) { |
260 | return "good"; | 261 | return "good"; |
261 | } | 262 | } |
262 | //No info | 263 | //No info |