Commit 3271af92 authored by Michael Brüning's avatar Michael Brüning Committed by Eike Ziller

Correct the setup of HelpNetworkReply.

Resources addressed as urls in offline css files were not loaded
(e.g. breadcrumb icons) due to the base url not being setup and
therefore defaulting to the main page, when it should have been
set to the url of the corresponding style sheet to make relative
urls work correctly.

This also eliminates the need for the workaround introduced earlier.

Task-number: QTCREATORBUG-8211

Change-Id: Icf365781544255e322259262ea6a19a0b1dc7a25
modified:   src/plugins/help/helpviewer_qwv.cpp
Reviewed-by: default avatarKarsten Heimrich <karsten.heimrich@digia.com>
(cherry picked from commit b5bfb815)
Reviewed-by: default avatarMichael Bruning <michael.bruning@digia.com>
parent 96b70ac6
......@@ -131,6 +131,7 @@ HelpNetworkReply::HelpNetworkReply(const QNetworkRequest &request,
, dataLength(fileData.length())
{
setRequest(request);
setUrl(request.url());
setOpenMode(QIODevice::ReadOnly);
setHeader(QNetworkRequest::ContentTypeHeader, mimeType);
......@@ -175,24 +176,6 @@ QNetworkReply *HelpNetworkAccessManager::createRequest(Operation op,
QString url = request.url().toString();
const QHelpEngineCore &engine = LocalHelpManager::helpEngine();
// TODO: For some reason the url to load is already wrong (passed from webkit)
// though the css file and the references inside should work that way. One
// possible problem might be that the css is loaded at the same level as the
// html, thus a path inside the css like (../images/foo.png) might cd out of
// the virtual folder
if (!engine.findFile(url).isValid()) {
if (url.startsWith(HelpViewer::NsNokia) || url.startsWith(HelpViewer::NsTrolltech)) {
QUrl newUrl = request.url();
if (!newUrl.path().startsWith(QLatin1String("/qdoc/")) ||
!newUrl.path().startsWith(QLatin1String("/doc/"))) {
QString path = newUrl.path();
newUrl.setPath(QLatin1String("/qdoc/") + path);
if (!engine.findFile(newUrl).isValid())
newUrl.setPath(QLatin1String("/doc/") + path);
url = newUrl.toString();
}
}
}
const QString &mimeType = HelpViewer::mimeFromUrl(url);
const QByteArray &data = engine.findFile(url).isValid() ? engine.fileData(url)
......
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