From cd087aad3182b7cd34f5a45cee4864cf54a69057 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 16 Jul 2018 10:51:03 +0200 Subject: 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. --- framework/src/domain/mime/partmodel.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'framework/src/domain/mime/partmodel.cpp') 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 PartModel::roleNames() const roles[IsEncryptedRole] = "encrypted"; roles[IsSignedRole] = "signed"; roles[SecurityLevelRole] = "securityLevel"; + roles[EncryptionSecurityLevelRole] = "encryptionSecurityLevel"; + roles[SignatureSecurityLevelRole] = "signatureSecurityLevel"; roles[ErrorType] = "errorType"; roles[ErrorString] = "errorString"; roles[IsErrorRole] = "error"; @@ -281,6 +283,35 @@ QVariant PartModel::data(const QModelIndex &index, int role) const //No info return "unknown"; } + case EncryptionSecurityLevelRole: { + auto encryption = messagePart->encryptionState(); + bool messageIsEncrypted = encryption == MimeTreeParser::KMMsgPartiallyEncrypted || + encryption == MimeTreeParser::KMMsgFullyEncrypted; + //All good + if (messageIsEncrypted) { + return "good"; + } + //No info + return "unknown"; + } + case SignatureSecurityLevelRole: { + auto signature = messagePart->signatureState(); + bool messageIsSigned = signature == MimeTreeParser::KMMsgPartiallySigned || + signature == MimeTreeParser::KMMsgFullySigned; + if (messageIsSigned) { + auto sigInfo = std::unique_ptr{signatureInfo(messagePart)}; + if (!sigInfo->signatureIsGood) { + if (sigInfo->keyMissing || sigInfo->keyExpired) { + return "notsogood"; + } + return "bad"; + } + return "good"; + } + //No info + return "unknown"; + + } case SignatureDetails: return QVariant::fromValue(signatureInfo(messagePart)); case EncryptionDetails: -- cgit v1.2.3