[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Help with DCOP interface to kalarm
From:       Adriaan de Groot <adridg () cs ! kun ! nl>
Date:       2003-12-28 12:56:18
[Download RAW message or body]

On Sunday 28 December 2003 12:30, Kevin Gilbert wrote:
> Can anyone help me with some (very) simple examples of how implement (a
> perhaps two-way) interface from a kicker applet to the kalarm daemon? I
> stress that this is a kicker applet - if that makes a difference. A URL
> or file path for "DCOP For Dummies" documentation would also be
> appreciated.

dcopclient.h contains _some_ information, but isn't really the preferred way 
to deal with DCOP calls to a known application. What you can do is grab the 
DCOP interface definition from kalam. That's the file 
kalarmd/alarmdaemoniface.h . Note that it defines one DCOP interface for the 
alarm demon (the other is the GUI interface). Run this through the dcopidl 
compilers:

dcopidl $SRCDIR/kalarmd/alarmdaemoniface.h > adi.kidl
dcopidl2cpp --no-skel adi.kidl

now you have an adi_stub.h and an adi_stub.cpp. Take a look in the .h file. 
That's a class that you can instatiate with an application name and interface 
name (ie. "kalarmd" and the name of the alarm demon interface, which you can 
discover by running dcop or kdcop.). Something like:

	AlarmDaemonIface_stub alarmStub("kalarmd","ad");

now, you can call methods of that object to do the DCOP communication:

	QStringList alarms = alarmStub.dumpAlarms();
	if (alarms.find("quit alarmd")) 
		{ alarmStub.enableAutoStart(false); alarmStub.quit(); }

There's a little more to it than that, you may need to check that the calls 
succeed before trusting the value returned, but that's the general idea.

-- 
pub  1024D/FEA2A3FE 2002-06-18 Adriaan de Groot <groot@kde.org>
            If the door is ajar, can we fill it with door-jamb?
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic