delay url setting until initialized

This commit is contained in:
Aaron Seigo 2011-03-03 07:52:13 +01:00
parent 15ac609228
commit 5a3c398e5a
2 changed files with 8 additions and 1 deletions

View File

@ -72,6 +72,7 @@ public:
Wallpaper::ResizeMethod lastResizeMethod;
QSizeF targetSize;
WallpaperScript *script;
QList<KUrl> pendingUrls;
bool cacheRendering : 1;
bool initialized : 1;
bool needsConfig : 1;

View File

@ -146,7 +146,9 @@ void Wallpaper::addUrls(const KUrl::List &urls)
void Wallpaper::setUrls(const KUrl::List &urls)
{
if (d->script) {
if (!d->initialized) {
d->pendingUrls = urls;
} else if (d->script) {
d->script->setUrls(urls);
} else {
QMetaObject::invokeMethod(this, "addUrls", Q_ARG(KUrl::List, urls));
@ -329,6 +331,10 @@ void Wallpaper::restore(const KConfigGroup &config)
{
init(config);
d->initialized = true;
if (!d->pendingUrls.isEmpty()) {
setUrls(d->pendingUrls);
d->pendingUrls.clear();
}
}
void Wallpaper::init(const KConfigGroup &config)