diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-04-27 19:32:08 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-04-27 19:32:08 (GMT) |
commit | e0a2a4d343902e96e51df1fabeaaf543f4cd2a47 (patch) | |
tree | 4cb1ab83e9881a403e2857882fb0d6383118a393 /tools/assistant | |
parent | f6f9777408691a945c49ef8ec5037d8401c747eb (diff) | |
parent | a17339e943f21bb6c6e16884f716dd9ab8f94938 (diff) | |
download | Qt-e0a2a4d343902e96e51df1fabeaaf543f4cd2a47.zip Qt-e0a2a4d343902e96e51df1fabeaaf543f4cd2a47.tar.gz Qt-e0a2a4d343902e96e51df1fabeaaf543f4cd2a47.tar.bz2 |
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts:
tools/qdoc3/test/assistant.qdocconf
tools/qdoc3/test/designer.qdocconf
tools/qdoc3/test/linguist.qdocconf
tools/qdoc3/test/qmake.qdocconf
tools/qdoc3/test/qt-html-templates.qdocconf
tools/qdoc3/test/qt.qdocconf
Diffstat (limited to 'tools/assistant')
-rw-r--r-- | tools/assistant/tools/assistant/helpviewer.cpp | 15 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/helpviewer.h | 9 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/helpviewer_qwv.cpp | 23 |
3 files changed, 33 insertions, 14 deletions
diff --git a/tools/assistant/tools/assistant/helpviewer.cpp b/tools/assistant/tools/assistant/helpviewer.cpp index 0c51a02..6499139 100644 --- a/tools/assistant/tools/assistant/helpviewer.cpp +++ b/tools/assistant/tools/assistant/helpviewer.cpp @@ -52,13 +52,15 @@ QT_BEGIN_NAMESPACE -QString AbstractHelpViewer::AboutBlank = +const QLatin1String AbstractHelpViewer::DocPath("qthelp://com.trolltech."); + +const QString AbstractHelpViewer::AboutBlank = QCoreApplication::translate("HelpViewer", "<title>about:blank</title>"); -QString AbstractHelpViewer::LocalHelpFile = QLatin1String("qthelp://" +const QString AbstractHelpViewer::LocalHelpFile = QLatin1String("qthelp://" "com.trolltech.com.assistantinternal-1.0.0/assistant/assistant.html"); -QString AbstractHelpViewer::PageNotFoundMessage = +const QString AbstractHelpViewer::PageNotFoundMessage = QCoreApplication::translate("HelpViewer", "<title>Error 404...</title><div " "align=\"center\"><br><br><h1>The page could not be found</h1><br><h3>'%1'" "</h3></div>"); @@ -128,11 +130,12 @@ bool AbstractHelpViewer::canOpenPage(const QString &url) return !mimeFromUrl(url).isEmpty(); } -QString AbstractHelpViewer::mimeFromUrl(const QString &url) +QString AbstractHelpViewer::mimeFromUrl(const QUrl &url) { TRACE_OBJ - const int index = url.lastIndexOf(QLatin1Char('.')); - const QByteArray &ext = url.mid(index).toUtf8().toLower(); + const QString &path = url.path(); + const int index = path.lastIndexOf(QLatin1Char('.')); + const QByteArray &ext = path.mid(index).toUtf8().toLower(); const ExtensionMap *e = extensionMap; while (e->extension) { diff --git a/tools/assistant/tools/assistant/helpviewer.h b/tools/assistant/tools/assistant/helpviewer.h index 6f1f48d..def9418 100644 --- a/tools/assistant/tools/assistant/helpviewer.h +++ b/tools/assistant/tools/assistant/helpviewer.h @@ -67,13 +67,14 @@ public: virtual bool handleForwardBackwardMouseButtons(QMouseEvent *e) = 0; - static QString AboutBlank; - static QString LocalHelpFile; - static QString PageNotFoundMessage; + static const QLatin1String DocPath; + static const QString AboutBlank; + static const QString LocalHelpFile; + static const QString PageNotFoundMessage; static bool isLocalUrl(const QUrl &url); static bool canOpenPage(const QString &url); - static QString mimeFromUrl(const QString &url); + static QString mimeFromUrl(const QUrl &url); static bool launchWithExternalApp(const QUrl &url); }; diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.cpp b/tools/assistant/tools/assistant/helpviewer_qwv.cpp index db1cd58..adaa45b 100644 --- a/tools/assistant/tools/assistant/helpviewer_qwv.cpp +++ b/tools/assistant/tools/assistant/helpviewer_qwv.cpp @@ -129,13 +129,28 @@ 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)) { + QUrl newUrl = request.url(); + if (!newUrl.path().startsWith(QLatin1String("/qdoc/"))) { + newUrl.setPath(QLatin1String("qdoc") + newUrl.path()); + url = newUrl.toString(); + } + } + } + + 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); } |