From 8a63420d03c8d7009e49d30c5688b14faa3128b9 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 1 Jul 2014 13:20:53 +0200 Subject: [PATCH] Fix that editor actions were enabled when help window is active The editor manager actions should not be enabled just because the main window is in edit/debug/analyze mode. Instead the corresponding mode must have focus. Otherwise they will be enabled even if extra windows that do not have editors (like the extra help window, which is e.g. used for the example documentation) are active. Change-Id: Id1bf3cc4d1a761ef7ea8a275701f78626ff44533 Reviewed-by: David Schulz --- src/plugins/analyzerbase/analyzermanager.cpp | 6 +++++- src/plugins/coreplugin/editmode.cpp | 11 ++++++++--- src/plugins/debugger/debuggerplugin.cpp | 6 +++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/plugins/analyzerbase/analyzermanager.cpp b/src/plugins/analyzerbase/analyzermanager.cpp index 76e8e8d339c..92a6b4e9bd3 100644 --- a/src/plugins/analyzerbase/analyzermanager.cpp +++ b/src/plugins/analyzerbase/analyzermanager.cpp @@ -98,7 +98,7 @@ public: AnalyzerMode(QObject *parent = 0) : IMode(parent) { - setContext(Context(C_EDITORMANAGER, C_ANALYZEMODE, C_NAVIGATION_PANE)); + setContext(Context(C_ANALYZEMODE, C_NAVIGATION_PANE)); setDisplayName(tr("Analyze")); setIcon(QIcon(QLatin1String(":/images/analyzer_mode.png"))); setPriority(P_MODE_ANALYZE); @@ -279,6 +279,10 @@ void AnalyzerManagerPrivate::delayedInit() splitter->addWidget(mainWindowSplitter); splitter->setStretchFactor(0, 0); splitter->setStretchFactor(1, 1); + Core::IContext *modeContextObject = new Core::IContext(this); + modeContextObject->setContext(Core::Context(Core::Constants::C_EDITORMANAGER)); + modeContextObject->setWidget(splitter); + Core::ICore::addContextObject(modeContextObject); m_mode->setWidget(splitter); AnalyzerPlugin::instance()->addAutoReleasedObject(m_mode); diff --git a/src/plugins/coreplugin/editmode.cpp b/src/plugins/coreplugin/editmode.cpp index 5bffb473e41..412d1425352 100644 --- a/src/plugins/coreplugin/editmode.cpp +++ b/src/plugins/coreplugin/editmode.cpp @@ -27,12 +27,13 @@ ** ****************************************************************************/ -#include "editmode.h" #include "coreconstants.h" +#include "editmode.h" +#include "icore.h" #include "modemanager.h" #include "minisplitter.h" -#include "outputpane.h" #include "navigationwidget.h" +#include "outputpane.h" #include "rightpane.h" #include #include @@ -85,9 +86,13 @@ EditMode::EditMode() : this, SLOT(grabEditorManager(Core::IMode*))); m_splitter->setFocusProxy(EditorManager::instance()); + IContext *modeContextObject = new IContext(this); + modeContextObject->setContext(Context(Constants::C_EDITORMANAGER)); + modeContextObject->setWidget(m_splitter); + ICore::addContextObject(modeContextObject); + setWidget(m_splitter); setContext(Context(Constants::C_EDIT_MODE, - Constants::C_EDITORMANAGER, Constants::C_NAVIGATION_PANE)); } diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 378461135f9..3b8e2bc3661 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -511,7 +511,7 @@ public: DebugMode() { setObjectName(QLatin1String("DebugMode")); - setContext(Context(CC::C_EDITORMANAGER, C_DEBUGMODE, CC::C_NAVIGATION_PANE)); + setContext(Context(C_DEBUGMODE, CC::C_NAVIGATION_PANE)); setDisplayName(DebuggerPlugin::tr("Debug")); setIcon(QIcon(QLatin1String(":/debugger/images/mode_debug.png"))); setPriority(85); @@ -3272,6 +3272,10 @@ void DebuggerPluginPrivate::extensionsInitialized() // Debug mode setup DebugMode *debugMode = new DebugMode; QWidget *widget = m_mainWindow->createContents(debugMode); + Core::IContext *modeContextObject = new Core::IContext(this); + modeContextObject->setContext(Core::Context(CC::C_EDITORMANAGER)); + modeContextObject->setWidget(widget); + Core::ICore::addContextObject(modeContextObject); widget->setFocusProxy(EditorManager::instance()); debugMode->setWidget(widget);