aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/extensionsystem/pluginview.cpp
diff options
context:
space:
mode:
authorLasse Holmstedt <[email protected]>2010-05-19 16:29:47 +0200
committerLasse Holmstedt <[email protected]>2010-05-19 16:36:27 +0200
commit557076410370d708ea61bc0457eb3f8c394a9e09 (patch)
tree01811f4006c3d44670e29f0af8cfc3790149a761 /src/libs/extensionsystem/pluginview.cpp
parent7948147410cb9ef0c46cc2f8045672db41466bb7 (diff)
Fix PluginView to handle dependencies when disabling plugins
Reviewed-by: con
Diffstat (limited to 'src/libs/extensionsystem/pluginview.cpp')
-rw-r--r--src/libs/extensionsystem/pluginview.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/libs/extensionsystem/pluginview.cpp b/src/libs/extensionsystem/pluginview.cpp
index 553f2a14df2..f60b2c32def 100644
--- a/src/libs/extensionsystem/pluginview.cpp
+++ b/src/libs/extensionsystem/pluginview.cpp
@@ -177,8 +177,7 @@ void PluginView::updateList()
defaultCollectionItem->setToolTip(C_LOAD, tr("Load on Startup"));
defaultCollectionItem->setData(0, Qt::UserRole, qVariantFromValue(defaultCollection));
- foreach (PluginSpec *spec, m_specToItem.keys())
- toggleRelatedPlugins(spec, spec->isEnabled() && !spec->isDisabledIndirectly());
+ updatePluginDependencies();
m_ui->categoryWidget->clear();
if (!m_items.isEmpty()) {
@@ -301,7 +300,7 @@ void PluginView::updatePluginSettings(QTreeWidgetItem *item, int column)
if (column == C_LOAD) {
spec->setEnabled(loadOnStartup);
- toggleRelatedPlugins(spec, loadOnStartup);
+ updatePluginDependencies();
if (item->parent()) {
PluginCollection *collection = item->parent()->data(0, Qt::UserRole).value<PluginCollection *>();
@@ -332,33 +331,36 @@ void PluginView::updatePluginSettings(QTreeWidgetItem *item, int column)
spec->setEnabled(loadOnStartup);
Qt::CheckState state = (loadOnStartup ? Qt::Checked : Qt::Unchecked);
child->setData(C_LOAD, Qt::CheckStateRole, state);
- toggleRelatedPlugins(spec, loadOnStartup);
} else {
child->setData(C_LOAD, Qt::CheckStateRole, Qt::Checked);
child->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
}
}
+ updatePluginDependencies();
emit pluginSettingsChanged(collection->plugins().first());
}
m_allowCheckStateUpdate = true;
}
-void PluginView::toggleRelatedPlugins(PluginSpec *modifiedPlugin, bool isPluginEnabled)
+void PluginView::updatePluginDependencies()
{
-
- for(int i = 0; i < modifiedPlugin->providesForSpecs().length(); ++i) {
- PluginSpec *spec = modifiedPlugin->providesForSpecs().at(i);
+ foreach (PluginSpec *spec, PluginManager::instance()->loadQueue()) {
+ bool disableIndirectly = false;
+ foreach(const PluginSpec *depSpec, spec->dependencySpecs()) {
+ if (!depSpec->isEnabled() || depSpec->isDisabledIndirectly()) {
+ disableIndirectly = true;
+ break;
+ }
+ }
QTreeWidgetItem *childItem = m_specToItem.value(spec);
+ childItem->setDisabled(disableIndirectly);
- if (childItem->isDisabled() != !isPluginEnabled) {
- childItem->setDisabled(!isPluginEnabled);
- if (childItem->parent() && !childItem->parent()->isExpanded())
- childItem->parent()->setExpanded(true);
-
+ if (disableIndirectly == spec->isDisabledIndirectly())
+ continue;
+ spec->setDisabledIndirectly(disableIndirectly);
- toggleRelatedPlugins(spec, isPluginEnabled);
- }
+ if (childItem->parent() && !childItem->parent()->isExpanded())
+ childItem->parent()->setExpanded(true);
}
}
-