Skip to content

KJSEmbed now has full DCOP Support

Sunday, 7 December 2003  |  geiseri

Finally after a long time of messing with this, DCOP now works in KJSEmbed.

Currently we support any type that can be used inside of a qt:QVariant. KJS functions can also be exported to DCOP interfaces now. This also gives us the ability to have connect dcop signals to local KJS functions.
A good example that shows off how this all plays out is below:

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();
}

This will yeild the following window: [image:258]

So now this is cool, because we can now write KJSEmbed scripts that completely integrate with KDE. Systems administrators can now write .login scripts, that will be more tighly couppled with KDE, and will perform much better than their bash counterparts.