diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2012-02-05 07:34:56 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2012-02-05 07:34:56 +0100 |
commit | df91591f4a692b42bb9e2ee5bfad309ce3e29957 (patch) | |
tree | 86ab0c0569a2c72b97921f032f99097f707f240a /src/webpage.cpp | |
parent | clean up filename content disposition retrieve (diff) | |
download | rekonq-df91591f4a692b42bb9e2ee5bfad309ce3e29957.tar.xz |
clean up download management
Remove one unuseful slot in webpage and better manage download dialog,
following rekonq AND KDE settings.
Diffstat (limited to 'src/webpage.cpp')
-rw-r--r-- | src/webpage.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
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(), |