From 86b50d83c09996e839f34913207697d0276c9176 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 29 May 2015 15:57:30 +0200 Subject: [PATCH] Wizards: Disable wizard actions while NewDialog is visible Change-Id: I4ceeeeba2e67132cca40e59f9f01c6da994b0f3b Reviewed-by: Eike Ziller --- src/plugins/coreplugin/iwizardfactory.cpp | 8 ++++++++ src/plugins/coreplugin/iwizardfactory.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/plugins/coreplugin/iwizardfactory.cpp b/src/plugins/coreplugin/iwizardfactory.cpp index c79785ef5b0..ed816659374 100644 --- a/src/plugins/coreplugin/iwizardfactory.cpp +++ b/src/plugins/coreplugin/iwizardfactory.cpp @@ -329,6 +329,13 @@ void IWizardFactory::clearWizardFactories() s_areFactoriesLoaded = false; } +void IWizardFactory::updateActions() +{ + bool isRunning = ICore::isNewItemDialogRunning(); + foreach (IWizardFactory *factory, s_allFactories) + factory->m_action->setEnabled(!isRunning); +} + FeatureSet IWizardFactory::pluginFeatures() const { static FeatureSet plugins; @@ -357,6 +364,7 @@ FeatureSet IWizardFactory::availableFeatures(const QString &platformName) const void IWizardFactory::initialize() { connect(ICore::instance(), &ICore::coreAboutToClose, &IWizardFactory::clearWizardFactories); + connect(ICore::instance(), &ICore::newItemDialogRunningChanged, &IWizardFactory::updateActions); auto resetAction = new QAction(tr("Reload All Wizards"), ActionManager::instance()); ActionManager::registerAction(resetAction, "Wizard.Factory.Reset"); diff --git a/src/plugins/coreplugin/iwizardfactory.h b/src/plugins/coreplugin/iwizardfactory.h index 670d0b7ecc2..00ccbef69fa 100644 --- a/src/plugins/coreplugin/iwizardfactory.h +++ b/src/plugins/coreplugin/iwizardfactory.h @@ -121,6 +121,7 @@ private: static void destroyFeatureProvider(); static void clearWizardFactories(); + static void updateActions(); QAction *m_action = 0; IWizardFactory::WizardKind m_kind;