summaryrefslogtreecommitdiffstats
path: root/framework/domain/maillistmodel.h
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-04-05 15:04:00 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-04-05 15:04:00 +0200
commit4b1798f0cdf87361869e7cf2b341acacd056c410 (patch)
tree3ff780641acdcb20b81f9b41533afd50a2525d38 /framework/domain/maillistmodel.h
parent71721aa4f3e85bea1a2fe504e86d99f80a3106a9 (diff)
downloadkube-4b1798f0cdf87361869e7cf2b341acacd056c410.tar.gz
kube-4b1798f0cdf87361869e7cf2b341acacd056c410.zip
Moved cpp code into src directory
Diffstat (limited to 'framework/domain/maillistmodel.h')
-rw-r--r--framework/domain/maillistmodel.h94
1 files changed, 0 insertions, 94 deletions
diff --git a/framework/domain/maillistmodel.h b/framework/domain/maillistmodel.h
deleted file mode 100644
index 44347661..00000000
--- a/framework/domain/maillistmodel.h
+++ /dev/null
@@ -1,94 +0,0 @@
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
29class 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 Q_PROPERTY (QString filter READ filter WRITE setFilter)
35
36public:
37 enum Status {
38 NoStatus,
39 InProgressStatus,
40 ErrorStatus
41 };
42 Q_ENUMS(Status)
43
44 MailListModel(QObject *parent = Q_NULLPTR);
45 ~MailListModel();
46
47 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
48
49 bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE;
50 bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const Q_DECL_OVERRIDE;
51
52 enum Roles {
53 Subject = Qt::UserRole + 1,
54 Sender,
55 SenderName,
56 To,
57 Cc,
58 Bcc,
59 Date,
60 Unread,
61 Important,
62 Draft,
63 Sent,
64 Trash,
65 Id,
66 MimeMessage,
67 DomainObject,
68 ThreadSize,
69 Mail,
70 Incomplete,
71 Status
72 };
73
74 QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
75
76 void runQuery(const Sink::Query &query);
77
78 void setParentFolder(const QVariant &parentFolder);
79 QVariant parentFolder() const;
80
81 void setMail(const QVariant &mail);
82 QVariant mail() const;
83
84 void setFilter(const QString &mail);
85 QString filter() const;
86
87private:
88 void fetchMail(Sink::ApplicationDomain::Mail::Ptr mail);
89
90 QSharedPointer<QAbstractItemModel> m_model;
91 bool mFetchMails = false;
92 QSet<QByteArray> mFetchedMails;
93 QByteArray mCurrentQueryItem;
94};