diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-19 17:00:16 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-19 17:00:16 +0100 |
commit | c26420604b71da2f32bb29dc531e779656d77fc1 (patch) | |
tree | 334f790543ce0893d14fe20a7c39ed37a9d6790b /common/resourcefacade.cpp | |
parent | 23e807c133a23f924d56bc860aa34f62f09109ff (diff) | |
download | sink-c26420604b71da2f32bb29dc531e779656d77fc1.tar.gz sink-c26420604b71da2f32bb29dc531e779656d77fc1.zip |
Make the akonadi2_client more generic
One syntax for all entity types and a generic mechanism to
execute operations.
Diffstat (limited to 'common/resourcefacade.cpp')
-rw-r--r-- | common/resourcefacade.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/common/resourcefacade.cpp b/common/resourcefacade.cpp index 89d072c..367704a 100644 --- a/common/resourcefacade.cpp +++ b/common/resourcefacade.cpp | |||
@@ -55,7 +55,7 @@ KAsync::Job<void> ResourceFacade::create(const Akonadi2::ApplicationDomain::Akon | |||
55 | KAsync::Job<void> ResourceFacade::modify(const Akonadi2::ApplicationDomain::AkonadiResource &resource) | 55 | KAsync::Job<void> ResourceFacade::modify(const Akonadi2::ApplicationDomain::AkonadiResource &resource) |
56 | { | 56 | { |
57 | return KAsync::start<void>([resource, this]() { | 57 | return KAsync::start<void>([resource, this]() { |
58 | const QByteArray identifier = resource.getProperty("identifier").toByteArray(); | 58 | const QByteArray identifier = resource.identifier(); |
59 | if (identifier.isEmpty()) { | 59 | if (identifier.isEmpty()) { |
60 | Warning() << "We need an \"identifier\" property to identify the resource to configure"; | 60 | Warning() << "We need an \"identifier\" property to identify the resource to configure"; |
61 | return; | 61 | return; |
@@ -77,7 +77,11 @@ KAsync::Job<void> ResourceFacade::modify(const Akonadi2::ApplicationDomain::Akon | |||
77 | KAsync::Job<void> ResourceFacade::remove(const Akonadi2::ApplicationDomain::AkonadiResource &resource) | 77 | KAsync::Job<void> ResourceFacade::remove(const Akonadi2::ApplicationDomain::AkonadiResource &resource) |
78 | { | 78 | { |
79 | return KAsync::start<void>([resource, this]() { | 79 | return KAsync::start<void>([resource, this]() { |
80 | const QByteArray identifier = resource.getProperty("identifier").toByteArray(); | 80 | const QByteArray identifier = resource.identifier(); |
81 | if (identifier.isEmpty()) { | ||
82 | Warning() << "We need an \"identifier\" property to identify the resource to configure"; | ||
83 | return; | ||
84 | } | ||
81 | ResourceConfig::removeResource(identifier); | 85 | ResourceConfig::removeResource(identifier); |
82 | }); | 86 | }); |
83 | } | 87 | } |
@@ -96,7 +100,6 @@ QPair<KAsync::Job<void>, typename Akonadi2::ResultEmitter<Akonadi2::ApplicationD | |||
96 | const auto type = configuredResources.value(res); | 100 | const auto type = configuredResources.value(res); |
97 | if (!query.propertyFilter.contains("type") || query.propertyFilter.value("type").toByteArray() == type) { | 101 | if (!query.propertyFilter.contains("type") || query.propertyFilter.value("type").toByteArray() == type) { |
98 | auto resource = Akonadi2::ApplicationDomain::AkonadiResource::Ptr::create("", res, 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 102 | auto resource = Akonadi2::ApplicationDomain::AkonadiResource::Ptr::create("", res, 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); |
99 | resource->setProperty("identifier", res); | ||
100 | resource->setProperty("type", type); | 103 | resource->setProperty("type", type); |
101 | resultProvider->add(resource); | 104 | resultProvider->add(resource); |
102 | } | 105 | } |