diff options
-rw-r--r-- | common/clientapi.cpp | 8 | ||||
-rw-r--r-- | common/clientapi.h | 6 | ||||
-rw-r--r-- | common/genericresource.cpp | 5 | ||||
-rw-r--r-- | common/listener.cpp | 2 | ||||
-rw-r--r-- | common/listener.h | 4 | ||||
-rw-r--r-- | common/notification.h | 3 | ||||
-rw-r--r-- | common/resource.h | 2 | ||||
-rw-r--r-- | common/resourceaccess.cpp | 2 | ||||
-rw-r--r-- | common/resourceaccess.h | 2 |
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 ¬ification) { | 310 | notifier->registerHandler([&future, id](const Notification ¬ification) { |
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 | ||
334 | Notifier::Notifier(const QSharedPointer<ResourceAccess> &resourceAccess) | 334 | Notifier::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 ¬ification) { | 337 | QObject::connect(resourceAccess.data(), &ResourceAccess::notification, d->context.data(), [this](const Notification ¬ification) { |
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 | ||
345 | void Notifier::registerHandler(std::function<void(const ResourceNotification &)> handler) | 345 | void 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 | ||
34 | namespace Akonadi2 { | 34 | namespace Akonadi2 { |
35 | class ResourceAccess; | 35 | class ResourceAccess; |
36 | class ResourceNotification; | 36 | class 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 { | |||
127 | class Notifier { | 127 | class Notifier { |
128 | public: | 128 | public: |
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 | ||
132 | private: | 134 | private: |
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 | ||
389 | void Listener::notify(const Akonadi2::ResourceNotification ¬ification) | 389 | void Listener::notify(const Akonadi2::Notification ¬ification) |
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 @@ | |||
28 | namespace Akonadi2 | 28 | namespace Akonadi2 |
29 | { | 29 | { |
30 | class Resource; | 30 | class Resource; |
31 | class ResourceNotification; | 31 | class Notification; |
32 | } | 32 | } |
33 | 33 | ||
34 | class QTimer; | 34 | class 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 | ||
83 | private: | 83 | private: |
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 | ||
26 | namespace Akonadi2 | 25 | namespace Akonadi2 |
27 | { | 26 | { |
@@ -29,7 +28,7 @@ namespace Akonadi2 | |||
29 | /** | 28 | /** |
30 | * A notification | 29 | * A notification |
31 | */ | 30 | */ |
32 | class AKONADI2COMMON_EXPORT ResourceNotification | 31 | class AKONADI2COMMON_EXPORT Notification |
33 | { | 32 | { |
34 | public: | 33 | public: |
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 | ||
58 | Q_SIGNALS: | 58 | Q_SIGNALS: |
59 | void revisionUpdated(qint64); | 59 | void revisionUpdated(qint64); |
60 | void notify(ResourceNotification); | 60 | void notify(Notification); |
61 | 61 | ||
62 | private: | 62 | private: |
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: | |||
55 | Q_SIGNALS: | 55 | Q_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 | ||
60 | public Q_SLOTS: | 60 | public Q_SLOTS: |
61 | virtual void open() = 0; | 61 | virtual void open() = 0; |