summaryrefslogtreecommitdiff
path: root/src/webpage.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-02-04 08:59:06 +0100
committerAndrea Diamantini <adjam7@gmail.com>2012-02-04 08:59:06 +0100
commit76fb43ba76f23ace16af78089793be2bb9ab3be9 (patch)
tree280ba4cd01b63d6560f647d191d237812ffae213 /src/webpage.cpp
parentConsider unknown network errors as errors :) (diff)
downloadrekonq-76fb43ba76f23ace16af78089793be2bb9ab3be9.tar.xz
clean up filename content disposition retrieve
Diffstat (limited to 'src/webpage.cpp')
-rw-r--r--src/webpage.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/webpage.cpp b/src/webpage.cpp
index 15d6cabf..2fdf4d01 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -289,6 +289,10 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply)
if (KParts::BrowserRun::isTextExecutable(_mimeType))
_mimeType = QL1S("text/plain");
+ // Get suggested file name...
+ const KIO::MetaData& data = reply->attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)).toMap();
+ _suggestedFileName = data.value(QL1S("content-disposition-filename"));
+
kDebug() << "Detected MimeType = " << _mimeType;
kDebug() << "Suggested File Name = " << _suggestedFileName;
// ------------------------------------------------
@@ -316,8 +320,6 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply)
{
KParts::BrowserOpenOrSaveQuestion dlg(rApp->mainWindow(), replyUrl, _mimeType);
- // Get suggested file name...
- DownloadManager::extractSuggestedFileName(reply, _suggestedFileName);
if (!_suggestedFileName.isEmpty())
dlg.setSuggestedFileName(_suggestedFileName);
@@ -418,10 +420,6 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply)
{
Q_ASSERT(reply);
- // check suggested file name
- if (_suggestedFileName.isEmpty())
- DownloadManager::extractSuggestedFileName(reply, _suggestedFileName);
-
QWebFrame* frame = qobject_cast<QWebFrame *>(reply->request().originatingObject());
const bool isMainFrameRequest = (frame == mainFrame());
const bool isLoadingUrlReply = (mainFrame()->url() == reply->url());