summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkh1 <qt-info@nokia.com>2010-04-20 14:20:16 (GMT)
committerkh1 <qt-info@nokia.com>2010-04-20 14:23:31 (GMT)
commit139497b6871d73d3366c21b51db9a74046855552 (patch)
tree3880bbf195d425757c4acc585154cced418f2e0d
parent019af5ecb5dbc9c173109ba670180177713a51ad (diff)
downloadQt-139497b6871d73d3366c21b51db9a74046855552.zip
Qt-139497b6871d73d3366c21b51db9a74046855552.tar.gz
Qt-139497b6871d73d3366c21b51db9a74046855552.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
-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);
};