switch wallpaper plugins

This commit is contained in:
Marco Martin 2013-03-07 15:27:53 +01:00
parent 647e265b0e
commit 18a663228f
4 changed files with 29 additions and 1 deletions

View File

@ -117,4 +117,9 @@ void ContainmentConfigView::setCurrentWallpaper(const QString &wallpaper)
emit currentWallpaperChanged();
}
void ContainmentConfigView::applyWallpaper()
{
m_contianmentInterface->containment()->setWallpaper(m_currentWallpaper);
}
#include "moc_containmentconfigview.cpp"

View File

@ -44,6 +44,8 @@ public:
void setCurrentWallpaper(const QString &wallpaper);
ConfigPropertyMap *wallpaperConfiguration() const;
Q_INVOKABLE void applyWallpaper();
Q_SIGNALS:
void currentWallpaperChanged();

View File

@ -91,6 +91,8 @@ void WallpaperInterface::syncWallpaperPackage()
m_configLoader->deleteLater();
m_configuration->deleteLater();
m_configLoader = 0;
m_configuration = 0;
if (configScheme()) {
m_configuration = new ConfigPropertyMap(configScheme(), this);
}

View File

@ -34,6 +34,7 @@ Column {
configDialog.wallpaperConfiguration[key] = main.currentPage["cfg_"+key]
}
}
configDialog.applyWallpaper()
}
function restoreConfig() {
@ -65,10 +66,10 @@ Column {
}
width: 64
onClicked: {
configDialog.currentWallpaper = model.pluginName
if (delegate.current) {
return
} else {
configDialog.currentWallpaper = model.pluginName
main.sourceFile = model.source
root.restoreConfig()
}
@ -78,10 +79,28 @@ Column {
categoriesView.currentIndex = index
}
}
Component.onCompleted: {
if (configDialog.currentWallpaper == model.pluginName) {
loadWallpaperTimer.pendingCurrent = model
loadWallpaperTimer.restart()
}
}
}
highlight: Rectangle {
color: theme.highlightColor
}
Timer {
id: loadWallpaperTimer
interval: 100
property variant pendingCurrent
onTriggered: {
if (pendingCurrent) {
main.sourceFile = pendingCurrent.source
root.restoreConfig()
categoriesView.currentIndex = pendingCurrent.index
}
}
}
}
PlasmaComponents.PageStack {
id: main