Enables ScriptEngine's like Apple's Dashboard Widgets or SuperKaramba's to implement containments too. Right, that means you are now able to write your own Panel or even Desktop using a scripting language :)

FEATURE

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=782729
This commit is contained in:
Sebastian Sauer 2008-03-05 21:12:33 +00:00
parent afdb5e84a0
commit 1420d4ba60
3 changed files with 15 additions and 5 deletions

View File

@ -222,6 +222,7 @@ endif(QT_QTOPENGL_FOUND AND OPENGL_FOUND)
install(FILES
servicetypes/plasma-animator.desktop
servicetypes/plasma-applet.desktop
servicetypes/plasma-containment.desktop
servicetypes/plasma-dataengine.desktop
servicetypes/plasma-packagestructure.desktop
servicetypes/plasma-runner.desktop

View File

@ -1359,11 +1359,16 @@ Applet* Applet::load(const QString& appletName, uint appletId, const QVariantLis
QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(appletName);
KService::List offers = KServiceTypeTrader::self()->query("Plasma/Applet", constraint);
bool isContainment = false;
if (offers.isEmpty()) {
//TODO: what would be -really- cool is offer to try and download the applet
// from the network at this point
kDebug() << "offers is empty for " << appletName;
return 0;
offers = KServiceTypeTrader::self()->query("Plasma/Containment", constraint);
isContainment = true;
if (!offers.isEmpty()) {
kDebug() << "offers is empty for " << appletName;
return 0;
}
} /* else if (offers.count() > 1) {
kDebug() << "hey! we got more than one! let's blindly take the first one";
} */
@ -1376,8 +1381,10 @@ Applet* Applet::load(const QString& appletName, uint appletId, const QVariantLis
if (!offer->property("X-Plasma-Language").toString().isEmpty()) {
kDebug() << "we have a script in the language of" << offer->property("X-Plasma-Language").toString();
Applet *applet = new Applet(0, offer->storageId(), appletId);
return applet;
if (isContainment) {
return new Containment(0, offer->storageId(), appletId);
}
return new Applet(0, offer->storageId(), appletId);
}
QVariantList allArgs;

View File

@ -312,7 +312,9 @@ bool Package::registerPackage(const PackageMetadata &data, const QString &iconPa
KDesktopFile config(service);
KConfigGroup cg = config.desktopGroup();
cg.writeEntry("Type", "Service");
cg.writeEntry("X-KDE-ServiceTypes", "Plasma/Applet");
//TODO do we really like to just install all packages as applet/containment? Probably
//it would make sense to let the packages themself decide what they are.
cg.writeEntry("X-KDE-ServiceTypes", "Plasma/Applet,Plasma/Containment");
cg.writeEntry("X-KDE-PluginInfo-EnabledByDefault", true);
QFile icon(iconPath);