diff options
Diffstat (limited to 'common/synchronizer.cpp')
-rw-r--r-- | common/synchronizer.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index 4ed6e3a..ec896ed 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp | |||
@@ -292,13 +292,14 @@ void Synchronizer::flushComplete(const QByteArray &flushId) | |||
292 | } | 292 | } |
293 | } | 293 | } |
294 | 294 | ||
295 | void Synchronizer::emitNotification(Notification::NoticationType type, int code, const QString &message, const QByteArray &id) | 295 | void Synchronizer::emitNotification(Notification::NoticationType type, int code, const QString &message, const QByteArray &id, const QByteArrayList &entities) |
296 | { | 296 | { |
297 | Sink::Notification n; | 297 | Sink::Notification n; |
298 | n.id = id; | 298 | n.id = id; |
299 | n.type = type; | 299 | n.type = type; |
300 | n.message = message; | 300 | n.message = message; |
301 | n.code = code; | 301 | n.code = code; |
302 | n.entities = entities; | ||
302 | emit notify(n); | 303 | emit notify(n); |
303 | } | 304 | } |
304 | 305 | ||
@@ -328,6 +329,7 @@ KAsync::Job<void> Synchronizer::processRequest(const SyncRequest &request) | |||
328 | return KAsync::start([this, request] { | 329 | return KAsync::start([this, request] { |
329 | SinkLogCtx(mLogCtx) << "Synchronizing: " << request.query; | 330 | SinkLogCtx(mLogCtx) << "Synchronizing: " << request.query; |
330 | emitNotification(Notification::Status, ApplicationDomain::BusyStatus, "Synchronization has started.", request.requestId); | 331 | emitNotification(Notification::Status, ApplicationDomain::BusyStatus, "Synchronization has started.", request.requestId); |
332 | emitNotification(Notification::Info, ApplicationDomain::SyncInProgress, {}, {}, request.query.ids()); | ||
331 | }).then(synchronizeWithSource(request.query)).then([this] { | 333 | }).then(synchronizeWithSource(request.query)).then([this] { |
332 | //Commit after every request, so implementations only have to commit more if they add a lot of data. | 334 | //Commit after every request, so implementations only have to commit more if they add a lot of data. |
333 | commit(); | 335 | commit(); |
@@ -335,10 +337,12 @@ KAsync::Job<void> Synchronizer::processRequest(const SyncRequest &request) | |||
335 | if (error) { | 337 | if (error) { |
336 | //Emit notification with error | 338 | //Emit notification with error |
337 | SinkWarningCtx(mLogCtx) << "Synchronization failed: " << error.errorMessage; | 339 | SinkWarningCtx(mLogCtx) << "Synchronization failed: " << error.errorMessage; |
340 | emitNotification(Notification::Warning, ApplicationDomain::SyncError, {}, {}, request.query.ids()); | ||
338 | emitNotification(Notification::Status, ApplicationDomain::ErrorStatus, "Synchronization has ended.", request.requestId); | 341 | emitNotification(Notification::Status, ApplicationDomain::ErrorStatus, "Synchronization has ended.", request.requestId); |
339 | return KAsync::error(error); | 342 | return KAsync::error(error); |
340 | } else { | 343 | } else { |
341 | SinkLogCtx(mLogCtx) << "Done Synchronizing"; | 344 | SinkLogCtx(mLogCtx) << "Done Synchronizing"; |
345 | emitNotification(Notification::Info, ApplicationDomain::SyncSuccess, {}, {}, request.query.ids()); | ||
342 | emitNotification(Notification::Status, ApplicationDomain::ConnectedStatus, "Synchronization has ended.", request.requestId); | 346 | emitNotification(Notification::Status, ApplicationDomain::ConnectedStatus, "Synchronization has ended.", request.requestId); |
343 | return KAsync::null(); | 347 | return KAsync::null(); |
344 | } | 348 | } |