JS API questions

Aaron J. Seigo aseigo at kde.org
Tue Mar 9 06:52:22 CET 2010


On March 8, 2010, Nikita Melnichenko wrote:
> 1. Issue with plasmoid.file.
> plasmoid.file("", "path/to/file") doesn't work
> I've found a workaround plasmoid.file("ui", "../path/to/file") but I don't
> like it. What's the proper way?

this is a small bug in libplasma; i'm fixing it now and will backport it for 
the next 4.4 release.

> 2. setMinimumSize bug.
> The thing doesn't work from the start, but does work after some time. We

i'm still not exactly sure what the bug you are seeing is. if you can provide 
test cases in the form of minimal-code plasmoids that would be excelent.

> 3. I can't figure out how to use stylesheet property. I've found some C++
> examples but they don't work here. Could you give me an example?

how are you trying to use it now?

> 4. I want to separate replies from dataengines, so I probably need to
> connect it to other objects than the global plasmoid object. That's to
> make code prettier. I'm aware about Label, TextEdit, Meter, but they're
> not suitable for this purpose, my dataUpdated isn't called. What can I do
> to separate replies?

in theory: create a new QObject, give it a dataUpdated function, and connect 
the DataEngine to that object. however, there are a number of QScript/C++ 
issues that block this from actually happening. i have a couple of ideas on 
how to address this, and will investigate and do one of them tomorrow.

> 5. The API docs have notes that we can draw on different widgets. That's
> good because I can workaround the SvgWidget bug. But I'm stuck here. Could
> you give me an example?

it should be a matter of overriding the paint method on the widget; though i 
haven't tried his yet from JS.

> 6. I'm using extensions so I want to block some of them to check different
> branches of code. How to do that?

just don't request them in your .desktop file :)

> 7. All plasmoids have a shortcuts. What's their purpose?

to give keyboard focus to the applet; in API v2 (KDE SC 4.5) there is also an 
activate() callback in the Plasmoid connected to this.

> 8. We talked with Aaron Seigo about Actions, Extenders, Runners lately and
> it was noted that he needs help to update the docs. I'd like to help in
> some way but I need a starting point: where to look for available methods,
> classes, etc.? Maybe somebody else would help here too.

this is mostly in the C++ API; Extenders are described here:

	http://techbase.kde.org/Development/Tutorials/Plasma/UsingExtenders

and the API in Javascript is essentially the same.

for the context menu, we have:

     setAction(const QString &name, const QString &text,
                      const QString &icon = QString(), const QString &shortcut 
= QString());

    removeAction(const QString &name);

this causes actions to be shown in the context menu of the Plasmoid, and when 
the action is triggered then plasmoid.action_<name> (where <name> is the name 
passed into setAction) is called.

a sample plasmoid for that would be nice :)

as for QAction itself, we don't actually have any particular bindings for them 
in the simple javascript API, and i'm not sure we need them?

-- 
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 Qt Development Frameworks


More information about the Plasma-devel mailing list