summaryrefslogtreecommitdiff
path: root/src/webpage.cpp
diff options
context:
space:
mode:
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());