Help: Fix destination of index locator filter

When using locator in the external help window, open help pages or show
the topic chooser in the external help window, not the main window.

Change-Id: I792223147f1eb00addafb2618017536c126c71dd
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2017-07-20 07:41:05 +02:00
parent b1390a07ca
commit 9297ee92c6
8 changed files with 30 additions and 29 deletions

View File

@@ -354,10 +354,8 @@ void HelpWidget::addSideBar()
auto indexItem = new Core::SideBarItem(indexWindow, Constants::HELP_INDEX);
indexWindow->setOpenInNewPageActionVisible(supportsNewPages);
indexWindow->setWindowTitle(HelpPlugin::tr(Constants::SB_INDEX));
connect(indexWindow, &IndexWindow::linkActivated,
this, &HelpWidget::open);
connect(indexWindow, &IndexWindow::linksActivated,
this, &HelpWidget::showTopicChooser);
this, &HelpWidget::showLinks);
m_indexAction = new QAction(HelpPlugin::tr(Constants::SB_INDEX), this);
cmd = Core::ActionManager::registerAction(m_indexAction, Constants::HELP_INDEX, m_context->context());
cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+I")
@@ -535,12 +533,18 @@ void HelpWidget::open(const QUrl &url, bool newPage)
setSource(url);
}
void HelpWidget::showTopicChooser(const QMap<QString, QUrl> &links,
void HelpWidget::showLinks(const QMap<QString, QUrl> &links,
const QString &keyword, bool newPage)
{
TopicChooser tc(this, keyword, links);
if (tc.exec() == QDialog::Accepted)
open(tc.link(), newPage);
if (links.size() < 1)
return;
if (links.size() == 1) {
open(links.first(), newPage);
} else {
TopicChooser tc(this, keyword, links);
if (tc.exec() == QDialog::Accepted)
open(tc.link(), newPage);
}
}
void HelpWidget::activateSideBarItem(const QString &id)