make containmentActionsConfig private
it will eventually have to be removed but for now the config needs to exist before the containmentactions instance, therefore still has to be out of ContainmentActions
This commit is contained in:
parent
5b8ee2a834
commit
206c5cfb5e
@ -250,7 +250,7 @@ void Containment::restore(KConfigGroup &group)
|
||||
if (cfg.exists()) {
|
||||
foreach (const QString &key, cfg.keyList()) {
|
||||
//kDebug() << "loading" << key;
|
||||
setContainmentActions(key, cfg.readEntry(key, QString()));
|
||||
addContainmentActions(key, cfg.readEntry(key, QString()));
|
||||
}
|
||||
} else { //shell defaults
|
||||
ContainmentActionsPluginsConfig conf = corona()->containmentActionsDefaults(d->type);
|
||||
@ -258,7 +258,7 @@ void Containment::restore(KConfigGroup &group)
|
||||
QHash<QString,QString> defaults = conf.d->plugins;
|
||||
for (QHash<QString,QString>::const_iterator it = defaults.constBegin(),
|
||||
end = defaults.constEnd(); it != end; ++it) {
|
||||
setContainmentActions(it.key(), it.value());
|
||||
addContainmentActions(it.key(), it.value());
|
||||
}
|
||||
}
|
||||
|
||||
@ -622,9 +622,9 @@ QString Containment::wallpaper() const
|
||||
return d->wallpaper;
|
||||
}
|
||||
|
||||
void Containment::setContainmentActions(const QString &trigger, const QString &pluginName)
|
||||
void Containment::addContainmentActions(const QString &trigger, const QString &pluginName)
|
||||
{
|
||||
KConfigGroup cfg = containmentActionsConfig();
|
||||
KConfigGroup cfg = d->containmentActionsConfig();
|
||||
ContainmentActions *plugin = 0;
|
||||
|
||||
if (d->actionPlugins()->contains(trigger)) {
|
||||
@ -664,15 +664,16 @@ void Containment::setContainmentActions(const QString &trigger, const QString &p
|
||||
emit configNeedsSaving();
|
||||
}
|
||||
|
||||
QStringList Containment::containmentActionsTriggers()
|
||||
QHash<QString, ContainmentActions*> Containment::containmentActions()
|
||||
{
|
||||
return d->actionPlugins()->keys();
|
||||
}
|
||||
|
||||
QString Containment::containmentActions(const QString &trigger)
|
||||
{
|
||||
ContainmentActions *c = d->actionPlugins()->value(trigger);
|
||||
return c ? c->pluginName() : QString();
|
||||
switch (d->containmentActionsSource) {
|
||||
case ContainmentPrivate::Activity:
|
||||
//FIXME
|
||||
case ContainmentPrivate::Local:
|
||||
return d->localActionPlugins;
|
||||
default:
|
||||
return d->globalActionPlugins;
|
||||
}
|
||||
}
|
||||
|
||||
void Containment::setActivity(const QString &activityId)
|
||||
@ -699,26 +700,6 @@ void Containment::showConfigurationInterface()
|
||||
Applet::showConfigurationInterface();
|
||||
}
|
||||
|
||||
KConfigGroup Containment::containmentActionsConfig()
|
||||
{
|
||||
KConfigGroup cfg;
|
||||
switch (d->containmentActionsSource) {
|
||||
case ContainmentPrivate::Local:
|
||||
cfg = config();
|
||||
cfg = KConfigGroup(&cfg, "ActionPlugins");
|
||||
break;
|
||||
case ContainmentPrivate::Activity:
|
||||
cfg = KConfigGroup(corona()->config(), "Activities");
|
||||
cfg = KConfigGroup(&cfg, d->activityId);
|
||||
cfg = KConfigGroup(&cfg, "ActionPlugins");
|
||||
break;
|
||||
default:
|
||||
cfg = KConfigGroup(corona()->config(), "ActionPlugins");
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
|
||||
|
||||
} // Plasma namespace
|
||||
|
||||
|
||||
|
@ -295,25 +295,13 @@ class PLASMA_EXPORT Containment : public Applet
|
||||
* @param pluginName the name of the plugin to attempt to load. blank = set no plugin.
|
||||
* @since 4.4
|
||||
*/
|
||||
void setContainmentActions(const QString &trigger, const QString &pluginName);
|
||||
void addContainmentActions(const QString &trigger, const QString &pluginName);
|
||||
|
||||
/**
|
||||
* @return a list of all triggers that have a containmentactions plugin associated
|
||||
* @since 4.4
|
||||
* @return All the loaded containment action plugins, indexed by trigger name
|
||||
* @since 5.0
|
||||
*/
|
||||
QStringList containmentActionsTriggers();
|
||||
|
||||
/**
|
||||
* @return the plugin name for the given trigger
|
||||
* @since 4.4
|
||||
*/
|
||||
QString containmentActions(const QString &trigger);
|
||||
|
||||
/**
|
||||
* @return the config group that containmentactions plugins go in
|
||||
* @since 4.6
|
||||
*/
|
||||
KConfigGroup containmentActionsConfig();
|
||||
QHash<QString, ContainmentActions*> containmentActions();
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
|
@ -390,6 +390,25 @@ bool ContainmentPrivate::isPanelContainment() const
|
||||
return type == Containment::PanelContainment || type == Containment::CustomPanelContainment;
|
||||
}
|
||||
|
||||
KConfigGroup ContainmentPrivate::containmentActionsConfig() const
|
||||
{
|
||||
KConfigGroup cfg;
|
||||
switch (containmentActionsSource) {
|
||||
case ContainmentPrivate::Local:
|
||||
cfg = q->config();
|
||||
cfg = KConfigGroup(&cfg, "ActionPlugins");
|
||||
break;
|
||||
case ContainmentPrivate::Activity:
|
||||
cfg = KConfigGroup(q->corona()->config(), "Activities");
|
||||
cfg = KConfigGroup(&cfg, activityId);
|
||||
cfg = KConfigGroup(&cfg, "ActionPlugins");
|
||||
break;
|
||||
default:
|
||||
cfg = KConfigGroup(q->corona()->config(), "ActionPlugins");
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
|
||||
bool ContainmentPrivate::prepareContainmentActions(const QString &trigger, const QPoint &screenPos, KMenu *menu)
|
||||
{
|
||||
ContainmentActions *plugin = actionPlugins()->value(trigger);
|
||||
@ -401,7 +420,7 @@ bool ContainmentPrivate::prepareContainmentActions(const QString &trigger, const
|
||||
plugin->setContainment(q);
|
||||
|
||||
// now configure it
|
||||
KConfigGroup cfg = q->containmentActionsConfig();
|
||||
KConfigGroup cfg = containmentActionsConfig();
|
||||
KConfigGroup pluginConfig = KConfigGroup(&cfg, trigger);
|
||||
plugin->restore(pluginConfig);
|
||||
}
|
||||
|
@ -98,6 +98,12 @@ public:
|
||||
*/
|
||||
static void addDefaultActions(KActionCollection *actions, Containment *c = 0);
|
||||
|
||||
/**
|
||||
* @return the config group that containmentactions plugins go in
|
||||
* @since 4.6
|
||||
*/
|
||||
KConfigGroup containmentActionsConfig() const;
|
||||
|
||||
/**
|
||||
* inits the containmentactions if necessary
|
||||
* if it needs configuring, this warns the user and returns false
|
||||
|
Loading…
Reference in New Issue
Block a user