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

List:       kde-core-devel
Subject:    Re: KGesture and DCOP Interfaces
From:       Simon Hausmann <hausmann () kde ! org>
Date:       2001-05-24 20:43:54
[Download RAW message or body]

On Thu, May 24, 2001 at 01:27:13PM -0700, Waldo Bastian wrote:
> On Thursday 24 May 2001 13:06, Mike Pilone wrote:
> > > > What are the chances of getting these exposed? Is KGesture going about
> > > > this the wrong way?
> > >
> > > No, this is exactly what DCOP is for. The problem is that application
> > > developers often don't use this themselves so they don't think of making
> > > functionality DCOP accesable. Can't you activate "actions" (KAction) via
> > > DCOP btw? I would assume that back() and next() (?) are based on KAction.
> >
> > Hey Waldo,
> >
> > I haven't been able to find the actions exposed via DCOP. Is this still
> > the case or have things changed?
> 
> Hm.. no idea actually.. maybe one of the KAction experts can shed light on 
> this.

There's a class available for exporting the functionality of a KAction object
(kdcopactionproxy in kdeui) . Konqueror and all the KOffice applications
utilize it, so you can easily call all sorts of methods for all the actions
these applications have. However there is not a dcop object for each action,
that would eat far too much memory. Instead this is implemented using
virtual object references, where the real object is encoded in another
object name.

Have a look at Konqueror's KonqMainWindowIface
(dcop konqueror "konqueror-mainwindow#1") for some ways how to query (virtual)
object references for action objects. (you can just get a list, query by
name or retrieve a map (useful in the python binding, where it's mapped to
a python dictionary of dcop references))

In case of Konqueror it's even a bit easier, the encoding is rather simple.
Just try

dcop konqueror "konqueror-mainwindow#1/action/copy"

As you can see with that example all the Qt properties of an action objects
are exported (set/get style and generic setProperty/property/propertyNames) ,
together with two helper functions, isPlugged() and activate() (the latter is
probably the one you're interested in most :-)

So

dcop konqueror "konqueror-mainwindow#1/action/back" activate

does what you expect :-)

Bye,
 Simon

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

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