diff options
Diffstat (limited to 'examples/webdavcommon/webdav.cpp')
-rw-r--r-- | examples/webdavcommon/webdav.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/examples/webdavcommon/webdav.cpp b/examples/webdavcommon/webdav.cpp index e86ebd1..05b5348 100644 --- a/examples/webdavcommon/webdav.cpp +++ b/examples/webdavcommon/webdav.cpp | |||
@@ -122,10 +122,6 @@ KAsync::Job<void> WebDavSynchronizer::synchronizeWithSource(const Sink::QueryBas | |||
122 | // for collections to be removed. | 122 | // for collections to be removed. |
123 | auto collectionResourceIDs = QSharedPointer<QSet<QByteArray>>::create(); | 123 | auto collectionResourceIDs = QSharedPointer<QSet<QByteArray>>::create(); |
124 | 124 | ||
125 | // Same but for items. | ||
126 | // Quirk: may contain a collection Id (see below) | ||
127 | auto itemsResourceIDs = QSharedPointer<QSet<QByteArray>>::create(); | ||
128 | |||
129 | return job | 125 | return job |
130 | .serialEach([=](const KDAV2::DavCollection &collection) { | 126 | .serialEach([=](const KDAV2::DavCollection &collection) { |
131 | auto collectionResourceID = resourceID(collection); | 127 | auto collectionResourceID = resourceID(collection); |
@@ -135,26 +131,22 @@ KAsync::Job<void> WebDavSynchronizer::synchronizeWithSource(const Sink::QueryBas | |||
135 | if (unchanged(collection)) { | 131 | if (unchanged(collection)) { |
136 | SinkTrace() << "Collection unchanged:" << collectionResourceID; | 132 | SinkTrace() << "Collection unchanged:" << collectionResourceID; |
137 | 133 | ||
138 | // It seems that doing this prevent the items in the | ||
139 | // collection to be removed when doing scanForRemovals | ||
140 | // below (since the collection is unchanged, we do not go | ||
141 | // through all of its items). | ||
142 | // Behaviour copied from the previous code. | ||
143 | itemsResourceIDs->insert(collectionResourceID); | ||
144 | |||
145 | return KAsync::null<void>(); | 134 | return KAsync::null<void>(); |
146 | } | 135 | } |
147 | 136 | ||
148 | SinkTrace() << "Syncing collection:" << collectionResourceID; | 137 | SinkTrace() << "Syncing collection:" << collectionResourceID; |
149 | return synchronizeCollection(collection, progress, total, itemsResourceIDs); | 138 | auto itemsResourceIDs = QSharedPointer<QSet<QByteArray>>::create(); |
139 | return synchronizeCollection(collection, progress, total, itemsResourceIDs) | ||
140 | .then([=] { | ||
141 | scanForRemovals(itemName, [&itemsResourceIDs](const QByteArray &remoteId) { | ||
142 | return itemsResourceIDs->contains(remoteId); | ||
143 | }); | ||
144 | }); | ||
150 | }) | 145 | }) |
151 | .then([=]() { | 146 | .then([=]() { |
152 | scanForRemovals(collectionName, [&collectionResourceIDs](const QByteArray &remoteId) { | 147 | scanForRemovals(collectionName, [&collectionResourceIDs](const QByteArray &remoteId) { |
153 | return collectionResourceIDs->contains(remoteId); | 148 | return collectionResourceIDs->contains(remoteId); |
154 | }); | 149 | }); |
155 | scanForRemovals(itemName, [&itemsResourceIDs](const QByteArray &remoteId) { | ||
156 | return itemsResourceIDs->contains(remoteId); | ||
157 | }); | ||
158 | }); | 150 | }); |
159 | } else { | 151 | } else { |
160 | SinkWarning() << "Unknown query type"; | 152 | SinkWarning() << "Unknown query type"; |