From 2629a080ee31fbb4ec91b7fd12db2c6f647a3281 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Tue, 22 Nov 2016 15:36:23 +0100 Subject: Use ErrorType and ErrorString from Encryption --- components/mailviewer/qml/EncryptionPart.qml | 4 ++++ framework/domain/messageparser.h | 4 +++- framework/domain/messageparser_new.cpp | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) 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 { visible: encryption.debug text: model.type } + Text { + visible: model.errorType || encryption.debug + text: model.errorType + ": " + model.errorString + } BorderImage { width: parent.width 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: ContentsRole, ContentRole, IsEmbededRole, - SecurityLevelRole + SecurityLevelRole, + EncryptionErrorType, + EncryptionErrorString }; QHash 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 NewModel::roleNames() const roles[ContentRole] = "content"; roles[IsEmbededRole] = "embeded"; roles[SecurityLevelRole] = "securityLevel"; + roles[EncryptionErrorType] = "errorType"; + roles[EncryptionErrorString] = "errorString"; return roles; } @@ -374,6 +376,21 @@ QVariant NewModel::data(const QModelIndex &index, int role) const return QStringLiteral("GREEN"); case IsEmbededRole: return data(index.parent(), IsEmbededRole); + case EncryptionErrorType: + { + switch(encryption->errorType()) { + case Encryption::NoError: + return QString(); + case Encryption::PassphraseError: + return QStringLiteral("PassphraseError"); + case Encryption::KeyMissing: + return QStringLiteral("KeyMissing"); + default: + return QStringLiteral("UnknownError"); + } + } + case EncryptionErrorString: + return encryption->errorString(); } } else if (_data->userType() == qMetaTypeId()) { const auto part = _data->value(); -- cgit v1.2.3