diff --git a/private/wallpaper_p.h b/private/wallpaper_p.h index 47f8ce2d9..f53ecd8c1 100644 --- a/private/wallpaper_p.h +++ b/private/wallpaper_p.h @@ -58,6 +58,7 @@ public: bool cacheRendering : 1; bool initialized : 1; bool needsConfig : 1; + bool scriptInitialized : 1; }; } // namespace Plasma diff --git a/wallpaper.cpp b/wallpaper.cpp index 6a6ac5482..f5d9b4378 100644 --- a/wallpaper.cpp +++ b/wallpaper.cpp @@ -268,6 +268,7 @@ void Wallpaper::restore(const KConfigGroup &config) void Wallpaper::init(const KConfigGroup &config) { if (d->script) { + d->initScript(); d->script->initWallpaper(config); } } @@ -398,7 +399,8 @@ WallpaperPrivate::WallpaperPrivate(KService::Ptr service, Wallpaper *wallpaper) script(0), cacheRendering(false), initialized(false), - needsConfig(false) + needsConfig(false), + scriptInitialized(false) { if (wallpaperDescription.isValid()) { QString api = wallpaperDescription.property("X-Plasma-API").toString(); @@ -417,8 +419,6 @@ WallpaperPrivate::WallpaperPrivate(KService::Ptr service, Wallpaper *wallpaper) << wallpaperDescription.name() << "Wallpaper."; delete package; package = 0; - } else { - QTimer::singleShot(0, q, SLOT(initScript())); } } } @@ -475,9 +475,10 @@ void WallpaperPrivate::setupScriptSupport() void WallpaperPrivate::initScript() { - if (script) { + if (script && !scriptInitialized) { setupScriptSupport(); script->init(); + scriptInitialized = true; } }