diff options
-rw-r--r-- | applications/kmail-quick/package/contents/ui/FolderListView.qml | 8 | ||||
-rw-r--r-- | framework/mail/folderlistcontroller.cpp | 5 | ||||
-rw-r--r-- | framework/mail/folderlistcontroller.h | 9 | ||||
-rw-r--r-- | framework/mail/folderlistmodel.cpp | 5 | ||||
-rw-r--r-- | framework/mail/mailplugin.cpp | 1 |
5 files changed, 18 insertions, 10 deletions
diff --git a/applications/kmail-quick/package/contents/ui/FolderListView.qml b/applications/kmail-quick/package/contents/ui/FolderListView.qml index 807e1568..f5ed7765 100644 --- a/applications/kmail-quick/package/contents/ui/FolderListView.qml +++ b/applications/kmail-quick/package/contents/ui/FolderListView.qml | |||
@@ -21,11 +21,15 @@ import QtQuick.Layouts 1.1 | |||
21 | 21 | ||
22 | import org.kde.plasma.core 2.0 as PlasmaCore | 22 | import org.kde.plasma.core 2.0 as PlasmaCore |
23 | 23 | ||
24 | 24 | import org.kde.akonadi2.mail 1.0 as Mail | |
25 | 25 | ||
26 | Item { | 26 | Item { |
27 | id: root | 27 | id: root |
28 | 28 | ||
29 | Mail.FolderList { | ||
30 | id: folderList | ||
31 | } | ||
32 | |||
29 | Item { | 33 | Item { |
30 | id: searchBox | 34 | id: searchBox |
31 | 35 | ||
@@ -56,7 +60,7 @@ Item { | |||
56 | 60 | ||
57 | clip: true | 61 | clip: true |
58 | 62 | ||
59 | model: FolderModel {} | 63 | model: folderList.model //FolderModel {} |
60 | 64 | ||
61 | delegate: ListItem { | 65 | delegate: ListItem { |
62 | 66 | ||
diff --git a/framework/mail/folderlistcontroller.cpp b/framework/mail/folderlistcontroller.cpp index 900e378d..9edc547c 100644 --- a/framework/mail/folderlistcontroller.cpp +++ b/framework/mail/folderlistcontroller.cpp | |||
@@ -25,6 +25,11 @@ void FolderListController::setAccountId(const QString &id) | |||
25 | } | 25 | } |
26 | } | 26 | } |
27 | 27 | ||
28 | FolderListModel* FolderListController::model() const | ||
29 | { | ||
30 | return m_model.data(); | ||
31 | } | ||
32 | |||
28 | void FolderListController::loadFolders(const QString &id) | 33 | void FolderListController::loadFolders(const QString &id) |
29 | { | 34 | { |
30 | //load foldermodel from akonadi | 35 | //load foldermodel from akonadi |
diff --git a/framework/mail/folderlistcontroller.h b/framework/mail/folderlistcontroller.h index 18f5624d..84ce24be 100644 --- a/framework/mail/folderlistcontroller.h +++ b/framework/mail/folderlistcontroller.h | |||
@@ -1,15 +1,16 @@ | |||
1 | #pragma once | 1 | #pragma once |
2 | 2 | ||
3 | #include "folderlistmodel.h" | ||
4 | |||
3 | #include <QObject> | 5 | #include <QObject> |
4 | #include <QScopedPointer> | 6 | #include <QScopedPointer> |
5 | #include <QString> | 7 | #include <QString> |
6 | #include <QAbstractItemModel> | ||
7 | 8 | ||
8 | class FolderListController : public QObject | 9 | class FolderListController : public QObject |
9 | { | 10 | { |
10 | Q_OBJECT | 11 | Q_OBJECT |
11 | Q_PROPERTY (QString accountId READ accountId WRITE setAccountId NOTIFY accountIdChanged) | 12 | Q_PROPERTY (QString accountId READ accountId WRITE setAccountId NOTIFY accountIdChanged) |
12 | Q_PROPERTY (QAbstractItemModel *model READ model CONSTANT) | 13 | Q_PROPERTY (FolderListModel *model READ model CONSTANT) |
13 | 14 | ||
14 | public: | 15 | public: |
15 | explicit FolderListController(QObject *parent = Q_NULLPTR); | 16 | explicit FolderListController(QObject *parent = Q_NULLPTR); |
@@ -17,7 +18,7 @@ public: | |||
17 | QString accountId() const; | 18 | QString accountId() const; |
18 | void setAccountId(const QString &id); | 19 | void setAccountId(const QString &id); |
19 | 20 | ||
20 | QAbstractItemModel *model() const; | 21 | FolderListModel *model() const; |
21 | 22 | ||
22 | void loadFolders(const QString &id); | 23 | void loadFolders(const QString &id); |
23 | 24 | ||
@@ -31,5 +32,5 @@ public slots: | |||
31 | 32 | ||
32 | private: | 33 | private: |
33 | QString m_accountId; | 34 | QString m_accountId; |
34 | QScopedPointer<QAbstractItemModel> m_model; | 35 | QScopedPointer<FolderListModel> m_model; |
35 | }; | 36 | }; |
diff --git a/framework/mail/folderlistmodel.cpp b/framework/mail/folderlistmodel.cpp index d7889da4..b4b31585 100644 --- a/framework/mail/folderlistmodel.cpp +++ b/framework/mail/folderlistmodel.cpp | |||
@@ -10,9 +10,8 @@ FolderListModel::FolderListModel(QObject *parent) : QIdentityProxyModel() | |||
10 | QList<QByteArray> requestedProperties; | 10 | QList<QByteArray> requestedProperties; |
11 | requestedProperties << "name" << "icon"; | 11 | requestedProperties << "name" << "icon"; |
12 | query.requestedProperties = requestedProperties.toSet(); | 12 | query.requestedProperties = requestedProperties.toSet(); |
13 | //TODO | 13 | mModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); |
14 | //mModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 14 | setSourceModel(mModel.data()); |
15 | //setSourceModel(mModel.data()); | ||
16 | } | 15 | } |
17 | 16 | ||
18 | FolderListModel::~FolderListModel() | 17 | FolderListModel::~FolderListModel() |
diff --git a/framework/mail/mailplugin.cpp b/framework/mail/mailplugin.cpp index e5988591..b2939acf 100644 --- a/framework/mail/mailplugin.cpp +++ b/framework/mail/mailplugin.cpp | |||
@@ -12,7 +12,6 @@ | |||
12 | void MailPlugin::registerTypes (const char *uri) | 12 | void MailPlugin::registerTypes (const char *uri) |
13 | { | 13 | { |
14 | Q_ASSERT(uri == QLatin1String("org.kde.akonadi2.mail")); | 14 | Q_ASSERT(uri == QLatin1String("org.kde.akonadi2.mail")); |
15 | qmlRegisterType<QAbstractItemModel>(); | ||
16 | 15 | ||
17 | qmlRegisterType<FolderListModel>(); | 16 | qmlRegisterType<FolderListModel>(); |
18 | qmlRegisterType<FolderListController>(uri, 1, 0, "FolderList"); | 17 | qmlRegisterType<FolderListController>(uri, 1, 0, "FolderList"); |