save/track/restore ItemStatus properly

This commit is contained in:
Aaron Seigo 2011-02-04 17:51:12 -08:00
parent b4b0fc207a
commit 2b2f482ecd
3 changed files with 23 additions and 3 deletions

View File

@ -803,10 +803,26 @@ void PopupAppletPrivate::dialogSizeChanged()
}
}
void PopupAppletPrivate::dialogStatusChanged(bool status)
void PopupAppletPrivate::dialogStatusChanged(bool shown)
{
q->setStatus(status ? NeedsAttentionStatus : PassiveStatus);
q->popupEvent(status);
if (shown) {
preShowStatus = q->status();
q->setStatus(NeedsAttentionStatus);
QObject::connect(q, SIGNAL(newStatus(Plasma::ItemStatus)),
q, SLOT(statusChangeWhileShown(Plasma::ItemStatus)),
Qt::UniqueConnection);
} else {
QObject::disconnect(q, SIGNAL(newStatus(Plasma::ItemStatus)),
q, SLOT(statusChangeWhileShown(Plasma::ItemStatus)));
q->setStatus(preShowStatus);
}
q->popupEvent(shown);
}
void PopupAppletPrivate::statusChangeWhileShown(Plasma::ItemStatus status)
{
preShowStatus = status;
}
void PopupAppletPrivate::restoreDialogSize()

View File

@ -230,6 +230,7 @@ private:
Q_PRIVATE_SLOT(d, void updateDialogPosition())
Q_PRIVATE_SLOT(d, void appletActivated())
Q_PRIVATE_SLOT(d, void iconSizeChanged(int))
Q_PRIVATE_SLOT(d, void statusChangeWhileShown(Plasma::ItemStatus status))
friend class Applet;
friend class AppletPrivate;

View File

@ -46,6 +46,8 @@ public:
void checkExtenderAppearance(Plasma::FormFactor f);
KConfigGroup popupConfigGroup();
void appletActivated();
void statusChangeWhileShown(Plasma::ItemStatus status);
PopupApplet *q;
Plasma::IconWidget *icon;
@ -59,6 +61,7 @@ public:
QTimer *autohideTimer;
QBasicTimer delayedShowTimer;
QPoint clicked;
ItemStatus preShowStatus;
bool popupLostFocus : 1;
bool passive : 1;
};