Commit b64bb0a7 authored by Eike Ziller's avatar Eike Ziller
Browse files

Help: Fix that help viewer opened even if URL is opened in browser



After we constructed the online URL for Qt/Qt Creator documentation that
is not installed locally, we can just open that via desktop services
instead of bothering built-in help viewers.

Change-Id: Ic8a37bc22d34af881b5daf87534d59db4d331e44
Task-number: QTCREATORBUG-16111
Reviewed-by: default avatarRobert Loehning <robert.loehning@qt.io>
parent 82803f5a
...@@ -622,25 +622,25 @@ void HelpPlugin::handleHelpRequest(const QUrl &url, HelpManager::HelpViewerLocat ...@@ -622,25 +622,25 @@ void HelpPlugin::handleHelpRequest(const QUrl &url, HelpManager::HelpViewerLocat
if (HelpViewer::launchWithExternalApp(url)) if (HelpViewer::launchWithExternalApp(url))
return; return;
QString address = url.toString();
if (!HelpManager::findFile(url).isValid()) { if (!HelpManager::findFile(url).isValid()) {
const QString address = url.toString();
if (address.startsWith("qthelp://org.qt-project.") if (address.startsWith("qthelp://org.qt-project.")
|| address.startsWith("qthelp://com.nokia.") || address.startsWith("qthelp://com.nokia.")
|| address.startsWith("qthelp://com.trolltech.")) { || address.startsWith("qthelp://com.trolltech.")) {
// local help not installed, resort to external web help // local help not installed, resort to external web help
QString urlPrefix = "http://doc.qt.io/"; QString urlPrefix = "http://doc.qt.io/";
if (url.authority() == "org.qt-project.qtcreator") if (url.authority() == "org.qt-project.qtcreator")
urlPrefix.append(QString::fromLatin1("qtcreator")); urlPrefix.append(QString::fromLatin1("qtcreator"));
else else
urlPrefix.append("qt-5"); urlPrefix.append("qt-5");
address = urlPrefix + address.mid(address.lastIndexOf(QLatin1Char('/'))); QDesktopServices::openUrl(QUrl(urlPrefix + address.mid(address.lastIndexOf(QLatin1Char('/')))));
return;
} }
} }
const QUrl newUrl(address);
HelpViewer *viewer = viewerForHelpViewerLocation(location); HelpViewer *viewer = viewerForHelpViewerLocation(location);
QTC_ASSERT(viewer, return); QTC_ASSERT(viewer, return);
viewer->setSource(newUrl); viewer->setSource(url);
ICore::raiseWindow(viewer); ICore::raiseWindow(viewer);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment