diff --git a/applet.cpp b/applet.cpp index 6a6df47b8..4253c7912 100644 --- a/applet.cpp +++ b/applet.cpp @@ -2920,10 +2920,14 @@ AppletOverlayWidget::AppletOverlayWidget(QGraphicsWidget *parent) void AppletOverlayWidget::destroy() { - Animation *zoomAnim = Plasma::Animator::create(Plasma::Animator::ZoomAnimation); - connect(zoomAnim, SIGNAL(finished()), this, SLOT(overlayAnimationComplete())); - zoomAnim->setTargetWidget(this); - zoomAnim->start(); + Animation *anim = Plasma::Animator::create(Plasma::Animator::DisappearAnimation); + if (anim) { + connect(anim, SIGNAL(finished()), this, SLOT(overlayAnimationComplete())); + anim->setTargetWidget(this); + anim->start(); + } else { + overlayAnimationComplete(); + } } void AppletOverlayWidget::overlayAnimationComplete() diff --git a/containment.cpp b/containment.cpp index d228f5c95..00a7f59e3 100644 --- a/containment.cpp +++ b/containment.cpp @@ -936,15 +936,15 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit) applet->installSceneEventFilter(this); //applet->setWindowFlags(Qt::Window); } - } else { applet->init(); - applet->setScale(0); - Plasma::Animation *zoomAnim = Plasma::Animator::create(Plasma::Animator::ZoomAnimation); - connect(zoomAnim, SIGNAL(finished()), this, SLOT(appletAppearAnimationComplete())); - zoomAnim->setTargetWidget(applet); - zoomAnim->setProperty("zoom", 1.0); - zoomAnim->start(QAbstractAnimation::DeleteWhenStopped); + Plasma::Animation *anim = Plasma::Animator::create(Plasma::Animator::AppearAnimation); + if (anim) { + connect(anim, SIGNAL(finished()), this, SLOT(appletAppearAnimationComplete())); + anim->start(QAbstractAnimation::DeleteWhenStopped); + } else { + d->appletAppeared(applet); + } } applet->updateConstraints(Plasma::AllConstraints); @@ -2276,32 +2276,26 @@ void ContainmentPrivate::appletDestroyed(Plasma::Applet *applet) void ContainmentPrivate::appletAppearAnimationComplete() { Animation *anim = qobject_cast(q->sender()); - if (!anim) { - return; - } - - Applet *applet = qobject_cast(anim->targetWidget()); - if (!applet) { - return; - } - - Animation *pulse = Plasma::Animator::create(Plasma::Animator::PulseAnimation); - pulse->setTargetWidget(applet); - pulse->setProperty("duration", 300); - pulse->setProperty("targetScale", 1.3); - pulse->start(QAbstractAnimation::DeleteWhenStopped); - - if (applet->parentItem() == q) { - if (type == Containment::DesktopContainment) { - applet->installSceneEventFilter(q); + if (anim) { + Applet *applet = qobject_cast(anim->targetWidget()); + if (applet) { + appletAppeared(applet); } - - KConfigGroup *cg = applet->d->mainConfigGroup(); - applet->save(*cg); - emit q->configNeedsSaving(); } } +void ContainmentPrivate::appletAppeared(Applet *applet) +{ + kDebug() << type << Containment::DesktopContainment; + if (type == Containment::DesktopContainment) { + applet->installSceneEventFilter(q); + } + + KConfigGroup *cg = applet->d->mainConfigGroup(); + applet->save(*cg); + emit q->configNeedsSaving(); +} + void ContainmentPrivate::positionPanel(bool force) { if (!q->scene()) { diff --git a/private/containment_p.h b/private/containment_p.h index 2e4c151a6..f1dd72c19 100644 --- a/private/containment_p.h +++ b/private/containment_p.h @@ -86,8 +86,9 @@ public: QPointF preferredPanelPos(Corona *corona) const; void setLockToolText(); void handleDisappeared(AppletHandle *handle); - void appletDestroyed(Plasma::Applet*); + void appletDestroyed(Applet*); void appletAppearAnimationComplete(); + void appletAppeared(Applet*); void clearDataForMimeJob(KIO::Job *job); void remoteAppletReady(Plasma::AccessAppletJob *job); void mimeTypeRetrieved(KIO::Job *job, const QString &mimetype);