Debian Codegraph @

Dekko/backend/mail/FolderList.h

raw symbols SCIP
1 /* Copyright (C) 2016 - 2017 Dan Chapman <[email protected]>
2
3 This file is part of Dekko email client for Ubuntu devices
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of
8 the License or (at your option) version 3
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef FOLDERLIST_H
19 #define FOLDERLIST_H
20
21 #include <QObject>
22 #include <QmlObjectListModel.h>
23 #include <qmailaccount.h>
24 #include "Folder.h"
25
26 class FolderList : public QObject
27 {
28 Q_OBJECT
29 Q_PROPERTY(QObject *model READ model NOTIFY modelChanged)
30 Q_PROPERTY(quint64 accountId READ accountId WRITE setAccountId NOTIFY accountIdChanged)
31 public:
32 explicit FolderList(QObject *parent = 0);
33
34 QObject *model() { return m_model; }
35 quint64 accountId() const { return m_accountId.toULongLong(); }
36
37
38 static bool sortIdList(const QMailFolderId &a, const QMailFolderId &b);
39
40 signals:
41 void modelChanged();
42 void accountIdChanged();
43
44 public slots:
45 void reset();
46 void setAccountId(const quint64 &id);
47 void addFolder(const QMailFolderId &folderId, QMailMessageKey key, QMailFolderIdList &folderList);
48 void insertFolder(const QMailFolderId &id, const Folder::FolderType &type, const QMailMessageKey &key);
49
50 private:
51 QQmlObjectListModel<Folder> *m_model;
52 QMailAccountId m_accountId;
53 };
54
55 #endif // FOLDERLIST_H