From 9ab147575870f0303bb3dd36684e28f4afb27aca Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 28 Mar 2017 16:37:32 +0200 Subject: Outboxmodel status --- components/package/contents/ui/Outbox.qml | 15 ++++++++++++--- framework/domain/outboxmodel.cpp | 2 +- framework/domain/outboxmodel.h | 7 +++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/components/package/contents/ui/Outbox.qml b/components/package/contents/ui/Outbox.qml index 6e29946b..1b48aa6f 100644 --- a/components/package/contents/ui/Outbox.qml +++ b/components/package/contents/ui/Outbox.qml @@ -86,9 +86,18 @@ Button { } text: model.subject - //FIXME use theme color - color: model.status == "error" ? KubeTheme.Colors.warningColor : KubeTheme.Colors.textColor - opacity: model.status == "sent" ? 0.5 : 1 + color: KubeTheme.Colors.textColor + opacity: 1 + states: [ + State { + name: "inprogress"; when: model.status == KubeFramework.OutboxModel.InProgressStatus + PropertyChanges { target: subjectLabel; text: "Sending: " + model.subject } + }, + State { + name: "error"; when: model.status == KubeFramework.OutboxModel.ErrorStatus + PropertyChanges { target: subjectLabel; color: KubeTheme.Colors.warningColor } + } + ] } } diff --git a/framework/domain/outboxmodel.cpp b/framework/domain/outboxmodel.cpp index 8494ca0d..b82c1c6b 100644 --- a/framework/domain/outboxmodel.cpp +++ b/framework/domain/outboxmodel.cpp @@ -71,7 +71,7 @@ QVariant OutboxModel::data(const QModelIndex &idx, int role) const case Date: return mail->getDate(); case Status: - return QString("pending"); //TODO + return PendingStatus; case Id: return mail->identifier(); case DomainObject: diff --git a/framework/domain/outboxmodel.h b/framework/domain/outboxmodel.h index 16b5dc49..86821bc2 100644 --- a/framework/domain/outboxmodel.h +++ b/framework/domain/outboxmodel.h @@ -31,6 +31,13 @@ class OutboxModel : public QSortFilterProxyModel Q_OBJECT public: + enum Status { + PendingStatus, + InProgressStatus, + ErrorStatus + }; + Q_ENUMS(Status) + OutboxModel(QObject *parent = Q_NULLPTR); ~OutboxModel(); -- cgit v1.2.3