summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-01-19 14:47:11 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-01-19 14:47:11 +0100
commit336e88d4bd330e0d28861c7f702711f53996bfca (patch)
tree82a58ccb3c4d15600a004b319e720bf722e31439
parentcd7287325944571e9d53b00b48abdba4c9257474 (diff)
downloadsink-336e88d4bd330e0d28861c7f702711f53996bfca.tar.gz
sink-336e88d4bd330e0d28861c7f702711f53996bfca.zip
ResourceNotification -> Notification
-rw-r--r--common/clientapi.cpp8
-rw-r--r--common/clientapi.h6
-rw-r--r--common/genericresource.cpp5
-rw-r--r--common/listener.cpp2
-rw-r--r--common/listener.h4
-rw-r--r--common/notification.h3
-rw-r--r--common/resource.h2
-rw-r--r--common/resourceaccess.cpp2
-rw-r--r--common/resourceaccess.h2
9 files changed, 18 insertions, 16 deletions
diff --git a/common/clientapi.cpp b/common/clientapi.cpp
index 0b417d3..824ef19 100644
--- a/common/clientapi.cpp
+++ b/common/clientapi.cpp
@@ -307,7 +307,7 @@ KAsync::Job<void> Resources::inspect(const Inspection &inspectionCommand)
307 auto id = QUuid::createUuid().toByteArray(); 307 auto id = QUuid::createUuid().toByteArray();
308 return resourceAccess->sendInspectionCommand(id, ApplicationDomain::getTypeName<DomainType>(), inspectionCommand.entityIdentifier, inspectionCommand.property, inspectionCommand.expectedValue) 308 return resourceAccess->sendInspectionCommand(id, ApplicationDomain::getTypeName<DomainType>(), inspectionCommand.entityIdentifier, inspectionCommand.property, inspectionCommand.expectedValue)
309 .template then<void>([resourceAccess, notifier, id](KAsync::Future<void> &future) { 309 .template then<void>([resourceAccess, notifier, id](KAsync::Future<void> &future) {
310 notifier->registerHandler([&future, id](const ResourceNotification &notification) { 310 notifier->registerHandler([&future, id](const Notification &notification) {
311 if (notification.id == id) { 311 if (notification.id == id) {
312 if (notification.code) { 312 if (notification.code) {
313 future.setError(-1, "Inspection returned an error: " + notification.message); 313 future.setError(-1, "Inspection returned an error: " + notification.message);
@@ -327,14 +327,14 @@ public:
327 327
328 } 328 }
329 QList<QSharedPointer<ResourceAccess> > resourceAccess; 329 QList<QSharedPointer<ResourceAccess> > resourceAccess;
330 QList<std::function<void(const ResourceNotification &)> > handler; 330 QList<std::function<void(const Notification &)> > handler;
331 QSharedPointer<QObject> context; 331 QSharedPointer<QObject> context;
332}; 332};
333 333
334Notifier::Notifier(const QSharedPointer<ResourceAccess> &resourceAccess) 334Notifier::Notifier(const QSharedPointer<ResourceAccess> &resourceAccess)
335 : d(new Akonadi2::Notifier::Private) 335 : d(new Akonadi2::Notifier::Private)
336{ 336{
337 QObject::connect(resourceAccess.data(), &ResourceAccess::notification, d->context.data(), [this](const ResourceNotification &notification) { 337 QObject::connect(resourceAccess.data(), &ResourceAccess::notification, d->context.data(), [this](const Notification &notification) {
338 for (const auto &handler : d->handler) { 338 for (const auto &handler : d->handler) {
339 handler(notification); 339 handler(notification);
340 } 340 }
@@ -342,7 +342,7 @@ Notifier::Notifier(const QSharedPointer<ResourceAccess> &resourceAccess)
342 d->resourceAccess << resourceAccess; 342 d->resourceAccess << resourceAccess;
343} 343}
344 344
345void Notifier::registerHandler(std::function<void(const ResourceNotification &)> handler) 345void Notifier::registerHandler(std::function<void(const Notification &)> handler)
346{ 346{
347 d->handler << handler; 347 d->handler << handler;
348} 348}
diff --git a/common/clientapi.h b/common/clientapi.h
index e1d5b8d..06376c2 100644
--- a/common/clientapi.h
+++ b/common/clientapi.h
@@ -33,7 +33,7 @@ class QAbstractItemModel;
33 33
34namespace Akonadi2 { 34namespace Akonadi2 {
35class ResourceAccess; 35class ResourceAccess;
36class ResourceNotification; 36class Notification;
37 37
38/** 38/**
39 * Store interface used in the client API. 39 * Store interface used in the client API.
@@ -127,7 +127,9 @@ namespace Resources {
127class Notifier { 127class Notifier {
128public: 128public:
129 Notifier(const QSharedPointer<ResourceAccess> &resourceAccess); 129 Notifier(const QSharedPointer<ResourceAccess> &resourceAccess);
130 void registerHandler(std::function<void(const ResourceNotification &)>); 130 // Notifier(const QByteArray &resource);
131 // Notifier(const QByteArrayList &resource);
132 void registerHandler(std::function<void(const Notification &)>);
131 133
132private: 134private:
133 class Private; 135 class Private;
diff --git a/common/genericresource.cpp b/common/genericresource.cpp
index e9a6012..c7f323a 100644
--- a/common/genericresource.cpp
+++ b/common/genericresource.cpp
@@ -7,6 +7,7 @@
7#include "modifyentity_generated.h" 7#include "modifyentity_generated.h"
8#include "deleteentity_generated.h" 8#include "deleteentity_generated.h"
9#include "inspection_generated.h" 9#include "inspection_generated.h"
10#include "notification_generated.h"
10#include "domainadaptor.h" 11#include "domainadaptor.h"
11#include "commands.h" 12#include "commands.h"
12#include "index.h" 13#include "index.h"
@@ -312,13 +313,13 @@ GenericResource::GenericResource(const QByteArray &resourceInstanceIdentifier, c
312 QVariant expectedValue; 313 QVariant expectedValue;
313 s >> expectedValue; 314 s >> expectedValue;
314 inspect(inspectionType, inspectionId, domainType, entityId, property, expectedValue).then<void>([=]() { 315 inspect(inspectionType, inspectionId, domainType, entityId, property, expectedValue).then<void>([=]() {
315 Akonadi2::ResourceNotification n; 316 Akonadi2::Notification n;
316 n.type = Akonadi2::Commands::NotificationType_Inspection; 317 n.type = Akonadi2::Commands::NotificationType_Inspection;
317 n.id = inspectionId; 318 n.id = inspectionId;
318 n.code = Akonadi2::Commands::NotificationCode_Success; 319 n.code = Akonadi2::Commands::NotificationCode_Success;
319 emit notify(n); 320 emit notify(n);
320 }, [=](int code, const QString &message) { 321 }, [=](int code, const QString &message) {
321 Akonadi2::ResourceNotification n; 322 Akonadi2::Notification n;
322 n.type = Akonadi2::Commands::NotificationType_Inspection; 323 n.type = Akonadi2::Commands::NotificationType_Inspection;
323 n.message = message; 324 n.message = message;
324 n.id = inspectionId; 325 n.id = inspectionId;
diff --git a/common/listener.cpp b/common/listener.cpp
index 857e15f..fa08472 100644
--- a/common/listener.cpp
+++ b/common/listener.cpp
@@ -386,7 +386,7 @@ void Listener::updateClientsWithRevision(qint64 revision)
386 m_fbb.Clear(); 386 m_fbb.Clear();
387} 387}
388 388
389void Listener::notify(const Akonadi2::ResourceNotification &notification) 389void Listener::notify(const Akonadi2::Notification &notification)
390{ 390{
391 auto messageString = m_fbb.CreateString(notification.message.toUtf8().constData(), notification.message.toUtf8().size()); 391 auto messageString = m_fbb.CreateString(notification.message.toUtf8().constData(), notification.message.toUtf8().size());
392 auto idString = m_fbb.CreateString(notification.id.constData(), notification.id.size()); 392 auto idString = m_fbb.CreateString(notification.id.constData(), notification.id.size());
diff --git a/common/listener.h b/common/listener.h
index 2dfd91a..4112a6a 100644
--- a/common/listener.h
+++ b/common/listener.h
@@ -28,7 +28,7 @@
28namespace Akonadi2 28namespace Akonadi2
29{ 29{
30 class Resource; 30 class Resource;
31 class ResourceNotification; 31 class Notification;
32} 32}
33 33
34class QTimer; 34class QTimer;
@@ -77,7 +77,7 @@ private Q_SLOTS:
77 void onDataAvailable(); 77 void onDataAvailable();
78 void processClientBuffers(); 78 void processClientBuffers();
79 void refreshRevision(qint64); 79 void refreshRevision(qint64);
80 void notify(const Akonadi2::ResourceNotification &); 80 void notify(const Akonadi2::Notification &);
81 void quit(); 81 void quit();
82 82
83private: 83private:
diff --git a/common/notification.h b/common/notification.h
index c83e579..e1b5bff 100644
--- a/common/notification.h
+++ b/common/notification.h
@@ -21,7 +21,6 @@
21 21
22#include <akonadi2common_export.h> 22#include <akonadi2common_export.h>
23#include <QString> 23#include <QString>
24#include "notification_generated.h"
25 24
26namespace Akonadi2 25namespace Akonadi2
27{ 26{
@@ -29,7 +28,7 @@ namespace Akonadi2
29/** 28/**
30 * A notification 29 * A notification
31 */ 30 */
32class AKONADI2COMMON_EXPORT ResourceNotification 31class AKONADI2COMMON_EXPORT Notification
33{ 32{
34public: 33public:
35 QByteArray id; 34 QByteArray id;
diff --git a/common/resource.h b/common/resource.h
index 2168e82..2ae71a0 100644
--- a/common/resource.h
+++ b/common/resource.h
@@ -57,7 +57,7 @@ public:
57 57
58Q_SIGNALS: 58Q_SIGNALS:
59 void revisionUpdated(qint64); 59 void revisionUpdated(qint64);
60 void notify(ResourceNotification); 60 void notify(Notification);
61 61
62private: 62private:
63 class Private; 63 class Private;
diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp
index e3ffe64..6592699 100644
--- a/common/resourceaccess.cpp
+++ b/common/resourceaccess.cpp
@@ -549,7 +549,7 @@ bool ResourceAccess::processMessageBuffer()
549 break; 549 break;
550 case Akonadi2::Commands::NotificationType::NotificationType_Inspection: { 550 case Akonadi2::Commands::NotificationType::NotificationType_Inspection: {
551 Log(d->resourceInstanceIdentifier) << "Received inspection notification."; 551 Log(d->resourceInstanceIdentifier) << "Received inspection notification.";
552 ResourceNotification n; 552 Notification n;
553 if (buffer->identifier()) { 553 if (buffer->identifier()) {
554 //Don't use fromRawData, the buffer is gone once we invoke emit notification 554 //Don't use fromRawData, the buffer is gone once we invoke emit notification
555 n.id = BufferUtils::extractBufferCopy(buffer->identifier()); 555 n.id = BufferUtils::extractBufferCopy(buffer->identifier());
diff --git a/common/resourceaccess.h b/common/resourceaccess.h
index e1c01d7..2fe83ed 100644
--- a/common/resourceaccess.h
+++ b/common/resourceaccess.h
@@ -55,7 +55,7 @@ public:
55Q_SIGNALS: 55Q_SIGNALS:
56 void ready(bool isReady); 56 void ready(bool isReady);
57 void revisionChanged(qint64 revision); 57 void revisionChanged(qint64 revision);
58 void notification(ResourceNotification revision); 58 void notification(Notification revision);
59 59
60public Q_SLOTS: 60public Q_SLOTS:
61 virtual void open() = 0; 61 virtual void open() = 0;