summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-12-11 19:29:42 +0100
committerAndrea Diamantini <adjam7@gmail.com>2011-12-11 19:29:42 +0100
commit4d123b75f982f297635d3b82338fe326f40073da (patch)
tree30cbde958dab81fac8f01668b9b8d1776d346814
parentbuild system fixes (diff)
downloadrekonq-4d123b75f982f297635d3b82338fe326f40073da.tar.xz
(really) fix handling of overwrite, by KIO delegating it
Copied from kdelibs commit 88e3b372fb9c5398f9 by dfaure. Thanks :)
-rw-r--r--src/downloadmanager.cpp28
1 files changed, 11 insertions, 17 deletions
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());