diff options
Diffstat (limited to 'common/facade.h')
-rw-r--r-- | common/facade.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/common/facade.h b/common/facade.h index d150d60..8b8a2a8 100644 --- a/common/facade.h +++ b/common/facade.h | |||
@@ -172,7 +172,7 @@ public: | |||
172 | KAsync::Job<void> load(const Akonadi2::Query &query, Akonadi2::ResultProviderInterface<typename DomainType::Ptr> &resultProvider) Q_DECL_OVERRIDE | 172 | KAsync::Job<void> load(const Akonadi2::Query &query, Akonadi2::ResultProviderInterface<typename DomainType::Ptr> &resultProvider) Q_DECL_OVERRIDE |
173 | { | 173 | { |
174 | //We delegate loading of initial data to the result provider, os it can decide for itself what it needs to load. | 174 | //We delegate loading of initial data to the result provider, os it can decide for itself what it needs to load. |
175 | resultProvider.setFetcher([this, query, &resultProvider](const QByteArray &parent) { | 175 | resultProvider.setFetcher([this, query, &resultProvider](const typename DomainType::Ptr &parent) { |
176 | const qint64 newRevision = executeInitialQuery(query, parent, resultProvider); | 176 | const qint64 newRevision = executeInitialQuery(query, parent, resultProvider); |
177 | mResourceAccess->sendRevisionReplayedCommand(newRevision); | 177 | mResourceAccess->sendRevisionReplayedCommand(newRevision); |
178 | }); | 178 | }); |
@@ -358,11 +358,16 @@ private: | |||
358 | }, resultProvider); | 358 | }, resultProvider); |
359 | } | 359 | } |
360 | 360 | ||
361 | qint64 executeInitialQuery(const Akonadi2::Query &query, const QByteArray &parent, Akonadi2::ResultProviderInterface<typename DomainType::Ptr> &resultProvider) | 361 | qint64 executeInitialQuery(const Akonadi2::Query &query, const typename DomainType::Ptr &parent, Akonadi2::ResultProviderInterface<typename DomainType::Ptr> &resultProvider) |
362 | { | 362 | { |
363 | Trace() << "Running initial query for parent:" << parent; | ||
364 | auto modifiedQuery = query; | 363 | auto modifiedQuery = query; |
365 | modifiedQuery.propertyFilter.insert("parent", parent); | 364 | if (parent) { |
365 | Trace() << "Running initial query for parent:" << parent->identifier(); | ||
366 | modifiedQuery.propertyFilter.insert("parent", parent->identifier()); | ||
367 | } else { | ||
368 | Trace() << "Running initial query for toplevel"; | ||
369 | modifiedQuery.propertyFilter.insert("parent", QVariant()); | ||
370 | } | ||
366 | return load(modifiedQuery, [&](Akonadi2::Storage::Transaction &transaction, QSet<QByteArray> &remainingFilters) -> ResultSet { | 371 | return load(modifiedQuery, [&](Akonadi2::Storage::Transaction &transaction, QSet<QByteArray> &remainingFilters) -> ResultSet { |
367 | return loadInitialResultSet(modifiedQuery, transaction, remainingFilters); | 372 | return loadInitialResultSet(modifiedQuery, transaction, remainingFilters); |
368 | }, resultProvider); | 373 | }, resultProvider); |