From 03801e29efe5c2054a39b36a6872b1ec3d134ebe Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 28 Jan 2020 16:56:37 +0100 Subject: [PATCH] ProjectExplorer: Add action to enable a kit for all projects Fixes: QTCREATORBUG-22964 Change-Id: Ife27bae6422043c3cde4e7995947e97a5f1cfd4d Reviewed-by: hjk --- .../projectexplorer/targetsettingspanel.cpp | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp index 79cfe02fdbb..e84f0280896 100644 --- a/src/plugins/projectexplorer/targetsettingspanel.cpp +++ b/src/plugins/projectexplorer/targetsettingspanel.cpp @@ -405,6 +405,16 @@ public: m_project->addTargetForKit(kit); }); + QAction * const enableForAllAction + = menu->addAction(tr("Enable Kit \"%1\" for All Projects").arg(kitName)); + enableForAllAction->setEnabled(isSelectable); + QObject::connect(enableForAllAction, &QAction::triggered, [kit] { + for (Project * const p : SessionManager::projects()) { + if (!p->target(kit)) + p->addTargetForKit(kit); + } + }); + QAction *disableAction = menu->addAction(tr("Disable Kit \"%1\" for Project \"%2\"").arg(kitName, projectName)); disableAction->setEnabled(isSelectable && m_kitId.isValid() && isEnabled()); QObject::connect(disableAction, &QAction::triggered, m_project, [this] { @@ -430,6 +440,20 @@ public: m_project->removeTarget(t); }); + QAction *disableForAllAction + = menu->addAction(tr("Disable Kit \"%1\" for All Projects").arg(kitName)); + disableForAllAction->setEnabled(isSelectable); + QObject::connect(disableForAllAction, &QAction::triggered, [kit] { + for (Project * const p : SessionManager::projects()) { + Target * const t = p->target(kit); + if (!t) + continue; + if (BuildManager::isBuilding(t)) + BuildManager::cancel(); + p->removeTarget(t); + } + }); + QMenu *copyMenu = menu->addMenu(tr("Copy Steps From Another Kit...")); if (m_kitId.isValid() && m_project->target(m_kitId)) { const QList kits = KitManager::kits();