summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-04-07 17:25:06 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2011-04-07 17:25:06 (GMT)
commit384679ff46d2f970de3010fd6aac8a697dbfb907 (patch)
treefd290567c21b3ccc3a319db2fc8d176b27f9bfd0
parent214751c5e7d7af6770cbd36a431d8f718c3041e1 (diff)
downloadQt-384679ff46d2f970de3010fd6aac8a697dbfb907.zip
Qt-384679ff46d2f970de3010fd6aac8a697dbfb907.tar.gz
Qt-384679ff46d2f970de3010fd6aac8a697dbfb907.tar.bz2
Ensured that incomplete downloads are removed.
Task-number: QTBUG-18509
-rw-r--r--doc/src/examples/ftp.qdoc4
-rw-r--r--examples/network/qftp/ftpwindow.cpp6
2 files changed, 9 insertions, 1 deletions
diff --git a/doc/src/examples/ftp.qdoc b/doc/src/examples/ftp.qdoc
index 4fa2cfd..841d298 100644
--- a/doc/src/examples/ftp.qdoc
+++ b/doc/src/examples/ftp.qdoc
@@ -131,7 +131,9 @@
\snippet examples/network/qftp/ftpwindow.cpp 5
- QFtp supports canceling the download of files.
+ QFtp supports canceling the download of files. We make sure that
+ any file that is currently being written to is closed and removed,
+ and tidy up by deleting the file object.
\snippet examples/network/qftp/ftpwindow.cpp 6
diff --git a/examples/network/qftp/ftpwindow.cpp b/examples/network/qftp/ftpwindow.cpp
index c3e629f..159cad6 100644
--- a/examples/network/qftp/ftpwindow.cpp
+++ b/examples/network/qftp/ftpwindow.cpp
@@ -243,6 +243,12 @@ void FtpWindow::downloadFile()
void FtpWindow::cancelDownload()
{
ftp->abort();
+
+ if (file->exists()) {
+ file->close();
+ file->remove();
+ }
+ delete file;
}
//![5]