summaryrefslogtreecommitdiffstats
path: root/framework/src/domain/mime/partmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/domain/mime/partmodel.cpp')
-rw-r--r--framework/src/domain/mime/partmodel.cpp31
1 files changed, 27 insertions, 4 deletions
diff --git a/framework/src/domain/mime/partmodel.cpp b/framework/src/domain/mime/partmodel.cpp
index de6c89c3..9f802375 100644
--- a/framework/src/domain/mime/partmodel.cpp
+++ b/framework/src/domain/mime/partmodel.cpp
@@ -86,8 +86,8 @@ QHash<int, QByteArray> PartModel::roleNames() const
86 roles[IsEncryptedRole] = "encrypted"; 86 roles[IsEncryptedRole] = "encrypted";
87 roles[IsSignedRole] = "signed"; 87 roles[IsSignedRole] = "signed";
88 roles[SecurityLevelRole] = "securityLevel"; 88 roles[SecurityLevelRole] = "securityLevel";
89 roles[EncryptionErrorType] = "errorType"; 89 roles[ErrorType] = "errorType";
90 roles[EncryptionErrorString] = "errorString"; 90 roles[ErrorString] = "errorString";
91 roles[IsErrorRole] = "error"; 91 roles[IsErrorRole] = "error";
92 roles[SenderRole] = "sender"; 92 roles[SenderRole] = "sender";
93 roles[DateRole] = "date"; 93 roles[DateRole] = "date";
@@ -209,9 +209,32 @@ QVariant PartModel::data(const QModelIndex &index, int role) const
209 return messagePart->encryptionState() != MimeTreeParser::KMMsgNotEncrypted; 209 return messagePart->encryptionState() != MimeTreeParser::KMMsgNotEncrypted;
210 case IsSignedRole: 210 case IsSignedRole:
211 return messagePart->signatureState() != MimeTreeParser::KMMsgNotSigned; 211 return messagePart->signatureState() != MimeTreeParser::KMMsgNotSigned;
212 case EncryptionErrorType: 212 case SecurityLevelRole: {
213 auto signature = messagePart->signatureState();
214 auto encryption = messagePart->encryptionState();
215 bool signatureIsOk = signature == MimeTreeParser::KMMsgPartiallySigned ||
216 signature == MimeTreeParser::KMMsgFullySigned;
217 bool encryptionIsOk = encryption == MimeTreeParser::KMMsgPartiallyEncrypted ||
218 encryption == MimeTreeParser::KMMsgFullyEncrypted;
219 bool isSigned = signature != MimeTreeParser::KMMsgNotSigned;
220 bool isEncrypted = encryption != MimeTreeParser::KMMsgNotEncrypted;
221 //Something is wonky
222 if ((isSigned && !signatureIsOk) || (isEncrypted && !encryptionIsOk)) {
223 if (signature == MimeTreeParser::KMMsgSignatureProblematic || encryption == MimeTreeParser::KMMsgEncryptionProblematic) {
224 return "bad";
225 }
226 return "notsogood";
227 }
228 //All good
229 if (signatureIsOk || encryptionIsOk) {
230 return "good";
231 }
232 //No info
233 return "unknown";
234 }
235 case ErrorType:
213 return messagePart->error(); 236 return messagePart->error();
214 case EncryptionErrorString: { 237 case ErrorString: {
215 switch (messagePart->error()) { 238 switch (messagePart->error()) {
216 case MimeTreeParser::MessagePart::NoKeyError: 239 case MimeTreeParser::MessagePart::NoKeyError:
217 return tr("No key available."); 240 return tr("No key available.");