diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/clientapi.cpp | 8 | ||||
-rw-r--r-- | common/resultprovider.h | 8 |
2 files changed, 6 insertions, 10 deletions
diff --git a/common/clientapi.cpp b/common/clientapi.cpp index 46f7534..25f0f1f 100644 --- a/common/clientapi.cpp +++ b/common/clientapi.cpp | |||
@@ -91,13 +91,6 @@ QSharedPointer<QAbstractItemModel> Store::loadModel(Query query) | |||
91 | 91 | ||
92 | // Query all resources and aggregate results | 92 | // Query all resources and aggregate results |
93 | auto resources = getResources(query.resources, ApplicationDomain::getTypeName<DomainType>()); | 93 | auto resources = getResources(query.resources, ApplicationDomain::getTypeName<DomainType>()); |
94 | if (resources.isEmpty()) { | ||
95 | Warning() << "No resources available."; | ||
96 | auto resultProvider = Akonadi2::ResultProvider<typename DomainType::Ptr>::Ptr::create(); | ||
97 | model->setEmitter(resultProvider->emitter()); | ||
98 | resultProvider->initialResultSetComplete(typename DomainType::Ptr()); | ||
99 | return model; | ||
100 | } | ||
101 | auto aggregatingEmitter = AggregatingResultEmitter<typename DomainType::Ptr>::Ptr::create(); | 94 | auto aggregatingEmitter = AggregatingResultEmitter<typename DomainType::Ptr>::Ptr::create(); |
102 | model->setEmitter(aggregatingEmitter); | 95 | model->setEmitter(aggregatingEmitter); |
103 | KAsync::iterate(resources) | 96 | KAsync::iterate(resources) |
@@ -114,7 +107,6 @@ QSharedPointer<QAbstractItemModel> Store::loadModel(Query query) | |||
114 | future.setFinished(); | 107 | future.setFinished(); |
115 | } | 108 | } |
116 | }).exec(); | 109 | }).exec(); |
117 | //TODO if the aggregatingEmitter is still empty we're done | ||
118 | model->fetchMore(QModelIndex()); | 110 | model->fetchMore(QModelIndex()); |
119 | 111 | ||
120 | return model; | 112 | return model; |
diff --git a/common/resultprovider.h b/common/resultprovider.h index d94ad44..08a7d53 100644 --- a/common/resultprovider.h +++ b/common/resultprovider.h | |||
@@ -362,8 +362,12 @@ public: | |||
362 | 362 | ||
363 | void fetch(const DomainType &parent) Q_DECL_OVERRIDE | 363 | void fetch(const DomainType &parent) Q_DECL_OVERRIDE |
364 | { | 364 | { |
365 | for (const auto &emitter : mEmitter) { | 365 | if (mEmitter.isEmpty()) { |
366 | emitter->fetch(parent); | 366 | this->initialResultSetComplete(parent); |
367 | } else { | ||
368 | for (const auto &emitter : mEmitter) { | ||
369 | emitter->fetch(parent); | ||
370 | } | ||
367 | } | 371 | } |
368 | } | 372 | } |
369 | 373 | ||