From fbe946ca4ca9f37631ffc5d3caa2a4338bd89bba Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 15 Apr 2010 19:25:30 +0000 Subject: [PATCH] don't toggle the popup on activate, but actually show it also set the state on needsattention. if the view of the applet is not the same for its containment, call popupposition with the parent of the applet rather than the applet itself. this fixes the popup appearing at funny places for applets in systemtray, like devicenotifier svn path=/trunk/KDE/kdelibs/; revision=1115260 --- popupapplet.cpp | 14 ++++++++++++-- popupapplet.h | 1 + private/popupapplet_p.h | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/popupapplet.cpp b/popupapplet.cpp index d6a01c599..cd115a86f 100644 --- a/popupapplet.cpp +++ b/popupapplet.cpp @@ -61,7 +61,7 @@ PopupApplet::PopupApplet(QObject *parent, const QVariantList &args) int iconSize = IconSize(KIconLoader::Desktop); resize(iconSize, iconSize); disconnect(this, SIGNAL(activate()), (Applet*)this, SLOT(setFocus())); - connect(this, SIGNAL(activate()), this, SLOT(togglePopup())); + connect(this, SIGNAL(activate()), this, SLOT(appletActivated())); setAcceptDrops(true); } @@ -430,6 +430,12 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints) emit q->sizeHintChanged(Qt::PreferredSize); } +void PopupAppletPrivate::appletActivated() +{ + q->setStatus(Plasma::NeedsAttentionStatus); + q->showPopup(); +} + void PopupApplet::mousePressEvent(QGraphicsSceneMouseEvent *event) { if (!d->icon && !d->popupLostFocus && event->buttons() == Qt::LeftButton) { @@ -772,7 +778,11 @@ void PopupAppletPrivate::updateDialogPosition() QSize s = dialog->size(); QPoint pos = view->mapFromScene(q->scenePos()); - pos = corona->popupPosition(q, s); + if (!q->containment() || view == q->containment()->view()) { + pos = corona->popupPosition(q, s); + } else { + pos = corona->popupPosition(q->parentItem(), s); + } bool reverse = false; if (q->formFactor() == Plasma::Vertical) { diff --git a/popupapplet.h b/popupapplet.h index 590fee37a..5218c5eda 100644 --- a/popupapplet.h +++ b/popupapplet.h @@ -168,6 +168,7 @@ private: Q_PRIVATE_SLOT(d, void dialogSizeChanged()) Q_PRIVATE_SLOT(d, void dialogStatusChanged(bool)) Q_PRIVATE_SLOT(d, void updateDialogPosition()) + Q_PRIVATE_SLOT(d, void appletActivated()) friend class Applet; friend class AppletPrivate; diff --git a/private/popupapplet_p.h b/private/popupapplet_p.h index 9bf88feaa..3057857c5 100644 --- a/private/popupapplet_p.h +++ b/private/popupapplet_p.h @@ -43,6 +43,7 @@ public: void popupConstraintsEvent(Plasma::Constraints constraints); void checkExtenderAppearance(Plasma::FormFactor f); KConfigGroup popupConfigGroup(); + void appletActivated(); PopupApplet *q; Plasma::IconWidget *icon;