From e202e4b8e0c891c362c29905e2f310ff9ee02279 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Mon, 24 Oct 2011 13:10:38 +0000 Subject: Fix various crashes Task-Number: QTCREATORBUG-6365 Change-Id: I19a200e3c811eef83d591f6eacca3e48eb0fba8f Reviewed-by: Tobias Hunger --- .../projectexplorer/runsettingspropertiespage.cpp | 32 +++++++++++++++++----- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'src/plugins/projectexplorer/runsettingspropertiespage.cpp') diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.cpp b/src/plugins/projectexplorer/runsettingspropertiespage.cpp index e1016ca460..e0497ca72e 100644 --- a/src/plugins/projectexplorer/runsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/runsettingspropertiespage.cpp @@ -42,6 +42,8 @@ #include #include +#include +#include #include #include @@ -389,15 +391,31 @@ void RunSettingsWidget::addDeployConfiguration() void RunSettingsWidget::removeDeployConfiguration() { DeployConfiguration *dc = m_target->activeDeployConfiguration(); - QMessageBox msgBox(QMessageBox::Question, tr("Remove Deploy Configuration?"), - tr("Do you really want to delete deploy configuration %1?").arg(dc->displayName()), - QMessageBox::Yes|QMessageBox::No, this); - msgBox.setDefaultButton(QMessageBox::No); - msgBox.setEscapeButton(QMessageBox::No); - if (msgBox.exec() == QMessageBox::No) - return; + ProjectExplorer::BuildManager *bm = ProjectExplorerPlugin::instance()->buildManager(); + if (bm->isBuilding(dc)) { + QMessageBox box; + QPushButton *closeAnyway = box.addButton(tr("Cancel Build && Remove Deploy Configuration"), QMessageBox::AcceptRole); + QPushButton *cancelClose = box.addButton(tr("Do Not Remove"), QMessageBox::RejectRole); + box.setDefaultButton(cancelClose); + box.setWindowTitle(tr("Remove Deploy Configuration %1?").arg(dc->displayName())); + box.setText(tr("The deploy configuration %1 is currently being built.").arg(dc->displayName())); + box.setInformativeText(tr("Do you want to cancel the build process and remove the Deploy Configuration anyway?")); + box.exec(); + if (box.clickedButton() != closeAnyway) + return; + bm->cancel(); + } else { + QMessageBox msgBox(QMessageBox::Question, tr("Remove Deploy Configuration?"), + tr("Do you really want to delete deploy configuration %1?").arg(dc->displayName()), + QMessageBox::Yes|QMessageBox::No, this); + msgBox.setDefaultButton(QMessageBox::No); + msgBox.setEscapeButton(QMessageBox::No); + if (msgBox.exec() == QMessageBox::No) + return; + } m_target->removeDeployConfiguration(dc); + m_removeDeployToolButton->setEnabled(m_target->deployConfigurations().size() > 1); } -- cgit v1.2.1