[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.2/kdelibs/plasma
From: Richard Dale <Richard_Dale () tipitina ! demon ! co ! uk>
Date: 2009-04-23 10:56:28
Message-ID: 1240484188.157290.30226.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 958045 by rdale:
* Allow scripting PopupApplets to be created if the metadata.desktop for the
applet has a 'ServiceTypes=Plasma/PopupApplet' line
M +26 -9 applet.cpp
--- branches/KDE/4.2/kdelibs/plasma/applet.cpp #958044:958045
@@ -1572,14 +1572,27 @@
//TODO: what would be -really- cool is offer to try and download the applet
// from the network at this point
offers = KServiceTypeTrader::self()->query("Plasma/Containment", constraint);
- isContainment = true;
- if (offers.isEmpty()) {
- kDebug() << "offers is empty for " << appletName;
- return 0;
+ if (offers.count() > 0) {
+ isContainment = true;
}
- } /* else if (offers.count() > 1) {
+ }
+
+ 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()) {
+ kDebug() << "offers is empty for " << appletName;
+ return 0;
+ }
KService::Ptr offer = offers.first();
@@ -1587,13 +1600,19 @@
appletId = ++AppletPrivate::s_maxAppletId;
}
+ QVariantList allArgs;
+ allArgs << offer->storageId() << appletId << args;
+
if (!offer->property("X-Plasma-API").toString().isEmpty()) {
kDebug() << "we have a script using the"
<< offer->property("X-Plasma-API").toString() << "API";
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);
}
KPluginLoader plugin(*offer);
@@ -1603,8 +1622,6 @@
return 0;
}
- QVariantList allArgs;
- allArgs << offer->storageId() << appletId << args;
QString error;
Applet *applet;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic