summaryrefslogtreecommitdiffstats
path: root/framework
diff options
context:
space:
mode:
authorRémi Nicole <nicole@kolabsystems.com>2018-02-26 18:19:43 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-02-26 18:20:13 +0100
commit331f75d4da056ddb235be45a3784d2c19e545211 (patch)
tree64adc5432725e6d484012acfcea64b95b5d1711f /framework
parent2dc4d380f8c0cc90aa0dec67a826703c3ceb34af (diff)
downloadkube-331f75d4da056ddb235be45a3784d2c19e545211.tar.gz
kube-331f75d4da056ddb235be45a3784d2c19e545211.zip
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
Diffstat (limited to 'framework')
-rw-r--r--framework/src/domain/maillistmodel.cpp33
-rw-r--r--framework/src/domain/maillistmodel.h4
-rw-r--r--framework/src/sinkfabric.cpp7
3 files changed, 44 insertions, 0 deletions
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
400{ 400{
401 return false; 401 return false;
402} 402}
403
404void MailListModel::setEntityId(const QString &id)
405{
406 qDebug() << "Running mail query for mail with ID:" << id;
407 using namespace Sink::ApplicationDomain;
408 Sink::Query query;
409 query.setFlags(Sink::Query::LiveQuery);
410 query.filter(id.toUtf8());
411 query.request<Mail::Subject>();
412 query.request<Mail::Sender>();
413 query.request<Mail::To>();
414 query.request<Mail::Cc>();
415 query.request<Mail::Bcc>();
416 query.request<Mail::Date>();
417 query.request<Mail::Unread>();
418 query.request<Mail::Important>();
419 query.request<Mail::Draft>();
420 query.request<Mail::Folder>();
421 query.request<Mail::Sent>();
422 query.request<Mail::Trash>();
423 query.request<Mail::MimeMessage>();
424 query.request<Mail::FullPayloadAvailable>();
425 mFetchMails = true;
426 mFetchedMails.clear();
427 // Latest mail at the top
428 sort(0, Qt::DescendingOrder);
429 runQuery(query);
430}
431
432QString MailListModel::entityId() const
433{
434 return {};
435}
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
33 Q_PROPERTY (QVariant mail READ mail WRITE setMail) 33 Q_PROPERTY (QVariant mail READ mail WRITE setMail)
34 Q_PROPERTY (bool showDrafts READ showDrafts WRITE setShowDrafts) 34 Q_PROPERTY (bool showDrafts READ showDrafts WRITE setShowDrafts)
35 Q_PROPERTY (bool showInbox READ showInbox WRITE setShowInbox) 35 Q_PROPERTY (bool showInbox READ showInbox WRITE setShowInbox)
36 Q_PROPERTY (QString entityId READ entityId WRITE setEntityId)
36 37
37 Q_PROPERTY (QString filter READ filter WRITE setFilter) 38 Q_PROPERTY (QString filter READ filter WRITE setFilter)
38 39
@@ -93,6 +94,9 @@ public:
93 void setShowInbox(bool); 94 void setShowInbox(bool);
94 bool showInbox() const; 95 bool showInbox() const;
95 96
97 void setEntityId(const QString &id);
98 QString entityId() const;
99
96private: 100private:
97 void fetchMail(Sink::ApplicationDomain::Mail::Ptr mail); 101 void fetchMail(Sink::ApplicationDomain::Mail::Ptr mail);
98 102
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:
152 QVariantMap message; 152 QVariantMap message;
153 if (notification.type == Sink::Notification::Warning) { 153 if (notification.type == Sink::Notification::Warning) {
154 message["type"] = "warning"; 154 message["type"] = "warning";
155
156 QVariantList entities;
157 for(const auto &entity : notification.entities) {
158 entities << entity;
159 }
160 message["entities"] = entities;
161
155 message["resource"] = QString{notification.resource}; 162 message["resource"] = QString{notification.resource};
156 if (notification.code == Sink::ApplicationDomain::TransmissionError) { 163 if (notification.code == Sink::ApplicationDomain::TransmissionError) {
157 message["message"] = QObject::tr("Failed to send message."); 164 message["message"] = QObject::tr("Failed to send message.");