* Allow scripting PopupApplets to be created if the metadata.desktop for the
applet has a 'ServiceTypes=Plasma/PopupApplet' line CCMAIL: kde-bindings@kde.org svn path=/trunk/KDE/kdelibs/; revision=958044
This commit is contained in:
parent
55169a2fda
commit
4bb4a0839e
26
applet.cpp
26
applet.cpp
@ -1747,14 +1747,27 @@ Applet *Applet::load(const QString &appletName, uint appletId, const QVariantLis
|
|||||||
//TODO: what would be -really- cool is offer to try and download the applet
|
//TODO: what would be -really- cool is offer to try and download the applet
|
||||||
// from the network at this point
|
// from the network at this point
|
||||||
offers = KServiceTypeTrader::self()->query("Plasma/Containment", constraint);
|
offers = KServiceTypeTrader::self()->query("Plasma/Containment", constraint);
|
||||||
|
if (offers.count() > 0) {
|
||||||
isContainment = true;
|
isContainment = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isPopupApplet = false;
|
||||||
|
if (offers.isEmpty()) {
|
||||||
|
offers = KServiceTypeTrader::self()->query("Plasma/PopupApplet", constraint);
|
||||||
|
if (offers.count() > 0) {
|
||||||
|
isPopupApplet = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if (offers.count() > 1) {
|
||||||
|
kDebug() << "hey! we got more than one! let's blindly take the first one";
|
||||||
|
} */
|
||||||
|
|
||||||
if (offers.isEmpty()) {
|
if (offers.isEmpty()) {
|
||||||
kDebug() << "offers is empty for " << appletName;
|
kDebug() << "offers is empty for " << appletName;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} /* else if (offers.count() > 1) {
|
|
||||||
kDebug() << "hey! we got more than one! let's blindly take the first one";
|
|
||||||
} */
|
|
||||||
|
|
||||||
KService::Ptr offer = offers.first();
|
KService::Ptr offer = offers.first();
|
||||||
|
|
||||||
@ -1769,9 +1782,12 @@ Applet *Applet::load(const QString &appletName, uint appletId, const QVariantLis
|
|||||||
kDebug() << "we have a script using the"
|
kDebug() << "we have a script using the"
|
||||||
<< offer->property("X-Plasma-API").toString() << "API";
|
<< offer->property("X-Plasma-API").toString() << "API";
|
||||||
if (isContainment) {
|
if (isContainment) {
|
||||||
return new Containment(0, offer->storageId(), appletId);
|
return new Containment(0, allArgs);
|
||||||
|
} else if (isPopupApplet) {
|
||||||
|
return new PopupApplet(0, allArgs);
|
||||||
|
} else {
|
||||||
|
return new Applet(0, allArgs);
|
||||||
}
|
}
|
||||||
return new Applet(0, offer->storageId(), appletId, allArgs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KPluginLoader plugin(*offer);
|
KPluginLoader plugin(*offer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user