diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dummyresource/resourcefactory.cpp | 20 | ||||
-rw-r--r-- | examples/dummyresource/resourcefactory.h | 1 |
2 files changed, 21 insertions, 0 deletions
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) | |||
134 | Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier + ".synchronization", Akonadi2::Storage::ReadWrite).removeFromDisk(); | 134 | Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier + ".synchronization", Akonadi2::Storage::ReadWrite).removeFromDisk(); |
135 | } | 135 | } |
136 | 136 | ||
137 | KAsync::Job<void> DummyResource::inspect(int inspectionType, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue) | ||
138 | { | ||
139 | |||
140 | Trace() << "Inspecting " << inspectionType << domainType << entityId << property << expectedValue; | ||
141 | if (property == "testInspection") { | ||
142 | Akonadi2::ResourceNotification n; | ||
143 | n.type = Akonadi2::NotificationType_Inspection; | ||
144 | if (expectedValue.toBool()) { | ||
145 | //Success | ||
146 | n.code = 0; | ||
147 | emit notify(n); | ||
148 | } else { | ||
149 | //Failure | ||
150 | n.code = 1; | ||
151 | emit notify(n); | ||
152 | } | ||
153 | } | ||
154 | return KAsync::null<void>(); | ||
155 | } | ||
156 | |||
137 | DummyResourceFactory::DummyResourceFactory(QObject *parent) | 157 | DummyResourceFactory::DummyResourceFactory(QObject *parent) |
138 | : Akonadi2::ResourceFactory(parent) | 158 | : Akonadi2::ResourceFactory(parent) |
139 | { | 159 | { |
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: | |||
40 | KAsync::Job<void> synchronizeWithSource(Akonadi2::Storage &mainStore, Akonadi2::Storage &synchronizationStore) Q_DECL_OVERRIDE; | 40 | KAsync::Job<void> synchronizeWithSource(Akonadi2::Storage &mainStore, Akonadi2::Storage &synchronizationStore) Q_DECL_OVERRIDE; |
41 | using GenericResource::synchronizeWithSource; | 41 | using GenericResource::synchronizeWithSource; |
42 | static void removeFromDisk(const QByteArray &instanceIdentifier); | 42 | static void removeFromDisk(const QByteArray &instanceIdentifier); |
43 | KAsync::Job<void> inspect(int inspectionType, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue) Q_DECL_OVERRIDE; | ||
43 | private: | 44 | private: |
44 | KAsync::Job<void> replay(Akonadi2::Storage &synchronizationStore, const QByteArray &type, const QByteArray &key, const QByteArray &value) Q_DECL_OVERRIDE; | 45 | KAsync::Job<void> replay(Akonadi2::Storage &synchronizationStore, const QByteArray &type, const QByteArray &key, const QByteArray &value) Q_DECL_OVERRIDE; |
45 | Akonadi2::ApplicationDomain::Event::Ptr createEvent(const QByteArray &rid, const QMap<QString, QVariant> &data, Akonadi2::Storage::Transaction &); | 46 | Akonadi2::ApplicationDomain::Event::Ptr createEvent(const QByteArray &rid, const QMap<QString, QVariant> &data, Akonadi2::Storage::Transaction &); |