summaryrefslogtreecommitdiffstats
path: root/tools/assistant
diff options
context:
space:
mode:
authorkh1 <qt-info@nokia.com>2010-04-19 16:59:32 (GMT)
committerkh1 <qt-info@nokia.com>2010-04-19 17:01:13 (GMT)
commit0fd81e81a357edb9f9e615cff28a1876bd363b2e (patch)
tree9d88029b48d3d71df18b1c59d338e4364d00d704 /tools/assistant
parentdfa8d13a20548c31b56678df517ae38e85fe1384 (diff)
downloadQt-0fd81e81a357edb9f9e615cff28a1876bd363b2e.zip
Qt-0fd81e81a357edb9f9e615cff28a1876bd363b2e.tar.gz
Qt-0fd81e81a357edb9f9e615cff28a1876bd363b2e.tar.bz2
Quick fix to make the documentation work, needs a proper solution though.
Reviewed-by: kh
Diffstat (limited to 'tools/assistant')
-rw-r--r--tools/assistant/tools/assistant/helpviewer.cpp4
-rw-r--r--tools/assistant/tools/assistant/helpviewer.h1
-rw-r--r--tools/assistant/tools/assistant/helpviewer_qwv.cpp22
3 files changed, 23 insertions, 4 deletions
diff --git a/tools/assistant/tools/assistant/helpviewer.cpp b/tools/assistant/tools/assistant/helpviewer.cpp
index 0c51a02..85e4e71 100644
--- a/tools/assistant/tools/assistant/helpviewer.cpp
+++ b/tools/assistant/tools/assistant/helpviewer.cpp
@@ -52,6 +52,10 @@
QT_BEGIN_NAMESPACE
+QString AbstractHelpViewer::DocPath = QString::fromLatin1("qthelp://com."
+ "trolltech.qt.%1/").arg(QString(QLatin1String(QT_VERSION_STR))
+ .replace(QLatin1String("."), QLatin1String("")));
+
QString AbstractHelpViewer::AboutBlank =
QCoreApplication::translate("HelpViewer", "<title>about:blank</title>");
diff --git a/tools/assistant/tools/assistant/helpviewer.h b/tools/assistant/tools/assistant/helpviewer.h
index 6f1f48d..9c3971f 100644
--- a/tools/assistant/tools/assistant/helpviewer.h
+++ b/tools/assistant/tools/assistant/helpviewer.h
@@ -67,6 +67,7 @@ public:
virtual bool handleForwardBackwardMouseButtons(QMouseEvent *e) = 0;
+ static QString DocPath;
static QString AboutBlank;
static QString LocalHelpFile;
static QString PageNotFoundMessage;
diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.cpp b/tools/assistant/tools/assistant/helpviewer_qwv.cpp
index db1cd58..a19b29a 100644
--- a/tools/assistant/tools/assistant/helpviewer_qwv.cpp
+++ b/tools/assistant/tools/assistant/helpviewer_qwv.cpp
@@ -129,13 +129,27 @@ QNetworkReply *HelpNetworkAccessManager::createRequest(Operation /*op*/,
const QNetworkRequest &request, QIODevice* /*outgoingData*/)
{
TRACE_OBJ
- const QUrl &url = request.url();
- const QString &mimeType = AbstractHelpViewer::mimeFromUrl(url.toString());
-
+ QString url = request.url().toString();
HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+
+ // 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 (!helpEngine.findFile(url).isValid()) {
+ if (url.startsWith(AbstractHelpViewer::DocPath)) {
+ if (!url.startsWith(AbstractHelpViewer::DocPath + QLatin1String("qdoc/"))) {
+ url = url.replace(AbstractHelpViewer::DocPath,
+ AbstractHelpViewer::DocPath + QLatin1String("qdoc/"));
+ }
+ }
+ }
+
+ const QString &mimeType = AbstractHelpViewer::mimeFromUrl(url);
const QByteArray &data = helpEngine.findFile(url).isValid()
? helpEngine.fileData(url)
- : AbstractHelpViewer::PageNotFoundMessage.arg(url.toString()).toUtf8();
+ : AbstractHelpViewer::PageNotFoundMessage.arg(url).toUtf8();
return new HelpNetworkReply(request, data, mimeType.isEmpty()
? QLatin1String("application/octet-stream") : mimeType);
}