From d8cd2d6585507a4e40881092a633ec1a80b14dd9 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 18 Jan 2016 15:17:30 +0100 Subject: Draft of inspection API --- examples/dummyresource/resourcefactory.cpp | 20 ++++++++++++++++++++ examples/dummyresource/resourcefactory.h | 1 + 2 files changed, 21 insertions(+) (limited to 'examples/dummyresource') diff --git a/examples/dummyresource/resourcefactory.cpp b/examples/dummyresource/resourcefactory.cpp index a984097..27d5f17 100644 --- a/examples/dummyresource/resourcefactory.cpp +++ b/examples/dummyresource/resourcefactory.cpp @@ -134,6 +134,26 @@ void DummyResource::removeFromDisk(const QByteArray &instanceIdentifier) Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier + ".synchronization", Akonadi2::Storage::ReadWrite).removeFromDisk(); } +KAsync::Job DummyResource::inspect(int inspectionType, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue) +{ + + Trace() << "Inspecting " << inspectionType << domainType << entityId << property << expectedValue; + if (property == "testInspection") { + Akonadi2::ResourceNotification n; + n.type = Akonadi2::NotificationType_Inspection; + if (expectedValue.toBool()) { + //Success + n.code = 0; + emit notify(n); + } else { + //Failure + n.code = 1; + emit notify(n); + } + } + return KAsync::null(); +} + DummyResourceFactory::DummyResourceFactory(QObject *parent) : Akonadi2::ResourceFactory(parent) { diff --git a/examples/dummyresource/resourcefactory.h b/examples/dummyresource/resourcefactory.h index 2ed4c5d..3f67187 100644 --- a/examples/dummyresource/resourcefactory.h +++ b/examples/dummyresource/resourcefactory.h @@ -40,6 +40,7 @@ public: KAsync::Job synchronizeWithSource(Akonadi2::Storage &mainStore, Akonadi2::Storage &synchronizationStore) Q_DECL_OVERRIDE; using GenericResource::synchronizeWithSource; static void removeFromDisk(const QByteArray &instanceIdentifier); + KAsync::Job inspect(int inspectionType, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue) Q_DECL_OVERRIDE; private: KAsync::Job replay(Akonadi2::Storage &synchronizationStore, const QByteArray &type, const QByteArray &key, const QByteArray &value) Q_DECL_OVERRIDE; Akonadi2::ApplicationDomain::Event::Ptr createEvent(const QByteArray &rid, const QMap &data, Akonadi2::Storage::Transaction &); -- cgit v1.2.3