diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.cpp b/src/plugins/qt4projectmanager/qt4projectmanager.cpp index 67161d2597b..acb260e0340 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.cpp +++ b/src/plugins/qt4projectmanager/qt4projectmanager.cpp @@ -400,20 +400,25 @@ void Qt4Manager::runQMake(ProjectExplorer::Project *p, ProjectExplorer::Node *no void Qt4Manager::buildSubDirContextMenu() { - handleSubDirContextMenu(BUILD); + handleSubDirContextMenu(BUILD, false); } void Qt4Manager::cleanSubDirContextMenu() { - handleSubDirContextMenu(CLEAN); + handleSubDirContextMenu(CLEAN, false); } void Qt4Manager::rebuildSubDirContextMenu() { - handleSubDirContextMenu(REBUILD); + handleSubDirContextMenu(REBUILD, false); } -void Qt4Manager::handleSubDirContextMenu(Qt4Manager::Action action) +void Qt4Manager::buildFileContextMenu() +{ + handleSubDirContextMenu(BUILD, true); +} + +void Qt4Manager::handleSubDirContextMenu(Qt4Manager::Action action, bool isFileBuild) { Qt4Project *qt4pro = qobject_cast(m_contextProject); QTC_ASSERT(qt4pro, return); @@ -427,7 +432,7 @@ void Qt4Manager::handleSubDirContextMenu(Qt4Manager::Action action) if (Qt4ProFileNode *profile = qobject_cast(m_contextNode)) bc->setSubNodeBuild(profile); - if (m_contextFile) + if (isFileBuild && m_contextFile) bc->setFileNodeBuild(m_contextFile); if (projectExplorer()->saveModifiedFiles()) { const Core::Id buildStep = Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD); diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.h b/src/plugins/qt4projectmanager/qt4projectmanager.h index c03069db8d2..32a12fa80cb 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.h +++ b/src/plugins/qt4projectmanager/qt4projectmanager.h @@ -122,6 +122,7 @@ public slots: void buildSubDirContextMenu(); void rebuildSubDirContextMenu(); void cleanSubDirContextMenu(); + void buildFileContextMenu(); private slots: void editorAboutToClose(Core::IEditor *editor); @@ -131,7 +132,7 @@ private slots: private: QList m_projects; - void handleSubDirContextMenu(Action action); + void handleSubDirContextMenu(Action action, bool isFileBuild); void addLibrary(const QString &fileName, Internal::ProFileEditorWidget *editor = 0); void runQMake(ProjectExplorer::Project *p, ProjectExplorer::Node *node); diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp index 97aac6fbc65..245e87eedff 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp +++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp @@ -262,7 +262,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * command->setDescription(m_buildFileAction->text()); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+B"))); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD); - connect(m_buildFileAction, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(buildSubDirContextMenu())); + connect(m_buildFileAction, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(buildFileContextMenu())); connect(m_projectExplorer->buildManager(), SIGNAL(buildStateChanged(ProjectExplorer::Project*)), this, SLOT(buildStateChanged(ProjectExplorer::Project*)));