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

List:       kde-devel
Subject:    Re: Implmenting DCOP
From:       Richard Dale <Richard_Dale () tipitina ! demon ! co ! uk>
Date:       2004-09-20 3:30:25
Message-ID: 200409200430.26060.Richard_Dale () tipitina ! demon ! co ! uk
[Download RAW message or body]

On Monday 20 September 2004 02:32, Ian Reinhart Geiser wrote:
> Richard Lärkäng said:
> > On Sunday 19 September 2004 20.28, PiggZ wrote:
> >> next question, a call to dcop returns kppp-PID,
>
> [...]
>
> > I don't thinks it's possible to listen for a dcop-signal in a shell
> > script,
> > but I could be wrong. OTOH, if you program in something like
> > perl/python/ruby
> > there's bindings for DCOP in the kdebindings module, from which you can
> > do really cool stuff.
>
> its possible with some hacks i did a few years ago, but its not so pretty.
>  Bsicly i wrote a small C++ app that just connected to the slots and
> returned to stdout the results.
>
> the javascript, python and afaik ruby bindings both support dcop signals
> and slots.  shell is funny when it comes to slots, since they are
> asynchronous by nature and a shell script is not.
Here's a ruby app that connects to kppp via dcop signals:

require 'Korundum'

class KpppMonitor < KDE::DCOPObject
    def initialize(*args)
        super
        connectDCOPSignal(nil, "KpppIface", 
                                      "connected()", "kpppConnect()", 
                                      false)
        connectDCOPSignal(nil, "KpppIface", 
                                      "disconnected()", "kpppDisconnect()", 
                                      false)
    end
 
    def kpppConnect()
        puts "kppp has connected"
    end
 
    def kpppDisconnect()
        puts "kppp has disconnected"
    end
end

class MainWindow < KDE::MainWindow
    def initialize(*args)
        super
        @kppp = KpppMonitor.new
    end
end

aboutData   = KDE::AboutData.new("kpppmonitor", "Kppp Monitor",
    "0.1", "Monitor kppp via signals", KDE::AboutData::License_GPL,
    "Richard Dale")
KDE::CmdLineArgs.init(ARGV, aboutData)

app = KDE::Application.new
mainWindow = MainWindow.new
mainWindow.show
app.exec

 
>> 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