get rid of ContainmentActions::isInitialized()
This commit is contained in:
parent
95cca61920
commit
6662b81c58
@ -899,16 +899,12 @@ void Containment::setContainmentActions(const QString &trigger, const QString &p
|
|||||||
plugin = 0;
|
plugin = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pluginName.isEmpty()) {
|
if (pluginName.isEmpty()) {
|
||||||
cfg.deleteEntry(trigger);
|
cfg.deleteEntry(trigger);
|
||||||
} else if (plugin) {
|
} else if (plugin) {
|
||||||
//it already existed, just reload config
|
// it already existed, reset the containment so it wil reload config on next show
|
||||||
if (plugin->isInitialized()) {
|
plugin->setContainment(0);
|
||||||
plugin->setContainment(this); //to be safe
|
|
||||||
//FIXME make a truly unique config group
|
|
||||||
KConfigGroup pluginConfig = KConfigGroup(&cfg, trigger);
|
|
||||||
plugin->restore(pluginConfig);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
switch (d->containmentActionsSource) {
|
switch (d->containmentActionsSource) {
|
||||||
case ContainmentPrivate::Activity:
|
case ContainmentPrivate::Activity:
|
||||||
@ -919,6 +915,7 @@ void Containment::setContainmentActions(const QString &trigger, const QString &p
|
|||||||
default:
|
default:
|
||||||
plugin = PluginLoader::self()->loadContainmentActions(0, pluginName);
|
plugin = PluginLoader::self()->loadContainmentActions(0, pluginName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin) {
|
if (plugin) {
|
||||||
cfg.writeEntry(trigger, pluginName);
|
cfg.writeEntry(trigger, pluginName);
|
||||||
d->actionPlugins()->insert(trigger, plugin);
|
d->actionPlugins()->insert(trigger, plugin);
|
||||||
|
@ -102,15 +102,9 @@ QString ContainmentActions::pluginName() const
|
|||||||
return d->containmentActionsDescription.pluginName();
|
return d->containmentActionsDescription.pluginName();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContainmentActions::isInitialized() const
|
|
||||||
{
|
|
||||||
return d->initialized;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContainmentActions::restore(const KConfigGroup &config)
|
void ContainmentActions::restore(const KConfigGroup &config)
|
||||||
{
|
{
|
||||||
init(config);
|
init(config);
|
||||||
d->initialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContainmentActions::init(const KConfigGroup &config)
|
void ContainmentActions::init(const KConfigGroup &config)
|
||||||
|
@ -85,11 +85,6 @@ class PLASMA_EXPORT ContainmentActions : public QObject
|
|||||||
**/
|
**/
|
||||||
QString icon() const;
|
QString icon() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true if initialized (usually by calling restore), false otherwise
|
|
||||||
*/
|
|
||||||
bool isInitialized() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method should be called once the plugin is loaded or settings are changed.
|
* This method should be called once the plugin is loaded or settings are changed.
|
||||||
* @param config Config group to load settings
|
* @param config Config group to load settings
|
||||||
@ -167,6 +162,11 @@ class PLASMA_EXPORT ContainmentActions : public QObject
|
|||||||
*/
|
*/
|
||||||
void setContainment(Containment *newContainment);
|
void setContainment(Containment *newContainment);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the containment the plugin is associated with.
|
||||||
|
*/
|
||||||
|
Containment *containment();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
/**
|
/**
|
||||||
* Emitted when @see configurationRequired() changes
|
* Emitted when @see configurationRequired() changes
|
||||||
@ -200,11 +200,6 @@ class PLASMA_EXPORT ContainmentActions : public QObject
|
|||||||
*/
|
*/
|
||||||
void setConfigurationRequired(bool needsConfiguring = true);
|
void setConfigurationRequired(bool needsConfiguring = true);
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the containment the plugin is associated with.
|
|
||||||
*/
|
|
||||||
Containment *containment();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class ContainmentActionsPackage;
|
friend class ContainmentActionsPackage;
|
||||||
friend class ContainmentActionsPrivate;
|
friend class ContainmentActionsPrivate;
|
||||||
|
@ -859,9 +859,11 @@ bool ContainmentPrivate::prepareContainmentActions(const QString &trigger, const
|
|||||||
if (!plugin) {
|
if (!plugin) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (plugin->containment() != q) {
|
||||||
plugin->setContainment(q);
|
plugin->setContainment(q);
|
||||||
|
|
||||||
if (!plugin->isInitialized()) {
|
// now configure it
|
||||||
KConfigGroup cfg = q->containmentActionsConfig();
|
KConfigGroup cfg = q->containmentActionsConfig();
|
||||||
KConfigGroup pluginConfig = KConfigGroup(&cfg, trigger);
|
KConfigGroup pluginConfig = KConfigGroup(&cfg, trigger);
|
||||||
plugin->restore(pluginConfig);
|
plugin->restore(pluginConfig);
|
||||||
|
@ -32,9 +32,8 @@ public:
|
|||||||
q(containmentActions),
|
q(containmentActions),
|
||||||
containmentActionsDescription(service),
|
containmentActionsDescription(service),
|
||||||
package(0),
|
package(0),
|
||||||
initialized(false),
|
containment(0),
|
||||||
needsConfig(false),
|
needsConfig(false)
|
||||||
containment(0)
|
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -42,9 +41,8 @@ public:
|
|||||||
KPluginInfo containmentActionsDescription;
|
KPluginInfo containmentActionsDescription;
|
||||||
Package *package;
|
Package *package;
|
||||||
KServiceAction mode;
|
KServiceAction mode;
|
||||||
bool initialized : 1;
|
|
||||||
bool needsConfig : 1;
|
|
||||||
Containment *containment;
|
Containment *containment;
|
||||||
|
bool needsConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Plasma
|
} // namespace Plasma
|
||||||
|
Loading…
Reference in New Issue
Block a user