From 5efb247935216ec10983db6ae6aa364933a6516f Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 25 Apr 2013 14:11:53 +0200 Subject: [PATCH] correctly build the wallpaper model --- src/shell/CMakeLists.txt | 1 + src/shell/containmentconfigview.cpp | 23 +++++++++++++++-------- src/shell/containmentconfigview.h | 1 + 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/shell/CMakeLists.txt b/src/shell/CMakeLists.txt index 009ff5a4e..c4529baac 100644 --- a/src/shell/CMakeLists.txt +++ b/src/shell/CMakeLists.txt @@ -83,6 +83,7 @@ target_link_libraries(plasma-shell ${KDE4_KDEUI_LIBS} KDE4__kde4support ${Solid_LIBRARIES} + kdeclarative ) message("+++ kde4support : ${kde4support_LIBRARY}") diff --git a/src/shell/containmentconfigview.cpp b/src/shell/containmentconfigview.cpp index edbc8824f..e73f561fa 100644 --- a/src/shell/containmentconfigview.cpp +++ b/src/shell/containmentconfigview.cpp @@ -42,6 +42,14 @@ ContainmentConfigView::ContainmentConfigView(Plasma::Containment *cont, QWindow { engine()->rootContext()->setContextProperty("configDialog", this); setCurrentWallpaper(cont->containment()->wallpaper()); + + Plasma::Package pkg = Plasma::PluginLoader::self()->loadPackage("Plasma/Generic"); + pkg.setDefaultPackageRoot("plasma/wallpapers"); + pkg.setPath(m_containment->wallpaper()); + QFile file(pkg.filePath("config", "main.xml")); + KConfigGroup cfg = m_containment->config(); + cfg = KConfigGroup(&cfg, "Wallpaper"); + m_currentWallpaperConfig = m_ownWallpaperConfig = new ConfigPropertyMap(new Plasma::ConfigLoader(&cfg, &file), this); } ContainmentConfigView::~ContainmentConfigView() @@ -95,15 +103,13 @@ QString ContainmentConfigView::currentWallpaper() const void ContainmentConfigView::setCurrentWallpaper(const QString &wallpaper) { - /*if (m_currentWallpaper == wallpaper) { + if (m_currentWallpaper == wallpaper) { return; } if (m_containment->wallpaper() == wallpaper) { delete m_currentWallpaperConfig; - if (m_containment->wallpaperInterface()) { - m_currentWallpaperConfig = m_containment->wallpaperInterface()->configuration(); - } + m_currentWallpaperConfig = m_ownWallpaperConfig; } else { if (m_containment->wallpaper() != m_currentWallpaper) { delete m_currentWallpaperConfig; @@ -117,7 +123,7 @@ void ContainmentConfigView::setCurrentWallpaper(const QString &wallpaper) KConfigGroup cfg = m_containment->config(); cfg = KConfigGroup(&cfg, "Wallpaper"); m_currentWallpaperConfig = new ConfigPropertyMap(new Plasma::ConfigLoader(&cfg, &file), this); - }*/ + } m_currentWallpaper = wallpaper; emit currentWallpaperChanged(); @@ -128,11 +134,12 @@ void ContainmentConfigView::applyWallpaper() { m_containment->setWallpaper(m_currentWallpaper); - /*if (m_currentWallpaperConfig != m_containment->wallpaperInterface()->configuration()) { + if (m_currentWallpaperConfig != m_ownWallpaperConfig) { delete m_currentWallpaperConfig; - m_currentWallpaperConfig = m_containment->wallpaperInterface()->configuration(); + m_currentWallpaperConfig = m_ownWallpaperConfig; emit wallpaperConfigurationChanged(); - }*/ + } } + #include "moc_containmentconfigview.cpp" diff --git a/src/shell/containmentconfigview.h b/src/shell/containmentconfigview.h index 1d2dfb16a..b1ee6b8ed 100644 --- a/src/shell/containmentconfigview.h +++ b/src/shell/containmentconfigview.h @@ -57,6 +57,7 @@ private: ConfigModel *m_wallpaperConfigModel; QString m_currentWallpaper; ConfigPropertyMap *m_currentWallpaperConfig; + ConfigPropertyMap *m_ownWallpaperConfig; }; #endif // multiple inclusion guard