diff options
Diffstat (limited to 'kjsembed/docs/examples/dcop/weather.js')
-rwxr-xr-x | kjsembed/docs/examples/dcop/weather.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/kjsembed/docs/examples/dcop/weather.js b/kjsembed/docs/examples/dcop/weather.js new file mode 100755 index 00000000..8d8a59c3 --- /dev/null +++ b/kjsembed/docs/examples/dcop/weather.js @@ -0,0 +1,25 @@ +#!/usr/bin/env kjscmd + +var dcop = new DCOPClient(this); +var box = new QHBox(this); +var go = new KPushButton(box); +var loc = new KLineEdit(box); + +go.pixmap = StdIcons.DesktopIcon("go",32); +go.connect(go, "clicked()", this, "getWeather"); + +dcop.attach(); +box.show(); + +function getWeather() +{ + if ( dcop.isAttached() ) + { + var icn = new Image(this); + icn.pixmap = dcop.call("KWeatherService","WeatherService","icon(QString)", loc.text); + icn.smoothScale(32,32); + go.pixmap = icn.pixmap; + } +} + +application.exec(); |