From 336e88d4bd330e0d28861c7f702711f53996bfca Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 19 Jan 2016 14:47:11 +0100 Subject: ResourceNotification -> Notification --- common/clientapi.cpp | 8 ++++---- common/clientapi.h | 6 ++++-- common/genericresource.cpp | 5 +++-- common/listener.cpp | 2 +- common/listener.h | 4 ++-- common/notification.h | 3 +-- common/resource.h | 2 +- common/resourceaccess.cpp | 2 +- common/resourceaccess.h | 2 +- 9 files changed, 18 insertions(+), 16 deletions(-) (limited to 'common') 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 Resources::inspect(const Inspection &inspectionCommand) auto id = QUuid::createUuid().toByteArray(); return resourceAccess->sendInspectionCommand(id, ApplicationDomain::getTypeName(), inspectionCommand.entityIdentifier, inspectionCommand.property, inspectionCommand.expectedValue) .template then([resourceAccess, notifier, id](KAsync::Future &future) { - notifier->registerHandler([&future, id](const ResourceNotification ¬ification) { + notifier->registerHandler([&future, id](const Notification ¬ification) { if (notification.id == id) { if (notification.code) { future.setError(-1, "Inspection returned an error: " + notification.message); @@ -327,14 +327,14 @@ public: } QList > resourceAccess; - QList > handler; + QList > handler; QSharedPointer context; }; Notifier::Notifier(const QSharedPointer &resourceAccess) : d(new Akonadi2::Notifier::Private) { - QObject::connect(resourceAccess.data(), &ResourceAccess::notification, d->context.data(), [this](const ResourceNotification ¬ification) { + QObject::connect(resourceAccess.data(), &ResourceAccess::notification, d->context.data(), [this](const Notification ¬ification) { for (const auto &handler : d->handler) { handler(notification); } @@ -342,7 +342,7 @@ Notifier::Notifier(const QSharedPointer &resourceAccess) d->resourceAccess << resourceAccess; } -void Notifier::registerHandler(std::function handler) +void Notifier::registerHandler(std::function handler) { d->handler << handler; } 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; namespace Akonadi2 { class ResourceAccess; -class ResourceNotification; +class Notification; /** * Store interface used in the client API. @@ -127,7 +127,9 @@ namespace Resources { class Notifier { public: Notifier(const QSharedPointer &resourceAccess); - void registerHandler(std::function); + // Notifier(const QByteArray &resource); + // Notifier(const QByteArrayList &resource); + void registerHandler(std::function); private: 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 @@ #include "modifyentity_generated.h" #include "deleteentity_generated.h" #include "inspection_generated.h" +#include "notification_generated.h" #include "domainadaptor.h" #include "commands.h" #include "index.h" @@ -312,13 +313,13 @@ GenericResource::GenericResource(const QByteArray &resourceInstanceIdentifier, c QVariant expectedValue; s >> expectedValue; inspect(inspectionType, inspectionId, domainType, entityId, property, expectedValue).then([=]() { - Akonadi2::ResourceNotification n; + Akonadi2::Notification n; n.type = Akonadi2::Commands::NotificationType_Inspection; n.id = inspectionId; n.code = Akonadi2::Commands::NotificationCode_Success; emit notify(n); }, [=](int code, const QString &message) { - Akonadi2::ResourceNotification n; + Akonadi2::Notification n; n.type = Akonadi2::Commands::NotificationType_Inspection; n.message = message; 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) m_fbb.Clear(); } -void Listener::notify(const Akonadi2::ResourceNotification ¬ification) +void Listener::notify(const Akonadi2::Notification ¬ification) { auto messageString = m_fbb.CreateString(notification.message.toUtf8().constData(), notification.message.toUtf8().size()); 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 @@ namespace Akonadi2 { class Resource; - class ResourceNotification; + class Notification; } class QTimer; @@ -77,7 +77,7 @@ private Q_SLOTS: void onDataAvailable(); void processClientBuffers(); void refreshRevision(qint64); - void notify(const Akonadi2::ResourceNotification &); + void notify(const Akonadi2::Notification &); void quit(); 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 @@ #include #include -#include "notification_generated.h" namespace Akonadi2 { @@ -29,7 +28,7 @@ namespace Akonadi2 /** * A notification */ -class AKONADI2COMMON_EXPORT ResourceNotification +class AKONADI2COMMON_EXPORT Notification { public: 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: Q_SIGNALS: void revisionUpdated(qint64); - void notify(ResourceNotification); + void notify(Notification); private: 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() break; case Akonadi2::Commands::NotificationType::NotificationType_Inspection: { Log(d->resourceInstanceIdentifier) << "Received inspection notification."; - ResourceNotification n; + Notification n; if (buffer->identifier()) { //Don't use fromRawData, the buffer is gone once we invoke emit notification 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: Q_SIGNALS: void ready(bool isReady); void revisionChanged(qint64 revision); - void notification(ResourceNotification revision); + void notification(Notification revision); public Q_SLOTS: virtual void open() = 0; -- cgit v1.2.3