diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-11-27 17:30:04 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-11-27 17:30:04 +0100 |
commit | 5b41b26a349967acf2197f9f9228526193fd826e (patch) | |
tree | 166452bcc0757564deefe233bf031d2ccb0564d2 /common/modelresult.h | |
parent | 13af56e436f49df32d3b2f6f223cf1dec2eabaac (diff) | |
download | sink-5b41b26a349967acf2197f9f9228526193fd826e.tar.gz sink-5b41b26a349967acf2197f9f9228526193fd826e.zip |
Introduced a QueryRunner object
The QueryRunner object lives for the duration of the query (so just
for the initial query for non-live queries, and for the lifetime of the
result model for live queries).
It's supposed to handle all the threading internally and decouple the
lifetime of the facade.
Diffstat (limited to 'common/modelresult.h')
-rw-r--r-- | common/modelresult.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/common/modelresult.h b/common/modelresult.h index 66dfce5..eb6c86b 100644 --- a/common/modelresult.h +++ b/common/modelresult.h | |||
@@ -23,20 +23,23 @@ | |||
23 | #include <QAbstractItemModel> | 23 | #include <QAbstractItemModel> |
24 | #include <QModelIndex> | 24 | #include <QModelIndex> |
25 | #include <QDebug> | 25 | #include <QDebug> |
26 | #include <QSharedPointer> | ||
26 | #include <functional> | 27 | #include <functional> |
27 | #include "query.h" | 28 | #include "query.h" |
29 | #include "resultprovider.h" | ||
28 | 30 | ||
29 | template<class T, class Ptr> | 31 | template<class T, class Ptr> |
30 | class ModelResult : public QAbstractItemModel | 32 | class ModelResult : public QAbstractItemModel |
31 | { | 33 | { |
32 | public: | 34 | public: |
33 | |||
34 | enum Roles { | 35 | enum Roles { |
35 | DomainObjectRole = Qt::UserRole + 1 | 36 | DomainObjectRole = Qt::UserRole + 1 |
36 | }; | 37 | }; |
37 | 38 | ||
38 | ModelResult(const Akonadi2::Query &query, const QList<QByteArray> &propertyColumns); | 39 | ModelResult(const Akonadi2::Query &query, const QList<QByteArray> &propertyColumns); |
39 | 40 | ||
41 | void setEmitter(const typename Akonadi2::ResultEmitter<Ptr>::Ptr &); | ||
42 | |||
40 | int rowCount(const QModelIndex &parent = QModelIndex()) const; | 43 | int rowCount(const QModelIndex &parent = QModelIndex()) const; |
41 | int columnCount(const QModelIndex &parent = QModelIndex()) const; | 44 | int columnCount(const QModelIndex &parent = QModelIndex()) const; |
42 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; | 45 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
@@ -65,5 +68,6 @@ private: | |||
65 | QList<QByteArray> mPropertyColumns; | 68 | QList<QByteArray> mPropertyColumns; |
66 | Akonadi2::Query mQuery; | 69 | Akonadi2::Query mQuery; |
67 | std::function<void(const Ptr &)> loadEntities; | 70 | std::function<void(const Ptr &)> loadEntities; |
71 | typename Akonadi2::ResultEmitter<Ptr>::Ptr mEmitter; | ||
68 | }; | 72 | }; |
69 | 73 | ||