From 4d123b75f982f297635d3b82338fe326f40073da Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 11 Dec 2011 19:29:42 +0100 Subject: (really) fix handling of overwrite, by KIO delegating it Copied from kdelibs commit 88e3b372fb9c5398f9 by dfaure. Thanks :) --- src/downloadmanager.cpp | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'src/downloadmanager.cpp') diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 1f58d99f..3980cc05 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -145,28 +145,22 @@ bool DownloadManager::downloadResource(const KUrl &srcUrl, const KIO::MetaData & { KUrl destUrl; - int result = KIO::R_OVERWRITE; const QString fileName((suggestedName.isEmpty() ? srcUrl.fileName() : suggestedName)); - do + if (ReKonfig::askDownloadPath()) { - if (ReKonfig::askDownloadPath()) - { - // follow bug:184202 fixes - destUrl = KFileDialog::getSaveFileName(KUrl::fromPath(fileName), QString(), parent); - } - else - { - destUrl = KUrl(ReKonfig::downloadPath().path() + QL1C('/') + fileName); - } - - kDebug() << "DEST URL: " << destUrl; + // follow bug:184202 fixes + destUrl = KFileDialog::getSaveFileName(KUrl::fromPath(fileName), QString(), parent); + } + else + { + destUrl = KUrl(ReKonfig::downloadPath().path() + QL1C('/') + fileName); + } - if (destUrl.isEmpty()) - return false; + kDebug() << "DEST URL: " << destUrl; - } - while (result == KIO::R_CANCEL && destUrl.isValid()); + if (!destUrl.isValid()) + return false; // Save download history DownloadItem *item = addDownload(srcUrl.pathOrUrl(), destUrl.pathOrUrl()); -- cgit v1.2.1