containments emit uiready only when all applets did

This commit is contained in:
Marco Martin 2013-08-09 14:58:36 +02:00
parent 0d9bc6d7be
commit ebdfbb2e25
3 changed files with 22 additions and 1 deletions

View File

@ -185,7 +185,21 @@ void AppletInterface::init()
}
geometryChanged(QRectF(), QRectF(x(), y(), width(), height()));
emit busyChanged();
m_appletScriptEngine->setUiReady(true);
if (!qobject_cast<Plasma::Containment *>(applet())) {
m_appletScriptEngine->setUiReady(true);
ContainmentInterface *containmentGraphicObject = qobject_cast<ContainmentInterface *>(applet()->containment()->property("graphicObject").value<QObject *>());
if (containmentGraphicObject) {
DeclarativeAppletScript *containmentScript = containmentGraphicObject->m_appletScriptEngine;
containmentScript->m_inProgressAppletInterfaces.remove(this);
if (containmentScript->m_inProgressAppletInterfaces.isEmpty()) {
containmentScript->setUiReady(true);
}
}
}
}
Plasma::Types::FormFactor AppletInterface::formFactor() const

View File

@ -82,6 +82,9 @@ void ContainmentInterface::init()
if (!m_appletInterfaces.isEmpty()) {
emit appletsChanged();
}
if (m_appletScriptEngine->m_inProgressAppletInterfaces.isEmpty()) {
m_appletScriptEngine->setUiReady(true);
}
}
QList <QObject *> ContainmentInterface::applets()
@ -173,6 +176,7 @@ void ContainmentInterface::appletAddedForward(Plasma::Applet *applet)
}
m_appletInterfaces << appletGraphicObject;
m_appletScriptEngine->m_inProgressAppletInterfaces.insert(appletGraphicObject);
emit appletAdded(appletGraphicObject);
emit appletsChanged();
}

View File

@ -24,6 +24,7 @@
#include <kdemacros.h>
#include <QQmlEngine>
#include <QSet>
#include <Plasma/AppletScript>
@ -64,7 +65,9 @@ Q_SIGNALS:
private:
AppletInterface *m_interface;
bool m_uiReady;
QSet<QObject *> m_inProgressAppletInterfaces;
friend class AppletInterface;
friend class ContainmentInterface;
};