diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-08-13 01:27:21 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-08-13 01:27:21 +0200 |
commit | b6d5d206de4d02149c6530236154283bf834087a (patch) | |
tree | 0d57764b674df3ffee1df3f3e9fb1690ae06bbdc /common/clientapi.h | |
parent | 7c9ae062101b5dc8f963c70fb753f8346a9b5c48 (diff) | |
download | sink-b6d5d206de4d02149c6530236154283bf834087a.tar.gz sink-b6d5d206de4d02149c6530236154283bf834087a.zip |
Untangled the include dependencies a bit.
We no longer depend on clientapi.h from everywhere.
Diffstat (limited to 'common/clientapi.h')
-rw-r--r-- | common/clientapi.h | 50 |
1 files changed, 4 insertions, 46 deletions
diff --git a/common/clientapi.h b/common/clientapi.h index 6294863..04433f8 100644 --- a/common/clientapi.h +++ b/common/clientapi.h | |||
@@ -21,22 +21,21 @@ | |||
21 | #pragma once | 21 | #pragma once |
22 | 22 | ||
23 | #include <QString> | 23 | #include <QString> |
24 | #include <QSet> | ||
25 | #include <QSharedPointer> | 24 | #include <QSharedPointer> |
26 | #include <QStandardPaths> | ||
27 | #include <QDebug> | ||
28 | #include <QEventLoop> | 25 | #include <QEventLoop> |
29 | #include <functional> | 26 | #include <functional> |
30 | #include <memory> | 27 | #include <memory> |
31 | 28 | ||
32 | #include <Async/Async> | 29 | #include <Async/Async> |
33 | 30 | ||
31 | #include "query.h" | ||
34 | #include "threadboundary.h" | 32 | #include "threadboundary.h" |
35 | #include "resultprovider.h" | 33 | #include "resultprovider.h" |
36 | #include "domain/applicationdomaintype.h" | 34 | #include "domain/applicationdomaintype.h" |
37 | #include "resourceconfig.h" | 35 | #include "resourceconfig.h" |
38 | #include "facadefactory.h" | 36 | #include "facadefactory.h" |
39 | #include "log.h" | 37 | #include "log.h" |
38 | #include "definitions.h" | ||
40 | 39 | ||
41 | namespace async { | 40 | namespace async { |
42 | //This should abstract if we execute from eventloop or in thread. | 41 | //This should abstract if we execute from eventloop or in thread. |
@@ -49,59 +48,18 @@ namespace Akonadi2 { | |||
49 | using namespace async; | 48 | using namespace async; |
50 | 49 | ||
51 | /** | 50 | /** |
52 | * A query that matches a set of objects | ||
53 | * | ||
54 | * The query will have to be updated regularly similary to the domain objects. | ||
55 | * It probably also makes sense to have a domain specific part of the query, | ||
56 | * such as what properties we're interested in (necessary information for on-demand | ||
57 | * loading of data). | ||
58 | * | ||
59 | * The query defines: | ||
60 | * * what resources to search | ||
61 | * * filters on various properties (parent collection, startDate range, ....) | ||
62 | * * properties we need (for on-demand querying) | ||
63 | * | ||
64 | * syncOnDemand: Execute a source sync before executing the query | ||
65 | * processAll: Ensure all local messages are processed before querying to guarantee an up-to date dataset. | ||
66 | */ | ||
67 | class Query | ||
68 | { | ||
69 | public: | ||
70 | Query() : syncOnDemand(true), processAll(false), liveQuery(false) {} | ||
71 | //Could also be a propertyFilter | ||
72 | QByteArrayList resources; | ||
73 | //Could also be a propertyFilter | ||
74 | QByteArrayList ids; | ||
75 | //Filters to apply | ||
76 | QHash<QByteArray, QVariant> propertyFilter; | ||
77 | //Properties to retrieve | ||
78 | QSet<QByteArray> requestedProperties; | ||
79 | bool syncOnDemand; | ||
80 | bool processAll; | ||
81 | //If live query is false, this query will not continuously be updated | ||
82 | bool liveQuery; | ||
83 | }; | ||
84 | |||
85 | |||
86 | |||
87 | /** | ||
88 | * Store interface used in the client API. | 51 | * Store interface used in the client API. |
89 | */ | 52 | */ |
90 | class Store { | 53 | class Store { |
91 | public: | 54 | public: |
92 | static QString storageLocation() | 55 | static QString storageLocation() |
93 | { | 56 | { |
94 | return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/akonadi2/storage"; | 57 | return Akonadi2::storageLocation(); |
95 | } | 58 | } |
96 | 59 | ||
97 | static QByteArray resourceName(const QByteArray &instanceIdentifier) | 60 | static QByteArray resourceName(const QByteArray &instanceIdentifier) |
98 | { | 61 | { |
99 | auto split = instanceIdentifier.split('.'); | 62 | return Akonadi2::resourceName(instanceIdentifier); |
100 | if (split.size() <= 1) { | ||
101 | return instanceIdentifier; | ||
102 | } | ||
103 | split.removeLast(); | ||
104 | return split.join('.'); | ||
105 | } | 63 | } |
106 | 64 | ||
107 | static QList<QByteArray> getResources(const QList<QByteArray> &resourceFilter) | 65 | static QList<QByteArray> getResources(const QList<QByteArray> &resourceFilter) |