diff --git a/src/plasma/corona.cpp b/src/plasma/corona.cpp index c6bd9497a..018dcd422 100644 --- a/src/plasma/corona.cpp +++ b/src/plasma/corona.cpp @@ -182,6 +182,26 @@ Containment *Corona::containmentForScreen(int screen) const return 0; } +Containment *Corona::containmentForScreen(int screen, + const QString &defaultPluginIfNonExistent, const QVariantList &defaultArgs) +{ + Containment *containment = containmentForScreen(screen); + if (!containment && !defaultPluginIfNonExistent.isEmpty()) { + // screen requests are allowed to bypass immutability + if (screen >= 0 && screen < numScreens()) { + Plasma::Types::ImmutabilityType imm = d->immutability; + d->immutability = Types::Mutable; + containment = d->addContainment(defaultPluginIfNonExistent, defaultArgs, 0, false); + if (containment) { + // containment->setScreen(screen); + } + d->immutability = imm; + } + } + + return containment; +} + QList Corona::containments() const { return d->containments; diff --git a/src/plasma/corona.h b/src/plasma/corona.h index f60fd74e2..70867d55f 100644 --- a/src/plasma/corona.h +++ b/src/plasma/corona.h @@ -107,6 +107,19 @@ public: */ Containment *containmentForScreen(int screen) const; + /** + * Returns the Containment for a given physical screen and desktop, creating one + * if none exists + * + * @param screen number of the physical screen to locate + * @param defaultPluginIfNonExistent the plugin to load by default; "null" is an empty + * Containment and "default" creates the default plugin + * @param defaultArgs optional arguments to pass in when creating a Containment if needed + */ + Containment *containmentForScreen(int screen, + const QString &defaultPluginIfNonExistent, + const QVariantList &defaultArgs = QVariantList()); + /** * Returns the number of screens available to plasma. * Subclasses should override this method as the default