diff options
author | Rémi Nicole <nicole@kolabsystems.com> | 2018-05-03 09:45:45 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-03 09:47:35 +0200 |
commit | 41ba42150d4232807299214a6fcfa44c669489b0 (patch) | |
tree | 117ff2c2afbc5fa2170c7d56a55f80b7811be235 /examples/webdavcommon/webdav.h | |
parent | 7a166895a54c4037749229b9ec9d0c90d60987b5 (diff) | |
download | sink-41ba42150d4232807299214a6fcfa44c669489b0.tar.gz sink-41ba42150d4232807299214a6fcfa44c669489b0.zip |
Implement replaying CalDAV events and calendars
Summary:
Notes:
- For calendars, only removal is implemented because:
- There is no DavCollectionCreateJob, possibly because there can't be an empty DAV collection
- DavCollectionModifyJob only allows modifying "properties", which we don't use (except for the name, if the name is considered a property)
- Currently, modifying an item with Sink overrides the one on the server, even if the store is not up-to-date
Reviewers: cmollekopf
Tags: #sink
Differential Revision: https://phabricator.kde.org/D12611
Diffstat (limited to 'examples/webdavcommon/webdav.h')
-rw-r--r-- | examples/webdavcommon/webdav.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/examples/webdavcommon/webdav.h b/examples/webdavcommon/webdav.h index 3a4977c..ecb6a81 100644 --- a/examples/webdavcommon/webdav.h +++ b/examples/webdavcommon/webdav.h | |||
@@ -35,6 +35,32 @@ public: | |||
35 | KAsync::Job<void> synchronizeWithSource(const Sink::QueryBase &query) Q_DECL_OVERRIDE; | 35 | KAsync::Job<void> synchronizeWithSource(const Sink::QueryBase &query) Q_DECL_OVERRIDE; |
36 | 36 | ||
37 | protected: | 37 | protected: |
38 | |||
39 | /** | ||
40 | * Called in a child synchronizer, when replaying a creation of an item. | ||
41 | */ | ||
42 | KAsync::Job<void> createItem(const KDAV2::DavItem &); | ||
43 | |||
44 | /** | ||
45 | * Called in a child synchronizer, when replaying a removal of an item. | ||
46 | */ | ||
47 | KAsync::Job<void> removeItem(const KDAV2::DavItem &); | ||
48 | |||
49 | /** | ||
50 | * Called in a child synchronizer, when replaying a modification of an item. | ||
51 | * | ||
52 | * The item to modify is chosen according to the given item's URL. | ||
53 | * The job will fail if the ETag does not match. | ||
54 | */ | ||
55 | KAsync::Job<void> modifyItem(const KDAV2::DavItem &); | ||
56 | |||
57 | /** | ||
58 | * See comments of the *Item version above | ||
59 | */ | ||
60 | KAsync::Job<void> createCollection(const KDAV2::DavUrl &); | ||
61 | KAsync::Job<void> removeCollection(const KDAV2::DavUrl &); | ||
62 | KAsync::Job<void> modifyCollection(const KDAV2::DavUrl &); | ||
63 | |||
38 | /** | 64 | /** |
39 | * Called with the list of discovered collections. It's purpose should be | 65 | * Called with the list of discovered collections. It's purpose should be |
40 | * adding the said collections to the store. | 66 | * adding the said collections to the store. |
@@ -63,6 +89,19 @@ protected: | |||
63 | static QByteArray resourceID(const KDAV2::DavCollection &); | 89 | static QByteArray resourceID(const KDAV2::DavCollection &); |
64 | static QByteArray resourceID(const KDAV2::DavItem &); | 90 | static QByteArray resourceID(const KDAV2::DavItem &); |
65 | 91 | ||
92 | /** | ||
93 | * Used to get the url of an item / collection with the given remote ID | ||
94 | */ | ||
95 | KDAV2::DavUrl urlOf(const QByteArray &remoteId); | ||
96 | |||
97 | /** | ||
98 | * Used to get the url of an item / collection with the given remote ID, | ||
99 | * and append `itemPath` to the path of the URI. | ||
100 | * | ||
101 | * Useful when adding a new item to a collection | ||
102 | */ | ||
103 | KDAV2::DavUrl urlOf(const QByteArray &collectionRemoteId, const QString &itemPath); | ||
104 | |||
66 | bool unchanged(const KDAV2::DavCollection &); | 105 | bool unchanged(const KDAV2::DavCollection &); |
67 | bool unchanged(const KDAV2::DavItem &); | 106 | bool unchanged(const KDAV2::DavItem &); |
68 | 107 | ||