Time estimation: Avoid a progress reset before finish. #2328
authorChristian Kamm <kamm@incasoftware.de>
Fri, 30 Jan 2015 08:16:14 +0000 (09:16 +0100)
committerChristian Kamm <kamm@incasoftware.de>
Wed, 22 Apr 2015 08:45:41 +0000 (10:45 +0200)
The current algorithm doesn't care much, but resetting progress
to 0 just before completing a job is confusing anyway.

src/libsync/propagateupload.cpp
src/libsync/propagateupload.h

index cfe57adf11f4b25a6cdb25da046cf905e5cc3906..a76ac2ddba1c35a3db555cb5f0c440a930db4785 100644 (file)
@@ -635,9 +635,14 @@ void PropagateUploadFileQNAM::finalize(const SyncFileItem &copy)
 
 void PropagateUploadFileQNAM::slotUploadProgress(qint64 sent, qint64 total)
 {
+    // Completion is signaled with sent=0, total=0; avoid accidentally
+    // resetting progress due to the sent being zero by ignoring it.
+    // finishedSignal() is bound to be emitted soon anyway.
+    // See https://bugreports.qt.io/browse/QTBUG-44782.
     if (sent == 0 && total == 0) {
-        return; // QNAM bug https://bugreports.qt.io/browse/QTBUG-44782
+        return;
     }
+
     int progressChunk = _currentChunk + _startChunk - 1;
     if (progressChunk >= _chunkCount)
         progressChunk = _currentChunk - 1;
index 99555958a4a08c605504df9bf254a4d85dc5058e..a11c33faf8befee7e69371f39bf4b5b9500be487 100644 (file)
@@ -87,7 +87,7 @@ public:
 
     QString errorString() {
         return _errorString.isEmpty() ? reply()->errorString() : _errorString;
-    };
+    }
 
     virtual void slotTimeout() Q_DECL_OVERRIDE;