diff options
Diffstat (limited to 'common/resourcefacade.cpp')
-rw-r--r-- | common/resourcefacade.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/common/resourcefacade.cpp b/common/resourcefacade.cpp index 20d9a7c..414e390 100644 --- a/common/resourcefacade.cpp +++ b/common/resourcefacade.cpp | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <QDir> | 25 | #include <QDir> |
26 | 26 | ||
27 | ResourceFacade::ResourceFacade(const QByteArray &) | 27 | ResourceFacade::ResourceFacade(const QByteArray &) |
28 | : Akonadi2::StoreFacade<Akonadi2::ApplicationDomain::AkonadiResource>() | 28 | : Sink::StoreFacade<Sink::ApplicationDomain::SinkResource>() |
29 | { | 29 | { |
30 | 30 | ||
31 | } | 31 | } |
@@ -35,7 +35,7 @@ ResourceFacade::~ResourceFacade() | |||
35 | 35 | ||
36 | } | 36 | } |
37 | 37 | ||
38 | KAsync::Job<void> ResourceFacade::create(const Akonadi2::ApplicationDomain::AkonadiResource &resource) | 38 | KAsync::Job<void> ResourceFacade::create(const Sink::ApplicationDomain::SinkResource &resource) |
39 | { | 39 | { |
40 | return KAsync::start<void>([resource, this]() { | 40 | return KAsync::start<void>([resource, this]() { |
41 | const QByteArray type = resource.getProperty("type").toByteArray(); | 41 | const QByteArray type = resource.getProperty("type").toByteArray(); |
@@ -57,7 +57,7 @@ KAsync::Job<void> ResourceFacade::create(const Akonadi2::ApplicationDomain::Akon | |||
57 | }); | 57 | }); |
58 | } | 58 | } |
59 | 59 | ||
60 | KAsync::Job<void> ResourceFacade::modify(const Akonadi2::ApplicationDomain::AkonadiResource &resource) | 60 | KAsync::Job<void> ResourceFacade::modify(const Sink::ApplicationDomain::SinkResource &resource) |
61 | { | 61 | { |
62 | return KAsync::start<void>([resource, this]() { | 62 | return KAsync::start<void>([resource, this]() { |
63 | const QByteArray identifier = resource.identifier(); | 63 | const QByteArray identifier = resource.identifier(); |
@@ -79,7 +79,7 @@ KAsync::Job<void> ResourceFacade::modify(const Akonadi2::ApplicationDomain::Akon | |||
79 | }); | 79 | }); |
80 | } | 80 | } |
81 | 81 | ||
82 | KAsync::Job<void> ResourceFacade::remove(const Akonadi2::ApplicationDomain::AkonadiResource &resource) | 82 | KAsync::Job<void> ResourceFacade::remove(const Sink::ApplicationDomain::SinkResource &resource) |
83 | { | 83 | { |
84 | return KAsync::start<void>([resource, this]() { | 84 | return KAsync::start<void>([resource, this]() { |
85 | const QByteArray identifier = resource.identifier(); | 85 | const QByteArray identifier = resource.identifier(); |
@@ -89,18 +89,18 @@ KAsync::Job<void> ResourceFacade::remove(const Akonadi2::ApplicationDomain::Akon | |||
89 | } | 89 | } |
90 | ResourceConfig::removeResource(identifier); | 90 | ResourceConfig::removeResource(identifier); |
91 | //TODO shutdown resource, or use the resource process with a --remove option to cleanup (so we can take advantage of the file locking) | 91 | //TODO shutdown resource, or use the resource process with a --remove option to cleanup (so we can take advantage of the file locking) |
92 | QDir dir(Akonadi2::storageLocation()); | 92 | QDir dir(Sink::storageLocation()); |
93 | for (const auto &folder : dir.entryList(QStringList() << identifier + "*")) { | 93 | for (const auto &folder : dir.entryList(QStringList() << identifier + "*")) { |
94 | Akonadi2::Storage(Akonadi2::storageLocation(), folder, Akonadi2::Storage::ReadWrite).removeFromDisk(); | 94 | Sink::Storage(Sink::storageLocation(), folder, Sink::Storage::ReadWrite).removeFromDisk(); |
95 | } | 95 | } |
96 | }); | 96 | }); |
97 | } | 97 | } |
98 | 98 | ||
99 | QPair<KAsync::Job<void>, typename Akonadi2::ResultEmitter<Akonadi2::ApplicationDomain::AkonadiResource::Ptr>::Ptr > ResourceFacade::load(const Akonadi2::Query &query) | 99 | QPair<KAsync::Job<void>, typename Sink::ResultEmitter<Sink::ApplicationDomain::SinkResource::Ptr>::Ptr > ResourceFacade::load(const Sink::Query &query) |
100 | { | 100 | { |
101 | auto resultProvider = new Akonadi2::ResultProvider<typename Akonadi2::ApplicationDomain::AkonadiResource::Ptr>(); | 101 | auto resultProvider = new Sink::ResultProvider<typename Sink::ApplicationDomain::SinkResource::Ptr>(); |
102 | auto emitter = resultProvider->emitter(); | 102 | auto emitter = resultProvider->emitter(); |
103 | resultProvider->setFetcher([](const QSharedPointer<Akonadi2::ApplicationDomain::AkonadiResource> &) {}); | 103 | resultProvider->setFetcher([](const QSharedPointer<Sink::ApplicationDomain::SinkResource> &) {}); |
104 | resultProvider->onDone([resultProvider]() { | 104 | resultProvider->onDone([resultProvider]() { |
105 | delete resultProvider; | 105 | delete resultProvider; |
106 | }); | 106 | }); |
@@ -109,13 +109,13 @@ QPair<KAsync::Job<void>, typename Akonadi2::ResultEmitter<Akonadi2::ApplicationD | |||
109 | for (const auto &res : configuredResources.keys()) { | 109 | for (const auto &res : configuredResources.keys()) { |
110 | const auto type = configuredResources.value(res); | 110 | const auto type = configuredResources.value(res); |
111 | if (!query.propertyFilter.contains("type") || query.propertyFilter.value("type").toByteArray() == type) { | 111 | if (!query.propertyFilter.contains("type") || query.propertyFilter.value("type").toByteArray() == type) { |
112 | auto resource = Akonadi2::ApplicationDomain::AkonadiResource::Ptr::create("", res, 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 112 | auto resource = Sink::ApplicationDomain::SinkResource::Ptr::create("", res, 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); |
113 | resource->setProperty("type", type); | 113 | resource->setProperty("type", type); |
114 | resultProvider->add(resource); | 114 | resultProvider->add(resource); |
115 | } | 115 | } |
116 | } | 116 | } |
117 | //TODO initialResultSetComplete should be implicit | 117 | //TODO initialResultSetComplete should be implicit |
118 | resultProvider->initialResultSetComplete(Akonadi2::ApplicationDomain::AkonadiResource::Ptr()); | 118 | resultProvider->initialResultSetComplete(Sink::ApplicationDomain::SinkResource::Ptr()); |
119 | resultProvider->complete(); | 119 | resultProvider->complete(); |
120 | }); | 120 | }); |
121 | return qMakePair(job, emitter); | 121 | return qMakePair(job, emitter); |