summaryrefslogtreecommitdiffstats
path: root/framework/domain/identitiesmodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'framework/domain/identitiesmodel.h')
-rw-r--r--framework/domain/identitiesmodel.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/framework/domain/identitiesmodel.h b/framework/domain/identitiesmodel.h
new file mode 100644
index 00000000..9b172251
--- /dev/null
+++ b/framework/domain/identitiesmodel.h
@@ -0,0 +1,60 @@
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
27namespace Sink {
28 class Query;
29}
30
31class IdentitiesModel : public QIdentityProxyModel
32{
33 Q_OBJECT
34
35public:
36 IdentitiesModel(QObject *parent = Q_NULLPTR);
37 ~IdentitiesModel();
38
39 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
40
41 enum Roles {
42 Name = Qt::UserRole + 1,
43 Username,
44 Address,
45 IdentityId,
46 AccountId,
47 AccountName,
48 AccountIcon,
49 DisplayName
50 };
51 Q_ENUMS(Roles)
52
53 QHash<int, QByteArray> roleNames() const;
54
55private:
56 void runQuery(const Sink::Query &query);
57 QSharedPointer<QAbstractItemModel> mModel;
58 QHash <QByteArray, QString> mAccountNames;
59 QHash <QByteArray, QString> mAccountIcons;
60};