Fixing the force-creation of applets when plasma is immutable

REVIEW:127442
This commit is contained in:
Ivan Čukić 2016-03-20 22:04:53 +01:00
parent 92e2c07adf
commit 8bd9e56572
2 changed files with 8 additions and 4 deletions

View File

@ -92,6 +92,10 @@ Applet::Applet(QObject *parentObject, const QVariantList &args)
d->appletDescription = KPluginInfo(args);
}
if (args.contains("org.kde.plasma:force-create")) {
setProperty("org.kde.plasma:force-create", true);
}
// WARNING: do not access config() OR globalConfig() in this method!
// that requires a scene, which is not available at this point
d->init(QString(), args.mid(2));

View File

@ -372,10 +372,6 @@ Applet *Containment::createApplet(const QString &name, const QVariantList &args)
void Containment::addApplet(Applet *applet)
{
if (immutability() != Types::Mutable) {
return;
}
if (!applet) {
#ifndef NDEBUG
// qCDebug(LOG_PLASMA) << "adding null applet!?!";
@ -383,6 +379,10 @@ void Containment::addApplet(Applet *applet)
return;
}
if (immutability() != Types::Mutable && !applet->property("org.kde.plasma:force-create").toBool()) {
return;
}
if (d->applets.contains(applet)) {
#ifndef NDEBUG
// qCDebug(LOG_PLASMA) << "already have this applet!";