* make sure we have an animation, return an error if we don't; makes this a bit more robust against changes in libplasma

* don't set the widget to aimate on an animation if the parent is automatically set to the applet; this has odd side-effects like Fade animations causing the plasmoid to disappear ;)

svn path=/trunk/KDE/kdebase/runtime/; revision=1062483
This commit is contained in:
Aaron J. Seigo 2009-12-14 21:52:40 +00:00
parent 15833bac25
commit 49f3bb58da

View File

@ -718,15 +718,23 @@ QScriptValue SimpleJavaScriptApplet::animation(QScriptContext *context, QScriptE
return context->throwError(i18n("%1 is not a known animation type", animName));
}
QGraphicsWidget *parent = extractParent(context, engine);
bool parentIsApplet = false;
QGraphicsWidget *parent = extractParent(context, engine, 0, &parentIsApplet);
if (isPause) {
QPauseAnimation *pause = new QPauseAnimation(parent);
return engine->newQObject(pause);
} else {
Plasma::Animation *anim = Plasma::Animator::create(s_animationDefs.value(animName), parent);
anim->setWidgetToAnimate(parent);
return engine->newQObject(anim);
if (anim) {
if (!parentIsApplet) {
anim->setWidgetToAnimate(parent);
}
return engine->newQObject(anim);
}
}
return context->throwError(i18n("%1 is not a known animation type", animName));
}
QScriptValue SimpleJavaScriptApplet::animationGroup(QScriptContext *context, QScriptEngine *engine)