summaryrefslogtreecommitdiff
path: root/src/downloadmanager.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/downloadmanager.cpp
parentConsider unknown network errors as errors :) (diff)
downloadrekonq-76fb43ba76f23ace16af78089793be2bb9ab3be9.tar.xz
clean up filename content disposition retrieve
Diffstat (limited to 'src/downloadmanager.cpp')
-rw-r--r--src/downloadmanager.cpp40
1 files changed, 0 insertions, 40 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp
index 6241394a..2e7e4607 100644
--- a/src/downloadmanager.cpp
+++ b/src/downloadmanager.cpp
@@ -201,43 +201,3 @@ bool DownloadManager::downloadResource(const KUrl &srcUrl, const KIO::MetaData &
job->uiDelegate()->setAutoErrorHandlingEnabled(true);
return true;
}
-
-
-// -------------------------------------------------------------------------------------------------------------------
-
-
-// STATIC
-void DownloadManager::extractSuggestedFileName(const QNetworkReply* reply, QString& fileName)
-{
- fileName.clear();
- const KIO::MetaData& metaData = reply->attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)).toMap();
- if (metaData.value(QL1S("content-disposition-type")).compare(QL1S("attachment"), Qt::CaseInsensitive) == 0)
- fileName = metaData.value(QL1S("content-disposition-filename"));
-
- if (!fileName.isEmpty())
- return;
-
- if (!reply->hasRawHeader("Content-Disposition"))
- return;
-
- const QString value(QL1S(reply->rawHeader("Content-Disposition").simplified().constData()));
- if (value.startsWith(QL1S("attachment"), Qt::CaseInsensitive) || value.startsWith(QL1S("inline"), Qt::CaseInsensitive))
- {
- const int length = value.size();
- int pos = value.indexOf(QL1S("filename"), 0, Qt::CaseInsensitive);
- if (pos > -1)
- {
- pos += 9;
- while (pos < length && (value.at(pos) == QL1C(' ') || value.at(pos) == QL1C('=') || value.at(pos) == QL1C('"')))
- pos++;
-
- int endPos = pos;
- while (endPos < length && value.at(endPos) != QL1C('"') && value.at(endPos) != QL1C(';'))
- endPos++;
-
- if (endPos > pos)
- fileName = value.mid(pos, (endPos - pos)).trimmed();
- }
- }
-}
-