aggregate applet status in the containment

CCBUG:236461

svn path=/trunk/KDE/kdelibs/; revision=1123366
This commit is contained in:
Aaron J. Seigo 2010-05-05 22:33:52 +00:00
parent 5e9ca683a6
commit dcba3a27a6
3 changed files with 24 additions and 0 deletions

View File

@ -930,6 +930,7 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit)
connect(applet, SIGNAL(configNeedsSaving()), this, SIGNAL(configNeedsSaving()));
connect(applet, SIGNAL(releaseVisualFocus()), this, SIGNAL(releaseVisualFocus()));
connect(applet, SIGNAL(appletDestroyed(Plasma::Applet*)), this, SLOT(appletDestroyed(Plasma::Applet*)));
connect(applet, SIGNAL(newStatus(Plasma::ItemStatus)), this, SLOT(checkStatus(Plasma::ItemStatus)));
connect(applet, SIGNAL(activate()), this, SIGNAL(activate()));
if (pos != QPointF(-1, -1)) {
@ -2062,6 +2063,27 @@ void ContainmentPrivate::requestConfiguration()
emit q->configureRequested(q);
}
void ContainmentPrivate::checkStatus(Plasma::ItemStatus appletStatus)
{
//kDebug() << "================== "<< appletStatus << q->status();
if (appletStatus == q->status()) {
emit q->newStatus(appletStatus);
return;
}
if (appletStatus < q->status()) {
// check to see if any other applet has a higher status, and stick with that
// if we do
foreach (Applet *applet, applets) {
if (applet->status() > appletStatus) {
appletStatus = applet->status();
}
}
}
q->setStatus(appletStatus);
}
void Containment::destroy(bool confirm)
{
if (immutability() != Mutable || Applet::d->transient) {

View File

@ -612,6 +612,7 @@ class PLASMA_EXPORT Containment : public Applet
Q_PRIVATE_SLOT(d, void requestConfiguration())
Q_PRIVATE_SLOT(d, void updateToolBoxVisibility())
Q_PRIVATE_SLOT(d, void showDropZoneDelayed())
Q_PRIVATE_SLOT(d, void checkStatus(Plasma::ItemStatus))
Q_PRIVATE_SLOT(d, void remoteAppletReady(Plasma::AccessAppletJob *))
/**
* This slot is called when the 'stat' after a job event has finished.

View File

@ -70,6 +70,7 @@ public:
void updateToolBoxVisibility();
void triggerShowAddWidgets();
void requestConfiguration();
void checkStatus(Plasma::ItemStatus status);
/**
* Called when constraints have been updated on this containment to provide