Figure out why my plasma wasn't notifying the startup
Make sure AppletPrivate::uiReady is set in applet_p.cpp when we report that the ui is ready. Make sure that if we loop through all the containments and they're all ready, we emit that it's done. So far, Corona::startupCompleted was never emitted. REVIEW: 119220
This commit is contained in:
parent
2f933387af
commit
dac1d8f265
@ -409,10 +409,10 @@ void Containment::addApplet(Applet *applet)
|
||||
|
||||
d->applets << applet;
|
||||
|
||||
if (!applet->d->uiReady) {
|
||||
if (!d->uiReady) {
|
||||
d->loadingApplets << applet;
|
||||
if (Applet::d->uiReady) {
|
||||
Applet::d->uiReady = false;
|
||||
if (d->uiReady) {
|
||||
d->uiReady = false;
|
||||
emit uiReadyChanged(false);
|
||||
}
|
||||
}
|
||||
@ -536,7 +536,7 @@ QHash<QString, ContainmentActions *> &Containment::containmentActions()
|
||||
|
||||
bool Containment::isUiReady() const
|
||||
{
|
||||
return Applet::d->uiReady && Applet::d->started;
|
||||
return d->uiReady && Applet::d->started;
|
||||
}
|
||||
|
||||
void Containment::setActivity(const QString &activityId)
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "pluginloader.h"
|
||||
#include "private/applet_p.h"
|
||||
#include "private/containment_p.h"
|
||||
#include "private/timetracker.h"
|
||||
|
||||
using namespace Plasma;
|
||||
|
||||
@ -54,6 +55,10 @@ Corona::Corona(QObject *parent)
|
||||
// qDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Corona ctor start";
|
||||
#endif
|
||||
d->init();
|
||||
|
||||
#ifndef NDEBUG
|
||||
new Plasma::TimeTracker(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
Corona::~Corona()
|
||||
@ -543,6 +548,10 @@ QList<Plasma::Containment *> CoronaPrivate::importLayout(const KConfigGroup &con
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (containmentsStarting <= 0) {
|
||||
emit q->startupCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
return newContainments;
|
||||
|
@ -41,6 +41,8 @@ class CoronaPrivate;
|
||||
class PLASMA_EXPORT Corona : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool isStartupCompleted READ isStartupCompleted NOTIFY startupCompleted)
|
||||
Q_PROPERTY(Plasma::Package package READ package NOTIFY packageChanged)
|
||||
|
||||
public:
|
||||
explicit Corona(QObject *parent = 0);
|
||||
|
@ -67,7 +67,6 @@ AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int
|
||||
needsConfig(false),
|
||||
started(false),
|
||||
globalShortcutEnabled(false),
|
||||
uiReady(false),
|
||||
userConfiguring(false)
|
||||
{
|
||||
if (appletId == 0) {
|
||||
@ -309,27 +308,10 @@ void AppletPrivate::setUiReady()
|
||||
//am i the containment?
|
||||
Containment *c = qobject_cast<Containment *>(q);
|
||||
if (c && c->isContainment()) {
|
||||
//if we are the containment and there is still some uncomplete applet, we're still incomplete
|
||||
if (!c->d->loadingApplets.isEmpty()) {
|
||||
return;
|
||||
} else if (!uiReady && started) {
|
||||
emit c->uiReadyChanged(true);
|
||||
}
|
||||
} else {
|
||||
c = q->containment();
|
||||
if (c) {
|
||||
c->d->loadingApplets.remove(q);
|
||||
|
||||
if (c->d->loadingApplets.isEmpty() && !c->Applet::d->uiReady) {
|
||||
c->Applet::d->uiReady = true;
|
||||
if (c->Applet::d->started) {
|
||||
emit c->uiReadyChanged(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
c->d->setUiReady();
|
||||
} else if (Containment* cc = q->containment()) {
|
||||
cc->d->appletLoaded(q);
|
||||
}
|
||||
|
||||
uiReady = true;
|
||||
}
|
||||
|
||||
// put all setup routines for script here. at this point we can assume that
|
||||
@ -375,9 +357,8 @@ void AppletPrivate::scheduleConstraintsUpdate(Plasma::Types::Constraints c)
|
||||
|
||||
if (c & Plasma::Types::StartupCompletedConstraint) {
|
||||
started = true;
|
||||
if (uiReady) {
|
||||
emit q->containment()->uiReadyChanged(true);
|
||||
}
|
||||
if (q->isContainment())
|
||||
qobject_cast<Containment*>(q)->d->setStarted();
|
||||
}
|
||||
|
||||
pendingConstraints |= c;
|
||||
|
@ -111,7 +111,6 @@ public:
|
||||
bool needsConfig : 1;
|
||||
bool started : 1;
|
||||
bool globalShortcutEnabled : 1;
|
||||
bool uiReady : 1;
|
||||
bool userConfiguring : 1;
|
||||
};
|
||||
|
||||
|
@ -46,7 +46,8 @@ ContainmentPrivate::ContainmentPrivate(Containment *c):
|
||||
formFactor(Types::Planar),
|
||||
location(Types::Floating),
|
||||
lastScreen(-1), // never had a screen
|
||||
type(Plasma::Types::NoContainmentType)
|
||||
type(Plasma::Types::NoContainmentType),
|
||||
uiReady(false)
|
||||
{
|
||||
//if the parent is an applet (i.e we are the systray)
|
||||
//we want to follow screen changed signals from the parent's containment
|
||||
@ -228,4 +229,36 @@ bool ContainmentPrivate::isPanelContainment() const
|
||||
return type == Plasma::Types::PanelContainment || type == Plasma::Types::CustomPanelContainment;
|
||||
}
|
||||
|
||||
void ContainmentPrivate::setStarted()
|
||||
{
|
||||
if (!q->Applet::d->started) {
|
||||
q->Applet::d->started = true;
|
||||
|
||||
if (uiReady)
|
||||
emit q->uiReadyChanged(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ContainmentPrivate::setUiReady()
|
||||
{
|
||||
//if we are the containment and there is still some uncomplete applet, we're still incomplete
|
||||
if (!uiReady && loadingApplets.isEmpty()) {
|
||||
uiReady = true;
|
||||
if (q->Applet::d->started)
|
||||
emit q->uiReadyChanged(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ContainmentPrivate::appletLoaded(Applet* applet)
|
||||
{
|
||||
loadingApplets.remove(q);
|
||||
|
||||
if (loadingApplets.isEmpty() && !uiReady) {
|
||||
uiReady = true;
|
||||
if (q->Applet::d->started) {
|
||||
emit q->uiReadyChanged(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -45,8 +45,6 @@ class ContainmentPrivate
|
||||
{
|
||||
public:
|
||||
ContainmentPrivate(Containment *c);
|
||||
|
||||
|
||||
~ContainmentPrivate();
|
||||
|
||||
void triggerShowAddWidgets();
|
||||
@ -60,7 +58,6 @@ public:
|
||||
void containmentConstraintsEvent(Plasma::Types::Constraints constraints);
|
||||
|
||||
bool isPanelContainment() const;
|
||||
void setLockToolText();
|
||||
void appletDeleted(Applet *);
|
||||
void configChanged();
|
||||
|
||||
@ -78,6 +75,10 @@ public:
|
||||
*/
|
||||
static void addDefaultActions(KActionCollection *actions, Containment *c = 0);
|
||||
|
||||
void setUiReady();
|
||||
void setStarted();
|
||||
void appletLoaded(Applet* applet);
|
||||
|
||||
Containment *q;
|
||||
Types::FormFactor formFactor;
|
||||
Types::Location location;
|
||||
@ -89,6 +90,7 @@ public:
|
||||
int lastScreen;
|
||||
QString activityId;
|
||||
Types::ContainmentType type;
|
||||
bool uiReady : 1;
|
||||
|
||||
static const char defaultWallpaper[];
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user