diff options
-rw-r--r-- | src/downloadmanager.cpp | 5 | ||||
-rw-r--r-- | src/downloadmanager.h | 2 | ||||
-rw-r--r-- | src/webpage.cpp | 17 | ||||
-rw-r--r-- | src/webpage.h | 3 |
4 files changed, 13 insertions, 14 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 2e7e4607..dd3cb119 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -141,13 +141,14 @@ void DownloadManager::downloadLinksWithKGet(const QVariant &contentList) // In this way, we can easily provide the extra functionality we need: // 1. KGet Integration // 2. Save downloads history -bool DownloadManager::downloadResource(const KUrl &srcUrl, const KIO::MetaData &metaData, QWidget *parent, const QString &suggestedName) +bool DownloadManager::downloadResource(const KUrl &srcUrl, const KIO::MetaData &metaData, + QWidget *parent, bool forceDirRequest, const QString &suggestedName) { KUrl destUrl; const QString fileName((suggestedName.isEmpty() ? srcUrl.fileName() : suggestedName)); - if (ReKonfig::askDownloadPath()) + if (forceDirRequest || ReKonfig::askDownloadPath()) { // follow bug:184202 fixes destUrl = KFileDialog::getSaveFileName(KUrl::fromPath(fileName), QString(), parent); diff --git a/src/downloadmanager.h b/src/downloadmanager.h index ce8de507..c3a91939 100644 --- a/src/downloadmanager.h +++ b/src/downloadmanager.h @@ -62,7 +62,7 @@ public: bool clearDownloadsHistory(); bool downloadResource(const KUrl &url, const KIO::MetaData &metaData = KIO::MetaData(), - QWidget *parent = 0, const QString &suggestedName = QString()); + QWidget *parent = 0, bool forceDirRequest = false, const QString &suggestedName = QString()); void downloadLinksWithKGet(const QVariant &contentList); diff --git a/src/webpage.cpp b/src/webpage.cpp index 2fdf4d01..6a6f1bc9 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -306,7 +306,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) { isLocal ? KMessageBox::sorry(view(), i18n("No service can handle this file.")) - : downloadReply(reply, _suggestedFileName); + : downloadUrl(reply->url()); return; } @@ -323,10 +323,17 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) if (!_suggestedFileName.isEmpty()) dlg.setSuggestedFileName(_suggestedFileName); + // read askEmbedOrSave preferences. If we don't have to show dialog and rekonq settings are + // to automatically choose download dir, we won't show local dir choose dialog + KConfigGroup cg = KConfigGroup(KSharedConfig::openConfig("filetypesrc", KConfig::NoGlobals), QL1S("Notification Messages")); + bool hideDialog = cg.readEntry(QL1S("askEmbedOrSave") + _mimeType, false); + + kDebug() << "Hide dialog for " << _mimeType << "? " << hideDialog; + switch (dlg.askEmbedOrSave()) { case KParts::BrowserOpenOrSaveQuestion::Save: - downloadReply(reply, _suggestedFileName); + rApp->downloadManager()->downloadResource(reply->url(), KIO::MetaData(), view(), !hideDialog, _suggestedFileName); return; case KParts::BrowserOpenOrSaveQuestion::Cancel: @@ -544,12 +551,6 @@ QString WebPage::errorPage(QNetworkReply *reply) } -void WebPage::downloadReply(const QNetworkReply *reply, const QString &suggestedFileName) -{ - rApp->downloadManager()->downloadResource(reply->url(), KIO::MetaData(), view(), suggestedFileName); -} - - void WebPage::downloadRequest(const QNetworkRequest &request) { rApp->downloadManager()->downloadResource(request.url(), diff --git a/src/webpage.h b/src/webpage.h index 7e5df309..3b2d37ad 100644 --- a/src/webpage.h +++ b/src/webpage.h @@ -107,9 +107,6 @@ private Q_SLOTS: void copyToTempFileResult(KJob*); private: - void downloadReply(const QNetworkReply *reply, const QString &suggestedFileName = QString()); - -private: QString errorPage(QNetworkReply *reply); KUrl _loadingUrl; |