diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-07-28 16:50:01 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-07-28 16:50:01 +0200 |
commit | a547d10f3d36e7c820d913d22798ca051c6e3df3 (patch) | |
tree | 24b0c7961a6243e80e439a1b22cb9ecb40855c39 /common/resourceaccess.h | |
parent | 7bd184460952932a237dc6f8bea7a8cd220afadf (diff) | |
download | sink-a547d10f3d36e7c820d913d22798ca051c6e3df3.tar.gz sink-a547d10f3d36e7c820d913d22798ca051c6e3df3.zip |
Allow to inject a fake ResourceInstance
Diffstat (limited to 'common/resourceaccess.h')
-rw-r--r-- | common/resourceaccess.h | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/common/resourceaccess.h b/common/resourceaccess.h index e873d8e..55379f3 100644 --- a/common/resourceaccess.h +++ b/common/resourceaccess.h | |||
@@ -33,33 +33,46 @@ namespace Akonadi2 | |||
33 | 33 | ||
34 | struct QueuedCommand; | 34 | struct QueuedCommand; |
35 | 35 | ||
36 | class ResourceAccess : public QObject | 36 | class ResourceAccessInterface : public QObject |
37 | { | 37 | { |
38 | Q_OBJECT | 38 | Q_OBJECT |
39 | public: | ||
40 | ResourceAccessInterface() {} | ||
41 | virtual ~ResourceAccessInterface() {} | ||
42 | virtual KAsync::Job<void> sendCommand(int commandId) = 0; | ||
43 | virtual KAsync::Job<void> sendCommand(int commandId, flatbuffers::FlatBufferBuilder &fbb) = 0; | ||
44 | virtual KAsync::Job<void> synchronizeResource(bool remoteSync, bool localSync) = 0; | ||
45 | |||
46 | Q_SIGNALS: | ||
47 | void ready(bool isReady); | ||
48 | void revisionChanged(unsigned long long revision); | ||
49 | |||
50 | public Q_SLOTS: | ||
51 | virtual void open() = 0; | ||
52 | virtual void close() = 0; | ||
53 | }; | ||
39 | 54 | ||
55 | class ResourceAccess : public ResourceAccessInterface | ||
56 | { | ||
57 | Q_OBJECT | ||
40 | public: | 58 | public: |
41 | ResourceAccess(const QByteArray &resourceName, QObject *parent = 0); | 59 | ResourceAccess(const QByteArray &resourceName); |
42 | ~ResourceAccess(); | 60 | ~ResourceAccess(); |
43 | 61 | ||
44 | QByteArray resourceName() const; | 62 | QByteArray resourceName() const; |
45 | bool isReady() const; | 63 | bool isReady() const; |
46 | 64 | ||
47 | KAsync::Job<void> sendCommand(int commandId); | 65 | KAsync::Job<void> sendCommand(int commandId) Q_DECL_OVERRIDE; |
48 | KAsync::Job<void> sendCommand(int commandId, flatbuffers::FlatBufferBuilder &fbb); | 66 | KAsync::Job<void> sendCommand(int commandId, flatbuffers::FlatBufferBuilder &fbb) Q_DECL_OVERRIDE; |
49 | KAsync::Job<void> synchronizeResource(bool remoteSync, bool localSync); | 67 | KAsync::Job<void> synchronizeResource(bool remoteSync, bool localSync) Q_DECL_OVERRIDE; |
50 | /** | 68 | /** |
51 | * Tries to connect to server, and returns a connected socket on success. | 69 | * Tries to connect to server, and returns a connected socket on success. |
52 | */ | 70 | */ |
53 | static KAsync::Job<QSharedPointer<QLocalSocket> > connectToServer(const QByteArray &identifier); | 71 | static KAsync::Job<QSharedPointer<QLocalSocket> > connectToServer(const QByteArray &identifier); |
54 | 72 | ||
55 | public Q_SLOTS: | 73 | public Q_SLOTS: |
56 | void open(); | 74 | void open() Q_DECL_OVERRIDE; |
57 | void close(); | 75 | void close() Q_DECL_OVERRIDE; |
58 | |||
59 | Q_SIGNALS: | ||
60 | void ready(bool isReady); | ||
61 | void revisionChanged(unsigned long long revision); | ||
62 | void commandCompleted(); | ||
63 | 76 | ||
64 | private Q_SLOTS: | 77 | private Q_SLOTS: |
65 | //TODO: move these to the Private class | 78 | //TODO: move these to the Private class |