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
This commit is contained in:
Marco Martin 2010-04-15 19:25:30 +00:00
parent daffafb9fe
commit fbe946ca4c
3 changed files with 14 additions and 2 deletions

View File

@ -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());
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) {

View File

@ -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;

View File

@ -43,6 +43,7 @@ public:
void popupConstraintsEvent(Plasma::Constraints constraints);
void checkExtenderAppearance(Plasma::FormFactor f);
KConfigGroup popupConfigGroup();
void appletActivated();
PopupApplet *q;
Plasma::IconWidget *icon;