emit appletadded only when manually added

when the containment's component.oncompleted is hitted, the applet list is guaranteed to be completely correctly restored from config

we may want to support both cases in the future to make writing containment easier
This commit is contained in:
Marco Martin 2013-09-20 18:18:46 +02:00
parent b14c23bed0
commit 4767f3a8d0
3 changed files with 12 additions and 20 deletions

View File

@ -181,15 +181,15 @@ void Containment::restore(KConfigGroup &group)
setFormFactor((Plasma::Types::FormFactor)group.readEntry("formfactor", (int)d->formFactor));
setWallpaper(group.readEntry("wallpaperplugin", ContainmentPrivate::defaultWallpaper));
//qDebug() << "setScreen from restore";
d->setScreen(group.readEntry("screen", d->screen));
d->activityId = group.readEntry("activityId", QString());
flushPendingConstraintsEvents();
restoreContents(group);
setImmutability((Types::ImmutabilityType)group.readEntry("immutability", (int)Types::Mutable));
//qDebug() << "setScreen from restore";
d->setScreen(group.readEntry("screen", d->screen));
KConfigGroup cfg = KConfigGroup(corona()->config(), "ActionPlugins");
cfg = KConfigGroup(&cfg, QString::number(containmentType()));

View File

@ -192,6 +192,7 @@ public:
Q_INVOKABLE QAction *action(QString name) const;
/**
* FIXME: remove?
* Retrieve the path of a file from the Plasmoid package
* @param fileName the package-recognized name, such as "mainscript"
* @returns the full absolute path of the file, if found, an empty string if not
@ -199,6 +200,7 @@ public:
Q_INVOKABLE QString file(const QString &fileName);
/**
* FIXME: remove?
* Retrieve the path of a file from the Plasmoid package
* @param fileType the type supported from the package, such as "ui", "config" or "image"
* @param filePath the name of the file, such as "foo.qml" or "bar.png"

View File

@ -76,27 +76,17 @@ ContainmentInterface::ContainmentInterface(DeclarativeAppletScript *parent)
connect(containment()->corona(), &Plasma::Corona::availableScreenRegionChanged,
this, &ContainmentInterface::availableScreenRegionChanged);
}
}
void ContainmentInterface::init()
{
AppletInterface::init();
foreach (QObject *appletObj, m_appletInterfaces) {
AppletInterface *applet = qobject_cast<AppletInterface *>(appletObj);
if (applet) {
if (!applet->qmlObject()) {
applet->init();
}
m_appletInterfaces << applet;
emit appletAdded(applet, 0, 0);
}
}
if (!m_appletInterfaces.isEmpty()) {
emit appletsChanged();
}
}
void ContainmentInterface::init()
{
AppletInterface::init();
if (m_qmlObject->rootObject()->property("minimumWidth").isValid()) {
connect(m_qmlObject->rootObject(), SIGNAL(minimumWidthChanged()),
this, SIGNAL(minimumWidthChanged()));