summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandro Knauß <sknauss@kde.org>2016-11-22 15:36:23 +0100
committerSandro Knauß <sknauss@kde.org>2016-11-23 16:38:21 +0100
commit2629a080ee31fbb4ec91b7fd12db2c6f647a3281 (patch)
tree9a43d9463b876fc06888a8d1f968a3405b62c275
parent3b5795ec482299655c497390496b28cebc8bd498 (diff)
downloadkube-2629a080ee31fbb4ec91b7fd12db2c6f647a3281.tar.gz
kube-2629a080ee31fbb4ec91b7fd12db2c6f647a3281.zip
Use ErrorType and ErrorString from Encryption
-rw-r--r--components/mailviewer/qml/EncryptionPart.qml4
-rw-r--r--framework/domain/messageparser.h4
-rw-r--r--framework/domain/messageparser_new.cpp17
3 files changed, 24 insertions, 1 deletions
diff --git a/components/mailviewer/qml/EncryptionPart.qml b/components/mailviewer/qml/EncryptionPart.qml
index 84f4f89d..058c9af7 100644
--- a/components/mailviewer/qml/EncryptionPart.qml
+++ b/components/mailviewer/qml/EncryptionPart.qml
@@ -44,6 +44,10 @@ Item {
44 visible: encryption.debug 44 visible: encryption.debug
45 text: model.type 45 text: model.type
46 } 46 }
47 Text {
48 visible: model.errorType || encryption.debug
49 text: model.errorType + ": " + model.errorString
50 }
47 BorderImage { 51 BorderImage {
48 width: parent.width 52 width: parent.width
49 height: childrenRect.height + 40 53 height: childrenRect.height + 40
diff --git a/framework/domain/messageparser.h b/framework/domain/messageparser.h
index 036cff7d..aeeed93c 100644
--- a/framework/domain/messageparser.h
+++ b/framework/domain/messageparser.h
@@ -113,7 +113,9 @@ public:
113 ContentsRole, 113 ContentsRole,
114 ContentRole, 114 ContentRole,
115 IsEmbededRole, 115 IsEmbededRole,
116 SecurityLevelRole 116 SecurityLevelRole,
117 EncryptionErrorType,
118 EncryptionErrorString
117 }; 119 };
118 120
119 QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE; 121 QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
diff --git a/framework/domain/messageparser_new.cpp b/framework/domain/messageparser_new.cpp
index 8afd5956..b95a6472 100644
--- a/framework/domain/messageparser_new.cpp
+++ b/framework/domain/messageparser_new.cpp
@@ -306,6 +306,8 @@ QHash<int, QByteArray> NewModel::roleNames() const
306 roles[ContentRole] = "content"; 306 roles[ContentRole] = "content";
307 roles[IsEmbededRole] = "embeded"; 307 roles[IsEmbededRole] = "embeded";
308 roles[SecurityLevelRole] = "securityLevel"; 308 roles[SecurityLevelRole] = "securityLevel";
309 roles[EncryptionErrorType] = "errorType";
310 roles[EncryptionErrorString] = "errorString";
309 return roles; 311 return roles;
310} 312}
311 313
@@ -374,6 +376,21 @@ QVariant NewModel::data(const QModelIndex &index, int role) const
374 return QStringLiteral("GREEN"); 376 return QStringLiteral("GREEN");
375 case IsEmbededRole: 377 case IsEmbededRole:
376 return data(index.parent(), IsEmbededRole); 378 return data(index.parent(), IsEmbededRole);
379 case EncryptionErrorType:
380 {
381 switch(encryption->errorType()) {
382 case Encryption::NoError:
383 return QString();
384 case Encryption::PassphraseError:
385 return QStringLiteral("PassphraseError");
386 case Encryption::KeyMissing:
387 return QStringLiteral("KeyMissing");
388 default:
389 return QStringLiteral("UnknownError");
390 }
391 }
392 case EncryptionErrorString:
393 return encryption->errorString();
377 } 394 }
378 } else if (_data->userType() == qMetaTypeId<Part *>()) { 395 } else if (_data->userType() == qMetaTypeId<Part *>()) {
379 const auto part = _data->value<Part *>(); 396 const auto part = _data->value<Part *>();