forked from qt-creator/qt-creator
Make sure we open the help only if needed.
Reviewed-by: ck
This commit is contained in:
@@ -29,6 +29,9 @@
|
||||
|
||||
#include "helpindexfilter.h"
|
||||
|
||||
#include "centralwidget.h"
|
||||
#include "topicchooser.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/helpmanager.h>
|
||||
@@ -86,10 +89,13 @@ void HelpIndexFilter::accept(FilterEntry selection) const
|
||||
{
|
||||
const QString &key = selection.displayName;
|
||||
const QMap<QString, QUrl> &links = Core::HelpManager::instance()->linksForKeyword(key);
|
||||
|
||||
if (links.size() == 1) {
|
||||
emit linkActivated(links.begin().value());
|
||||
} 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 @@
|
||||
namespace Help {
|
||||
namespace Internal {
|
||||
|
||||
class HelpPlugin;
|
||||
|
||||
class HelpIndexFilter : public Locator::ILocatorFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -57,7 +55,6 @@ public:
|
||||
|
||||
signals:
|
||||
void linkActivated(const QUrl &link) const;
|
||||
void linksActivated(const QMap<QString, QUrl> &urls, const QString &keyword) const;
|
||||
|
||||
private:
|
||||
QIcon m_icon;
|
||||
|
||||
@@ -299,8 +299,6 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
addAutoReleasedObject(helpIndexFilter);
|
||||
connect(helpIndexFilter, SIGNAL(linkActivated(QUrl)), this,
|
||||
SLOT(switchToHelpMode(QUrl)));
|
||||
connect(helpIndexFilter, SIGNAL(linksActivated(QMap<QString, QUrl>, QString)),
|
||||
this, SLOT(switchToHelpMode(QMap<QString, QUrl>, QString)));
|
||||
|
||||
QDesktopServices::setUrlHandler("qthelp", this, "handleHelpRequest");
|
||||
connect(m_core->modeManager(), SIGNAL(currentModeChanged(Core::IMode*)),
|
||||
@@ -562,13 +560,6 @@ void HelpPlugin::switchToHelpMode(const QUrl &source)
|
||||
m_centralWidget->setFocus();
|
||||
}
|
||||
|
||||
void HelpPlugin::switchToHelpMode(const QMap<QString, QUrl> &urls,
|
||||
const QString &keyword)
|
||||
{
|
||||
activateHelpMode();
|
||||
m_centralWidget->showTopicChooser(urls, keyword);
|
||||
}
|
||||
|
||||
void HelpPlugin::slotHideRightPane()
|
||||
{
|
||||
Core::RightPaneWidget::instance()->setShown(false);
|
||||
|
||||
@@ -88,7 +88,6 @@ private slots:
|
||||
|
||||
void switchToHelpMode();
|
||||
void switchToHelpMode(const QUrl &source);
|
||||
void switchToHelpMode(const QMap<QString, QUrl> &urls, const QString &keyword);
|
||||
void slotHideRightPane();
|
||||
|
||||
void updateSideBarSource();
|
||||
|
||||
Reference in New Issue
Block a user