diff options
Diffstat (limited to 'framework')
-rw-r--r-- | framework/qml/ConversationView.qml | 6 | ||||
-rw-r--r-- | framework/src/domain/maillistmodel.cpp | 42 | ||||
-rw-r--r-- | framework/src/domain/maillistmodel.h | 4 |
3 files changed, 47 insertions, 5 deletions
diff --git a/framework/qml/ConversationView.qml b/framework/qml/ConversationView.qml index e1e93b66..b052caa2 100644 --- a/framework/qml/ConversationView.qml +++ b/framework/qml/ConversationView.qml | |||
@@ -28,7 +28,7 @@ import QtQml 2.2 as QtQml | |||
28 | FocusScope { | 28 | FocusScope { |
29 | id: root | 29 | id: root |
30 | 30 | ||
31 | property variant mail; | 31 | property alias model: listView.model |
32 | property bool hideTrash: true; | 32 | property bool hideTrash: true; |
33 | property bool hideNonTrash: false; | 33 | property bool hideNonTrash: false; |
34 | property string searchString: "" | 34 | property string searchString: "" |
@@ -83,10 +83,6 @@ FocusScope { | |||
83 | //Shrink the listview if the content doesn't fill the full height, so the email appears on top instead of on the bottom. | 83 | //Shrink the listview if the content doesn't fill the full height, so the email appears on top instead of on the bottom. |
84 | height: Math.min(contentHeight, parent.height) | 84 | height: Math.min(contentHeight, parent.height) |
85 | 85 | ||
86 | model: Kube.MailListModel { | ||
87 | mail: root.mail | ||
88 | } | ||
89 | |||
90 | Keys.onPressed: { | 86 | Keys.onPressed: { |
91 | //Not implemented as a shortcut because we want it only to apply if we have the focus | 87 | //Not implemented as a shortcut because we want it only to apply if we have the focus |
92 | if (event.text == "d") { | 88 | if (event.text == "d") { |
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 | ||