Javascript and notifications help

Marco Martin notmart at gmail.com
Fri Mar 19 23:36:23 CET 2010


On Friday 19 March 2010, asdfgh ertyhn wrote:
> Good evening folks,
> 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
> 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 sources of the notification dataengine, I'll need to pass a variable
> with lots of strings referring to: the icon to be shown, the app name,
> summary, body, actions and expired timeout. How i can do that ? Last
> question: how can I start the notification ?
> Please reply to my email, since I'm not subscribed to your ml, thank you.
> Best regards,
> 
> -- Alanis
> 

As Aaron said, it's not possible with KDE 4.4.
however it's possible in trunk, so will in KDE 4.5
i've put an example in the kde-examples svn directory (recomended to try to 
everyone is doing a javascript)
in brief, what you have to do is the following

    engine = dataEngine("notifications");
    service = engine.serviceForSource("notification");
    op = service.operationDescription("createNotification");
    op["appName"] = "foobar";
    op["appIcon"] = "konqueror";
    op["summary"] = "this is a summary";
    op["body"] = "body of notification";
    op["timeout"] = 2000;

    service.startOperationCall(op);

as i said is necessary to have trunk and actions are (yet?) not supported

Cheers,
Marco Martin


More information about the Plasma-devel mailing list