nasty little hack for when PopupApplet is in a focussable window; prior to this, a PopupApplet in plasmoidviewer would show the popup over and over and over
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=862100
This commit is contained in:
parent
2a979b4e00
commit
f24df9f3ed
@ -54,7 +54,8 @@ public:
|
|||||||
popupPlacement(Plasma::FloatingPopup),
|
popupPlacement(Plasma::FloatingPopup),
|
||||||
savedAspectRatio(Plasma::InvalidAspectRatioMode),
|
savedAspectRatio(Plasma::InvalidAspectRatioMode),
|
||||||
timer(0),
|
timer(0),
|
||||||
startupComplete(false)
|
startupComplete(false),
|
||||||
|
popupLostFocus(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,6 +71,7 @@ public:
|
|||||||
|
|
||||||
void togglePopup();
|
void togglePopup();
|
||||||
void hideTimedPopup();
|
void hideTimedPopup();
|
||||||
|
void clearPopupLostFocus();
|
||||||
void dialogSizeChanged();
|
void dialogSizeChanged();
|
||||||
void dialogStatusChanged(bool status);
|
void dialogStatusChanged(bool status);
|
||||||
void updateDialogPosition();
|
void updateDialogPosition();
|
||||||
@ -83,7 +85,8 @@ public:
|
|||||||
Plasma::AspectRatioMode savedAspectRatio;
|
Plasma::AspectRatioMode savedAspectRatio;
|
||||||
QTimer *timer;
|
QTimer *timer;
|
||||||
QPoint clicked;
|
QPoint clicked;
|
||||||
bool startupComplete;
|
bool startupComplete : 1;
|
||||||
|
bool popupLostFocus : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
PopupApplet::PopupApplet(QObject *parent, const QVariantList &args)
|
PopupApplet::PopupApplet(QObject *parent, const QVariantList &args)
|
||||||
@ -291,11 +294,12 @@ void PopupApplet::constraintsEvent(Plasma::Constraints constraints)
|
|||||||
|
|
||||||
void PopupApplet::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
void PopupApplet::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (!d->icon && event->buttons() == Qt::LeftButton) {
|
if (!d->icon && !d->popupLostFocus && event->buttons() == Qt::LeftButton) {
|
||||||
d->clicked = scenePos().toPoint();
|
d->clicked = scenePos().toPoint();
|
||||||
event->setAccepted(true);
|
event->setAccepted(true);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
d->popupLostFocus = false;
|
||||||
Applet::mousePressEvent(event);
|
Applet::mousePressEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -312,7 +316,9 @@ void PopupApplet::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
bool PopupApplet::eventFilter(QObject *watched, QEvent *event)
|
bool PopupApplet::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
{
|
||||||
if (watched == d->dialog && (event->type() == QEvent::WindowDeactivate)) {
|
if (watched == d->dialog && (event->type() == QEvent::WindowDeactivate)) {
|
||||||
|
d->popupLostFocus = true;
|
||||||
hidePopup();
|
hidePopup();
|
||||||
|
QTimer::singleShot(100, this, SLOT(clearPopupLostFocus()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (watched == graphicsWidget() && (event->type() == QEvent::GraphicsSceneResize)) {
|
if (watched == graphicsWidget() && (event->type() == QEvent::GraphicsSceneResize)) {
|
||||||
@ -378,6 +384,7 @@ void PopupApplet::popupEvent(bool)
|
|||||||
|
|
||||||
void PopupAppletPrivate::togglePopup()
|
void PopupAppletPrivate::togglePopup()
|
||||||
{
|
{
|
||||||
|
kDebug();
|
||||||
if (dialog) {
|
if (dialog) {
|
||||||
if (timer) {
|
if (timer) {
|
||||||
timer->stop();
|
timer->stop();
|
||||||
@ -401,6 +408,11 @@ void PopupAppletPrivate::hideTimedPopup()
|
|||||||
q->hidePopup();
|
q->hidePopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PopupAppletPrivate::clearPopupLostFocus()
|
||||||
|
{
|
||||||
|
popupLostFocus = false;
|
||||||
|
}
|
||||||
|
|
||||||
void PopupAppletPrivate::dialogSizeChanged()
|
void PopupAppletPrivate::dialogSizeChanged()
|
||||||
{
|
{
|
||||||
//Reposition the dialog
|
//Reposition the dialog
|
||||||
|
@ -116,6 +116,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
Q_PRIVATE_SLOT(d, void togglePopup())
|
Q_PRIVATE_SLOT(d, void togglePopup())
|
||||||
Q_PRIVATE_SLOT(d, void hideTimedPopup())
|
Q_PRIVATE_SLOT(d, void hideTimedPopup())
|
||||||
|
Q_PRIVATE_SLOT(d, void clearPopupLostFocus())
|
||||||
Q_PRIVATE_SLOT(d, void dialogSizeChanged())
|
Q_PRIVATE_SLOT(d, void dialogSizeChanged())
|
||||||
Q_PRIVATE_SLOT(d, void dialogStatusChanged(bool))
|
Q_PRIVATE_SLOT(d, void dialogStatusChanged(bool))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user