The K Desktop Environment

Next Previous Table of Contents

2. Using The KDE Daemon In Your Application

Before we can use any of kded's services, we have to know something about it's "position" in the KDE and the way it itself and the services can be accessed.

As kded uses CORBA to communicate with it's clients, your application (as client), has to

The first two points are fixed for all clients, the third one depends on the specific client. In general you have to choices:

Although kded uses CORBA extensively, the API is kept simple and free from complicated CORBA stuff. In fact when talking about kded and it's API not the kded server is meant but the KDE Daemon library. This library contains the interface to the server (for the clients) as well as the whole server functionality. The reason for this is based on the idea that an application using kded should not be forced to rely on an existing kded server binary nor a running server at all. The following three situations may exist when a client app gets started:

To sum it up: libkded will always make sure that the services of kded are available for your client application, no matter in what alien environment the app is running :-) . And, although you don't have to care about this, you can optionally control this behaviour of libkded by adding one of the following three commandline arguments to your app:

Your actual interface to kded and it's services is the KdedInstance class, defined in kded_instance.h . So if you want to use kded (I guess that's why you're reading this shit ;) ) then make sure to create one single instance of it, preferably by adding the following line somewhere in the beginning of your main() :

KdedInstance( argc, argv, _a_reference_to_the_orb_here_ );
If you're using KOMApplication as application object (make sure to create the instance before this line) , then you're fine by specifying komapp_orb as reference to the ORB.

As there is always only one single instance of this class, you can simply access it by the static self() method of the class from anywhere you want. No need to pass KdedInstance arguments all around in your program ;-) .

For further information about KdedInstance you might want to read kded_instance.h , it's pretty good documented.

Next Previous Table of Contents