From 2a8024d4a14d4b07d775fcf4a9c28e8812182fae Mon Sep 17 00:00:00 2001 From: Davide Bettio Date: Thu, 28 Aug 2008 18:30:50 +0000 Subject: [PATCH] Added popupEvent. CCMAIL:plasma-devel@kde.org svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=854047 --- popupapplet.cpp | 9 +++++++++ popupapplet.h | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/popupapplet.cpp b/popupapplet.cpp index 5f3e936fb..8d9bb9362 100644 --- a/popupapplet.cpp +++ b/popupapplet.cpp @@ -243,6 +243,7 @@ void PopupApplet::constraintsEvent(Plasma::Constraints constraints) void PopupApplet::showPopup(uint popupDuration) { if (d->dialog && (formFactor() == Horizontal || formFactor() == Vertical)) { + popupEvent(true); d->dialog->move(popupPosition(d->dialog->size())); d->dialog->show(); @@ -264,10 +265,16 @@ void PopupApplet::showPopup(uint popupDuration) void PopupApplet::hidePopup() { if (d->dialog && (formFactor() == Horizontal || formFactor() == Vertical)) { + popupEvent(false); d->dialog->hide(); } } +void PopupApplet::popupEvent(bool) +{ + +} + void PopupApplet::widgetGeometryChanged() { if (graphicsWidget() && layout()) { @@ -284,6 +291,8 @@ void PopupApplet::widgetGeometryChanged() void PopupAppletPrivate::togglePopup() { if (dialog) { + q->popupEvent(!dialog->isVisible()); + if (dialog->isVisible()) { dialog->hide(); } else { diff --git a/popupapplet.h b/popupapplet.h index 6c489a908..c29eab617 100644 --- a/popupapplet.h +++ b/popupapplet.h @@ -88,6 +88,12 @@ public: */ void showPopup(uint displayTime = 0); + /** + * This event handler can be reimplemented in a subclass to receive an event before the popup is showed or hidden. + * @arg show true if the popup is going to be showed, false if the popup is going to be hiden. + */ + virtual void popupEvent(bool show); + public Q_SLOTS: /** * Hides the popup.