put the whitelist in its own config key

svn path=/trunk/KDE/kdelibs/; revision=1022152
This commit is contained in:
Aaron J. Seigo 2009-09-10 22:26:14 +00:00
parent 01d626b7f4
commit d1c51d506d

View File

@ -117,6 +117,7 @@ public:
KService::List offers = KServiceTypeTrader::self()->query("Plasma/Runner"); KService::List offers = KServiceTypeTrader::self()->query("Plasma/Runner");
bool loadAll = config.readEntry("loadAll", false); bool loadAll = config.readEntry("loadAll", false);
QStringList whiteList = config.readEntry("pluginWhiteList", QStringList());
KConfigGroup pluginConf(&config, "Plugins"); KConfigGroup pluginConf(&config, "Plugins");
foreach (const KService::Ptr &service, offers) { foreach (const KService::Ptr &service, offers) {
@ -133,7 +134,8 @@ public:
description.load(pluginConf); description.load(pluginConf);
bool loaded = runners.contains(runnerName); bool loaded = runners.contains(runnerName);
bool selected = loadAll || description.isPluginEnabled(); bool selected = loadAll ||
description.isPluginEnabled() && (whiteList.isEmpty() || whiteList.contains(runnerName));
if (selected) { if (selected) {
if (!loaded) { if (!loaded) {
@ -295,27 +297,13 @@ void RunnerManager::setAllowedRunners(const QStringList &runners)
d->runners.clear(); d->runners.clear();
KConfigGroup config = d->configGroup(); KConfigGroup config = d->configGroup();
KConfigGroup pluginConf(&config, "Plugins"); config.writeEntry("pluginWhiteList", runners);
pluginConf.deleteGroup();
foreach (const QString &runner, runners) {
pluginConf.writeEntry(runner, true);
}
} }
QStringList RunnerManager::allowedRunners() const QStringList RunnerManager::allowedRunners() const
{ {
KConfigGroup config = d->configGroup(); KConfigGroup config = d->configGroup();
KConfigGroup pluginConf(&config, "Plugins"); return config.readEntry("pluginWhiteList", QStringList());
QStringList runners;
foreach (const QString &key, pluginConf.keyList()) {
if (pluginConf.readEntry(key, true)) {
runners << key;
}
}
return runners;
} }
AbstractRunner* RunnerManager::runner(const QString &name) const AbstractRunner* RunnerManager::runner(const QString &name) const