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

Try estimate the progress of a full sync



This speculates that the sync is a full resync of an existing folder,
which already was synced before and the number of local items already
known will be approximately the same as the remote item count.

A true value could be obtained by issuing a GetFolder request before,
but this would mean an extra request just for UI purpose, which is
really not that important.

Signed-off-by: Krzysztof Nowicki's avatarKrzysztof Nowicki <krissn@op.pl>
parent dd8d63ff
......@@ -210,6 +210,9 @@ void EwsFetchItemsJob::remoteItemFetchDone(KJob *job)
}
}
const auto totalItems = mRemoteAddedItems.size() + mRemoteChangedItems.size() + mRemoteDeletedIds.size() + mRemoteFlagChangedIds.size();
if (!mLocalItems.empty()) {
Q_EMIT percent(qMin(totalItems * 50 / mLocalItems.size(), 50));
}
Q_EMIT status(AgentBase::Running, i18nc("@info:status", "Retrieving %1 item list (%2 items)", mCollection.name(), totalItems));
}
}
......@@ -431,7 +434,7 @@ void EwsFetchItemsJob::itemDetailFetchDone(KJob *job)
}
mTotalItemsFetched = mChangedItems.size();
Q_EMIT percent((mTotalItemsFetched * 100) / mTotalItemsToFetch);
Q_EMIT percent(50 + (mTotalItemsFetched * 50) / mTotalItemsToFetch);
if (subjobs().isEmpty()) {
emitResult();
......
Supports Markdown
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