summaryrefslogtreecommitdiffstats
path: root/common/resourcefacade.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-22 16:35:09 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-22 16:35:09 +0100
commite8ab53258c044969146be385629a80afe801dee5 (patch)
tree170ded5835b8a60ef813964530aff7c79e52f4a0 /common/resourcefacade.cpp
parent50069f3c28b4130a9a81c25746d2c9d97c0356f5 (diff)
downloadsink-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.cpp8
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
24ResourceFacade::ResourceFacade(const QByteArray &) 27ResourceFacade::ResourceFacade(const QByteArray &)
25 : Akonadi2::StoreFacade<Akonadi2::ApplicationDomain::AkonadiResource>() 28 : Akonadi2::StoreFacade<Akonadi2::ApplicationDomain::AkonadiResource>()
@@ -35,8 +38,9 @@ ResourceFacade::~ResourceFacade()
35KAsync::Job<void> ResourceFacade::create(const Akonadi2::ApplicationDomain::AkonadiResource &resource) 38KAsync::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();