diff options
Diffstat (limited to 'common/synchronizer.cpp')
-rw-r--r-- | common/synchronizer.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index 3e7bd30..58e5e7a 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp | |||
@@ -304,9 +304,21 @@ void Synchronizer::emitNotification(Notification::NoticationType type, int code, | |||
304 | emit notify(n); | 304 | emit notify(n); |
305 | } | 305 | } |
306 | 306 | ||
307 | void Synchronizer::emitProgressNotification(Notification::NoticationType type, int progress, int total, const QByteArray &id, const QByteArrayList &entities) | ||
308 | { | ||
309 | Sink::Notification n; | ||
310 | n.id = id; | ||
311 | n.type = type; | ||
312 | n.progress = progress; | ||
313 | n.total = total; | ||
314 | n.entities = entities; | ||
315 | emit notify(n); | ||
316 | } | ||
317 | |||
307 | void Synchronizer::reportProgress(int progress, int total) | 318 | void Synchronizer::reportProgress(int progress, int total) |
308 | { | 319 | { |
309 | SinkLogCtx(mLogCtx) << "Progress: " << progress << " out of " << total; | 320 | SinkLogCtx(mLogCtx) << "Progress: " << progress << " out of " << total; |
321 | emitProgressNotification(Notification::Progress, progress, total, mCurrentRequest.requestId, mCurrentRequest.applicableEntities); | ||
310 | } | 322 | } |
311 | 323 | ||
312 | void Synchronizer::setStatusFromResult(const KAsync::Error &error, const QString &s, const QByteArray &requestId) | 324 | void Synchronizer::setStatusFromResult(const KAsync::Error &error, const QString &s, const QByteArray &requestId) |
@@ -465,13 +477,15 @@ KAsync::Job<void> Synchronizer::processSyncQueue() | |||
465 | if (request.requestType == Synchronizer::SyncRequest::Synchronization) { | 477 | if (request.requestType == Synchronizer::SyncRequest::Synchronization) { |
466 | setBusy(true, "Synchronization has started.", request.requestId); | 478 | setBusy(true, "Synchronization has started.", request.requestId); |
467 | } else if (request.requestType == Synchronizer::SyncRequest::ChangeReplay) { | 479 | } else if (request.requestType == Synchronizer::SyncRequest::ChangeReplay) { |
468 | setBusy(true, "ChangeReplay has started.", "changereplay"); | 480 | setBusy(true, "ChangeReplay has started.", request.requestId); |
469 | } | 481 | } |
482 | mCurrentRequest = request; | ||
470 | }) | 483 | }) |
471 | .then(processRequest(request)) | 484 | .then(processRequest(request)) |
472 | .then<void>([this, request](const KAsync::Error &error) { | 485 | .then<void>([this, request](const KAsync::Error &error) { |
473 | SinkTraceCtx(mLogCtx) << "Sync request processed"; | 486 | SinkTraceCtx(mLogCtx) << "Sync request processed"; |
474 | setBusy(false, {}, request.requestId); | 487 | setBusy(false, {}, request.requestId); |
488 | mCurrentRequest = {}; | ||
475 | mEntityStore->abortTransaction(); | 489 | mEntityStore->abortTransaction(); |
476 | mSyncTransaction.abort(); | 490 | mSyncTransaction.abort(); |
477 | mMessageQueue->commit(); | 491 | mMessageQueue->commit(); |
@@ -516,7 +530,7 @@ void Synchronizer::revisionChanged() | |||
516 | return; | 530 | return; |
517 | } | 531 | } |
518 | } | 532 | } |
519 | mSyncRequestQueue << Synchronizer::SyncRequest{Synchronizer::SyncRequest::ChangeReplay}; | 533 | mSyncRequestQueue << Synchronizer::SyncRequest{Synchronizer::SyncRequest::ChangeReplay, "changereplay"}; |
520 | processSyncQueue().exec(); | 534 | processSyncQueue().exec(); |
521 | } | 535 | } |
522 | 536 | ||