From 384679ff46d2f970de3010fd6aac8a697dbfb907 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Apr 2011 19:25:06 +0200 Subject: Ensured that incomplete downloads are removed. Task-number: QTBUG-18509 --- doc/src/examples/ftp.qdoc | 4 +++- examples/network/qftp/ftpwindow.cpp | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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] -- cgit v0.12