From b6593d8f8985018e492346d30c960a03ae41aec7 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 26 Mar 2017 22:38:42 +0200 Subject: Fixed notification quering --- common/modelresult.cpp | 10 +++++++--- common/notifier.cpp | 6 +++--- common/store.cpp | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/common/modelresult.cpp b/common/modelresult.cpp index 3edbec7..26d4f82 100644 --- a/common/modelresult.cpp +++ b/common/modelresult.cpp @@ -53,7 +53,9 @@ ModelResult::ModelResult(const Sink::Query &query, const QListregisterHandler([this](const Notification ¬ification) { switch (notification.type) { case Notification::Status: @@ -120,8 +122,10 @@ ModelResult::ModelResult(const Sink::Query &query, const QList &access) { - QObject::connect(access.data(), &ResourceAccess::notification, context.data(), [this](const Notification ¬ification) { + QObject::connect(access.data(), &ResourceAccess::notification, &context, [this](const Notification ¬ification) { for (const auto &handler : handler) { handler(notification); } @@ -49,7 +49,7 @@ public: QList> resourceAccess; QList> handler; - QSharedPointer context; + QObject context; }; Notifier::Notifier(const QSharedPointer &resourceAccess) : d(new Sink::Notifier::Private) @@ -77,7 +77,7 @@ Notifier::Notifier(const Sink::Query &resourceQuery) : d(new Sink::Notifier::Pri auto result = facade->load(resourceQuery, resourceCtx); auto emitter = result.second; emitter->onAdded([=](const ApplicationDomain::SinkResource::Ptr &resource) { - auto resourceAccess = Sink::ResourceAccess::Ptr::create(resource->identifier(), ResourceConfig::getResourceType(resource->identifier())); + auto resourceAccess = Sink::ResourceAccessFactory::instance().getAccess(resource->identifier(), ResourceConfig::getResourceType(resource->identifier())); resourceAccess->open(); d->listenForNotifications(resourceAccess); }); diff --git a/common/store.cpp b/common/store.cpp index 264f2e3..8c0a985 100644 --- a/common/store.cpp +++ b/common/store.cpp @@ -279,7 +279,7 @@ KAsync::Job Store::removeDataFromDisk(const QByteArray &identifier) static KAsync::Job synchronize(const QByteArray &resource, const Sink::SyncScope &scope) { - SinkLog() << "Synchronizing " << resource; + SinkLog() << "Synchronizing " << resource << scope; auto resourceAccess = ResourceAccessFactory::instance().getAccess(resource, ResourceConfig::getResourceType(resource)); return resourceAccess->synchronizeResource(scope) .addToContext(resourceAccess) -- cgit v1.2.3