From f6f1721a64d13c68f04a7180e5932de34ded74ab Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Wed, 28 Jan 2009 13:57:42 +0100
Subject: [PATCH]     Fixes:    help: small refactoring

---
 src/plugins/help/helpplugin.cpp | 21 +++++++++++++--------
 src/plugins/help/helpplugin.h   |  1 +
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp
index 3eddaa5e0ec..4d48afd0b20 100644
--- a/src/plugins/help/helpplugin.cpp
+++ b/src/plugins/help/helpplugin.cpp
@@ -395,6 +395,11 @@ void HelpPlugin::rightPaneForward()
     m_helpViewerForSideBar->forward();
 }
 
+void HelpPlugin::activateHelpMode()
+{
+    m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
+}
+
 void HelpPlugin::switchToHelpMode()
 {
     switchToHelpMode(m_helpViewerForSideBar->source());
@@ -403,14 +408,14 @@ void HelpPlugin::switchToHelpMode()
 
 void HelpPlugin::switchToHelpMode(const QUrl &source)
 {
-    m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
+    activateHelpMode();
     m_centralWidget->setSource(source);
     m_centralWidget->setFocus();
 }
 
 void HelpPlugin::switchToHelpMode(const QMap<QString, QUrl> &urls, const QString &keyword)
 {
-    m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
+    activateHelpMode();
     m_centralWidget->showTopicChooser(urls, keyword);
 }
 
@@ -561,7 +566,7 @@ void HelpPlugin::activateContext()
                 viewer = m_helpViewerForSideBar;
             } else {
                 viewer = m_centralWidget->currentHelpViewer();
-                m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
+                activateHelpMode();
             }
             
             if (viewer) {
@@ -579,7 +584,7 @@ void HelpPlugin::activateContext()
             viewer = m_helpViewerForSideBar;
         } else {
             viewer = m_centralWidget->currentHelpViewer();
-            m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
+            activateHelpMode();
         }
 
         if (viewer) {
@@ -593,19 +598,19 @@ void HelpPlugin::activateContext()
 
 void HelpPlugin::activateIndex()
 {
-    m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
+    activateHelpMode();
     m_sideBar->activateItem(m_indexItem);
 }
 
 void HelpPlugin::activateContents()
 {
-    m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
+    activateHelpMode();
     m_sideBar->activateItem(m_contentItem);
 }
 
 void HelpPlugin::activateSearch()
 {
-    m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
+    activateHelpMode();
     m_sideBar->activateItem(m_searchItem);
 }
 
@@ -680,7 +685,7 @@ void HelpPlugin::addNewBookmark(const QString &title, const QString &url)
 
 void HelpPlugin::openGettingStarted()
 {
-    m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
+    activateHelpMode();
     m_centralWidget->setSource(
         QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html")
         .arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));
diff --git a/src/plugins/help/helpplugin.h b/src/plugins/help/helpplugin.h
index ef56c7e3364..145981e16a2 100644
--- a/src/plugins/help/helpplugin.h
+++ b/src/plugins/help/helpplugin.h
@@ -134,6 +134,7 @@ private slots:
 private:
     QToolBar *createToolBar();
     void createRightPaneSideBar();
+    void activateHelpMode();
 
     Core::ICore *m_core;
     QHelpEngine *m_helpEngine;
-- 
GitLab