From b4db894f76de9ac252081972143efcd3fcd66533 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 19 Apr 2015 21:07:36 +0200 Subject: Moved complete writing part to GenericFacade --- examples/dummyresource/facade.cpp | 24 ++---------------------- examples/dummyresource/facade.h | 4 ---- 2 files changed, 2 insertions(+), 26 deletions(-) (limited to 'examples') diff --git a/examples/dummyresource/facade.cpp b/examples/dummyresource/facade.cpp index e50e4f3..37f75ae 100644 --- a/examples/dummyresource/facade.cpp +++ b/examples/dummyresource/facade.cpp @@ -38,8 +38,7 @@ using namespace flatbuffers; DummyResourceFacade::DummyResourceFacade() - : Akonadi2::GenericFacade("org.kde.dummy"), - mFactory(new DummyEventAdaptorFactory) + : Akonadi2::GenericFacade("org.kde.dummy", QSharedPointer::create()) { } @@ -47,25 +46,6 @@ DummyResourceFacade::~DummyResourceFacade() { } -Async::Job DummyResourceFacade::create(const Akonadi2::ApplicationDomain::Event &domainObject) -{ - flatbuffers::FlatBufferBuilder entityFbb; - mFactory->createBuffer(domainObject, entityFbb); - return sendCreateCommand("event", QByteArray::fromRawData(reinterpret_cast(entityFbb.GetBufferPointer()), entityFbb.GetSize())); -} - -Async::Job DummyResourceFacade::modify(const Akonadi2::ApplicationDomain::Event &domainObject) -{ - //Create message buffer and send to resource - return Async::null(); -} - -Async::Job DummyResourceFacade::remove(const Akonadi2::ApplicationDomain::Event &domainObject) -{ - //Create message buffer and send to resource - return Async::null(); -} - static std::function prepareQuery(const Akonadi2::Query &query) { //Compose some functions to make query matching fast. @@ -133,7 +113,7 @@ void DummyResourceFacade::readValue(QSharedPointer storage, c qint64 revision = metadataBuffer ? metadataBuffer->revision() : -1; //This only works for a 1:1 mapping of resource to domain types. //Not i.e. for tags that are stored as flags in each entity of an imap store. - auto adaptor = mFactory->createAdaptor(buffer.entity()); + auto adaptor = mDomainTypeAdaptorFactory->createAdaptor(buffer.entity()); //TODO only copy requested properties auto memoryAdaptor = QSharedPointer::create(*adaptor); // here we could copy additional properties that don't have a 1:1 mapping, such as separately stored tags. diff --git a/examples/dummyresource/facade.h b/examples/dummyresource/facade.h index 91ae351..2fd2fa9 100644 --- a/examples/dummyresource/facade.h +++ b/examples/dummyresource/facade.h @@ -34,12 +34,8 @@ class DummyResourceFacade : public Akonadi2::GenericFacade create(const Akonadi2::ApplicationDomain::Event &domainObject) Q_DECL_OVERRIDE; - Async::Job modify(const Akonadi2::ApplicationDomain::Event &domainObject) Q_DECL_OVERRIDE; - Async::Job remove(const Akonadi2::ApplicationDomain::Event &domainObject) Q_DECL_OVERRIDE; Async::Job load(const Akonadi2::Query &query, const std::function &resultCallback) Q_DECL_OVERRIDE; private: void readValue(QSharedPointer storage, const QByteArray &key, const std::function &resultCallback, std::function); - QSharedPointer > mFactory; }; -- cgit v1.2.3