Review Request: ScriptEngine's as Containments

Aaron J. Seigo aseigo at kde.org
Wed Mar 5 21:21:54 CET 2008


On Wednesday 05 March 2008, Sebastian Sauer wrote:
> On Wednesday 05 March 2008, Sebastian Sauer wrote:
> > inspired by http://aseigo.blogspot.com/2008/03/power-of-containments.html
> >
> > :)
> >
> > The attached patch does enable Containments (tested with panels) written
> > using a ScriptEngine like SuperKaramba.
>
> I forgot to also patch the package.cpp. Refreshed patch that also includes
> that part and some codingstyle fixes is attached.

this change to plasma-containment.desktop:

+[PropertyDef::X-Plasma-Language]
+Type=QString

isn't actually needed since that property is defined in another .desktop file 
already. if it's already been registered in one .dekstop file, all of them 
can use it. i wasn't aware of that interesting detail either until shortly 
before 4.0...

also, this:

+        offers = KServiceTypeTrader::self()->query("Plasma/Containment", 
constraint);
+        isContainment = true;
+        if(!offers.isEmpty()) {
+            kDebug() << "offers is empty for " << appletName;
+            return 0;
+        }

in applet.cpp shouldn't be necessary; since all containments also have 
Plasma/Applet in their service types list, it will never get to this branch. 
however, i think this approach is useful anyways for another reason:

with all scripts installed via Package becoming containments as well, it may 
slightly complicate the UI for setting/creating new containments (since the 
list will be *really* long now and full of general plugins versus Containment 
specializations (such as DefaultDesktop and Panel, which dont' particularly 
make any sense as Widgets).

so with the second check for Plasma/Containment, we could change 
their .desktop files to not have 
X-KDE-ServiceType=Plasma/Applet,Plasma/Containment as they do now, but rather 
just X-KDE-ServiceType=Plasma/Containment. this would make it easy to sort 
out the "widgets-that-are-containments-too" from the "just containments" 
entries.

neat; i like that =)

so other than the .desktop file change which isn't necessary, it looks good to 
go. 

it's impressive how little the code needed to be changed ..... coo'

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Trolltech
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20080305/d3bdd959/attachment.pgp 


More information about the Panel-devel mailing list