From 47b4442c585a25b2e4b857f2d9e3ab371d942c19 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 18 Jan 2015 10:51:34 +0100 Subject: Use jobs to track progress of write commands. --- dummyresource/facade.cpp | 14 +++++++++----- dummyresource/facade.h | 6 +++--- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'dummyresource') diff --git a/dummyresource/facade.cpp b/dummyresource/facade.cpp index 668fbbf..13c174b 100644 --- a/dummyresource/facade.cpp +++ b/dummyresource/facade.cpp @@ -46,7 +46,7 @@ DummyResourceFacade::~DummyResourceFacade() { } -void DummyResourceFacade::create(const Akonadi2::Domain::Event &domainObject) +Async::Job DummyResourceFacade::create(const Akonadi2::Domain::Event &domainObject) { //Create message buffer and send to resource flatbuffers::FlatBufferBuilder eventFbb; @@ -64,24 +64,28 @@ void DummyResourceFacade::create(const Akonadi2::Domain::Event &domainObject) Akonadi2::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), 0, 0); flatbuffers::FlatBufferBuilder fbb; - auto type = fbb.CreateString(Akonadi2::Domain::getTypeName().toStdString().data()); + //This is the resource type and not the domain type + auto type = fbb.CreateString("event"); auto delta = fbb.CreateVector(entityFbb.GetBufferPointer(), entityFbb.GetSize()); Akonadi2::Commands::CreateEntityBuilder builder(fbb); builder.add_domainType(type); builder.add_delta(delta); auto location = builder.Finish(); Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); - mResourceAccess->sendCommand(Akonadi2::Commands::CreateEntityCommand, fbb); + mResourceAccess->open(); + return mResourceAccess->sendCommand(Akonadi2::Commands::CreateEntityCommand, fbb); } -void DummyResourceFacade::modify(const Akonadi2::Domain::Event &domainObject) +Async::Job DummyResourceFacade::modify(const Akonadi2::Domain::Event &domainObject) { //Create message buffer and send to resource + return Async::null(); } -void DummyResourceFacade::remove(const Akonadi2::Domain::Event &domainObject) +Async::Job DummyResourceFacade::remove(const Akonadi2::Domain::Event &domainObject) { //Create message buffer and send to resource + return Async::null(); } static std::function prepareQuery(const Akonadi2::Query &query) diff --git a/dummyresource/facade.h b/dummyresource/facade.h index e01d254..9c8827a 100644 --- a/dummyresource/facade.h +++ b/dummyresource/facade.h @@ -37,9 +37,9 @@ class DummyResourceFacade : public Akonadi2::StoreFacade create(const Akonadi2::Domain::Event &domainObject); + virtual Async::Job modify(const Akonadi2::Domain::Event &domainObject); + virtual Async::Job remove(const Akonadi2::Domain::Event &domainObject); virtual void load(const Akonadi2::Query &query, const std::function &resultCallback, const std::function &completeCallback); private: -- cgit v1.2.3