diff options
Diffstat (limited to 'common/clientapi.cpp')
-rw-r--r-- | common/clientapi.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/common/clientapi.cpp b/common/clientapi.cpp index 5edab97..df48c3f 100644 --- a/common/clientapi.cpp +++ b/common/clientapi.cpp | |||
@@ -5,6 +5,7 @@ | |||
5 | #include "resourcefacade.h" | 5 | #include "resourcefacade.h" |
6 | #include "log.h" | 6 | #include "log.h" |
7 | #include "definitions.h" | 7 | #include "definitions.h" |
8 | #include "resourceconfig.h" | ||
8 | #include <QtConcurrent/QtConcurrentRun> | 9 | #include <QtConcurrent/QtConcurrentRun> |
9 | #include <QTimer> | 10 | #include <QTimer> |
10 | 11 | ||
@@ -31,6 +32,44 @@ namespace async | |||
31 | namespace Akonadi2 | 32 | namespace Akonadi2 |
32 | { | 33 | { |
33 | 34 | ||
35 | QString Store::storageLocation() | ||
36 | { | ||
37 | return Akonadi2::storageLocation(); | ||
38 | } | ||
39 | |||
40 | QByteArray Store::resourceName(const QByteArray &instanceIdentifier) | ||
41 | { | ||
42 | return Akonadi2::resourceName(instanceIdentifier); | ||
43 | } | ||
44 | |||
45 | QList<QByteArray> Store::getResources(const QList<QByteArray> &resourceFilter, const QByteArray &type) | ||
46 | { | ||
47 | //Return the global resource (signified by an empty name) for types that don't eblong to a specific resource | ||
48 | if (type == "akonadiresource") { | ||
49 | qWarning() << "Global resource"; | ||
50 | return QList<QByteArray>() << ""; | ||
51 | } | ||
52 | QList<QByteArray> resources; | ||
53 | const auto configuredResources = ResourceConfig::getResources(); | ||
54 | if (resourceFilter.isEmpty()) { | ||
55 | for (const auto &res : configuredResources) { | ||
56 | if (configuredResources.value(res) == type) { | ||
57 | resources << res; | ||
58 | } | ||
59 | } | ||
60 | } else { | ||
61 | for (const auto &res : resourceFilter) { | ||
62 | if (configuredResources.contains(res)) { | ||
63 | resources << res; | ||
64 | } else { | ||
65 | qWarning() << "Resource is not existing: " << res; | ||
66 | } | ||
67 | } | ||
68 | } | ||
69 | qWarning() << "Found resources: " << resources; | ||
70 | return resources; | ||
71 | } | ||
72 | |||
34 | void Store::shutdown(const QByteArray &identifier) | 73 | void Store::shutdown(const QByteArray &identifier) |
35 | { | 74 | { |
36 | Trace() << "shutdown"; | 75 | Trace() << "shutdown"; |