diff options
-rw-r--r-- | examples/webdavcommon/webdav.cpp | 21 | ||||
-rw-r--r-- | examples/webdavcommon/webdav.h | 4 |
2 files changed, 13 insertions, 12 deletions
diff --git a/examples/webdavcommon/webdav.cpp b/examples/webdavcommon/webdav.cpp index 904e1e2..ffda34a 100644 --- a/examples/webdavcommon/webdav.cpp +++ b/examples/webdavcommon/webdav.cpp | |||
@@ -89,11 +89,11 @@ static KAsync::Job<T> runJob(KJob *job, const std::function<T(KJob *)> &func) | |||
89 | } | 89 | } |
90 | 90 | ||
91 | WebDavSynchronizer::WebDavSynchronizer(const Sink::ResourceContext &context, | 91 | WebDavSynchronizer::WebDavSynchronizer(const Sink::ResourceContext &context, |
92 | KDAV2::Protocol protocol, QByteArray collectionName, QByteArray itemName) | 92 | KDAV2::Protocol protocol, QByteArray mCollectionType, QByteArray mEntityType) |
93 | : Sink::Synchronizer(context), | 93 | : Sink::Synchronizer(context), |
94 | protocol(protocol), | 94 | protocol(protocol), |
95 | collectionName(std::move(collectionName)), | 95 | mCollectionType(std::move(mCollectionType)), |
96 | itemName(std::move(itemName)) | 96 | mEntityType(std::move(mEntityType)) |
97 | { | 97 | { |
98 | auto config = ResourceConfig::getConfiguration(context.instanceId()); | 98 | auto config = ResourceConfig::getConfiguration(context.instanceId()); |
99 | 99 | ||
@@ -111,15 +111,16 @@ QList<Sink::Synchronizer::SyncRequest> WebDavSynchronizer::getSyncRequests(const | |||
111 | // We want to synchronize everything | 111 | // We want to synchronize everything |
112 | 112 | ||
113 | // Item synchronization does the collections anyway | 113 | // Item synchronization does the collections anyway |
114 | // list << Synchronizer::SyncRequest{ Sink::QueryBase(collectionName) }; | 114 | // list << Synchronizer::SyncRequest{ Sink::QueryBase(mCollectionType) }; |
115 | list << Synchronizer::SyncRequest{ Sink::QueryBase(itemName) }; | 115 | list << Synchronizer::SyncRequest{ Sink::QueryBase(mEntityType) }; |
116 | } | 116 | } |
117 | return list; | 117 | return list; |
118 | } | 118 | } |
119 | 119 | ||
120 | KAsync::Job<void> WebDavSynchronizer::synchronizeWithSource(const Sink::QueryBase &query) | 120 | KAsync::Job<void> WebDavSynchronizer::synchronizeWithSource(const Sink::QueryBase &query) |
121 | { | 121 | { |
122 | if (query.type() != collectionName && query.type() != itemName) { | 122 | if (query.type() != mCollectionType && query.type() != mEntityType) { |
123 | SinkWarning() << "Received synchronization reuqest with unkown type" << query; | ||
123 | return KAsync::null<void>(); | 124 | return KAsync::null<void>(); |
124 | } | 125 | } |
125 | 126 | ||
@@ -133,10 +134,10 @@ KAsync::Job<void> WebDavSynchronizer::synchronizeWithSource(const Sink::QueryBas | |||
133 | return collections; | 134 | return collections; |
134 | }); | 135 | }); |
135 | 136 | ||
136 | if (query.type() == collectionName) { | 137 | if (query.type() == mCollectionType) { |
137 | // Do nothing more | 138 | // Do nothing more |
138 | return job; | 139 | return job; |
139 | } else if (query.type() == itemName) { | 140 | } else if (query.type() == mEntityType) { |
140 | auto progress = QSharedPointer<int>::create(0); | 141 | auto progress = QSharedPointer<int>::create(0); |
141 | auto total = QSharedPointer<int>::create(0); | 142 | auto total = QSharedPointer<int>::create(0); |
142 | 143 | ||
@@ -160,13 +161,13 @@ KAsync::Job<void> WebDavSynchronizer::synchronizeWithSource(const Sink::QueryBas | |||
160 | auto itemsResourceIDs = QSharedPointer<QSet<QByteArray>>::create(); | 161 | auto itemsResourceIDs = QSharedPointer<QSet<QByteArray>>::create(); |
161 | return synchronizeCollection(collection, progress, total, itemsResourceIDs) | 162 | return synchronizeCollection(collection, progress, total, itemsResourceIDs) |
162 | .then([=] { | 163 | .then([=] { |
163 | scanForRemovals(itemName, [&itemsResourceIDs](const QByteArray &remoteId) { | 164 | scanForRemovals(mEntityType, [&itemsResourceIDs](const QByteArray &remoteId) { |
164 | return itemsResourceIDs->contains(remoteId); | 165 | return itemsResourceIDs->contains(remoteId); |
165 | }); | 166 | }); |
166 | }); | 167 | }); |
167 | }) | 168 | }) |
168 | .then([=]() { | 169 | .then([=]() { |
169 | scanForRemovals(collectionName, [&collectionResourceIDs](const QByteArray &remoteId) { | 170 | scanForRemovals(mCollectionType, [&collectionResourceIDs](const QByteArray &remoteId) { |
170 | return collectionResourceIDs->contains(remoteId); | 171 | return collectionResourceIDs->contains(remoteId); |
171 | }); | 172 | }); |
172 | }); | 173 | }); |
diff --git a/examples/webdavcommon/webdav.h b/examples/webdavcommon/webdav.h index 813da60..af6c47e 100644 --- a/examples/webdavcommon/webdav.h +++ b/examples/webdavcommon/webdav.h | |||
@@ -109,8 +109,8 @@ protected: | |||
109 | 109 | ||
110 | private: | 110 | private: |
111 | KDAV2::Protocol protocol; | 111 | KDAV2::Protocol protocol; |
112 | const QByteArray collectionName; | 112 | const QByteArray mCollectionType; |
113 | const QByteArray itemName; | 113 | const QByteArray mEntityType; |
114 | 114 | ||
115 | QUrl mServer; | 115 | QUrl mServer; |
116 | QString mUsername; | 116 | QString mUsername; |