diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-22 16:35:09 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-22 16:35:09 +0100 |
commit | e8ab53258c044969146be385629a80afe801dee5 (patch) | |
tree | 170ded5835b8a60ef813964530aff7c79e52f4a0 /common/resourcefacade.cpp | |
parent | 50069f3c28b4130a9a81c25746d2c9d97c0356f5 (diff) | |
download | sink-e8ab53258c044969146be385629a80afe801dee5.tar.gz sink-e8ab53258c044969146be385629a80afe801dee5.zip |
Turn operations of resources into a special case.
Resources don't live inside a resource context, and as such inherently
are a special case. By also removing the option to manually specify the
identifier, the commandline is a lot easier to use.
Diffstat (limited to 'common/resourcefacade.cpp')
-rw-r--r-- | common/resourcefacade.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/common/resourcefacade.cpp b/common/resourcefacade.cpp index 367704a..df52538 100644 --- a/common/resourcefacade.cpp +++ b/common/resourcefacade.cpp | |||
@@ -20,6 +20,9 @@ | |||
20 | 20 | ||
21 | #include "resourceconfig.h" | 21 | #include "resourceconfig.h" |
22 | #include "query.h" | 22 | #include "query.h" |
23 | #include "definitions.h" | ||
24 | #include "storage.h" | ||
25 | #include <QDir> | ||
23 | 26 | ||
24 | ResourceFacade::ResourceFacade(const QByteArray &) | 27 | ResourceFacade::ResourceFacade(const QByteArray &) |
25 | : Akonadi2::StoreFacade<Akonadi2::ApplicationDomain::AkonadiResource>() | 28 | : Akonadi2::StoreFacade<Akonadi2::ApplicationDomain::AkonadiResource>() |
@@ -35,8 +38,9 @@ ResourceFacade::~ResourceFacade() | |||
35 | KAsync::Job<void> ResourceFacade::create(const Akonadi2::ApplicationDomain::AkonadiResource &resource) | 38 | KAsync::Job<void> ResourceFacade::create(const Akonadi2::ApplicationDomain::AkonadiResource &resource) |
36 | { | 39 | { |
37 | return KAsync::start<void>([resource, this]() { | 40 | return KAsync::start<void>([resource, this]() { |
38 | const QByteArray identifier = resource.getProperty("identifier").toByteArray(); | ||
39 | const QByteArray type = resource.getProperty("type").toByteArray(); | 41 | const QByteArray type = resource.getProperty("type").toByteArray(); |
42 | //It is currently a requirement that the resource starts with the type | ||
43 | const QByteArray identifier = ResourceConfig::newIdentifier(type); | ||
40 | ResourceConfig::addResource(identifier, type); | 44 | ResourceConfig::addResource(identifier, type); |
41 | auto changedProperties = resource.changedProperties(); | 45 | auto changedProperties = resource.changedProperties(); |
42 | changedProperties.removeOne("identifier"); | 46 | changedProperties.removeOne("identifier"); |
@@ -57,7 +61,7 @@ KAsync::Job<void> ResourceFacade::modify(const Akonadi2::ApplicationDomain::Akon | |||
57 | return KAsync::start<void>([resource, this]() { | 61 | return KAsync::start<void>([resource, this]() { |
58 | const QByteArray identifier = resource.identifier(); | 62 | const QByteArray identifier = resource.identifier(); |
59 | if (identifier.isEmpty()) { | 63 | if (identifier.isEmpty()) { |
60 | Warning() << "We need an \"identifier\" property to identify the resource to configure"; | 64 | Warning() << "We need an \"identifier\" property to identify the resource to configure."; |
61 | return; | 65 | return; |
62 | } | 66 | } |
63 | auto changedProperties = resource.changedProperties(); | 67 | auto changedProperties = resource.changedProperties(); |