Now tooltip on kickoff works again, when hide/show it.
The popupApplet has now the capability to know if the dialog is displayed or not, then call popupEvent. svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=855715
This commit is contained in:
parent
7943daabac
commit
91e63390b4
12
dialog.cpp
12
dialog.cpp
@ -197,5 +197,17 @@ bool Dialog::eventFilter(QObject *watched, QEvent *event)
|
||||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void Dialog::hideEvent(QHideEvent * event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
emit dialogVisible(false);
|
||||
}
|
||||
|
||||
void Dialog::showEvent(QShowEvent * event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
emit dialogVisible(true);
|
||||
}
|
||||
|
||||
}
|
||||
#include "dialog.moc"
|
||||
|
8
dialog.h
8
dialog.h
@ -67,6 +67,11 @@ class PLASMA_EXPORT Dialog : public QWidget
|
||||
*/
|
||||
void dialogResized();
|
||||
|
||||
/**
|
||||
* Emit a signal when the dialog become visible/invisible
|
||||
*/
|
||||
void dialogVisible(bool status);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Reimplemented from QWidget
|
||||
@ -74,6 +79,9 @@ class PLASMA_EXPORT Dialog : public QWidget
|
||||
void paintEvent(QPaintEvent *e);
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
void hideEvent (QHideEvent * event);
|
||||
void showEvent (QShowEvent * event);
|
||||
|
||||
|
||||
private:
|
||||
DialogPrivate * const d;
|
||||
|
@ -63,6 +63,7 @@ public:
|
||||
void togglePopup();
|
||||
void hideTimedPopup();
|
||||
void dialogSizeChanged();
|
||||
void dialogStatusChanged(bool status);
|
||||
|
||||
PopupApplet *q;
|
||||
Plasma::Icon *icon;
|
||||
@ -210,7 +211,7 @@ void PopupApplet::constraintsEvent(Plasma::Constraints constraints)
|
||||
d->dialog = new Plasma::Dialog();
|
||||
d->dialog->setWindowFlags(Qt::Popup);
|
||||
connect(d->dialog, SIGNAL(dialogResized()), this, SLOT(dialogSizeChanged()));
|
||||
|
||||
connect(d->dialog, SIGNAL(dialogVisible(bool)), this , SLOT(dialogStatusChanged(bool)));
|
||||
if (graphicsWidget()) {
|
||||
Corona *corona = qobject_cast<Corona *>(graphicsWidget()->scene());
|
||||
|
||||
@ -259,7 +260,6 @@ bool PopupApplet::eventFilter(QObject *watched, QEvent *event)
|
||||
void PopupApplet::showPopup(uint popupDuration)
|
||||
{
|
||||
if (d->dialog && (formFactor() == Horizontal || formFactor() == Vertical)) {
|
||||
popupEvent(true);
|
||||
d->dialog->move(popupPosition(d->dialog->size()));
|
||||
d->dialog->show();
|
||||
|
||||
@ -281,7 +281,6 @@ void PopupApplet::showPopup(uint popupDuration)
|
||||
void PopupApplet::hidePopup()
|
||||
{
|
||||
if (d->dialog && (formFactor() == Horizontal || formFactor() == Vertical)) {
|
||||
popupEvent(false);
|
||||
d->dialog->hide();
|
||||
}
|
||||
}
|
||||
@ -294,16 +293,9 @@ void PopupApplet::popupEvent(bool)
|
||||
void PopupAppletPrivate::togglePopup()
|
||||
{
|
||||
if (dialog) {
|
||||
q->popupEvent(!dialog->isVisible());
|
||||
|
||||
if (dialog->isVisible()) {
|
||||
//TODO: probably this code is never executed... I can't understand why
|
||||
dialog->hide();
|
||||
} else {
|
||||
dialog->move(q->popupPosition(dialog->size()));
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
dialog->move(q->popupPosition(dialog->size()));
|
||||
dialog->show();
|
||||
|
||||
dialog->clearFocus();
|
||||
}
|
||||
}
|
||||
@ -312,7 +304,6 @@ void PopupAppletPrivate::hideTimedPopup()
|
||||
{
|
||||
timer->stop();
|
||||
q->hidePopup();
|
||||
q->popupEvent(false);
|
||||
}
|
||||
|
||||
void PopupAppletPrivate::dialogSizeChanged()
|
||||
@ -324,6 +315,11 @@ void PopupAppletPrivate::dialogSizeChanged()
|
||||
}
|
||||
}
|
||||
|
||||
void PopupAppletPrivate::dialogStatusChanged(bool status)
|
||||
{
|
||||
q->popupEvent(status);
|
||||
}
|
||||
|
||||
} // Plasma namespace
|
||||
|
||||
#include "popupapplet.moc"
|
||||
|
@ -108,6 +108,7 @@ private:
|
||||
Q_PRIVATE_SLOT(d, void togglePopup())
|
||||
Q_PRIVATE_SLOT(d, void hideTimedPopup())
|
||||
Q_PRIVATE_SLOT(d, void dialogSizeChanged())
|
||||
Q_PRIVATE_SLOT(d, void dialogStatusChanged(bool));
|
||||
PopupAppletPrivate * const d;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user