diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dummyresource/resourcefactory.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/dummyresource/resourcefactory.cpp b/examples/dummyresource/resourcefactory.cpp index e029308..0e18282 100644 --- a/examples/dummyresource/resourcefactory.cpp +++ b/examples/dummyresource/resourcefactory.cpp | |||
@@ -42,13 +42,13 @@ DummyResource::DummyResource(const QByteArray &instanceIdentifier, const QShared | |||
42 | { | 42 | { |
43 | auto eventFactory = QSharedPointer<DummyEventAdaptorFactory>::create(); | 43 | auto eventFactory = QSharedPointer<DummyEventAdaptorFactory>::create(); |
44 | const auto resourceIdentifier = mResourceInstanceIdentifier; | 44 | const auto resourceIdentifier = mResourceInstanceIdentifier; |
45 | auto eventIndexer = new Akonadi2::SimpleProcessor("eventIndexer", [eventFactory, resourceIdentifier](const Akonadi2::PipelineState &state, const Akonadi2::Entity &entity) { | 45 | auto eventIndexer = new Akonadi2::SimpleProcessor("eventIndexer", [eventFactory, resourceIdentifier](const Akonadi2::PipelineState &state, const Akonadi2::Entity &entity, Akonadi2::Storage::Transaction &transaction) { |
46 | auto adaptor = eventFactory->createAdaptor(entity); | 46 | auto adaptor = eventFactory->createAdaptor(entity); |
47 | //FIXME set revision? | 47 | //FIXME set revision? |
48 | Akonadi2::ApplicationDomain::Event event(resourceIdentifier, state.key(), -1, adaptor); | 48 | Akonadi2::ApplicationDomain::Event event(resourceIdentifier, state.key(), -1, adaptor); |
49 | Akonadi2::ApplicationDomain::TypeImplementation<Akonadi2::ApplicationDomain::Event>::index(event); | 49 | Akonadi2::ApplicationDomain::TypeImplementation<Akonadi2::ApplicationDomain::Event>::index(event, transaction); |
50 | 50 | ||
51 | Index ridIndex(Akonadi2::storageLocation(), resourceIdentifier + ".index.rid", Akonadi2::Storage::ReadWrite); | 51 | Index ridIndex("index.rid", transaction); |
52 | const auto rid = event.getProperty("remoteId"); | 52 | const auto rid = event.getProperty("remoteId"); |
53 | if (rid.isValid()) { | 53 | if (rid.isValid()) { |
54 | ridIndex.add(rid.toByteArray(), event.identifier()); | 54 | ridIndex.add(rid.toByteArray(), event.identifier()); |
@@ -63,8 +63,8 @@ DummyResource::DummyResource(const QByteArray &instanceIdentifier, const QShared | |||
63 | KAsync::Job<void> DummyResource::synchronizeWithSource() | 63 | KAsync::Job<void> DummyResource::synchronizeWithSource() |
64 | { | 64 | { |
65 | return KAsync::start<void>([this](KAsync::Future<void> &f) { | 65 | return KAsync::start<void>([this](KAsync::Future<void> &f) { |
66 | //TODO start transaction on index | 66 | auto transaction = Akonadi2::Storage(Akonadi2::storageLocation(), mResourceInstanceIdentifier + ".index.uid", Akonadi2::Storage::ReadOnly).createTransaction(Akonadi2::Storage::ReadOnly); |
67 | Index uidIndex(Akonadi2::storageLocation(), mResourceInstanceIdentifier + ".index.uid", Akonadi2::Storage::ReadOnly); | 67 | Index uidIndex("index.uid", transaction); |
68 | 68 | ||
69 | const auto data = DummyStore::instance().data(); | 69 | const auto data = DummyStore::instance().data(); |
70 | for (auto it = data.constBegin(); it != data.constEnd(); it++) { | 70 | for (auto it = data.constBegin(); it != data.constEnd(); it++) { |