summaryrefslogtreecommitdiffstats
path: root/common/queryrunner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/queryrunner.cpp')
-rw-r--r--common/queryrunner.cpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/common/queryrunner.cpp b/common/queryrunner.cpp
index e365cfc..9f6d23f 100644
--- a/common/queryrunner.cpp
+++ b/common/queryrunner.cpp
@@ -53,27 +53,17 @@ static inline ResultSet fullScan(const Akonadi2::Storage::Transaction &transacti
53template<class DomainType> 53template<class DomainType>
54QueryRunner<DomainType>::QueryRunner(const Akonadi2::Query &query, const Akonadi2::ResourceAccessInterface::Ptr &resourceAccess, const QByteArray &instanceIdentifier, const DomainTypeAdaptorFactoryInterface::Ptr &factory, const QByteArray &bufferType) 54QueryRunner<DomainType>::QueryRunner(const Akonadi2::Query &query, const Akonadi2::ResourceAccessInterface::Ptr &resourceAccess, const QByteArray &instanceIdentifier, const DomainTypeAdaptorFactoryInterface::Ptr &factory, const QByteArray &bufferType)
55 : QueryRunnerBase(), 55 : QueryRunnerBase(),
56 mResourceAccess(resourceAccess),
57 mResultProvider(new ResultProvider<typename DomainType::Ptr>), 56 mResultProvider(new ResultProvider<typename DomainType::Ptr>),
57 mResourceAccess(resourceAccess),
58 mDomainTypeAdaptorFactory(factory), 58 mDomainTypeAdaptorFactory(factory),
59 mQuery(query),
60 mResourceInstanceIdentifier(instanceIdentifier), 59 mResourceInstanceIdentifier(instanceIdentifier),
61 mBufferType(bufferType) 60 mBufferType(bufferType),
61 mQuery(query)
62{ 62{
63 Trace() << "Starting query"; 63 Trace() << "Starting query";
64 //We delegate loading of initial data to the result provider, os it can decide for itself what it needs to load. 64 //We delegate loading of initial data to the result provider, os it can decide for itself what it needs to load.
65 mResultProvider->setFetcher([this, query](const typename DomainType::Ptr &parent) { 65 mResultProvider->setFetcher([this, query](const typename DomainType::Ptr &parent) {
66 Trace() << "Running fetcher"; 66 Trace() << "Running fetcher";
67
68 // auto watcher = new QFutureWatcher<qint64>;
69 // QObject::connect(watcher, &QFutureWatcher::finished, [](qint64 newRevision) {
70 // mResourceAccess->sendRevisionReplayedCommand(newRevision);
71 // });
72 // auto future = QtConcurrent::run([&resultProvider]() -> qint64 {
73 // const qint64 newRevision = executeInitialQuery(query, parent, resultProvider);
74 // return newRevision;
75 // });
76 // watcher->setFuture(future);
77 const qint64 newRevision = executeInitialQuery(query, parent, *mResultProvider); 67 const qint64 newRevision = executeInitialQuery(query, parent, *mResultProvider);
78 mResourceAccess->sendRevisionReplayedCommand(newRevision); 68 mResourceAccess->sendRevisionReplayedCommand(newRevision);
79 }); 69 });
@@ -109,11 +99,9 @@ typename Akonadi2::ResultEmitter<typename DomainType::Ptr>::Ptr QueryRunner<Doma
109 return mResultProvider->emitter(); 99 return mResultProvider->emitter();
110} 100}
111 101
112//TODO move into result provider?
113template<class DomainType> 102template<class DomainType>
114void QueryRunner<DomainType>::replaySet(ResultSet &resultSet, Akonadi2::ResultProviderInterface<typename DomainType::Ptr> &resultProvider) 103void QueryRunner<DomainType>::replaySet(ResultSet &resultSet, Akonadi2::ResultProviderInterface<typename DomainType::Ptr> &resultProvider)
115{ 104{
116 // Trace() << "Replay set";
117 int counter = 0; 105 int counter = 0;
118 while (resultSet.next([&resultProvider, &counter](const Akonadi2::ApplicationDomain::ApplicationDomainType::Ptr &value, Akonadi2::Operation operation) -> bool { 106 while (resultSet.next([&resultProvider, &counter](const Akonadi2::ApplicationDomain::ApplicationDomainType::Ptr &value, Akonadi2::Operation operation) -> bool {
119 counter++; 107 counter++;