Improved workaround for new qt documentation, base on dboddie's work.

Make the check more generic, to also work for all other Qt namespaces
than qt.ver.s.ion. Still there's something broken in Qt webkit or so.

Reviewed-by: ck
This commit is contained in:
kh1
2010-04-23 12:11:23 +02:00
parent f996b24612
commit d086f76038
3 changed files with 10 additions and 11 deletions

View File

@@ -44,14 +44,12 @@
using namespace Help::Internal;
QString HelpViewer::DocPath = QString::fromLatin1("qthelp://com."
"trolltech.qt.%1/").arg(QString(QLatin1String(QT_VERSION_STR))
.replace(QLatin1String("."), QLatin1String("")));
const QString HelpViewer::DocPath = QLatin1String("qthelp://com.trolltech.");
QString HelpViewer::AboutBlankPage =
const QString HelpViewer::AboutBlankPage =
QCoreApplication::translate("HelpViewer", "<title>about:blank</title>");
QString HelpViewer::PageNotFoundMessage =
const QString HelpViewer::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>");

View File

@@ -85,9 +85,9 @@ public:
bool findText(const QString &text, Find::IFindSupport::FindFlags flags,
bool incremental, bool fromSearch);
static QString DocPath;
static QString AboutBlankPage;
static QString PageNotFoundMessage;
static const QString DocPath;
static const QString AboutBlankPage;
static const QString PageNotFoundMessage;
static bool isLocalUrl(const QUrl &url);
static bool canOpenPage(const QString &url);

View File

@@ -133,9 +133,10 @@ QNetworkReply *HelpNetworkAccessManager::createRequest(Operation /*op*/,
// the virtual folder
if (!engine.findFile(url).isValid()) {
if (url.startsWith(HelpViewer::DocPath)) {
if (!url.startsWith(HelpViewer::DocPath + "qdoc/")) {
url = url.replace(HelpViewer::DocPath,
HelpViewer::DocPath + QLatin1String("qdoc/"));
QUrl newUrl = request.url();
if (!newUrl.path().startsWith(QLatin1String("/qdoc/"))) {
newUrl.setPath(QLatin1String("/qdoc/") + newUrl.path());
url = newUrl.toString();
}
}
}