summaryrefslogtreecommitdiffstats
path: root/framework/src
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-07-16 10:51:03 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-07-16 10:51:03 +0200
commitcd087aad3182b7cd34f5a45cee4864cf54a69057 (patch)
treedc9cac71c6c62e3ef9af74f0dfa446bf74c356c9 /framework/src
parent0f5eb0a41164177715667e271b01015d4348ab69 (diff)
downloadkube-cd087aad3182b7cd34f5a45cee4864cf54a69057.tar.gz
kube-cd087aad3182b7cd34f5a45cee4864cf54a69057.zip
Separated colors for encryption and signature.
Typically we have a good encryption and potentialyl a problem with the signature. It's weird if there is a problem with the encryption indicated, while there isn't actually one.
Diffstat (limited to 'framework/src')
-rw-r--r--framework/src/domain/mime/partmodel.cpp31
-rw-r--r--framework/src/domain/mime/partmodel.h2
2 files changed, 33 insertions, 0 deletions
diff --git a/framework/src/domain/mime/partmodel.cpp b/framework/src/domain/mime/partmodel.cpp
index ca8856fd..02ef2f6d 100644
--- a/framework/src/domain/mime/partmodel.cpp
+++ b/framework/src/domain/mime/partmodel.cpp
@@ -85,6 +85,8 @@ QHash<int, QByteArray> PartModel::roleNames() const
85 roles[IsEncryptedRole] = "encrypted"; 85 roles[IsEncryptedRole] = "encrypted";
86 roles[IsSignedRole] = "signed"; 86 roles[IsSignedRole] = "signed";
87 roles[SecurityLevelRole] = "securityLevel"; 87 roles[SecurityLevelRole] = "securityLevel";
88 roles[EncryptionSecurityLevelRole] = "encryptionSecurityLevel";
89 roles[SignatureSecurityLevelRole] = "signatureSecurityLevel";
88 roles[ErrorType] = "errorType"; 90 roles[ErrorType] = "errorType";
89 roles[ErrorString] = "errorString"; 91 roles[ErrorString] = "errorString";
90 roles[IsErrorRole] = "error"; 92 roles[IsErrorRole] = "error";
@@ -281,6 +283,35 @@ QVariant PartModel::data(const QModelIndex &index, int role) const
281 //No info 283 //No info
282 return "unknown"; 284 return "unknown";
283 } 285 }
286 case EncryptionSecurityLevelRole: {
287 auto encryption = messagePart->encryptionState();
288 bool messageIsEncrypted = encryption == MimeTreeParser::KMMsgPartiallyEncrypted ||
289 encryption == MimeTreeParser::KMMsgFullyEncrypted;
290 //All good
291 if (messageIsEncrypted) {
292 return "good";
293 }
294 //No info
295 return "unknown";
296 }
297 case SignatureSecurityLevelRole: {
298 auto signature = messagePart->signatureState();
299 bool messageIsSigned = signature == MimeTreeParser::KMMsgPartiallySigned ||
300 signature == MimeTreeParser::KMMsgFullySigned;
301 if (messageIsSigned) {
302 auto sigInfo = std::unique_ptr<SignatureInfo>{signatureInfo(messagePart)};
303 if (!sigInfo->signatureIsGood) {
304 if (sigInfo->keyMissing || sigInfo->keyExpired) {
305 return "notsogood";
306 }
307 return "bad";
308 }
309 return "good";
310 }
311 //No info
312 return "unknown";
313
314 }
284 case SignatureDetails: 315 case SignatureDetails:
285 return QVariant::fromValue(signatureInfo(messagePart)); 316 return QVariant::fromValue(signatureInfo(messagePart));
286 case EncryptionDetails: 317 case EncryptionDetails:
diff --git a/framework/src/domain/mime/partmodel.h b/framework/src/domain/mime/partmodel.h
index 0c8a133d..945fda12 100644
--- a/framework/src/domain/mime/partmodel.h
+++ b/framework/src/domain/mime/partmodel.h
@@ -45,6 +45,8 @@ public:
45 IsSignedRole, 45 IsSignedRole,
46 IsErrorRole, 46 IsErrorRole,
47 SecurityLevelRole, 47 SecurityLevelRole,
48 EncryptionSecurityLevelRole,
49 SignatureSecurityLevelRole,
48 SignatureDetails, 50 SignatureDetails,
49 EncryptionDetails, 51 EncryptionDetails,
50 ErrorType, 52 ErrorType,