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 --- common/clientapi.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'common/clientapi.cpp') diff --git a/common/clientapi.cpp b/common/clientapi.cpp index 5c0bcb8..deab962 100644 --- a/common/clientapi.cpp +++ b/common/clientapi.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -289,10 +290,26 @@ KAsync::Job > Store::fetch(const Akonadi2::Query }); } +template +KAsync::Job Resources::inspect(const Inspection &inspectionCommand) +{ + auto resource = inspectionCommand.resourceIdentifier; + + Trace() << "Sending inspection " << resource; + auto resourceAccess = QSharedPointer::create(resource); + resourceAccess->open(); + auto id = QUuid::createUuid().toByteArray(); + return resourceAccess->sendInspectionCommand(id, ApplicationDomain::getTypeName(), inspectionCommand.entityIdentifier, inspectionCommand.property, inspectionCommand.expectedValue) + .template then([resourceAccess]() { + //TODO wait for inspection notification + }); +} + #define REGISTER_TYPE(T) template KAsync::Job Store::remove(const T &domainObject); \ template KAsync::Job Store::create(const T &domainObject); \ template KAsync::Job Store::modify(const T &domainObject); \ template QSharedPointer Store::loadModel(Query query); \ + template KAsync::Job Resources::inspect(const Inspection &); \ template KAsync::Job Store::fetchOne(const Query &); \ template KAsync::Job > Store::fetchAll(const Query &); \ template KAsync::Job > Store::fetch(const Query &, int); \ -- cgit v1.2.3