OSDN Git Service

Do not switch to help mode if we launch a browser to show the help.
authorDaniel Molkentin <daniel.molkentin@nokia.com>
Wed, 10 Jun 2009 15:38:45 +0000 (17:38 +0200)
committerDaniel Molkentin <daniel.molkentin@nokia.com>
Wed, 10 Jun 2009 15:39:59 +0000 (17:39 +0200)
Also, find the help pages for Creator on the web properly.

Reviewed-By: kh
src/plugins/help/helpplugin.cpp

index ae2baa2..d318641 100644 (file)
@@ -769,12 +769,19 @@ void HelpPlugin::openHelpPage(const QUrl& url)
 
 void HelpPlugin::openHelpPage(const QString& url)
 {
-    activateHelpMode();
-    if (m_helpEngine->findFile(url).isValid())
+    if (m_helpEngine->findFile(url).isValid()) {
+        activateHelpMode();
         m_centralWidget->setSource(url);
-    else {
-        QDesktopServices::openUrl(QLatin1String("http://doc.trolltech.com/latest/")
-            + url.mid(url.lastIndexOf('/') + 1));
+    } else {
+        // local help not installed, resort to external web help
+        QString urlPrefix;
+        if (url.startsWith("qthelp://com.nokia.qtcreator")) {
+            urlPrefix = QString::fromLatin1("http://doc.trolltech.com/qtcreator-%1.%2/")
+                        .arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR);
+        } else {
+            urlPrefix = QLatin1String("http://doc.trolltech.com/latest/");
+        }
+        QDesktopServices::openUrl(urlPrefix + url.mid(url.lastIndexOf('/') + 1));
     }
 }