diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-26 22:43:15 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-26 22:43:15 +0200 |
commit | 2b0278a02b8bb5de9da79de395942c55449c1c59 (patch) | |
tree | 80a3255cea34cfe6fdb74d69e041c1a4d6da7e08 | |
parent | 35bb27c935eb444aa11b3063458a24122445a4d2 (diff) | |
download | kube-2b0278a02b8bb5de9da79de395942c55449c1c59.tar.gz kube-2b0278a02b8bb5de9da79de395942c55449c1c59.zip |
Update email status
-rw-r--r-- | components/package/contents/ui/ConversationView.qml | 15 | ||||
-rw-r--r-- | framework/domain/maillistmodel.cpp | 12 | ||||
-rw-r--r-- | framework/domain/maillistmodel.h | 10 |
3 files changed, 33 insertions, 4 deletions
diff --git a/components/package/contents/ui/ConversationView.qml b/components/package/contents/ui/ConversationView.qml index 3f5976c2..aa3abcd2 100644 --- a/components/package/contents/ui/ConversationView.qml +++ b/components/package/contents/ui/ConversationView.qml | |||
@@ -476,9 +476,20 @@ Rectangle { | |||
476 | rightMargin: Kirigami.Units.largeSpacing | 476 | rightMargin: Kirigami.Units.largeSpacing |
477 | topMargin: Math.max(attachments.height, Kirigami.Units.largeSpacing) | 477 | topMargin: Math.max(attachments.height, Kirigami.Units.largeSpacing) |
478 | } | 478 | } |
479 | //TODO Change text if we're fetching the body | ||
480 | text: "Incomplete body..." | ||
481 | visible: model.incomplete | 479 | visible: model.incomplete |
480 | text: "Incomplete body..." | ||
481 | color: Kirigami.Theme.textColor | ||
482 | enabled: false | ||
483 | states: [ | ||
484 | State { | ||
485 | name: "inprogress"; when: model.status == KubeFramework.MailListModel.InProgressStatus | ||
486 | PropertyChanges { target: incompleteBody; text: "Downloading message..." } | ||
487 | }, | ||
488 | State { | ||
489 | name: "error"; when: model.status == KubeFramework.MailListModel.ErrorStatus | ||
490 | PropertyChanges { target: incompleteBody; text: "Failed to download message..." } | ||
491 | } | ||
492 | ] | ||
482 | } | 493 | } |
483 | Item { | 494 | Item { |
484 | id: footer | 495 | id: footer |
diff --git a/framework/domain/maillistmodel.cpp b/framework/domain/maillistmodel.cpp index bdf7b9f5..278dca22 100644 --- a/framework/domain/maillistmodel.cpp +++ b/framework/domain/maillistmodel.cpp | |||
@@ -67,6 +67,7 @@ QHash< int, QByteArray > MailListModel::roleNames() const | |||
67 | roles[ThreadSize] = "threadSize"; | 67 | roles[ThreadSize] = "threadSize"; |
68 | roles[Mail] = "mail"; | 68 | roles[Mail] = "mail"; |
69 | roles[Incomplete] = "incomplete"; | 69 | roles[Incomplete] = "incomplete"; |
70 | roles[Status] = "status"; | ||
70 | 71 | ||
71 | return roles; | 72 | return roles; |
72 | } | 73 | } |
@@ -137,6 +138,15 @@ QVariant MailListModel::data(const QModelIndex &idx, int role) const | |||
137 | return QVariant::fromValue(mail); | 138 | return QVariant::fromValue(mail); |
138 | case Incomplete: | 139 | case Incomplete: |
139 | return !mail->getFullPayloadAvailable(); | 140 | return !mail->getFullPayloadAvailable(); |
141 | case Status: | ||
142 | const auto status = srcIdx.data(Sink::Store::StatusRole).toInt(); | ||
143 | if (status == Sink::ApplicationDomain::SyncStatus::SyncInProgress) { | ||
144 | return InProgressStatus; | ||
145 | } | ||
146 | if (status == Sink::ApplicationDomain::SyncStatus::SyncError) { | ||
147 | return ErrorStatus; | ||
148 | } | ||
149 | return NoStatus; | ||
140 | } | 150 | } |
141 | return QSortFilterProxyModel::data(idx, role); | 151 | return QSortFilterProxyModel::data(idx, role); |
142 | } | 152 | } |
@@ -208,7 +218,7 @@ void MailListModel::setMail(const QVariant &variant) | |||
208 | } | 218 | } |
209 | mCurrentQueryItem = mail->identifier(); | 219 | mCurrentQueryItem = mail->identifier(); |
210 | Sink::Query query = Sink::StandardQueries::completeThread(*mail); | 220 | Sink::Query query = Sink::StandardQueries::completeThread(*mail); |
211 | query.setFlags(Sink::Query::LiveQuery); | 221 | query.setFlags(Sink::Query::LiveQuery | Sink::Query::UpdateStatus); |
212 | query.request<Mail::Subject>(); | 222 | query.request<Mail::Subject>(); |
213 | query.request<Mail::Sender>(); | 223 | query.request<Mail::Sender>(); |
214 | query.request<Mail::To>(); | 224 | query.request<Mail::To>(); |
diff --git a/framework/domain/maillistmodel.h b/framework/domain/maillistmodel.h index 8f61fce6..8e22da60 100644 --- a/framework/domain/maillistmodel.h +++ b/framework/domain/maillistmodel.h | |||
@@ -34,6 +34,13 @@ class MailListModel : public QSortFilterProxyModel | |||
34 | Q_PROPERTY (QString filter READ filter WRITE setFilter) | 34 | Q_PROPERTY (QString filter READ filter WRITE setFilter) |
35 | 35 | ||
36 | public: | 36 | public: |
37 | enum Status { | ||
38 | NoStatus, | ||
39 | InProgressStatus, | ||
40 | ErrorStatus | ||
41 | }; | ||
42 | Q_ENUMS(Status) | ||
43 | |||
37 | MailListModel(QObject *parent = Q_NULLPTR); | 44 | MailListModel(QObject *parent = Q_NULLPTR); |
38 | ~MailListModel(); | 45 | ~MailListModel(); |
39 | 46 | ||
@@ -59,7 +66,8 @@ public: | |||
59 | DomainObject, | 66 | DomainObject, |
60 | ThreadSize, | 67 | ThreadSize, |
61 | Mail, | 68 | Mail, |
62 | Incomplete | 69 | Incomplete, |
70 | Status | ||
63 | }; | 71 | }; |
64 | 72 | ||
65 | QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE; | 73 | QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE; |