summaryrefslogtreecommitdiff
path: root/src/plugins/help
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@nokia.com>2012-05-11 14:41:40 +0200
committerEike Ziller <eike.ziller@nokia.com>2012-05-11 15:14:07 +0200
commitd762373b9577bcf66152c72130f4164b355b810e (patch)
tree45e3735dd3ef8a59a71b1c064c116fba68bd1ebd /src/plugins/help
parent5787c1e4cd8403691c879918385e467e018d6ca8 (diff)
downloadqt-creator-d762373b9577bcf66152c72130f4164b355b810e.tar.gz
Make it possible to Show/Hide the sidebar in help mode.
Task-number: QTCREATORBUG-1533 Change-Id: I0ac767db5bcbda12a9d8ba1572ee75881308d0d0 Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
Diffstat (limited to 'src/plugins/help')
-rw-r--r--src/plugins/help/helpplugin.cpp27
-rw-r--r--src/plugins/help/helpplugin.h4
2 files changed, 28 insertions, 3 deletions
diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp
index fcea273847..b93f0e90b2 100644
--- a/src/plugins/help/helpplugin.cpp
+++ b/src/plugins/help/helpplugin.cpp
@@ -137,7 +137,8 @@ HelpPlugin::HelpPlugin()
m_connectWindow(true),
m_externalWindow(0),
m_backMenu(0),
- m_nextMenu(0)
+ m_nextMenu(0),
+ m_isSidebarVisible(true)
{
}
@@ -407,8 +408,13 @@ void HelpPlugin::extensionsInitialized()
ExtensionSystem::IPlugin::ShutdownFlag HelpPlugin::aboutToShutdown()
{
- if (m_sideBar)
- m_sideBar->saveSettings(Core::ICore::settings(), QLatin1String("HelpSideBar"));
+ if (m_sideBar) {
+ QSettings *settings = Core::ICore::settings();
+ m_sideBar->saveSettings(settings, QLatin1String("HelpSideBar"));
+ // keep a boolean value to avoid to modify the sidebar class, at least some qml stuff
+ // depends on the always visible property of the sidebar...
+ settings->setValue(QLatin1String("HelpSideBar/") + QLatin1String("Visible"), m_isSidebarVisible);
+ }
delete m_externalWindow;
return SynchronousShutdown;
@@ -500,7 +506,9 @@ void HelpPlugin::setupUi()
<< m_openPagesItem;
m_sideBar = new Core::SideBar(itemList, QList<Core::SideBarItem*>()
<< m_contentItem << m_openPagesItem);
+ m_sideBar->setCloseWhenEmpty(true);
m_sideBar->setShortcutMap(shortcutMap);
+ connect(m_sideBar, SIGNAL(sideBarClosed()), this, SLOT(onSideBarVisibilityChanged()));
m_splitter->setOpaqueResize(false);
m_splitter->insertWidget(0, m_sideBar);
@@ -508,6 +516,12 @@ void HelpPlugin::setupUi()
m_splitter->setStretchFactor(1, 1);
m_sideBar->readSettings(Core::ICore::settings(), QLatin1String("HelpSideBar"));
m_splitter->setSizes(QList<int>() << m_sideBar->size().width() << 300);
+
+ m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Core::Constants::ICON_TOGGLE_SIDEBAR)),
+ tr("Show Sidebar"), this);
+ m_toggleSideBarAction->setCheckable(true);
+ connect(m_toggleSideBarAction, SIGNAL(triggered(bool)), this, SLOT(showHideSidebar()));
+ cmd = am->registerAction(m_toggleSideBarAction, Core::Constants::TOGGLE_SIDEBAR, modecontext);
}
void HelpPlugin::resetFilter()
@@ -690,6 +704,7 @@ void HelpPlugin::slotHideRightPane()
void HelpPlugin::showHideSidebar()
{
m_sideBar->setVisible(!m_sideBar->isVisible());
+ onSideBarVisibilityChanged();
}
void HelpPlugin::showExternalWindow()
@@ -1229,6 +1244,12 @@ void HelpPlugin::openFindToolBar()
Find::FindPlugin::instance()->openFindToolBar(Find::FindPlugin::FindForward);
}
+void HelpPlugin::onSideBarVisibilityChanged()
+{
+ m_isSidebarVisible = m_sideBar->isVisible();
+ m_toggleSideBarAction->setToolTip(m_isSidebarVisible ? tr("Hide Sidebar") : tr("Show Sidebar"));
+}
+
void HelpPlugin::doSetupIfNeeded()
{
m_helpManager->setupGuiHelpEngine();
diff --git a/src/plugins/help/helpplugin.h b/src/plugins/help/helpplugin.h
index 4a0b10df12..fbb5e07dc8 100644
--- a/src/plugins/help/helpplugin.h
+++ b/src/plugins/help/helpplugin.h
@@ -119,6 +119,7 @@ private slots:
void slotReportBug();
void openFindToolBar();
+ void onSideBarVisibilityChanged();
void scaleRightPaneUp();
void scaleRightPaneDown();
@@ -176,6 +177,9 @@ private:
QMenu *m_nextMenu;
Utils::StyledBar *m_internalHelpBar;
Utils::StyledBar *m_externalHelpBar;
+
+ bool m_isSidebarVisible;
+ QAction *m_toggleSideBarAction;
};
} // namespace Internal