From 52ad5949710983c03bb3e3474eadbcf81a1241f1 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Mon, 29 Dec 2008 06:03:43 +0000 Subject: [PATCH] allow checking if the applet has a popup showing associated with it. not BC, but we haven't released 4.2.0 yet and this is the least ucky way of doig it ;) svn path=/trunk/KDE/kdelibs/; revision=902770 --- applet.cpp | 5 +++++ applet.h | 7 +++++++ popupapplet.cpp | 6 ++++++ popupapplet.h | 5 +++++ 4 files changed, 23 insertions(+) diff --git a/applet.cpp b/applet.cpp index 5791bb1ae..621002494 100644 --- a/applet.cpp +++ b/applet.cpp @@ -1164,6 +1164,11 @@ KShortcut Applet::globalShortcut() const return KShortcut(); } +bool Applet::isPopupShowing() const +{ + return false; +} + void Applet::addAssociatedWidget(QWidget *widget) { d->actions.addAssociatedWidget(widget); diff --git a/applet.h b/applet.h index 66ea41dc9..1d79b6cc5 100644 --- a/applet.h +++ b/applet.h @@ -508,6 +508,13 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget */ KShortcut globalShortcut() const; + /** + * @return true is there is a popup assoiated with this Applet + * showing, such as the dialog of a PopupApplet. May be reimplemented + * for custom popup implementations. + */ + virtual bool isPopupShowing() const; + /** * associate actions with this widget, including ones added after this call. * needed to make keyboard shortcuts work. diff --git a/popupapplet.cpp b/popupapplet.cpp index dfaf6b825..dc0157217 100644 --- a/popupapplet.cpp +++ b/popupapplet.cpp @@ -66,6 +66,7 @@ void PopupApplet::setPopupIcon(const QIcon &icon) setLayout(0); setAspectRatioMode(d->savedAspectRatio); } + return; } @@ -434,6 +435,11 @@ bool PopupApplet::isPassivePopup() const return d->passive; } +bool PopupApplet::isPopupShowing() const +{ + return d->dialog && d->dialog->isVisible(); +} + PopupAppletPrivate::PopupAppletPrivate(PopupApplet *applet) : q(applet), icon(0), diff --git a/popupapplet.h b/popupapplet.h index 8c50758b0..4c9d087d8 100644 --- a/popupapplet.h +++ b/popupapplet.h @@ -100,6 +100,11 @@ public: */ bool isPassivePopup() const; + /** + * @return true if the applet is popped up + */ + bool isPopupShowing() const; + public Q_SLOTS: /** * Hides the popup.