Make showPopup a slot to be consistent with hidePopup and add a togglepopup slot just for convenience.

svn path=/trunk/KDE/kdelibs/; revision=885723
This commit is contained in:
Rob Scheepmaker 2008-11-17 20:03:20 +00:00
parent f8a342f0f5
commit 6ce288cc0e
2 changed files with 20 additions and 8 deletions

View File

@ -350,6 +350,13 @@ void PopupApplet::hidePopup()
}
}
void PopupApplet::togglePopup()
{
if (d->dialog && (formFactor() == Horizontal || formFactor() == Vertical)) {
d->dialog->setVisible(!d->dialog->isVisible());
}
}
Plasma::PopupPlacement PopupApplet::popupPlacement() const
{
return d->popupPlacement;
@ -417,7 +424,7 @@ void PopupAppletPrivate::dialogSizeChanged()
{
//Reposition the dialog
if (dialog) {
dialog->updateGeometry();
//dialog->updateGeometry();
dialog->move(q->popupPosition(dialog->size()));
KConfigGroup sizeGroup = q->config();

View File

@ -82,13 +82,6 @@ public:
*/
virtual QGraphicsWidget *graphicsWidget();
/**
* Shows the dialog showing the widget if the applet is in a panel.
* @arg displayTime the time in ms that the popup should be displayed, defaults to 0 which means
* always (until the user closes it again, that is).
*/
void showPopup(uint displayTime = 0);
/**
* @return the placement of the popup relating to the icon
*/
@ -109,6 +102,18 @@ public Q_SLOTS:
*/
void hidePopup();
/**
* Shows the dialog showing the widget if the applet is in a panel.
* @arg displayTime the time in ms that the popup should be displayed, defaults to 0 which means
* always (until the user closes it again, that is).
*/
void showPopup(uint displayTime = 0);
/**
* Toggles the popup.
*/
void togglePopup();
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);