diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-10-23 09:24:55 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-10-23 09:24:55 +0200 |
commit | 88556fa0f4040792aacb2ad1af28b2f61b365448 (patch) | |
tree | 49400c2e4cb8c46b048ad126336c2bb6288ab635 /common/clientapi.h | |
parent | 26c879c241ff3ce207d5ae754818fea1b50bd153 (diff) | |
download | sink-88556fa0f4040792aacb2ad1af28b2f61b365448.tar.gz sink-88556fa0f4040792aacb2ad1af28b2f61b365448.zip |
Made headers installable and install headers
Diffstat (limited to 'common/clientapi.h')
-rw-r--r-- | common/clientapi.h | 86 |
1 files changed, 6 insertions, 80 deletions
diff --git a/common/clientapi.h b/common/clientapi.h index c4125bd..4e6db09 100644 --- a/common/clientapi.h +++ b/common/clientapi.h | |||
@@ -29,13 +29,10 @@ | |||
29 | #include <Async/Async> | 29 | #include <Async/Async> |
30 | 30 | ||
31 | #include "query.h" | 31 | #include "query.h" |
32 | #include "threadboundary.h" | ||
33 | #include "resultprovider.h" | 32 | #include "resultprovider.h" |
34 | #include "domain/applicationdomaintype.h" | 33 | #include "applicationdomaintype.h" |
35 | #include "resourceconfig.h" | ||
36 | #include "facadefactory.h" | 34 | #include "facadefactory.h" |
37 | #include "log.h" | 35 | #include "log.h" |
38 | #include "definitions.h" | ||
39 | 36 | ||
40 | namespace async { | 37 | namespace async { |
41 | //This should abstract if we execute from eventloop or in thread. | 38 | //This should abstract if we execute from eventloop or in thread. |
@@ -51,42 +48,12 @@ using namespace async; | |||
51 | * Store interface used in the client API. | 48 | * Store interface used in the client API. |
52 | */ | 49 | */ |
53 | class Store { | 50 | class Store { |
54 | public: | 51 | private: |
55 | static QString storageLocation() | 52 | static QList<QByteArray> getResources(const QList<QByteArray> &resourceFilter, const QByteArray &type); |
56 | { | ||
57 | return Akonadi2::storageLocation(); | ||
58 | } | ||
59 | 53 | ||
60 | static QByteArray resourceName(const QByteArray &instanceIdentifier) | 54 | public: |
61 | { | 55 | static QString storageLocation(); |
62 | return Akonadi2::resourceName(instanceIdentifier); | 56 | static QByteArray resourceName(const QByteArray &instanceIdentifier); |
63 | } | ||
64 | |||
65 | static QList<QByteArray> getResources(const QList<QByteArray> &resourceFilter, const QByteArray &type) | ||
66 | { | ||
67 | //Return the global resource (signified by an empty name) for types that don't eblong to a specific resource | ||
68 | if (type == "akonadiresource") { | ||
69 | return QList<QByteArray>() << ""; | ||
70 | } | ||
71 | QList<QByteArray> resources; | ||
72 | const auto configuredResources = ResourceConfig::getResources(); | ||
73 | if (resourceFilter.isEmpty()) { | ||
74 | for (const auto &res : configuredResources) { | ||
75 | if (configuredResources.value(res) == type) { | ||
76 | resources << res; | ||
77 | } | ||
78 | } | ||
79 | } else { | ||
80 | for (const auto &res : resourceFilter) { | ||
81 | if (configuredResources.contains(res)) { | ||
82 | resources << res; | ||
83 | } else { | ||
84 | qWarning() << "Resource is not existing: " << res; | ||
85 | } | ||
86 | } | ||
87 | } | ||
88 | return resources; | ||
89 | } | ||
90 | 57 | ||
91 | /** | 58 | /** |
92 | * Asynchronusly load a dataset | 59 | * Asynchronusly load a dataset |
@@ -192,47 +159,6 @@ public: | |||
192 | static void synchronize(const QByteArray &resourceIdentifier); | 159 | static void synchronize(const QByteArray &resourceIdentifier); |
193 | }; | 160 | }; |
194 | 161 | ||
195 | /** | ||
196 | * Configuration interface used in the client API. | ||
197 | * | ||
198 | * This interface provides convenience API for manipulating resources. | ||
199 | * This interface uses internally the same interface that is part of the regular Store API. | ||
200 | * | ||
201 | * Resources provide their configuration implementation by implementing a StoreFacade for the AkonadiResource type. | ||
202 | */ | ||
203 | class Configuration { | ||
204 | public: | ||
205 | static QWidget *getConfigurationWidget(const QByteArray &resourceIdentifier) | ||
206 | { | ||
207 | //TODO here we want to implement the code to create a configuration widget from the QML config interface provided by the resource | ||
208 | return nullptr; | ||
209 | } | ||
210 | |||
211 | static ApplicationDomain::AkonadiResource::Ptr getConfiguration(const QByteArray &resource) | ||
212 | { | ||
213 | Query query; | ||
214 | query.resources << resource; | ||
215 | // auto result = Store::load<ApplicationDomain::AkonadiResource>(query); | ||
216 | //FIXME retrieve result and return it | ||
217 | return ApplicationDomain::AkonadiResource::Ptr::create(); | ||
218 | } | ||
219 | |||
220 | static void setConfiguration(const ApplicationDomain::AkonadiResource &resource) | ||
221 | { | ||
222 | Store::modify<ApplicationDomain::AkonadiResource>(resource); | ||
223 | } | ||
224 | |||
225 | static void createResource(const ApplicationDomain::AkonadiResource &resource) | ||
226 | { | ||
227 | Store::create<ApplicationDomain::AkonadiResource>(resource); | ||
228 | } | ||
229 | |||
230 | static void removeResource(const QByteArray &resourceIdentifier) | ||
231 | { | ||
232 | ApplicationDomain::AkonadiResource resource(resourceIdentifier); | ||
233 | Store::remove<ApplicationDomain::AkonadiResource>(resource); | ||
234 | } | ||
235 | }; | ||
236 | 162 | ||
237 | } | 163 | } |
238 | 164 | ||