don't create an unused button

svn path=/trunk/KDE/kdelibs/; revision=889542
This commit is contained in:
Aaron J. Seigo 2008-11-27 06:03:53 +00:00
parent c11105d5af
commit 4659724790
4 changed files with 36 additions and 10 deletions

View File

@ -804,8 +804,6 @@ void Applet::setConfigurationRequired(bool needsConfig, const QString &reason)
//configLayout->setAlignment(explanation, Qt::AlignBottom | Qt::AlignCenter);
}
PushButton *configWidget = new PushButton(d->messageOverlay);
//popupapplets in panels just show an icon, otherwise the button is too large
Plasma::FormFactor f = formFactor();
if (f == Plasma::Horizontal || f == Plasma::Vertical) {

View File

@ -246,7 +246,13 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
//stuff out of your Dialog (extenders). Monitor WindowDeactivate events so we can
//emulate the same kind of behavior as Qt::Popup (close when you click somewhere
//else.
dialog->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
Qt::WindowFlags wflags = Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint;
if (passive) {
wflags |= Qt::X11BypassWindowManagerHint;
}
dialog->setWindowFlags(wflags);
KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager);
dialog->installEventFilter(q);
@ -390,7 +396,21 @@ Plasma::PopupPlacement PopupApplet::popupPlacement() const
void PopupApplet::popupEvent(bool)
{
}
void PopupApplet::setPassivePopup(bool passive)
{
d->passive = passive;
if (d->dialog) {
Qt::WindowFlags wflags = Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint;
if (d->passive) {
wflags |= Qt::X11BypassWindowManagerHint;
}
d->dialog->setWindowFlags(wflags);
}
}
PopupAppletPrivate::PopupAppletPrivate(PopupApplet *applet)
@ -402,7 +422,8 @@ PopupAppletPrivate::PopupAppletPrivate(PopupApplet *applet)
savedAspectRatio(Plasma::InvalidAspectRatioMode),
timer(0),
startupComplete(false),
popupLostFocus(false)
popupLostFocus(false),
passive(false)
{
}

View File

@ -88,13 +88,9 @@ public:
Plasma::PopupPlacement popupPlacement() const;
/**
* This event handler can be reimplemented in a subclass to receive an
* event before the popup is shown or hidden.
* @arg show true if the popup is going to be shown, false if the popup
* is going to be hidden.
* Note that showing and hiding the popup on click is already done in PopupApplet.
*
*/
virtual void popupEvent(bool show);
void setPassivePopup(bool passive);
public Q_SLOTS:
/**
@ -115,6 +111,15 @@ public Q_SLOTS:
void togglePopup();
protected:
/**
* This event handler can be reimplemented in a subclass to receive an
* event before the popup is shown or hidden.
* @arg show true if the popup is going to be shown, false if the popup
* is going to be hidden.
* Note that showing and hiding the popup on click is already done in PopupApplet.
*/
virtual void popupEvent(bool show);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
bool eventFilter(QObject *watched, QEvent *event);
@ -127,6 +132,7 @@ private:
Q_PRIVATE_SLOT(d, void dialogStatusChanged(bool))
friend class Applet;
friend class PopupAppletPrivate;
PopupAppletPrivate * const d;
};

View File

@ -47,6 +47,7 @@ public:
QPoint clicked;
bool startupComplete : 1;
bool popupLostFocus : 1;
bool passive : 1;
};
} // Plasma namespace