diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-03-09 15:20:31 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-03-09 15:20:31 +0100 |
commit | f5185c4799fe0e9c31a218dfc8310515ac921c2b (patch) | |
tree | 5524d7a85c8bf82890d79ec6d1bb82b5124fd3b3 /framework/domain/maillistmodel.h | |
parent | c9ccf868f5d533a07811b949577f772f618d2de3 (diff) | |
download | kube-f5185c4799fe0e9c31a218dfc8310515ac921c2b.tar.gz kube-f5185c4799fe0e9c31a218dfc8310515ac921c2b.zip |
Moved framework/mail to framework/domain
Diffstat (limited to 'framework/domain/maillistmodel.h')
-rw-r--r-- | framework/domain/maillistmodel.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/framework/domain/maillistmodel.h b/framework/domain/maillistmodel.h new file mode 100644 index 00000000..47a2a091 --- /dev/null +++ b/framework/domain/maillistmodel.h | |||
@@ -0,0 +1,66 @@ | |||
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 <sink/store.h> | ||
24 | |||
25 | #include <QSortFilterProxyModel> | ||
26 | #include <QSharedPointer> | ||
27 | #include <QStringList> | ||
28 | |||
29 | class MailListModel : public QSortFilterProxyModel | ||
30 | { | ||
31 | Q_OBJECT | ||
32 | Q_PROPERTY (QVariant parentFolder READ parentFolder WRITE setParentFolder) | ||
33 | Q_PROPERTY (QVariant mail READ mail WRITE setMail) | ||
34 | |||
35 | public: | ||
36 | MailListModel(QObject *parent = Q_NULLPTR); | ||
37 | ~MailListModel(); | ||
38 | |||
39 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; | ||
40 | |||
41 | bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE; | ||
42 | |||
43 | enum Roles { | ||
44 | Subject = Qt::UserRole + 1, | ||
45 | Sender, | ||
46 | SenderName, | ||
47 | Date, | ||
48 | Unread, | ||
49 | Important, | ||
50 | Id, | ||
51 | MimeMessage, | ||
52 | DomainObject | ||
53 | }; | ||
54 | |||
55 | QHash<int, QByteArray> roleNames() const; | ||
56 | |||
57 | void runQuery(const Sink::Query &query); | ||
58 | |||
59 | void setParentFolder(const QVariant &parentFolder); | ||
60 | QVariant parentFolder() const; | ||
61 | |||
62 | void setMail(const QVariant &mail); | ||
63 | QVariant mail() const; | ||
64 | private: | ||
65 | QSharedPointer<QAbstractItemModel> m_model; | ||
66 | }; | ||