From 90825e2392b2d70e43c7a25b8a3752299a933894 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kjsembed/docs/examples/dcop/signalslot.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 kjsembed/docs/examples/dcop/signalslot.js (limited to 'kjsembed/docs/examples/dcop/signalslot.js') diff --git a/kjsembed/docs/examples/dcop/signalslot.js b/kjsembed/docs/examples/dcop/signalslot.js new file mode 100755 index 00000000..884faa29 --- /dev/null +++ b/kjsembed/docs/examples/dcop/signalslot.js @@ -0,0 +1,25 @@ +#!/usr/bin/env kjscmd + +function newWeather( station ) +{ + var temp = client.call("KWeatherService", "WeatherService", "temperature(QString)", "KMKE"); + var name = client.call("KWeatherService", "WeatherService", "stationName(QString)", "KMKE"); + var label = new QLabel(this); + label.text = "The temperature at " + name + " is " + temp; + label.show(); +} + +var client = new DCOPClient(this); +if ( client.attach() ) +{ + var dcop = new DCOPInterface(this, "weather"); + dcop.publish("void newWeather(QString)"); + + client.connectDCOPSignal("KWeatherService", "WeatherService", "fileUpdate(QString)", + "weather","newWeather(QString)"); + + + client.send("KWeatherService", "WeatherService", "update(QString)", "KMKE"); + + application.exec(); +} -- cgit v1.2.1