diff options
Diffstat (limited to 'framework/domain/folderlistmodel.h')
-rw-r--r-- | framework/domain/folderlistmodel.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/framework/domain/folderlistmodel.h b/framework/domain/folderlistmodel.h new file mode 100644 index 00000000..7844e59a --- /dev/null +++ b/framework/domain/folderlistmodel.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | Copyright (c) 2016 Michael Bohlender <michael.bohlender@kdemail.net> | ||
3 | Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com> | ||
4 | |||
5 | This library is free software; you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Library General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, but WITHOUT | ||
11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | ||
13 | License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Library General Public License | ||
16 | along with this library; see the file COPYING.LIB. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
18 | 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | #pragma once | ||
22 | |||
23 | #include <QObject> | ||
24 | #include <QIdentityProxyModel> | ||
25 | #include <QSharedPointer> | ||
26 | #include <QStringList> | ||
27 | |||
28 | class FolderListModel : public QIdentityProxyModel | ||
29 | { | ||
30 | Q_OBJECT | ||
31 | |||
32 | public: | ||
33 | FolderListModel(QObject *parent = Q_NULLPTR); | ||
34 | ~FolderListModel(); | ||
35 | |||
36 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; | ||
37 | |||
38 | enum Roles { | ||
39 | Name = Qt::UserRole + 1, | ||
40 | Icon, | ||
41 | Id, | ||
42 | DomainObject | ||
43 | }; | ||
44 | Q_ENUMS(Roles) | ||
45 | |||
46 | QHash<int, QByteArray> roleNames() const; | ||
47 | |||
48 | private: | ||
49 | QSharedPointer<QAbstractItemModel> mModel; | ||
50 | }; | ||