From 6ce288cc0ef8790d5e61b34c3d5f151df69dd32f Mon Sep 17 00:00:00 2001 From: Rob Scheepmaker Date: Mon, 17 Nov 2008 20:03:20 +0000 Subject: [PATCH] Make showPopup a slot to be consistent with hidePopup and add a togglepopup slot just for convenience. svn path=/trunk/KDE/kdelibs/; revision=885723 --- popupapplet.cpp | 9 ++++++++- popupapplet.h | 19 ++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/popupapplet.cpp b/popupapplet.cpp index a4e16ae45..835646cea 100644 --- a/popupapplet.cpp +++ b/popupapplet.cpp @@ -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(); diff --git a/popupapplet.h b/popupapplet.h index f63694f93..1d6d619bd 100644 --- a/popupapplet.h +++ b/popupapplet.h @@ -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);