summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShane Kearns <ext-shane.2.kearns@nokia.com>2012-01-31 17:14:22 +0000
committerPasi Pentikäinen <ext-pasi.a.pentikainen@nokia.com>2012-02-15 09:47:14 +0100
commit83f67c850449e9135b5fb20ef4459dc276a2235f (patch)
treea8a4dae53c514fc3b6ac1776fec359c76014a6f1
parent6e7930aa3ea2d9207ba22b8ef44786668eaa45f7 (diff)
downloadqt4-tools-83f67c850449e9135b5fb20ef4459dc276a2235f.tar.gz
Fix progress bar values >100% when http upload is retried
If a http upload (PUT or POST) fails, the IO device is reset and the upload is retried a second time. Now we also reset the progress counter in the wrapper class QNonContigiousByteDevice. That way the progress bar goes back to 0% and stops at 100% Previously if the 1st attempt failed at 20%, the progress values would carry on from 20% and finish at 120%. Task-number: ou1cimx1#970373 Task-number: QTBUG-23993 Change-Id: Ifc9963595113cf3001ed45f94f525e2305ad479b Reviewed-by: Markus Goetz <markus@woboq.com> Reviewed-by: Richard J. Moore <rich@kde.org> (cherry picked from commit f5ddeeca80983ad7579e0b7ba116f0250debdfcd) Reviewed-by: Shane Kearns <ext-shane.2.kearns@nokia.com> Reviewed-by: Pasi Pentikäinen <ext-pasi.a.pentikainen@nokia.com>
-rw-r--r--src/corelib/io/qnoncontiguousbytedevice.cpp1
-rw-r--r--src/corelib/io/qnoncontiguousbytedevice_p.h2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/io/qnoncontiguousbytedevice.cpp b/src/corelib/io/qnoncontiguousbytedevice.cpp
index d5ce56bc09..eb44651dc9 100644
--- a/src/corelib/io/qnoncontiguousbytedevice.cpp
+++ b/src/corelib/io/qnoncontiguousbytedevice.cpp
@@ -392,6 +392,7 @@ bool QNonContiguousByteDeviceIoDeviceImpl::reset()
if (device->seek(initialPosition)) {
eof = false; // assume eof is false, it will be true after a read has been attempted
+ totalAdvancements = 0; //reset the progress counter
return true;
}
diff --git a/src/corelib/io/qnoncontiguousbytedevice_p.h b/src/corelib/io/qnoncontiguousbytedevice_p.h
index c7c94243b9..1257c99997 100644
--- a/src/corelib/io/qnoncontiguousbytedevice_p.h
+++ b/src/corelib/io/qnoncontiguousbytedevice_p.h
@@ -146,7 +146,7 @@ protected:
qint64 currentReadBufferSize;
qint64 currentReadBufferAmount;
qint64 currentReadBufferPosition;
- qint64 totalAdvancements;
+ qint64 totalAdvancements; //progress counter used for emitting the readProgress signal
bool eof;
qint64 initialPosition;
};