Javascript and notifications help

Aaron J. Seigo aseigo at kde.org
Fri Mar 19 21:20:31 CET 2010


hi Alanis ...

On March 19, 2010, asdfgh ertyhn wrote:
> I'm trying to use the notifications service within my javascript plasmoid
> in order to display a nice popup notification on certain events, but I'm

you know, this is a "funny" topic: it's not something i figured would be 
overly critical but it's something a lot of people want to do from their 
javascript plasmoid. so i had (obviously mistakenly) delayed this feature 
until the 4.5 release this summer (Javascript API v2).

short story: there is no good way of doing it right now.

longer story: i or someone likes me needs to write a small C++ Service plugin 
(does not need to be related to a data engine at all, in fact, though it 
probably could make sense as part of the Notifications engine as well) to do 
this. 

sorry for the horrible news. :/

> stuck with its initialization. Looking at the API ( service(string
> dataEngineName, string sourceName) ), I wrote something like:
> 
> job = service("notifications",)
> 
> but then I was stuck on the meaning of the second parameter. Could you
> explain what you mean with "sourceName" please? Furthermore, looking at

the source name is what the entry is called in the DataEngine. the idea is 
this:

you have a DataEngine and your are connected to one of the pieces of 
information it provides. in the Hotplug engine (which announces events like 
when you plug in a USB stick, for instance) this might be a disk drive. 

then you want to interact with it. in the Hotplug engine case, maybe you want 
to request that the disk be mounted. at that point you ask for the service for 
that source, and you do so by asking the DataEngine to give you a service for 
the source by that name.

a concept we don't have is a "default service" for a DataEngine: you always 
need to ask for the service for a given source.

in the case of a service-without-a-source, as in the case of notifications, 
one can ask directly for a Service without going through a DataEngine.

for notifications, that Service needs to be written still.

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