FEATURE: configurable default containment plugin name

svn path=/trunk/KDE/kdelibs/; revision=1213879
This commit is contained in:
Aaron J. Seigo 2011-01-12 00:05:13 +00:00
parent 3af6a91dd7
commit cd4e26f59f
3 changed files with 30 additions and 3 deletions

View File

@ -92,6 +92,20 @@ QString Corona::appletMimeType()
return d->mimetype;
}
void Corona::setDefaultContainmentPlugin(const QString &name)
{
// we could check if it is in:
// Containment::listContainments().contains(name) ||
// Containment::listContainments(QString(), KGlobal::mainComponent().componentName()).contains(name)
// but that seems like overkill
d->defaultContainmentPlugin = name;
}
QString Corona::defaultContainmentPlugin() const
{
return d->defaultContainmentPlugin;
}
void Corona::saveLayout(const QString &configName) const
{
KSharedConfigPtr c;
@ -744,6 +758,7 @@ CoronaPrivate::CoronaPrivate(Corona *corona)
: q(corona),
immutability(Mutable),
mimetype("text/x-plasmoidservicename"),
defaultContainmentPlugin("desktop"),
config(0),
actions(corona)
{
@ -874,8 +889,7 @@ void CoronaPrivate::syncConfig()
emit q->configSynced();
}
Containment *CoronaPrivate::addContainment(const QString &name, const QVariantList &args,
uint id, bool delayedInit)
Containment *CoronaPrivate::addContainment(const QString &name, const QVariantList &args, uint id, bool delayedInit)
{
QString pluginName = name;
Containment *containment = 0;
@ -885,7 +899,7 @@ Containment *CoronaPrivate::addContainment(const QString &name, const QVariantLi
if (pluginName.isEmpty() || pluginName == "default") {
// default to the desktop containment
pluginName = "desktop";
pluginName = defaultContainmentPlugin;
}
bool loadingNull = pluginName == "null";

View File

@ -66,6 +66,12 @@ public:
*/
QString appletMimeType();
/**
* @return the default containment plugin type
* @since 4.7
*/
QString defaultContainmentPlugin() const;
/**
* @return all containments on this Corona
*/
@ -479,6 +485,12 @@ protected:
*/
void setPreferredToolBoxPlugin(const Containment::Type type, const QString &plugin);
/**
* Sets the default containment plugin to try and load
* @since 4.7
*/
void setDefaultContainmentPlugin(const QString &name);
//Reimplemented from QGraphicsScene
void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);

View File

@ -54,6 +54,7 @@ public:
ImmutabilityType immutability;
QString mimetype;
QString configName;
QString defaultContainmentPlugin;
KSharedConfigPtr config;
QTimer configSyncTimer;
QList<Containment*> containments;