From 61362cf51a0894a00f972c2cb703ed9f1daa3594 Mon Sep 17 00:00:00 2001 From: kh1 Date: Thu, 1 Dec 2011 14:37:55 +0100 Subject: If we cancel an download, prevent the failure msgbox. Make sure to check for cancel in httpError, as the error gets emited as soon as we call http abort in cancelDownload(). Later in the chain httpDone would reset m_canceled and cancelDownload would call httpDone now with an unset m_canceled, resulting in emmiting an error. Change-Id: Ic1e74bef83706dba42ce8d2cb444c08078fa1ed8 Reviewed-by: Niels Weber Reviewed-by: Tim Jenssen --- .../libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.cpp | 3 ++- installerbuilder/libinstaller/downloadarchivesjob.cpp | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'installerbuilder') diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.cpp index 4de001e12..fbb7b5d28 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.cpp +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.cpp @@ -1163,7 +1163,8 @@ void KDUpdater::HttpDownloader::httpReadyRead() void KDUpdater::HttpDownloader::httpError(QNetworkReply::NetworkError) { - httpDone(true); + if (!d->aborted) + httpDone(true); } void KDUpdater::HttpDownloader::cancelDownload() diff --git a/installerbuilder/libinstaller/downloadarchivesjob.cpp b/installerbuilder/libinstaller/downloadarchivesjob.cpp index dbfb471f6..f0827dbe3 100644 --- a/installerbuilder/libinstaller/downloadarchivesjob.cpp +++ b/installerbuilder/libinstaller/downloadarchivesjob.cpp @@ -241,7 +241,7 @@ void DownloadArchivesJob::registerFile() } const QByteArray archiveHash = hash.result().toHex(); - if (archiveHash != m_currentHash) { + if ((archiveHash != m_currentHash) && (!m_canceled)) { //TODO: Maybe we should try to download the file again automatically const QMessageBox::Button res = MessageBoxHandler::critical(MessageBoxHandler::currentBestSuitParent(), @@ -276,6 +276,9 @@ void DownloadArchivesJob::downloadCanceled() void DownloadArchivesJob::downloadFailed(const QString &error) { + if (m_canceled) + return; + const QMessageBox::StandardButton b = MessageBoxHandler::critical(MessageBoxHandler::currentBestSuitParent(), QLatin1String("archiveDownloadError"), tr("Download Error"), tr("Could not download archive: %1 : %2") -- cgit v1.2.3