Commit 01fb9cdb authored by kh1's avatar kh1
Browse files

Make sure we open the help only if needed.

Reviewed-by: ck
parent 141e5556
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
#include "helpindexfilter.h" #include "helpindexfilter.h"
#include "centralwidget.h"
#include "topicchooser.h"
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/helpmanager.h> #include <coreplugin/helpmanager.h>
...@@ -86,10 +89,13 @@ void HelpIndexFilter::accept(FilterEntry selection) const ...@@ -86,10 +89,13 @@ void HelpIndexFilter::accept(FilterEntry selection) const
{ {
const QString &key = selection.displayName; const QString &key = selection.displayName;
const QMap<QString, QUrl> &links = Core::HelpManager::instance()->linksForKeyword(key); const QMap<QString, QUrl> &links = Core::HelpManager::instance()->linksForKeyword(key);
if (links.size() == 1) { if (links.size() == 1) {
emit linkActivated(links.begin().value()); emit linkActivated(links.begin().value());
} else if (!links.isEmpty()) { } else if (!links.isEmpty()) {
emit linksActivated(links, key); TopicChooser tc(CentralWidget::instance(), key, links);
if (tc.exec() == QDialog::Accepted)
emit linkActivated(tc.link());
} }
} }
......
...@@ -37,8 +37,6 @@ ...@@ -37,8 +37,6 @@
namespace Help { namespace Help {
namespace Internal { namespace Internal {
class HelpPlugin;
class HelpIndexFilter : public Locator::ILocatorFilter class HelpIndexFilter : public Locator::ILocatorFilter
{ {
Q_OBJECT Q_OBJECT
...@@ -57,7 +55,6 @@ public: ...@@ -57,7 +55,6 @@ public:
signals: signals:
void linkActivated(const QUrl &link) const; void linkActivated(const QUrl &link) const;
void linksActivated(const QMap<QString, QUrl> &urls, const QString &keyword) const;
private: private:
QIcon m_icon; QIcon m_icon;
......
...@@ -299,8 +299,6 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) ...@@ -299,8 +299,6 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
addAutoReleasedObject(helpIndexFilter); addAutoReleasedObject(helpIndexFilter);
connect(helpIndexFilter, SIGNAL(linkActivated(QUrl)), this, connect(helpIndexFilter, SIGNAL(linkActivated(QUrl)), this,
SLOT(switchToHelpMode(QUrl))); SLOT(switchToHelpMode(QUrl)));
connect(helpIndexFilter, SIGNAL(linksActivated(QMap<QString, QUrl>, QString)),
this, SLOT(switchToHelpMode(QMap<QString, QUrl>, QString)));
QDesktopServices::setUrlHandler("qthelp", this, "handleHelpRequest"); QDesktopServices::setUrlHandler("qthelp", this, "handleHelpRequest");
connect(m_core->modeManager(), SIGNAL(currentModeChanged(Core::IMode*)), connect(m_core->modeManager(), SIGNAL(currentModeChanged(Core::IMode*)),
...@@ -562,13 +560,6 @@ void HelpPlugin::switchToHelpMode(const QUrl &source) ...@@ -562,13 +560,6 @@ void HelpPlugin::switchToHelpMode(const QUrl &source)
m_centralWidget->setFocus(); m_centralWidget->setFocus();
} }
void HelpPlugin::switchToHelpMode(const QMap<QString, QUrl> &urls,
const QString &keyword)
{
activateHelpMode();
m_centralWidget->showTopicChooser(urls, keyword);
}
void HelpPlugin::slotHideRightPane() void HelpPlugin::slotHideRightPane()
{ {
Core::RightPaneWidget::instance()->setShown(false); Core::RightPaneWidget::instance()->setShown(false);
......
...@@ -88,7 +88,6 @@ private slots: ...@@ -88,7 +88,6 @@ private slots:
void switchToHelpMode(); void switchToHelpMode();
void switchToHelpMode(const QUrl &source); void switchToHelpMode(const QUrl &source);
void switchToHelpMode(const QMap<QString, QUrl> &urls, const QString &keyword);
void slotHideRightPane(); void slotHideRightPane();
void updateSideBarSource(); void updateSideBarSource();
......
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