Commit 89126edf authored by Daniel Teske's avatar Daniel Teske
Browse files

Rename PluginSpec::isEnabled() into isEnabledInSettings



This is what it actually is.

Change-Id: I2ea2e77edc3fd80eb1e25156edc7a59e86dfac9a
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@digia.com>
parent 80263a52
......@@ -45,7 +45,7 @@ PluginErrorOverview::PluginErrorOverview(QWidget *parent) :
foreach (PluginSpec *spec, PluginManager::plugins()) {
// only show errors on startup if plugin is enabled.
if (spec->hasError() && spec->isEnabled() && !spec->isDisabledIndirectly()) {
if (spec->hasError() && spec->isEnabledInSettings() && !spec->isDisabledIndirectly()) {
QListWidgetItem *item = new QListWidgetItem(spec->name());
item->setData(Qt::UserRole, qVariantFromValue(spec));
m_ui->pluginList->addItem(item);
......
......@@ -335,7 +335,7 @@ bool PluginManager::hasError()
{
foreach (PluginSpec *spec, plugins()) {
// only show errors on startup if plugin is enabled.
if (spec->hasError() && spec->isEnabled() && !spec->isDisabledIndirectly())
if (spec->hasError() && spec->isEnabledInSettings() && !spec->isDisabledIndirectly())
return true;
}
return false;
......@@ -882,9 +882,9 @@ void PluginManagerPrivate::writeSettings()
QStringList tempDisabledPlugins;
QStringList tempForceEnabledPlugins;
foreach (PluginSpec *spec, pluginSpecs) {
if (!spec->isDisabledByDefault() && !spec->isEnabled())
if (!spec->isDisabledByDefault() && !spec->isEnabledInSettings())
tempDisabledPlugins.append(spec->name());
if (spec->isDisabledByDefault() && spec->isEnabled())
if (spec->isDisabledByDefault() && spec->isEnabledInSettings())
tempForceEnabledPlugins.append(spec->name());
}
......@@ -1120,7 +1120,7 @@ void PluginManagerPrivate::loadPlugin(PluginSpec *spec, PluginSpec::State destSt
return;
// don't load disabled plugins.
if ((spec->isDisabledIndirectly() || !spec->isEnabled()) && destState == PluginSpec::Loaded)
if ((spec->isDisabledIndirectly() || !spec->isEnabledInSettings()) && destState == PluginSpec::Loaded)
return;
switch (destState) {
......
......@@ -283,12 +283,15 @@ bool PluginSpec::isDisabledByDefault() const
}
/*!
\fn bool PluginSpec::isEnabled() const
Returns if the plugin is loaded at startup. True by default - the user can change it from the Plugin settings.
\fn bool PluginSpec::isEnabledInSettings() const
Returns if the plugin should be loaded at startup. True by default
The user can change it from the Plugin settings.
Note: That this function returns true even if a plugin is disabled because
of a not loaded dependencies, or a error in loading.
*/
bool PluginSpec::isEnabled() const
bool PluginSpec::isEnabledInSettings() const
{
return d->enabled;
return d->enabledInSettings;
}
/*!
......@@ -468,7 +471,7 @@ PluginSpecPrivate::PluginSpecPrivate(PluginSpec *spec)
:
experimental(false),
disabledByDefault(false),
enabled(true),
enabledInSettings(true),
disabledIndirectly(false),
plugin(0),
state(PluginSpec::Invalid),
......@@ -528,7 +531,7 @@ bool PluginSpecPrivate::read(const QString &fileName)
void PluginSpec::setEnabled(bool value)
{
d->enabled = value;
d->enabledInSettings = value;
}
void PluginSpec::setDisabledByDefault(bool value)
......@@ -616,7 +619,7 @@ void PluginSpecPrivate::readPluginSpec(QXmlStreamReader &reader)
return;
if (experimental)
disabledByDefault = true;
enabled = !disabledByDefault;
enabledInSettings = !disabledByDefault;
while (!reader.atEnd()) {
reader.readNext();
switch (reader.tokenType()) {
......@@ -888,7 +891,7 @@ bool PluginSpecPrivate::resolveDependencies(const QList<PluginSpec *> &specs)
void PluginSpecPrivate::disableIndirectlyIfDependencyDisabled()
{
if (!enabled)
if (!enabledInSettings)
return;
if (disabledIndirectly)
......@@ -900,7 +903,7 @@ void PluginSpecPrivate::disableIndirectlyIfDependencyDisabled()
if (it.key().type == PluginDependency::Optional)
continue;
PluginSpec *dependencySpec = it.value();
if (dependencySpec->isDisabledIndirectly() || !dependencySpec->isEnabled()) {
if (dependencySpec->isDisabledIndirectly() || !dependencySpec->isEnabledInSettings()) {
disabledIndirectly = true;
break;
}
......
......@@ -92,7 +92,7 @@ public:
QString category() const;
bool isExperimental() const;
bool isDisabledByDefault() const;
bool isEnabled() const;
bool isEnabledInSettings() const;
bool isDisabledIndirectly() const;
QList<PluginDependency> dependencies() const;
......
......@@ -73,7 +73,7 @@ public:
QString url;
QString category;
QList<PluginDependency> dependencies;
bool enabled;
bool enabledInSettings;
bool disabledIndirectly;
QString location;
......
......@@ -189,7 +189,7 @@ void PluginView::updateList()
int PluginView::parsePluginSpecs(QTreeWidgetItem *parentItem, Qt::CheckState &groupState, QList<PluginSpec*> plugins)
{
int ret = 0;
int loadCount = 0;
int checkedCount = 0;
for (int i = 0; i < plugins.length(); ++i) {
PluginSpec *spec = plugins[i];
......@@ -212,9 +212,9 @@ int PluginView::parsePluginSpecs(QTreeWidgetItem *parentItem, Qt::CheckState &gr
pluginItem->setData(0, Qt::UserRole, qVariantFromValue(spec));
Qt::CheckState state = Qt::Unchecked;
if (spec->isEnabled()) {
if (spec->isEnabledInSettings()) {
state = Qt::Checked;
++loadCount;
++checkedCount;
}
if (!m_whitelist.contains(spec->name())) {
......@@ -235,10 +235,10 @@ int PluginView::parsePluginSpecs(QTreeWidgetItem *parentItem, Qt::CheckState &gr
}
if (loadCount == plugins.length()) {
if (checkedCount == plugins.length()) {
groupState = Qt::Checked;
ret |= ParsedAll;
} else if (loadCount == 0) {
} else if (checkedCount == 0) {
groupState = Qt::Unchecked;
ret |= ParsedNone;
} else {
......@@ -300,7 +300,7 @@ void PluginView::updatePluginSettings(QTreeWidgetItem *item, int column)
Qt::CheckState state = Qt::PartiallyChecked;
int loadCount = 0;
for (int i = 0; i < collection->plugins().length(); ++i) {
if (collection->plugins().at(i)->isEnabled())
if (collection->plugins().at(i)->isEnabledInSettings())
++loadCount;
}
if (loadCount == collection->plugins().length())
......@@ -349,7 +349,7 @@ void PluginView::updatePluginDependencies()
if (it.key().type == PluginDependency::Optional)
continue;
PluginSpec *depSpec = it.value();
if (!depSpec->isEnabled() || depSpec->isDisabledIndirectly()) {
if (!depSpec->isEnabledInSettings() || depSpec->isDisabledIndirectly()) {
disableIndirectly = true;
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment