From 4869eb7bcce8a57651fd097e42f8d2a9a11cf521 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Fri, 24 May 2024 06:35:13 +0300 Subject: [PATCH] plasma: check the popup dialog visibility on status change too because the status may change as the popup dialog is visible Signed-off-by: Ivailo Monev --- plasma/popupapplet.cpp | 21 +++++++-------------- plasma/private/popupapplet_p.h | 1 - 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/plasma/popupapplet.cpp b/plasma/popupapplet.cpp index 04c656c4..24a29cf5 100644 --- a/plasma/popupapplet.cpp +++ b/plasma/popupapplet.cpp @@ -327,13 +327,13 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints) //kDebug() << "about to switch to a popup"; if (!qWidget && !gWidget) { delete dialogPtr.data(); - maybeStartAnimation(); + statusChange(q->status()); return; } //there was already a dialog? don't make the switch again if (dialogPtr) { - maybeStartAnimation(); + statusChange(q->status()); return; } @@ -406,7 +406,7 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints) emit q->sizeHintChanged(Qt::PreferredSize); } - maybeStartAnimation(); + statusChange(q->status()); } void PopupAppletPrivate::appletActivated() @@ -765,6 +765,10 @@ void PopupAppletPrivate::statusChange(Plasma::ItemStatus status) statusAnimation->setLoopCount(-1); } if (icon) { + // not if the dialog is visible + if (dialogPtr && dialogPtr.data()->isVisible()) { + return; + } statusAnimation->start(QAbstractAnimation::KeepWhenStopped); } } else { @@ -792,17 +796,6 @@ void PopupAppletPrivate::createIconWidget() q->setLayout(layout); } -void PopupAppletPrivate::maybeStartAnimation() -{ - if (statusAnimation && q->status() == Plasma::ItemStatus::NeedsAttentionStatus) { - // not if the dialog is visible - if (dialogPtr && dialogPtr.data()->isVisible()) { - return; - } - statusAnimation->start(QAbstractAnimation::KeepWhenStopped); - } -} - void PopupAppletPrivate::restoreDialogSize() { Plasma::Dialog *dialog = dialogPtr.data(); diff --git a/plasma/private/popupapplet_p.h b/plasma/private/popupapplet_p.h index afb567d5..04843072 100644 --- a/plasma/private/popupapplet_p.h +++ b/plasma/private/popupapplet_p.h @@ -51,7 +51,6 @@ public: void appletActivated(); void statusChange(Plasma::ItemStatus status); void createIconWidget(); - void maybeStartAnimation(); PopupApplet *q; Plasma::IconWidget *icon;