summaryrefslogtreecommitdiffstats
path: root/dummyresource
diff options
context:
space:
mode:
Diffstat (limited to 'dummyresource')
-rw-r--r--dummyresource/resourcefactory.cpp25
-rw-r--r--dummyresource/resourcefactory.h8
2 files changed, 30 insertions, 3 deletions
diff --git a/dummyresource/resourcefactory.cpp b/dummyresource/resourcefactory.cpp
index 37bfdac..bd85b4f 100644
--- a/dummyresource/resourcefactory.cpp
+++ b/dummyresource/resourcefactory.cpp
@@ -19,6 +19,7 @@
19 19
20#include "resourcefactory.h" 20#include "resourcefactory.h"
21#include "facade.h" 21#include "facade.h"
22#include "dummycalendar_generated.h"
22 23
23DummyResource::DummyResource() 24DummyResource::DummyResource()
24 : Akonadi2::Resource() 25 : Akonadi2::Resource()
@@ -26,9 +27,29 @@ DummyResource::DummyResource()
26 27
27} 28}
28 29
29void DummyResource::synchronizeWithSource() 30void DummyResource::synchronizeWithSource(Akonadi2::Pipeline *pipeline)
30{ 31{
31 // TODO populate the storage 32 // TODO actually populate the storage with new items
33 auto builder = DummyCalendar::DummyEventBuilder(m_fbb);
34 builder .add_summary(m_fbb.CreateString("summary summary!"));
35 auto buffer = builder.Finish();
36 DummyCalendar::FinishDummyEventBuffer(m_fbb, buffer);
37 pipeline->newEntity("fakekey", m_fbb);
38 m_fbb.Clear();
39}
40
41void DummyResource::processCommand(int commandId, const QByteArray &data, uint size, Akonadi2::Pipeline *pipeline)
42{
43 Q_UNUSED(commandId)
44 Q_UNUSED(data)
45 Q_UNUSED(size)
46 //TODO reallly process the commands :)
47 auto builder = DummyCalendar::DummyEventBuilder(m_fbb);
48 builder .add_summary(m_fbb.CreateString("summary summary!"));
49 auto buffer = builder.Finish();
50 DummyCalendar::FinishDummyEventBuffer(m_fbb, buffer);
51 pipeline->newEntity("fakekey", m_fbb);
52 m_fbb.Clear();
32} 53}
33 54
34DummyResourceFactory::DummyResourceFactory(QObject *parent) 55DummyResourceFactory::DummyResourceFactory(QObject *parent)
diff --git a/dummyresource/resourcefactory.h b/dummyresource/resourcefactory.h
index 7c40084..807a654 100644
--- a/dummyresource/resourcefactory.h
+++ b/dummyresource/resourcefactory.h
@@ -21,6 +21,8 @@
21 21
22#include "common/resource.h" 22#include "common/resource.h"
23 23
24#include <flatbuffers/flatbuffers.h>
25
24//TODO: a little ugly to have this in two places, once here and once in Q_PLUGIN_METADATA 26//TODO: a little ugly to have this in two places, once here and once in Q_PLUGIN_METADATA
25#define PLUGIN_NAME "org.kde.dummy" 27#define PLUGIN_NAME "org.kde.dummy"
26 28
@@ -28,7 +30,11 @@ class DummyResource : public Akonadi2::Resource
28{ 30{
29public: 31public:
30 DummyResource(); 32 DummyResource();
31 void synchronizeWithSource(); 33 void synchronizeWithSource(Akonadi2::Pipeline *pipeline);
34 void processCommand(int commandId, const QByteArray &data, uint size, Akonadi2::Pipeline *pipeline);
35
36private:
37 flatbuffers::FlatBufferBuilder m_fbb;
32}; 38};
33 39
34class DummyResourceFactory : public Akonadi2::ResourceFactory 40class DummyResourceFactory : public Akonadi2::ResourceFactory