allow creating a plain Containment object by passing in "null" for the plugin name. this still allows us to protect better against broken configurations where the plugin value is no longer readable while getting us back the ability to request a plain Containment on purpose.

CCMAIL:frerich@hex.athame.co.uk

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=730445
This commit is contained in:
Aaron J. Seigo 2007-10-28 20:04:38 +00:00
parent 4d1cac45c8
commit d5dc647850
2 changed files with 13 additions and 6 deletions

View File

@ -273,16 +273,20 @@ Containment* Corona::addContainment(const QString& name, const QVariantList& arg
if (pluginName.isEmpty()) {
// default to the desktop containment
pluginName = "desktop";
} else if (pluginName != "null") {
applet = Applet::loadApplet(pluginName, id, args);
containment = dynamic_cast<Containment*>(applet);
}
applet = Applet::loadApplet(pluginName, id, args);
containment = dynamic_cast<Containment*>(applet);
if (!containment) {
kDebug() << "loading of containment" << name << "failed.";
delete applet; // in case we got a non-Containment from Applet::loadApplet
// in case we got a non-Containment from Applet::loadApplet or a null containment was requested
delete applet;
containment = new Containment;
containment->setFailedToLaunch(false); // we want to provide something and don't care about the failure to launch
// we want to provide something and don't care about the failure to launch
containment->setFailedToLaunch(false);
}
if (!delayedInit) {

View File

@ -122,7 +122,10 @@ public Q_SLOTS:
* Adds a Containment to the Corona
*
* @param name the plugin name for the containment, as given by
* KPluginInfo::pluginName()
* 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
* @param id to assign to this containment, or 0 to auto-assign it a new id
* @param geometry where to place the containment, or to auto-place it if an invalid