From 090c1069297883fd4073152d0c62fd4c8e08afb3 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 24 Jun 2016 13:54:33 +0200 Subject: [PATCH] Fix Ctrl+M (bookmark) in editor when help mode is visible For external windows we need to separate the contexts in which help mode's "add bookmark" and editor's "toggle bookmark" are present. Task-number: QTCREATORBUG-16286 Change-Id: I2a7a28c75dc53e1dd0b21c0a8833bd4594d5afad Reviewed-by: David Schulz --- src/plugins/bookmarks/bookmarksplugin.cpp | 12 +++++++----- src/plugins/help/helpplugin.cpp | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/plugins/bookmarks/bookmarksplugin.cpp b/src/plugins/bookmarks/bookmarksplugin.cpp index 8e5e75d4c33..89119bb830b 100644 --- a/src/plugins/bookmarks/bookmarksplugin.cpp +++ b/src/plugins/bookmarks/bookmarksplugin.cpp @@ -71,9 +71,11 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *) mbm->menu()->setTitle(tr("&Bookmarks")); mtools->addMenu(mbm); + const Context editorManagerContext(Core::Constants::C_EDITORMANAGER); + //Toggle m_toggleAction = new QAction(tr("Toggle Bookmark"), this); - Command *cmd = ActionManager::registerAction(m_toggleAction, BOOKMARKS_TOGGLE_ACTION); + Command *cmd = ActionManager::registerAction(m_toggleAction, BOOKMARKS_TOGGLE_ACTION, editorManagerContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+M") : tr("Ctrl+M"))); mbm->addAction(cmd); @@ -81,13 +83,13 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *) //Previous m_prevAction = new QAction(tr("Previous Bookmark"), this); - cmd = ActionManager::registerAction(m_prevAction, BOOKMARKS_PREV_ACTION); + cmd = ActionManager::registerAction(m_prevAction, BOOKMARKS_PREV_ACTION, editorManagerContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+,") : tr("Ctrl+,"))); mbm->addAction(cmd); //Next m_nextAction = new QAction(tr("Next Bookmark"), this); - cmd = ActionManager::registerAction(m_nextAction, BOOKMARKS_NEXT_ACTION); + cmd = ActionManager::registerAction(m_nextAction, BOOKMARKS_NEXT_ACTION, editorManagerContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+.") : tr("Ctrl+."))); mbm->addAction(cmd); @@ -95,12 +97,12 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *) //Previous Doc m_docPrevAction = new QAction(tr("Previous Bookmark in Document"), this); - cmd = ActionManager::registerAction(m_docPrevAction, BOOKMARKS_PREVDOC_ACTION); + cmd = ActionManager::registerAction(m_docPrevAction, BOOKMARKS_PREVDOC_ACTION, editorManagerContext); mbm->addAction(cmd); //Next Doc m_docNextAction = new QAction(tr("Next Bookmark in Document"), this); - cmd = ActionManager::registerAction(m_docNextAction, BOOKMARKS_NEXTDOC_ACTION); + cmd = ActionManager::registerAction(m_docNextAction, BOOKMARKS_NEXTDOC_ACTION, editorManagerContext); mbm->addAction(cmd); m_editBookmarkAction = new QAction(tr("Edit Bookmark"), this); diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 4bcf9fbab13..243399489ad 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -150,7 +150,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) addAutoReleasedObject(new GeneralSettingsPage()); addAutoReleasedObject(m_searchTaskHandler = new SearchTaskHandler); - m_centralWidget = new CentralWidget(modecontext); + m_centralWidget = new CentralWidget(Context("Help.CentralHelpWidget")); connect(m_centralWidget, SIGNAL(sourceChanged(QUrl)), this, SLOT(updateSideBarSource(QUrl))); connect(m_centralWidget, &CentralWidget::closeButtonClicked,