make really sure the wallpaper is loaded only once
and that an empty wallpaper is not loaded at all
This commit is contained in:
parent
9b52bfad89
commit
ce13335f36
@ -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);
|
||||
|
@ -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"<<m_wallpaperPlugin<<" "<<m_containmentInterface->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();
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ private Q_SLOTS:
|
||||
void syncWallpaperPackage();
|
||||
|
||||
private:
|
||||
QString m_wallpaperPlugin;
|
||||
ContainmentInterface *m_containmentInterface;
|
||||
QmlObject *m_qmlObject;
|
||||
Plasma::Package m_pkg;
|
||||
|
Loading…
Reference in New Issue
Block a user