diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-07-23 12:16:08 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-07-23 14:28:15 +0200 |
commit | e0604f713649186507db37be54cc3aaadcd99663 (patch) | |
tree | 66b796b19b3943f0ecdbb0ff0720a6d0bd36ae0f /framework/src | |
parent | 36b2a1ac66ce66708904870b9458512bbaea4a03 (diff) | |
download | kube-e0604f713649186507db37be54cc3aaadcd99663.tar.gz kube-e0604f713649186507db37be54cc3aaadcd99663.zip |
Search view updates
Diffstat (limited to 'framework/src')
-rw-r--r-- | framework/src/domain/maillistmodel.cpp | 42 | ||||
-rw-r--r-- | framework/src/domain/maillistmodel.h | 4 |
2 files changed, 46 insertions, 0 deletions
diff --git a/framework/src/domain/maillistmodel.cpp b/framework/src/domain/maillistmodel.cpp index 152b4f23..d29e851e 100644 --- a/framework/src/domain/maillistmodel.cpp +++ b/framework/src/domain/maillistmodel.cpp | |||
@@ -328,6 +328,48 @@ QVariant MailListModel::mail() const | |||
328 | return QVariant(); | 328 | return QVariant(); |
329 | } | 329 | } |
330 | 330 | ||
331 | void MailListModel::setSingleMail(const QVariant &variant) | ||
332 | { | ||
333 | using namespace Sink::ApplicationDomain; | ||
334 | auto mail = variant.value<Sink::ApplicationDomain::Mail::Ptr>(); | ||
335 | if (!mail) { | ||
336 | mCurrentQueryItem.clear(); | ||
337 | setSourceModel(nullptr); | ||
338 | return; | ||
339 | } | ||
340 | if (mCurrentQueryItem == mail->identifier()) { | ||
341 | return; | ||
342 | } | ||
343 | mCurrentQueryItem = mail->identifier(); | ||
344 | Sink::Query query{*mail}; | ||
345 | query.setFlags(Sink::Query::LiveQuery | Sink::Query::UpdateStatus); | ||
346 | query.request<Mail::Subject>(); | ||
347 | query.request<Mail::Sender>(); | ||
348 | query.request<Mail::To>(); | ||
349 | query.request<Mail::Cc>(); | ||
350 | query.request<Mail::Bcc>(); | ||
351 | query.request<Mail::Date>(); | ||
352 | query.request<Mail::Unread>(); | ||
353 | query.request<Mail::Important>(); | ||
354 | query.request<Mail::Draft>(); | ||
355 | query.request<Mail::Folder>(); | ||
356 | query.request<Mail::Sent>(); | ||
357 | query.request<Mail::Trash>(); | ||
358 | query.request<Mail::MimeMessage>(); | ||
359 | query.request<Mail::FullPayloadAvailable>(); | ||
360 | mFetchMails = true; | ||
361 | mFetchedMails.clear(); | ||
362 | qDebug() << "Running mail query: " << mail->resourceInstanceIdentifier() << mail->identifier(); | ||
363 | //Latest mail at the bottom | ||
364 | sort(0, Qt::AscendingOrder); | ||
365 | runQuery(query); | ||
366 | } | ||
367 | |||
368 | QVariant MailListModel::singleMail() const | ||
369 | { | ||
370 | return {}; | ||
371 | } | ||
372 | |||
331 | 373 | ||
332 | void MailListModel::setShowDrafts(bool) | 374 | void MailListModel::setShowDrafts(bool) |
333 | { | 375 | { |
diff --git a/framework/src/domain/maillistmodel.h b/framework/src/domain/maillistmodel.h index 4af13dbd..052e4541 100644 --- a/framework/src/domain/maillistmodel.h +++ b/framework/src/domain/maillistmodel.h | |||
@@ -31,6 +31,7 @@ class KUBE_EXPORT MailListModel : public QSortFilterProxyModel | |||
31 | Q_OBJECT | 31 | Q_OBJECT |
32 | Q_PROPERTY (QVariant parentFolder READ parentFolder WRITE setParentFolder) | 32 | Q_PROPERTY (QVariant parentFolder READ parentFolder WRITE setParentFolder) |
33 | Q_PROPERTY (QVariant mail READ mail WRITE setMail) | 33 | Q_PROPERTY (QVariant mail READ mail WRITE setMail) |
34 | Q_PROPERTY (QVariant singleMail READ singleMail WRITE setSingleMail) | ||
34 | Q_PROPERTY (bool showDrafts READ showDrafts WRITE setShowDrafts) | 35 | Q_PROPERTY (bool showDrafts READ showDrafts WRITE setShowDrafts) |
35 | Q_PROPERTY (bool showInbox READ showInbox WRITE setShowInbox) | 36 | Q_PROPERTY (bool showInbox READ showInbox WRITE setShowInbox) |
36 | Q_PROPERTY (QString entityId READ entityId WRITE setEntityId) | 37 | Q_PROPERTY (QString entityId READ entityId WRITE setEntityId) |
@@ -85,6 +86,9 @@ public: | |||
85 | void setMail(const QVariant &mail); | 86 | void setMail(const QVariant &mail); |
86 | QVariant mail() const; | 87 | QVariant mail() const; |
87 | 88 | ||
89 | void setSingleMail(const QVariant &mail); | ||
90 | QVariant singleMail() const; | ||
91 | |||
88 | void setFilter(const QString &mail); | 92 | void setFilter(const QString &mail); |
89 | QString filter() const; | 93 | QString filter() const; |
90 | 94 | ||