diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-04-05 15:04:00 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-04-05 15:04:00 +0200 |
commit | 4b1798f0cdf87361869e7cf2b341acacd056c410 (patch) | |
tree | 3ff780641acdcb20b81f9b41533afd50a2525d38 /framework/src/accounts/accountsmodel.h | |
parent | 71721aa4f3e85bea1a2fe504e86d99f80a3106a9 (diff) | |
download | kube-4b1798f0cdf87361869e7cf2b341acacd056c410.tar.gz kube-4b1798f0cdf87361869e7cf2b341acacd056c410.zip |
Moved cpp code into src directory
Diffstat (limited to 'framework/src/accounts/accountsmodel.h')
-rw-r--r-- | framework/src/accounts/accountsmodel.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/framework/src/accounts/accountsmodel.h b/framework/src/accounts/accountsmodel.h new file mode 100644 index 00000000..2c82a8b9 --- /dev/null +++ b/framework/src/accounts/accountsmodel.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com> | ||
3 | |||
4 | This library is free software; you can redistribute it and/or modify it | ||
5 | under the terms of the GNU Library General Public License as published by | ||
6 | the Free Software Foundation; either version 2 of the License, or (at your | ||
7 | option) any later version. | ||
8 | |||
9 | This library is distributed in the hope that it will be useful, but WITHOUT | ||
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | ||
12 | License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Library General Public License | ||
15 | along with this library; see the file COPYING.LIB. If not, write to the | ||
16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
17 | 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | #pragma once | ||
21 | |||
22 | #include <QObject> | ||
23 | #include <QIdentityProxyModel> | ||
24 | #include <QSharedPointer> | ||
25 | #include <QStringList> | ||
26 | |||
27 | namespace Sink { | ||
28 | class Query; | ||
29 | } | ||
30 | |||
31 | class AccountsModel : public QIdentityProxyModel | ||
32 | { | ||
33 | Q_OBJECT | ||
34 | |||
35 | Q_PROPERTY (QByteArray accountId READ accountId WRITE setAccountId) | ||
36 | public: | ||
37 | enum Status { | ||
38 | OfflineStatus, | ||
39 | ConnectedStatus, | ||
40 | BusyStatus, | ||
41 | ErrorStatus, | ||
42 | NoStatus | ||
43 | }; | ||
44 | Q_ENUMS(Status) | ||
45 | |||
46 | AccountsModel(QObject *parent = Q_NULLPTR); | ||
47 | ~AccountsModel(); | ||
48 | |||
49 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; | ||
50 | |||
51 | enum Roles { | ||
52 | Name = Qt::UserRole + 1, | ||
53 | Icon, | ||
54 | AccountId, | ||
55 | Status | ||
56 | }; | ||
57 | Q_ENUMS(Roles) | ||
58 | |||
59 | QHash<int, QByteArray> roleNames() const; | ||
60 | |||
61 | void setAccountId(const QByteArray &id); | ||
62 | QByteArray accountId() const; | ||
63 | |||
64 | private: | ||
65 | void runQuery(const Sink::Query &query); | ||
66 | QSharedPointer<QAbstractItemModel> mModel; | ||
67 | }; | ||