diff options
Diffstat (limited to 'framework/accounts')
-rw-r--r-- | framework/accounts/accountsmodel.cpp | 20 | ||||
-rw-r--r-- | framework/accounts/accountsmodel.h | 12 |
2 files changed, 17 insertions, 15 deletions
diff --git a/framework/accounts/accountsmodel.cpp b/framework/accounts/accountsmodel.cpp index f0487f4f..d999bdbd 100644 --- a/framework/accounts/accountsmodel.cpp +++ b/framework/accounts/accountsmodel.cpp | |||
@@ -45,8 +45,6 @@ QHash< int, QByteArray > AccountsModel::roleNames() const | |||
45 | roles[Icon] = "icon"; | 45 | roles[Icon] = "icon"; |
46 | roles[AccountId] = "accountId"; | 46 | roles[AccountId] = "accountId"; |
47 | roles[Status] = "status"; | 47 | roles[Status] = "status"; |
48 | roles[StatusIcon] = "statusIcon"; | ||
49 | roles[ShowStatus] = "showStatus"; | ||
50 | 48 | ||
51 | return roles; | 49 | return roles; |
52 | } | 50 | } |
@@ -63,17 +61,15 @@ QVariant AccountsModel::data(const QModelIndex &idx, int role) const | |||
63 | case AccountId: | 61 | case AccountId: |
64 | return account->identifier(); | 62 | return account->identifier(); |
65 | case Status: | 63 | case Status: |
66 | return account->getStatus(); | 64 | switch (account->getStatus()) { |
67 | case StatusIcon: | 65 | case Sink::ApplicationDomain::ErrorStatus: |
68 | if (account->getStatus() == Sink::ApplicationDomain::ErrorStatus) { | 66 | return ErrorStatus; |
69 | return "emblem-error"; | 67 | case Sink::ApplicationDomain::BusyStatus: |
70 | } else if (account->getStatus() == Sink::ApplicationDomain::BusyStatus) { | 68 | return BusyStatus; |
71 | return "view-refresh"; | 69 | case Sink::ApplicationDomain::ConnectedStatus: |
72 | } else if (account->getStatus() == Sink::ApplicationDomain::ConnectedStatus) { | 70 | return ConnectedStatus; |
73 | return "checkmark"; | ||
74 | } | 71 | } |
75 | case ShowStatus: | 72 | return OfflineStatus; |
76 | return (account->getStatus() != Sink::ApplicationDomain::OfflineStatus); | ||
77 | } | 73 | } |
78 | return QIdentityProxyModel::data(idx, role); | 74 | return QIdentityProxyModel::data(idx, role); |
79 | } | 75 | } |
diff --git a/framework/accounts/accountsmodel.h b/framework/accounts/accountsmodel.h index 3a2dd712..a32e2c79 100644 --- a/framework/accounts/accountsmodel.h +++ b/framework/accounts/accountsmodel.h | |||
@@ -34,6 +34,14 @@ class AccountsModel : public QIdentityProxyModel | |||
34 | 34 | ||
35 | Q_PROPERTY (QByteArray accountId READ accountId WRITE setAccountId) | 35 | Q_PROPERTY (QByteArray accountId READ accountId WRITE setAccountId) |
36 | public: | 36 | public: |
37 | enum Status { | ||
38 | OfflineStatus, | ||
39 | ConnectedStatus, | ||
40 | BusyStatus, | ||
41 | ErrorStatus | ||
42 | }; | ||
43 | Q_ENUMS(Status) | ||
44 | |||
37 | AccountsModel(QObject *parent = Q_NULLPTR); | 45 | AccountsModel(QObject *parent = Q_NULLPTR); |
38 | ~AccountsModel(); | 46 | ~AccountsModel(); |
39 | 47 | ||
@@ -43,9 +51,7 @@ public: | |||
43 | Name = Qt::UserRole + 1, | 51 | Name = Qt::UserRole + 1, |
44 | Icon, | 52 | Icon, |
45 | AccountId, | 53 | AccountId, |
46 | Status, | 54 | Status |
47 | StatusIcon, | ||
48 | ShowStatus | ||
49 | }; | 55 | }; |
50 | Q_ENUMS(Roles) | 56 | Q_ENUMS(Roles) |
51 | 57 | ||