Commit 6bea521e authored by con's avatar con

Debugger view menus were enabled when they shouldn't be

parent 11acf055
......@@ -272,11 +272,11 @@ DebuggerLanguages DebuggerMainWindow::activeDebugLanguages() const
void DebuggerMainWindow::onModeChanged(IMode *mode)
{
d->m_inDebugMode = (mode->id() == Constants::MODE_DEBUG);
d->m_inDebugMode = (mode && mode->id() == Constants::MODE_DEBUG);
setDockActionsVisible(d->m_inDebugMode);
// Hide all the debugger windows if mode is different.
if (mode->id() == Constants::MODE_DEBUG) {
if (d->m_inDebugMode) {
readSettings();
d->updateActiveLanguages();
} else {
......@@ -292,7 +292,7 @@ void DebuggerMainWindowPrivate::createViewsMenuItems()
{
ICore *core = ICore::instance();
ActionManager *am = core->actionManager();
Context globalcontext(Core::Constants::C_GLOBAL);
Context debugcontext(Core::Context(Constants::C_DEBUGMODE));
m_viewsMenu = am->actionContainer(Id(Core::Constants::M_WINDOW_VIEWS));
QTC_ASSERT(m_viewsMenu, return)
......@@ -305,20 +305,25 @@ void DebuggerMainWindowPrivate::createViewsMenuItems()
Command *cmd = 0;
cmd = am->registerAction(openMemoryEditorAction,
Core::Id("Debugger.Views.OpenMemoryEditor"),
Core::Context(Constants::C_DEBUGMODE));
debugcontext);
cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd);
cmd = am->registerAction(q->menuSeparator1(),
Core::Id("Debugger.Views.Separator1"), globalcontext);
m_viewsMenu->addAction(cmd);
Core::Id("Debugger.Views.Separator1"), debugcontext);
cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
cmd = am->registerAction(q->toggleLockedAction(),
Core::Id("Debugger.Views.ToggleLocked"), globalcontext);
m_viewsMenu->addAction(cmd);
Core::Id("Debugger.Views.ToggleLocked"), debugcontext);
cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
cmd = am->registerAction(q->menuSeparator2(),
Core::Id("Debugger.Views.Separator2"), globalcontext);
m_viewsMenu->addAction(cmd);
Core::Id("Debugger.Views.Separator2"), debugcontext);
cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
cmd = am->registerAction(q->resetLayoutAction(),
Core::Id("Debugger.Views.ResetSimple"), globalcontext);
m_viewsMenu->addAction(cmd);
Core::Id("Debugger.Views.ResetSimple"), debugcontext);
cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
}
void DebuggerMainWindowPrivate::addLanguage(const DebuggerLanguage &languageId,
......
......@@ -1016,6 +1016,7 @@ public slots:
void toggleBreakpointByFileAndLine(const QString &fileName, int lineNumber);
void toggleBreakpointByAddress(quint64 address);
void onModeChanged(Core::IMode *mode);
void onCoreAboutToOpen();
void showSettingsDialog();
void debugProject();
......@@ -2265,6 +2266,11 @@ void DebuggerPluginPrivate::updateDebugActions()
m_debugAction->setEnabled(pe->canRun(project, Constants::DEBUGMODE));
}
void DebuggerPluginPrivate::onCoreAboutToOpen()
{
m_mainWindow->onModeChanged(ModeManager::instance()->currentMode());
}
void DebuggerPluginPrivate::onModeChanged(IMode *mode)
{
// FIXME: This one gets always called, even if switching between modes
......@@ -3037,6 +3043,8 @@ void DebuggerPluginPrivate::extensionsInitialized()
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
SLOT(onModeChanged(Core::IMode*)));
connect(ICore::instance(), SIGNAL(coreAboutToOpen()),
SLOT(onCoreAboutToOpen()));
// Debug mode setup
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment