diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-30 15:57:44 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-30 15:57:44 +0200 |
commit | 49824a0bb7ca2d35b5a3f074ecd86ffd6a1f177a (patch) | |
tree | 18f4eacddc04bebcd9f086de188d5320f072f642 /framework/domain/outboxmodel.cpp | |
parent | 211fdde3ab546142e8aaf9d2b6508c949474b634 (diff) | |
download | kube-49824a0bb7ca2d35b5a3f074ecd86ffd6a1f177a.tar.gz kube-49824a0bb7ca2d35b5a3f074ecd86ffd6a1f177a.zip |
Outbox mail status
Diffstat (limited to 'framework/domain/outboxmodel.cpp')
-rw-r--r-- | framework/domain/outboxmodel.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/framework/domain/outboxmodel.cpp b/framework/domain/outboxmodel.cpp index 7cfdc71a..237648b1 100644 --- a/framework/domain/outboxmodel.cpp +++ b/framework/domain/outboxmodel.cpp | |||
@@ -39,7 +39,7 @@ OutboxModel::OutboxModel(QObject *parent) | |||
39 | 39 | ||
40 | using namespace Sink::ApplicationDomain; | 40 | using namespace Sink::ApplicationDomain; |
41 | auto query = Sink::StandardQueries::outboxMails(); | 41 | auto query = Sink::StandardQueries::outboxMails(); |
42 | query.setFlags(Sink::Query::LiveQuery); | 42 | query.setFlags(Sink::Query::LiveQuery | Sink::Query::UpdateStatus); |
43 | query.request<Mail::Subject>(); | 43 | query.request<Mail::Subject>(); |
44 | query.request<Mail::Date>(); | 44 | query.request<Mail::Date>(); |
45 | query.request<Mail::Folder>(); | 45 | query.request<Mail::Folder>(); |
@@ -48,6 +48,7 @@ OutboxModel::OutboxModel(QObject *parent) | |||
48 | connect(this, &QAbstractItemModel::rowsRemoved, this, &OutboxModel::countChanged); | 48 | connect(this, &QAbstractItemModel::rowsRemoved, this, &OutboxModel::countChanged); |
49 | 49 | ||
50 | mNotifier->registerHandler([this] (const Sink::Notification &n) { | 50 | mNotifier->registerHandler([this] (const Sink::Notification &n) { |
51 | //TODO aggregate status from multiple resources | ||
51 | if (n.type == Sink::Notification::Status) { | 52 | if (n.type == Sink::Notification::Status) { |
52 | switch (n.code) { | 53 | switch (n.code) { |
53 | case Sink::ApplicationDomain::Status::ErrorStatus: | 54 | case Sink::ApplicationDomain::Status::ErrorStatus: |
@@ -95,8 +96,16 @@ QVariant OutboxModel::data(const QModelIndex &idx, int role) const | |||
95 | return mail->getSubject(); | 96 | return mail->getSubject(); |
96 | case Date: | 97 | case Date: |
97 | return mail->getDate(); | 98 | return mail->getDate(); |
98 | case Status: | 99 | case Status: { |
100 | const auto status = srcIdx.data(Sink::Store::StatusRole).toInt(); | ||
101 | if (status == Sink::ApplicationDomain::SyncStatus::SyncInProgress) { | ||
102 | return InProgressStatus; | ||
103 | } | ||
104 | if (status == Sink::ApplicationDomain::SyncStatus::SyncError) { | ||
105 | return ErrorStatus; | ||
106 | } | ||
99 | return PendingStatus; | 107 | return PendingStatus; |
108 | } | ||
100 | case Id: | 109 | case Id: |
101 | return mail->identifier(); | 110 | return mail->identifier(); |
102 | case DomainObject: | 111 | case DomainObject: |