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()
|
void ContainmentInterface::loadWallpaper()
|
||||||
{
|
{
|
||||||
if (m_appletScriptEngine->drawWallpaper()) {
|
if (m_appletScriptEngine->drawWallpaper() && !containment()->wallpaper().isEmpty()) {
|
||||||
delete m_wallpaperInterface;
|
delete m_wallpaperInterface;
|
||||||
|
|
||||||
m_wallpaperInterface = new WallpaperInterface(this);
|
m_wallpaperInterface = new WallpaperInterface(this);
|
||||||
|
@ -38,10 +38,12 @@ WallpaperInterface::WallpaperInterface(ContainmentInterface *parent)
|
|||||||
m_configLoader(0),
|
m_configLoader(0),
|
||||||
m_configuration(0)
|
m_configuration(0)
|
||||||
{
|
{
|
||||||
|
if (!m_containmentInterface->containment()->wallpaper().isEmpty()) {
|
||||||
|
syncWallpaperPackage();
|
||||||
|
}
|
||||||
connect(m_containmentInterface->containment(), &Plasma::Containment::wallpaperChanged,
|
connect(m_containmentInterface->containment(), &Plasma::Containment::wallpaperChanged,
|
||||||
this, &WallpaperInterface::syncWallpaperPackage);
|
this, &WallpaperInterface::syncWallpaperPackage);
|
||||||
|
|
||||||
syncWallpaperPackage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WallpaperInterface::~WallpaperInterface()
|
WallpaperInterface::~WallpaperInterface()
|
||||||
@ -80,6 +82,13 @@ Plasma::ConfigLoader *WallpaperInterface::configScheme()
|
|||||||
|
|
||||||
void WallpaperInterface::syncWallpaperPackage()
|
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) {
|
if (!m_qmlObject) {
|
||||||
m_qmlObject = new QmlObject(this);
|
m_qmlObject = new QmlObject(this);
|
||||||
m_qmlObject->setInitializationDelayed(true);
|
m_qmlObject->setInitializationDelayed(true);
|
||||||
@ -87,7 +96,7 @@ void WallpaperInterface::syncWallpaperPackage()
|
|||||||
|
|
||||||
m_pkg = Plasma::PluginLoader::self()->loadPackage("Plasma/Generic");
|
m_pkg = Plasma::PluginLoader::self()->loadPackage("Plasma/Generic");
|
||||||
m_pkg.setDefaultPackageRoot("plasma/wallpapers");
|
m_pkg.setDefaultPackageRoot("plasma/wallpapers");
|
||||||
m_pkg.setPath(m_containmentInterface->containment()->wallpaper());
|
m_pkg.setPath(m_wallpaperPlugin);
|
||||||
|
|
||||||
m_configLoader->deleteLater();
|
m_configLoader->deleteLater();
|
||||||
m_configuration->deleteLater();
|
m_configuration->deleteLater();
|
||||||
@ -120,7 +129,6 @@ void WallpaperInterface::syncWallpaperPackage()
|
|||||||
} else {
|
} else {
|
||||||
qWarning() << "Error loading the wallpaper, package not found";
|
qWarning() << "Error loading the wallpaper, package not found";
|
||||||
}
|
}
|
||||||
|
|
||||||
emit packageChanged();
|
emit packageChanged();
|
||||||
emit configurationChanged();
|
emit configurationChanged();
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ private Q_SLOTS:
|
|||||||
void syncWallpaperPackage();
|
void syncWallpaperPackage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QString m_wallpaperPlugin;
|
||||||
ContainmentInterface *m_containmentInterface;
|
ContainmentInterface *m_containmentInterface;
|
||||||
QmlObject *m_qmlObject;
|
QmlObject *m_qmlObject;
|
||||||
Plasma::Package m_pkg;
|
Plasma::Package m_pkg;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user