how can I access DataEngines from JavaScript in the Web Plasmoids?

Aaron J. Seigo aseigo at kde.org
Sat Jan 2 20:36:05 CET 2010


On January 2, 2010, Petri Damstén wrote:
> On Saturday 02 January 2010 03:56:48 Aaron J. Seigo wrote:
> > On January 1, 2010, Patrick Aljord wrote:
> > > I just read a comment by Aaron saying that DataEngines can be accesed
> > > from JavaScript in the Web Plasmoids. I tried to figured how it can be
> > > done but couldn't so far. Any clue? :)
> > 
> > kdeexamples/plasma/webkit/plasmoids/
> > 
> > requires today's trunk for everything to work perfectly
> 
> I think dataengines in webkit plasmoids have worked since KDE 4.3.

ugh, yes, indeed. (been looking through the svn history this morning, though 
the moving of things around in trunk, e.g. the scriptengines from 
workspace/plasma/scriptengines to workspace/plasma/generic/scriptengines, has 
made that a lot more difficult). the problem is that the API is utterly unlike 
the other scriptengines and the "tests" that were in the webkit/tests/ 
directory since day 1 of this script engine's existence  were completely 
ignored by subsequent work and they stopped functioning. funny and sad :) 

(i've since moved the data engine "test" to kdeexamples and spified it up a 
bit more)

right now there are two objects in the JS of the webkit plasmoids: "plasma" 
and "applet". "plasma" contains one method: "knownDataEngines". this is the 
old style API from 4.2, even, and should be listAllDataEngines. besides that, 
it really doesn't make sense to have two different objects, one which has 
exactly one function in it. confusing++, when one will do just fine. moreover, 
we are calling the object "plasmoid" in the QScript-driven JavaScript 
ScriptEngine, and "applet" in the WebKit one. the lack of consistency isn't 
good.

it sucks to change the API at this point, but it doesn't look like this API 
was very well groomed to start with. we've changed some of the API in the 
JavaScript API as well in 4.4, so i'd like to get this all "right" for 4.4 (as 
much as we can do such a thing) and commit to API stability from 4.4 on for 
both JavaScript and WebKit driven plasmoids.

i will commit shortly. sorry for breaking your plasmoids with this, but the 
fixes are easy and should never have been necessary if we'd been watching over 
this script engine with more diligence and care.

-- 
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