re-add Corona::createContainmentDelayed()
unfortunate, but necessary for on the fly containment plugin switch
This commit is contained in:
parent
25bb220724
commit
d8731d7806
@ -198,6 +198,15 @@ Containment *Corona::createContainment(const QString &name, const QVariantList &
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Containment *Corona::createContainmentDelayed(const QString &name, const QVariantList &args)
|
||||||
|
{
|
||||||
|
if (d->immutability == Types::Mutable) {
|
||||||
|
return d->addContainment(name, args, 0, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int Corona::screenForContainment(const Containment* containment) const
|
int Corona::screenForContainment(const Containment* containment) const
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -388,7 +397,7 @@ void CoronaPrivate::syncConfig()
|
|||||||
emit q->configSynced();
|
emit q->configSynced();
|
||||||
}
|
}
|
||||||
|
|
||||||
Containment *CoronaPrivate::addContainment(const QString &name, const QVariantList &args, uint id)
|
Containment *CoronaPrivate::addContainment(const QString &name, const QVariantList &args, uint id, bool delayedInit)
|
||||||
{
|
{
|
||||||
QString pluginName = name;
|
QString pluginName = name;
|
||||||
Containment *containment = 0;
|
Containment *containment = 0;
|
||||||
@ -448,14 +457,16 @@ Containment *CoronaPrivate::addContainment(const QString &name, const QVariantLi
|
|||||||
QObject::connect(containment, SIGNAL(screenChanged(int)),
|
QObject::connect(containment, SIGNAL(screenChanged(int)),
|
||||||
q, SIGNAL(screenOwnerChanged(int)));
|
q, SIGNAL(screenOwnerChanged(int)));
|
||||||
|
|
||||||
containment->init();
|
if (!delayedInit) {
|
||||||
KConfigGroup cg = containment->config();
|
containment->init();
|
||||||
containment->restore(cg);
|
KConfigGroup cg = containment->config();
|
||||||
containment->updateConstraints(Plasma::Types::StartupCompletedConstraint);
|
containment->restore(cg);
|
||||||
containment->save(cg);
|
containment->updateConstraints(Plasma::Types::StartupCompletedConstraint);
|
||||||
q->requestConfigSync();
|
containment->save(cg);
|
||||||
containment->flushPendingConstraintsEvents();
|
q->requestConfigSync();
|
||||||
emit q->containmentAdded(containment);
|
containment->flushPendingConstraintsEvents();
|
||||||
|
emit q->containmentAdded(containment);
|
||||||
|
}
|
||||||
|
|
||||||
return containment;
|
return containment;
|
||||||
}
|
}
|
||||||
|
@ -271,6 +271,26 @@ protected:
|
|||||||
**/
|
**/
|
||||||
virtual void loadDefaultLayout();
|
virtual void loadDefaultLayout();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads a containment with delayed initialization, primarily useful
|
||||||
|
* for implementations of loadDefaultLayout. The caller is responsible
|
||||||
|
* for all initializating, saving and notification of a new containment.
|
||||||
|
*
|
||||||
|
* @param name the plugin name for the containment, as given by
|
||||||
|
* KPluginInfo::pluginName(). If an empty string is passed in, the defalt
|
||||||
|
* containment plugin will be used (usually DesktopContainment). If the
|
||||||
|
* string literal "null" is passed in, then no plugin will be loaded and
|
||||||
|
* a simple Containment object will be created instead.
|
||||||
|
* @param args argument list to pass to the containment
|
||||||
|
*
|
||||||
|
* @return a pointer to the containment on success, or 0 on failure. Failure can
|
||||||
|
* be caused by the Immutability type being too restrictive, as containments can't be added
|
||||||
|
* when widgets are locked, or if the requested containment plugin can not be located
|
||||||
|
* or successfully loaded.
|
||||||
|
* @see addContainment
|
||||||
|
**/
|
||||||
|
Containment *createContainmentDelayed(const QString &name,
|
||||||
|
const QVariantList &args = QVariantList());
|
||||||
private:
|
private:
|
||||||
CoronaPrivate *const d;
|
CoronaPrivate *const d;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
void updateContainmentImmutability();
|
void updateContainmentImmutability();
|
||||||
void containmentDestroyed(QObject *obj);
|
void containmentDestroyed(QObject *obj);
|
||||||
void syncConfig();
|
void syncConfig();
|
||||||
Containment *addContainment(const QString &name, const QVariantList &args, uint id);
|
Containment *addContainment(const QString &name, const QVariantList &args, uint id, bool delayedInit = false);
|
||||||
QList<Plasma::Containment *> importLayout(const KConfigGroup &conf, bool mergeConfig);
|
QList<Plasma::Containment *> importLayout(const KConfigGroup &conf, bool mergeConfig);
|
||||||
|
|
||||||
Corona *q;
|
Corona *q;
|
||||||
|
@ -148,6 +148,10 @@ void ContainmentInterface::init()
|
|||||||
QQmlProperty prop(qmlObject()->rootObject(), "anchors.fill");
|
QQmlProperty prop(qmlObject()->rootObject(), "anchors.fill");
|
||||||
prop.write(expr.evaluate());
|
prop.write(expr.evaluate());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!containment()->wallpaper().isEmpty()) {
|
||||||
|
loadWallpaper();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList <QObject *> ContainmentInterface::applets()
|
QList <QObject *> ContainmentInterface::applets()
|
||||||
|
@ -110,12 +110,13 @@ Plasma::ConfigLoader *WallpaperInterface::configScheme()
|
|||||||
|
|
||||||
void WallpaperInterface::syncWallpaperPackage()
|
void WallpaperInterface::syncWallpaperPackage()
|
||||||
{
|
{
|
||||||
if (m_wallpaperPlugin == m_containmentInterface->containment()->wallpaper()) {
|
if (m_wallpaperPlugin == m_containmentInterface->containment()->wallpaper() &&
|
||||||
|
m_qmlObject->rootObject()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_wallpaperPlugin = m_containmentInterface->containment()->wallpaper();
|
m_wallpaperPlugin = m_containmentInterface->containment()->wallpaper();
|
||||||
|
|
||||||
if (!m_qmlObject) {
|
if (!m_qmlObject) {
|
||||||
m_qmlObject = new KDeclarative::QmlObject(this);
|
m_qmlObject = new KDeclarative::QmlObject(this);
|
||||||
s_rootObjects[m_qmlObject->engine()] = this;
|
s_rootObjects[m_qmlObject->engine()] = this;
|
||||||
@ -138,7 +139,6 @@ void WallpaperInterface::syncWallpaperPackage()
|
|||||||
m_configuration = new KDeclarative::ConfigPropertyMap(configScheme(), this);
|
m_configuration = new KDeclarative::ConfigPropertyMap(configScheme(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_qmlObject->setSource(QUrl::fromLocalFile(m_pkg.filePath("mainscript")));
|
m_qmlObject->setSource(QUrl::fromLocalFile(m_pkg.filePath("mainscript")));
|
||||||
m_qmlObject->engine()->rootContext()->setContextProperty("wallpaper", this);
|
m_qmlObject->engine()->rootContext()->setContextProperty("wallpaper", this);
|
||||||
m_qmlObject->completeInitialization();
|
m_qmlObject->completeInitialization();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user