Commit b97d7f86 authored by Krzysztof Nowicki's avatar Krzysztof Nowicki Committed by Laurent Montel
Browse files

Deliver new items separately in item fetch job

Instead of returning new and modified items in one list (which is
enough for the retrieveItems request), return them in separate lists.

This prepares the EwsFetchItemsJob to be used directly in response to
subscription notifications.
parent 3f72ce3a
......@@ -430,7 +430,14 @@ void EwsFetchItemsJob::itemDetailFetchDone(KJob *job)
if (!job->error()) {
auto detailJob = qobject_cast<EwsFetchItemDetailJob *>(job);
if (detailJob) {
mChangedItems += detailJob->changedItems();
const auto changedItems = detailJob->changedItems();
for (const auto &item : changedItems) {
if (item.isValid()) {
mChangedItems.append(item);
} else {
mNewItems.append(item);
}
}
}
mTotalItemsFetched = mChangedItems.size();
......
......@@ -39,6 +39,11 @@ public:
EwsResource *parent);
~EwsFetchItemsJob() override;
Akonadi::Item::List newItems() const
{
return mNewItems;
}
Akonadi::Item::List changedItems() const
{
return mChangedItems;
......@@ -102,6 +107,7 @@ private:
EwsTagStore *mTagStore = nullptr;
bool mTagsSynced;
Akonadi::Item::List mNewItems;
Akonadi::Item::List mChangedItems;
Akonadi::Item::List mDeletedItems;
};
......
......@@ -456,7 +456,7 @@ void EwsResource::itemFetchJobFinished(KJob *job)
}
} else {
saveCollectionSyncState(col, fetchJob->syncState());
itemsRetrievedIncremental(fetchJob->changedItems(), fetchJob->deletedItems());
itemsRetrievedIncremental(fetchJob->newItems() + fetchJob->changedItems(), fetchJob->deletedItems());
}
saveState();
mItemsToCheck.remove(fetchJob->collection().remoteId());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment