From 331f75d4da056ddb235be45a3784d2c19e545211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Nicole?= Date: Mon, 26 Feb 2018 18:19:43 +0100 Subject: Improvements of the log view Summary: - Add a test view for the log view - Allow passing the `entities` part of Sink messages - That allowed getting information about which mail could not be sent in sink transmission errors Reviewers: cmollekopf Reviewed By: cmollekopf Differential Revision: https://phabricator.kde.org/D10861 --- framework/src/domain/maillistmodel.cpp | 33 +++++++++++++++++++++++++++++++++ framework/src/domain/maillistmodel.h | 4 ++++ framework/src/sinkfabric.cpp | 7 +++++++ 3 files changed, 44 insertions(+) (limited to 'framework') diff --git a/framework/src/domain/maillistmodel.cpp b/framework/src/domain/maillistmodel.cpp index e2f52d13..143c8a60 100644 --- a/framework/src/domain/maillistmodel.cpp +++ b/framework/src/domain/maillistmodel.cpp @@ -400,3 +400,36 @@ bool MailListModel::showInbox() const { return false; } + +void MailListModel::setEntityId(const QString &id) +{ + qDebug() << "Running mail query for mail with ID:" << id; + using namespace Sink::ApplicationDomain; + Sink::Query query; + query.setFlags(Sink::Query::LiveQuery); + query.filter(id.toUtf8()); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + mFetchMails = true; + mFetchedMails.clear(); + // Latest mail at the top + sort(0, Qt::DescendingOrder); + runQuery(query); +} + +QString MailListModel::entityId() const +{ + return {}; +} diff --git a/framework/src/domain/maillistmodel.h b/framework/src/domain/maillistmodel.h index f83656b9..a6965915 100644 --- a/framework/src/domain/maillistmodel.h +++ b/framework/src/domain/maillistmodel.h @@ -33,6 +33,7 @@ class MailListModel : public QSortFilterProxyModel Q_PROPERTY (QVariant mail READ mail WRITE setMail) Q_PROPERTY (bool showDrafts READ showDrafts WRITE setShowDrafts) Q_PROPERTY (bool showInbox READ showInbox WRITE setShowInbox) + Q_PROPERTY (QString entityId READ entityId WRITE setEntityId) Q_PROPERTY (QString filter READ filter WRITE setFilter) @@ -93,6 +94,9 @@ public: void setShowInbox(bool); bool showInbox() const; + void setEntityId(const QString &id); + QString entityId() const; + private: void fetchMail(Sink::ApplicationDomain::Mail::Ptr mail); diff --git a/framework/src/sinkfabric.cpp b/framework/src/sinkfabric.cpp index 7d780ce3..8492f272 100644 --- a/framework/src/sinkfabric.cpp +++ b/framework/src/sinkfabric.cpp @@ -152,6 +152,13 @@ public: QVariantMap message; if (notification.type == Sink::Notification::Warning) { message["type"] = "warning"; + + QVariantList entities; + for(const auto &entity : notification.entities) { + entities << entity; + } + message["entities"] = entities; + message["resource"] = QString{notification.resource}; if (notification.code == Sink::ApplicationDomain::TransmissionError) { message["message"] = QObject::tr("Failed to send message."); -- cgit v1.2.3