summaryrefslogtreecommitdiff
path: root/src/plugins/help
diff options
context:
space:
mode:
authorkh1 <qt-info@nokia.com>2010-04-28 15:04:39 +0200
committerkh1 <qt-info@nokia.com>2010-04-28 15:07:06 +0200
commitc908da836fe7f4e5ef474d3982e05989c14240a8 (patch)
tree99907df8887e751a9ef32fb040d0fdb41b0b2fd6 /src/plugins/help
parentb0f9b1d491b8c5c0771312d1f83b6836fac97212 (diff)
downloadqt-creator-c908da836fe7f4e5ef474d3982e05989c14240a8.tar.gz
Fix handleHelpRequest.
* Make sure we only change our own urls inside that function * QDesktopService::setUrlHandler expects the target slot to take a QUrl Reviewed-by: ck
Diffstat (limited to 'src/plugins/help')
-rw-r--r--src/plugins/help/helpmanager.cpp2
-rw-r--r--src/plugins/help/helpmanager.h3
-rw-r--r--src/plugins/help/helpplugin.cpp33
-rw-r--r--src/plugins/help/helpplugin.h5
4 files changed, 23 insertions, 20 deletions
diff --git a/src/plugins/help/helpmanager.cpp b/src/plugins/help/helpmanager.cpp
index 300d313e0c..bc5bef0a46 100644
--- a/src/plugins/help/helpmanager.cpp
+++ b/src/plugins/help/helpmanager.cpp
@@ -102,7 +102,7 @@ bool HelpManager::guiEngineNeedsUpdate() const
void HelpManager::handleHelpRequest(const QString &url)
{
- emit helpRequested(url);
+ emit helpRequested(QUrl(url));
}
void HelpManager::verifyDocumenation()
diff --git a/src/plugins/help/helpmanager.h b/src/plugins/help/helpmanager.h
index aca4100700..39f2c939ea 100644
--- a/src/plugins/help/helpmanager.h
+++ b/src/plugins/help/helpmanager.h
@@ -39,6 +39,7 @@ QT_FORWARD_DECLARE_CLASS(QHelpEngine)
QT_FORWARD_DECLARE_CLASS(QHelpEngineCore)
QT_FORWARD_DECLARE_CLASS(QString)
QT_FORWARD_DECLARE_CLASS(QStringList)
+QT_FORWARD_DECLARE_CLASS(QUrl)
class BookmarkManager;
@@ -69,7 +70,7 @@ public:
static BookmarkManager& bookmarkManager();
signals:
- void helpRequested(const QString &Url);
+ void helpRequested(const QUrl &url);
private:
static bool m_guiNeedsSetup;
diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp
index 721ff6785d..48cdbce6e9 100644
--- a/src/plugins/help/helpplugin.cpp
+++ b/src/plugins/help/helpplugin.cpp
@@ -145,8 +145,8 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
SLOT(updateFilterPage()));
connect(m_generalSettingsPage, SIGNAL(fontChanged()), this,
SLOT(fontChanged()));
- connect(m_helpManager, SIGNAL(helpRequested(QString)), this,
- SLOT(handleHelpRequest(QString)));
+ connect(m_helpManager, SIGNAL(helpRequested(QUrl)), this,
+ SLOT(handleHelpRequest(QUrl)));
connect(m_filterSettingsPage, SIGNAL(filtersChanged()), this,
SLOT(setupHelpEngineIfNeeded()));
connect(m_docSettingsPage, SIGNAL(documentationChanged()), this,
@@ -825,13 +825,12 @@ void HelpPlugin::addBookmark()
manager->showBookmarkDialog(m_centralWidget, viewer->title(), url);
}
-void HelpPlugin::handleHelpRequest(const QString &address)
+void HelpPlugin::handleHelpRequest(const QUrl &url)
{
- if (HelpViewer::launchWithExternalApp(address))
+ if (HelpViewer::launchWithExternalApp(url))
return;
- if (m_helpManager->helpEngineCore().findFile(address).isValid()) {
- const QUrl url(address);
+ if (m_helpManager->helpEngineCore().findFile(url).isValid()) {
if (url.queryItemValue(QLatin1String("view")) == QLatin1String("split")) {
if (HelpViewer* viewer = viewerForContextMode())
viewer->setSource(url);
@@ -840,16 +839,20 @@ void HelpPlugin::handleHelpRequest(const QString &address)
m_centralWidget->setSource(url);
}
} else {
- // local help not installed, resort to external web help
- QString urlPrefix;
- if (address.startsWith(QLatin1String("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/");
+ QString address = url.toString();
+ if (address.startsWith(HelpViewer::NsNokia)
+ || address.startsWith(HelpViewer::NsTrolltech)) {
+ // local help not installed, resort to external web help
+ QString urlPrefix = QLatin1String("http://doc.trolltech.com/");
+ if (url.authority() == QLatin1String("com.nokia.qtcreator")) {
+ urlPrefix.append(QString::fromLatin1("qtcreator-%1.%2")
+ .arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));
+ } else {
+ urlPrefix.append(QLatin1String("latest"));
+ }
+ address = urlPrefix + address.mid(address.lastIndexOf(QLatin1Char('/')));
}
- QDesktopServices::openUrl(QUrl(urlPrefix + address.mid(address
- .lastIndexOf(QLatin1Char('/')) + 1)));
+ QDesktopServices::openUrl(address);
}
}
diff --git a/src/plugins/help/helpplugin.h b/src/plugins/help/helpplugin.h
index 11e6bf1eba..c5a56f40f0 100644
--- a/src/plugins/help/helpplugin.h
+++ b/src/plugins/help/helpplugin.h
@@ -73,9 +73,6 @@ public:
void extensionsInitialized();
void shutdown();
-public slots:
- void handleHelpRequest(const QString &url);
-
private slots:
void modeChanged(Core::IMode *mode);
@@ -101,6 +98,8 @@ private slots:
void updateCloseButton();
void setupHelpEngineIfNeeded();
+ void handleHelpRequest(const QUrl &url);
+
private:
void setupUi();
void resetFilter();