From d34aee4d533304e3afacecf2ff0ae0d243fcd188 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 27 Sep 2019 13:05:34 +0200 Subject: Help: Fix missing page switching keyboard shortcuts for external window Which are relevant now that external windows support multiple pages. Change-Id: Ibc748e9e0582c8d54264af535c32aa2702f91631 Reviewed-by: Christian Stenger --- src/plugins/help/helpplugin.cpp | 25 ------------------------- src/plugins/help/helpwidget.cpp | 31 +++++++++++++++++++++++++++++-- src/plugins/help/helpwidget.h | 2 ++ 3 files changed, 31 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index fdbe8a154f..1313ca6c0a 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -191,8 +191,6 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) HelpPluginPrivate::HelpPluginPrivate() { - Context modecontext(Help::Constants::C_MODE_HELP); - const QString &locale = ICore::userInterfaceLanguage(); if (!locale.isEmpty()) { auto qtr = new QTranslator(this); @@ -284,29 +282,6 @@ HelpPluginPrivate::HelpPluginPrivate() ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_SUPPORT); connect(action, &QAction::triggered, this, &HelpPluginPrivate::slotSystemInformation); - if (ActionContainer *windowMenu = ActionManager::actionContainer(Core::Constants::M_WINDOW)) { - // reuse EditorManager constants to avoid a second pair of menu actions - // Goto Previous In History Action - action = new QAction(this); - Command *ctrlTab = ActionManager::registerAction(action, Core::Constants::GOTOPREVINHISTORY, - modecontext); - windowMenu->addAction(ctrlTab, Core::Constants::G_WINDOW_NAVIGATE); - connect(action, - &QAction::triggered, - m_centralWidget->openPagesManager(), - &OpenPagesManager::gotoPreviousPage); - - // Goto Next In History Action - action = new QAction(this); - Command *ctrlShiftTab = ActionManager::registerAction(action, Core::Constants::GOTONEXTINHISTORY, - modecontext); - windowMenu->addAction(ctrlShiftTab, Core::Constants::G_WINDOW_NAVIGATE); - connect(action, - &QAction::triggered, - m_centralWidget->openPagesManager(), - &OpenPagesManager::gotoNextPage); - } - connect(&helpIndexFilter, &HelpIndexFilter::linksActivated, this, &HelpPluginPrivate::showLinksInCurrentViewer); diff --git a/src/plugins/help/helpwidget.cpp b/src/plugins/help/helpwidget.cpp index 9a66c0a6f5..ff95cedac7 100644 --- a/src/plugins/help/helpwidget.cpp +++ b/src/plugins/help/helpwidget.cpp @@ -261,8 +261,35 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget layout->addWidget(m_filterComboBox); connect(m_filterComboBox, QOverload::of(&QComboBox::activated), LocalHelpManager::instance(), &LocalHelpManager::setFilterIndex); - connect(LocalHelpManager::instance(), &LocalHelpManager::filterIndexChanged, - m_filterComboBox, &QComboBox::setCurrentIndex); + connect(LocalHelpManager::instance(), + &LocalHelpManager::filterIndexChanged, + m_filterComboBox, + &QComboBox::setCurrentIndex); + + Core::ActionContainer *windowMenu = Core::ActionManager::actionContainer( + Core::Constants::M_WINDOW); + if (QTC_GUARD(windowMenu)) { + // reuse EditorManager constants to avoid a second pair of menu actions + m_gotoPrevious = new QAction(this); + cmd = Core::ActionManager::registerAction(m_gotoPrevious, + Core::Constants::GOTOPREVINHISTORY, + context); + windowMenu->addAction(cmd, Core::Constants::G_WINDOW_NAVIGATE); + connect(m_gotoPrevious, + &QAction::triggered, + openPagesManager(), + &OpenPagesManager::gotoPreviousPage); + + m_gotoNext = new QAction(this); + cmd = Core::ActionManager::registerAction(m_gotoNext, + Core::Constants::GOTONEXTINHISTORY, + context); + windowMenu->addAction(cmd, Core::Constants::G_WINDOW_NAVIGATE); + connect(m_gotoNext, + &QAction::triggered, + openPagesManager(), + &OpenPagesManager::gotoNextPage); + } } else { layout->addWidget(new QLabel(), 10); } diff --git a/src/plugins/help/helpwidget.h b/src/plugins/help/helpwidget.h index 53df93153e..f104e90b8d 100644 --- a/src/plugins/help/helpwidget.h +++ b/src/plugins/help/helpwidget.h @@ -161,6 +161,8 @@ private: QAction *m_resetScale = nullptr; QAction *m_printAction = nullptr; QAction *m_copy = nullptr; + QAction *m_gotoPrevious = nullptr; + QAction *m_gotoNext = nullptr; QStackedWidget *m_viewerStack = nullptr; QPrinter *m_printer = nullptr; -- cgit v1.2.1