diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-26 22:38:42 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-26 22:38:42 +0200 |
commit | b6593d8f8985018e492346d30c960a03ae41aec7 (patch) | |
tree | 3583f2e29243077008ce7663c1a9ba5399b93d1e /common/notifier.cpp | |
parent | 5e13772bfdf7bf083b1a2faed5aba8c9724664bd (diff) | |
download | sink-b6593d8f8985018e492346d30c960a03ae41aec7.tar.gz sink-b6593d8f8985018e492346d30c960a03ae41aec7.zip |
Fixed notification quering
Diffstat (limited to 'common/notifier.cpp')
-rw-r--r-- | common/notifier.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/common/notifier.cpp b/common/notifier.cpp index 7dbc85e..f52e28b 100644 --- a/common/notifier.cpp +++ b/common/notifier.cpp | |||
@@ -39,7 +39,7 @@ public: | |||
39 | 39 | ||
40 | void listenForNotifications(const QSharedPointer<ResourceAccess> &access) | 40 | void listenForNotifications(const QSharedPointer<ResourceAccess> &access) |
41 | { | 41 | { |
42 | QObject::connect(access.data(), &ResourceAccess::notification, context.data(), [this](const Notification ¬ification) { | 42 | QObject::connect(access.data(), &ResourceAccess::notification, &context, [this](const Notification ¬ification) { |
43 | for (const auto &handler : handler) { | 43 | for (const auto &handler : handler) { |
44 | handler(notification); | 44 | handler(notification); |
45 | } | 45 | } |
@@ -49,7 +49,7 @@ public: | |||
49 | 49 | ||
50 | QList<QSharedPointer<ResourceAccess>> resourceAccess; | 50 | QList<QSharedPointer<ResourceAccess>> resourceAccess; |
51 | QList<std::function<void(const Notification &)>> handler; | 51 | QList<std::function<void(const Notification &)>> handler; |
52 | QSharedPointer<QObject> context; | 52 | QObject context; |
53 | }; | 53 | }; |
54 | 54 | ||
55 | Notifier::Notifier(const QSharedPointer<ResourceAccess> &resourceAccess) : d(new Sink::Notifier::Private) | 55 | Notifier::Notifier(const QSharedPointer<ResourceAccess> &resourceAccess) : d(new Sink::Notifier::Private) |
@@ -77,7 +77,7 @@ Notifier::Notifier(const Sink::Query &resourceQuery) : d(new Sink::Notifier::Pri | |||
77 | auto result = facade->load(resourceQuery, resourceCtx); | 77 | auto result = facade->load(resourceQuery, resourceCtx); |
78 | auto emitter = result.second; | 78 | auto emitter = result.second; |
79 | emitter->onAdded([=](const ApplicationDomain::SinkResource::Ptr &resource) { | 79 | emitter->onAdded([=](const ApplicationDomain::SinkResource::Ptr &resource) { |
80 | auto resourceAccess = Sink::ResourceAccess::Ptr::create(resource->identifier(), ResourceConfig::getResourceType(resource->identifier())); | 80 | auto resourceAccess = Sink::ResourceAccessFactory::instance().getAccess(resource->identifier(), ResourceConfig::getResourceType(resource->identifier())); |
81 | resourceAccess->open(); | 81 | resourceAccess->open(); |
82 | d->listenForNotifications(resourceAccess); | 82 | d->listenForNotifications(resourceAccess); |
83 | }); | 83 | }); |