forked from qt-creator/qt-creator
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: Karsten Heimrich <karsten.heimrich@digia.com>
This commit is contained in:
committed by
Karsten Heimrich
parent
84a625248f
commit
b5bfb81508
@@ -135,6 +135,7 @@ HelpNetworkReply::HelpNetworkReply(const QNetworkRequest &request,
|
||||
, dataLength(fileData.length())
|
||||
{
|
||||
setRequest(request);
|
||||
setUrl(request.url());
|
||||
setOpenMode(QIODevice::ReadOnly);
|
||||
|
||||
setHeader(QNetworkRequest::ContentTypeHeader, mimeType);
|
||||
@@ -179,24 +180,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)
|
||||
|
||||
Reference in New Issue
Block a user