summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkh1 <qt-info@nokia.com>2010-04-20 14:20:16 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2010-04-21 03:34:30 (GMT)
commit0adc1cf1bcf6077c0bc439bdd2ef54fc9a523c38 (patch)
treefd1768c11c879e4d6450665c8bc9096e081590d7
parent0732ebb54714557c1851c74f8d4d3f516db2bf1d (diff)
downloadQt-0adc1cf1bcf6077c0bc439bdd2ef54fc9a523c38.zip
Qt-0adc1cf1bcf6077c0bc439bdd2ef54fc9a523c38.tar.gz
Qt-0adc1cf1bcf6077c0bc439bdd2ef54fc9a523c38.tar.bz2
Just use the path as the url can have an anchor attached etc...
Fixes the broken topic chooser and keyword resolving. We are only interested in the extention, which fails if we get an url e.g. with anchor attached. Reviewed-by: ck (cherry picked from commit 139497b6871d73d3366c21b51db9a74046855552)
-rw-r--r--tools/assistant/tools/assistant/helpviewer.cpp7
-rw-r--r--tools/assistant/tools/assistant/helpviewer.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/tools/assistant/tools/assistant/helpviewer.cpp b/tools/assistant/tools/assistant/helpviewer.cpp
index 85e4e71..22b3f30 100644
--- a/tools/assistant/tools/assistant/helpviewer.cpp
+++ b/tools/assistant/tools/assistant/helpviewer.cpp
@@ -132,11 +132,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 9c3971f..80a6f87 100644
--- a/tools/assistant/tools/assistant/helpviewer.h
+++ b/tools/assistant/tools/assistant/helpviewer.h
@@ -74,7 +74,7 @@ public:
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);
};