summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorShane Kearns <ext-shane.2.kearns@nokia.com>2012-01-31 17:14:22 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-02-03 14:25:17 (GMT)
commitf5ddeeca80983ad7579e0b7ba116f0250debdfcd (patch)
tree67b95f89500a6012eeb20471ce9ace98ac07b6d5 /src/corelib
parente4073fdea521c4b6c36461b51fc16f818c502cc3 (diff)
downloadQt-f5ddeeca80983ad7579e0b7ba116f0250debdfcd.zip
Qt-f5ddeeca80983ad7579e0b7ba116f0250debdfcd.tar.gz
Qt-f5ddeeca80983ad7579e0b7ba116f0250debdfcd.tar.bz2
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>
Diffstat (limited to 'src/corelib')
-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 f0f0762..23739a8 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 ded6056..f4903d3 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;
};