Next Previous Table of Contents
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:
CORBA::ORB_ptr orb = CORBA::ORB_init( argc, argv, "mico-local-orb" );Please note that when using this construct or similar ones, your application is not able to act as CORBA server if you are using KDE/Qt classes at the same time. This is due to the fact that the ORB needs it's own event loop, beside the main Qt event loop. Currently only KOMApplication, as part of the KDE Object Model, implements the needed functionality to combine both event loops and thus making KDE apps able to serve CORBA Objects.
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