Commit 90bcb608 authored by kh1's avatar kh1
Browse files

Suppress accessing the network for any other data.

parent 58703ba7
......@@ -120,28 +120,27 @@ HelpNetworkAccessManager::HelpNetworkAccessManager(QHelpEngine *engine,
{
}
QNetworkReply *HelpNetworkAccessManager::createRequest(Operation op,
const QNetworkRequest &request, QIODevice *outgoingData)
{
const QString& scheme = request.url().scheme();
if (scheme == QLatin1String("qthelp") || scheme == QLatin1String("about")) {
const QUrl& url = request.url();
QString mimeType = url.toString();
if (mimeType.endsWith(QLatin1String(".svg"))
|| mimeType.endsWith(QLatin1String(".svgz"))) {
mimeType = QLatin1String("image/svg+xml");
}
else if (mimeType.endsWith(QLatin1String(".css"))) {
mimeType = QLatin1String("text/css");
}
else if (mimeType.endsWith(QLatin1String(".js"))) {
mimeType = QLatin1String("text/javascript");
} else {
mimeType = QLatin1String("text/html");
}
return new HelpNetworkReply(request, helpEngine->fileData(url), mimeType);
QNetworkReply *HelpNetworkAccessManager::createRequest(Operation /*op*/,
const QNetworkRequest &request, QIODevice */*outgoingData*/)
{
const QUrl& url = request.url();
QString mimeType = url.toString();
if (mimeType.endsWith(QLatin1String(".svg"))
|| mimeType.endsWith(QLatin1String(".svgz"))) {
mimeType = QLatin1String("image/svg+xml");
} else if (mimeType.endsWith(QLatin1String(".css"))) {
mimeType = QLatin1String("text/css");
} else if (mimeType.endsWith(QLatin1String(".js"))) {
mimeType = QLatin1String("text/javascript");
} else if (mimeType.endsWith(QLatin1String(".txt"))) {
mimeType = QLatin1String("text/plain");
} else {
mimeType = QLatin1String("text/html");
}
return QNetworkAccessManager::createRequest(op, request, outgoingData);
const QByteArray &data = helpEngine->findFile(url).isValid()
? helpEngine->fileData(url) : QByteArray("The page could not be found");
return new HelpNetworkReply(request, data, mimeType);
}
class HelpPage : public QWebPage
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment