diff --git a/src/scriptengines/qml/plasmoid/containmentinterface.cpp b/src/scriptengines/qml/plasmoid/containmentinterface.cpp index 7148684e4..69a35527d 100644 --- a/src/scriptengines/qml/plasmoid/containmentinterface.cpp +++ b/src/scriptengines/qml/plasmoid/containmentinterface.cpp @@ -167,7 +167,7 @@ void ContainmentInterface::appletRemovedForward(Plasma::Applet *applet) void ContainmentInterface::loadWallpaper() { - if (m_appletScriptEngine->drawWallpaper()) { + if (m_appletScriptEngine->drawWallpaper() && !containment()->wallpaper().isEmpty()) { delete m_wallpaperInterface; m_wallpaperInterface = new WallpaperInterface(this); diff --git a/src/scriptengines/qml/plasmoid/wallpaperinterface.cpp b/src/scriptengines/qml/plasmoid/wallpaperinterface.cpp index 98ba87130..b4f7ffadb 100644 --- a/src/scriptengines/qml/plasmoid/wallpaperinterface.cpp +++ b/src/scriptengines/qml/plasmoid/wallpaperinterface.cpp @@ -38,10 +38,12 @@ WallpaperInterface::WallpaperInterface(ContainmentInterface *parent) m_configLoader(0), m_configuration(0) { + if (!m_containmentInterface->containment()->wallpaper().isEmpty()) { + syncWallpaperPackage(); + } connect(m_containmentInterface->containment(), &Plasma::Containment::wallpaperChanged, this, &WallpaperInterface::syncWallpaperPackage); - syncWallpaperPackage(); } WallpaperInterface::~WallpaperInterface() @@ -80,6 +82,13 @@ Plasma::ConfigLoader *WallpaperInterface::configScheme() void WallpaperInterface::syncWallpaperPackage() { +qWarning()<<"22222222222222222"<containment()->wallpaper(); + if (m_wallpaperPlugin == m_containmentInterface->containment()->wallpaper()) { + return; + } + + m_wallpaperPlugin = m_containmentInterface->containment()->wallpaper(); + if (!m_qmlObject) { m_qmlObject = new QmlObject(this); m_qmlObject->setInitializationDelayed(true); @@ -87,7 +96,7 @@ void WallpaperInterface::syncWallpaperPackage() m_pkg = Plasma::PluginLoader::self()->loadPackage("Plasma/Generic"); m_pkg.setDefaultPackageRoot("plasma/wallpapers"); - m_pkg.setPath(m_containmentInterface->containment()->wallpaper()); + m_pkg.setPath(m_wallpaperPlugin); m_configLoader->deleteLater(); m_configuration->deleteLater(); @@ -120,7 +129,6 @@ void WallpaperInterface::syncWallpaperPackage() } else { qWarning() << "Error loading the wallpaper, package not found"; } - emit packageChanged(); emit configurationChanged(); } diff --git a/src/scriptengines/qml/plasmoid/wallpaperinterface.h b/src/scriptengines/qml/plasmoid/wallpaperinterface.h index d344e5080..53f2cc222 100644 --- a/src/scriptengines/qml/plasmoid/wallpaperinterface.h +++ b/src/scriptengines/qml/plasmoid/wallpaperinterface.h @@ -57,6 +57,7 @@ private Q_SLOTS: void syncWallpaperPackage(); private: + QString m_wallpaperPlugin; ContainmentInterface *m_containmentInterface; QmlObject *m_qmlObject; Plasma::Package m_pkg;