wallpapers will no longer have modes; just plugin names to differentiate

modes were a bit of a hack to easily allow one C++ plugin to handle
multiple (to the user) wallpapers. this just doesn't seem necessary
anymore (and even in the C++ case could have been addressed by compiling
multiple plugins that share code)
This commit is contained in:
Aaron Seigo 2013-02-06 15:23:48 +01:00
parent 796dcb132b
commit 46cf753b15
4 changed files with 15 additions and 42 deletions

View File

@ -231,8 +231,7 @@ void Containment::restore(KConfigGroup &group)
restoreContents(group);
setImmutability((ImmutabilityType)group.readEntry("immutability", (int)Mutable));
setWallpaper(group.readEntry("wallpaperplugin", ContainmentPrivate::defaultWallpaper),
group.readEntry("wallpaperpluginmode", ContainmentPrivate::defaultWallpaperMode));
setWallpaper(group.readEntry("wallpaperplugin", ContainmentPrivate::defaultWallpaper));
KConfigGroup cfg;
if (containmentType() == PanelContainment || containmentType() == CustomPanelContainment) {
@ -288,8 +287,6 @@ void Containment::restore(KConfigGroup &group)
#endif
"screen" << screen() <<
"geometry is" << geometry() <<
"wallpaper" << ((d->wallpaper) ? d->wallpaper->pluginName() : QString()) <<
"wallpaper mode" << wallpaperMode() <<
"config entries" << group.entryMap();
*/
}
@ -320,11 +317,7 @@ void Containment::save(KConfigGroup &g) const
group.writeEntry("location", (int)d->location);
group.writeEntry("activityId", d->activityId);
group.writeEntry("wallpaperplugin", d->wallpaper);
group.writeEntry("wallpaperpluginmode", d->wallpaperMode);
//TODO: the wallpaper implementation must know it has to save at this point
saveContents(group);
}
@ -761,24 +754,15 @@ bool Containment::drawWallpaper()
return d->drawWallpaper;
}
void Containment::setWallpaper(const QString &pluginName, const QString &mode)
void Containment::setWallpaper(const QString &pluginName)
{
KConfigGroup cfg = config();
bool newPlugin = pluginName != d->wallpaper;
bool newMode = mode != d->wallpaperMode;
if (newPlugin || newMode) {
if (pluginName != d->wallpaper) {
d->wallpaper = pluginName;
d->wallpaperMode = mode;
if (newMode) {
cfg.writeEntry("wallpaperpluginmode", mode);
}
if (newPlugin) {
cfg.writeEntry("wallpaperplugin", pluginName);
}
KConfigGroup cfg = config();
cfg.writeEntry("wallpaperplugin", d->wallpaper);
emit configNeedsSaving();
emit wallpaperChanged();
}
}
@ -787,11 +771,6 @@ QString Containment::wallpaper() const
return d->wallpaper;
}
QString Containment::wallpaperMode() const
{
return d->wallpaperMode;
}
void Containment::setContainmentActions(const QString &trigger, const QString &pluginName)
{
KConfigGroup cfg = containmentActionsConfig();

View File

@ -69,6 +69,7 @@ class AbstractToolBox;
class PLASMA_EXPORT Containment : public Applet
{
Q_OBJECT
Q_PROPERTY(QString wallpaper READ wallpaper WRITE setWallpaper NOTIFY wallpaperChanged)
public:
@ -302,22 +303,14 @@ class PLASMA_EXPORT Containment : public Applet
* Sets wallpaper plugin.
*
* @param pluginName the name of the wallpaper to attempt to load
* @param mode optional mode or the wallpaper plugin (e.g. "Slideshow").
* These values are pugin specific and enumerated in the plugin's
* .desktop file.
*/
void setWallpaper(const QString &pluginName, const QString &mode = QString());
void setWallpaper(const QString &pluginName);
/**
* Return wallpaper plugin.
*/
QString wallpaper() const;
/**
* Return wallpaper rendering mode.
*/
QString wallpaperMode() const;
/**
* Sets the current activity by id
*
@ -420,6 +413,11 @@ Q_SIGNALS:
*/
void configureRequested(Plasma::Containment *containment);
/**
* Emitted when the wallpaper plugin is changed
*/
void wallpaperChanged();
public Q_SLOTS:
/**
* Informs the Corona as to what position it is in. This is informational

View File

@ -310,11 +310,8 @@ KActionCollection* ContainmentPrivate::actions()
void ContainmentPrivate::configChanged()
{
if (drawWallpaper) {
KConfigGroup group = q->config();
q->setWallpaper(group.readEntry("wallpaperplugin", defaultWallpaper),
group.readEntry("wallpaperpluginmode", defaultWallpaperMode));
}
KConfigGroup group = q->config();
q->setWallpaper(group.readEntry("wallpaperplugin", defaultWallpaper));
}
void ContainmentPrivate::requestConfiguration()

View File

@ -127,7 +127,6 @@ public:
Location location;
Applet::List applets;
QString wallpaper;
QString wallpaperMode;
QHash<QString, ContainmentActions*> localActionPlugins;
int screen;
int lastScreen;