From 139497b6871d73d3366c21b51db9a74046855552 Mon Sep 17 00:00:00 2001 From: kh1 Date: Tue, 20 Apr 2010 16:20:16 +0200 Subject: 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 --- tools/assistant/tools/assistant/helpviewer.cpp | 7 ++++--- tools/assistant/tools/assistant/helpviewer.h | 2 +- 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); }; -- cgit v0.12