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
This commit is contained in:
Aaron J. Seigo 2008-12-29 06:03:43 +00:00
parent c1266d8689
commit 52ad594971
4 changed files with 23 additions and 0 deletions

View File

@ -1164,6 +1164,11 @@ KShortcut Applet::globalShortcut() const
return KShortcut(); return KShortcut();
} }
bool Applet::isPopupShowing() const
{
return false;
}
void Applet::addAssociatedWidget(QWidget *widget) void Applet::addAssociatedWidget(QWidget *widget)
{ {
d->actions.addAssociatedWidget(widget); d->actions.addAssociatedWidget(widget);

View File

@ -508,6 +508,13 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
*/ */
KShortcut globalShortcut() const; 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. * associate actions with this widget, including ones added after this call.
* needed to make keyboard shortcuts work. * needed to make keyboard shortcuts work.

View File

@ -66,6 +66,7 @@ void PopupApplet::setPopupIcon(const QIcon &icon)
setLayout(0); setLayout(0);
setAspectRatioMode(d->savedAspectRatio); setAspectRatioMode(d->savedAspectRatio);
} }
return; return;
} }
@ -434,6 +435,11 @@ bool PopupApplet::isPassivePopup() const
return d->passive; return d->passive;
} }
bool PopupApplet::isPopupShowing() const
{
return d->dialog && d->dialog->isVisible();
}
PopupAppletPrivate::PopupAppletPrivate(PopupApplet *applet) PopupAppletPrivate::PopupAppletPrivate(PopupApplet *applet)
: q(applet), : q(applet),
icon(0), icon(0),

View File

@ -100,6 +100,11 @@ public:
*/ */
bool isPassivePopup() const; bool isPassivePopup() const;
/**
* @return true if the applet is popped up
*/
bool isPopupShowing() const;
public Q_SLOTS: public Q_SLOTS:
/** /**
* Hides the popup. * Hides the popup.