Commit 3aef80df authored by dt's avatar dt
Browse files

Fixes: Run from the context menu runs the startupProject

Task:     Reported on mailing list.
parent 43dcbae9
......@@ -521,6 +521,9 @@ bool ProjectExplorerPlugin::initialize(const QStringList & /*arguments*/, QStrin
cmd = am->registerAction(m_runAction, Constants::RUN, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R")));
mbuild->addAction(cmd, Constants::G_BUILD_RUN);
m_runActionContextMenu = new QAction(runIcon, tr("Run"), this);
cmd = am->registerAction(m_runActionContextMenu, Constants::RUNCONTEXTMENU, globalcontext);
mproject->addAction(cmd, Constants::G_PROJECT_RUN);
Core::ActionContainer *mrc = am->createMenu(Constants::RUNCONFIGURATIONMENU);
......@@ -616,6 +619,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList & /*arguments*/, QStrin
connect(m_cleanAction, SIGNAL(triggered()), this, SLOT(cleanProject()));
connect(m_cleanSessionAction, SIGNAL(triggered()), this, SLOT(cleanSession()));
connect(m_runAction, SIGNAL(triggered()), this, SLOT(runProject()));
connect(m_runActionContextMenu, SIGNAL(triggered()), this, SLOT(runProjectContextMenu()));
connect(m_cancelBuildAction, SIGNAL(triggered()), this, SLOT(cancelBuild()));
connect(m_debugAction, SIGNAL(triggered()), this, SLOT(debugProject()));
connect(m_dependenciesAction, SIGNAL(triggered()), this, SLOT(editDependencies()));
......@@ -1348,7 +1352,16 @@ void ProjectExplorerPlugin::cleanSession()
void ProjectExplorerPlugin::runProject()
{
Project *pro = startupProject();
runProjectImpl(startupProject());
}
void ProjectExplorerPlugin::runProjectContextMenu()
{
runProjectImpl(m_currentProject);
}
void ProjectExplorerPlugin::runProjectImpl(Project *pro)
{
if (!pro)
return;
......@@ -1434,10 +1447,14 @@ IRunConfigurationRunner *ProjectExplorerPlugin::findRunner(QSharedPointer<RunCon
void ProjectExplorerPlugin::updateRunAction()
{
const Project *project = startupProject();
const bool canRun = project && findRunner(project->activeRunConfiguration(), ProjectExplorer::Constants::RUNMODE);
bool canRun = project && findRunner(project->activeRunConfiguration(), ProjectExplorer::Constants::RUNMODE);
const bool canDebug = project && !m_debuggingRunControl && findRunner(project->activeRunConfiguration(), ProjectExplorer::Constants::DEBUGMODE);
const bool building = m_buildManager->isBuilding();
m_runAction->setEnabled(canRun && !building);
canRun = m_currentProject && findRunner(m_currentProject->activeRunConfiguration(), ProjectExplorer::Constants::RUNMODE);
m_runActionContextMenu->setEnabled(canRun && !building);
m_debugAction->setEnabled(canDebug && !building);
}
......
......@@ -156,6 +156,7 @@ private slots:
void restoreSession();
void loadSession(const QString &session);
void runProject();
void runProjectContextMenu();
void savePersistentSettings();
void goToTaskWindow();
......@@ -188,6 +189,7 @@ private slots:
void currentModeChanged(Core::IMode *mode);
private:
void runProjectImpl(Project *pro);
void setCurrent(Project *project, QString filePath, Node *node);
QStringList allFilesWithDependencies(Project *pro);
......@@ -223,6 +225,7 @@ private:
QAction *m_cleanAction;
QAction *m_cleanSessionAction;
QAction *m_runAction;
QAction *m_runActionContextMenu;
QAction *m_cancelBuildAction;
QAction *m_debugAction;
QAction *m_dependenciesAction;
......
......@@ -57,6 +57,7 @@ const char * const BUILDCONFIGURATIONMENU = "ProjectExplorer.BuildConfigurationM
const char * const CANCELBUILD = "ProjectExplorer.CancelBuild";
const char * const RUNCONFIGURATIONMENU = "ProjectExplorer.RunConfigurationMenu";
const char * const RUN = "ProjectExplorer.Run";
const char * const RUNCONTEXTMENU = "ProjectExplorer.RunContextMenu";
const char * const STOP = "ProjectExplorer.Stop";
const char * const DEBUG = "ProjectExplorer.Debug";
const char * const DEPENDENCIES = "ProjectExplorer.Dependencies";
......
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