[Kde-bindings] ruby and connectDCOPSignal

Richard Dale Richard_Dale at tipitina.demon.co.uk
Tue Jun 7 10:15:28 UTC 2005

On Tuesday 07 June 2005 04:58, Chris Gow wrote:
> I've just started to play with ruby and the kde bindings. According to the
> documentation on developer.kde.org, I should automagically get a
> connectDCOPSignal method if I have a k_dcop slots declaration. I've added
> one, but whenever I attempt to call connectDCOPSignal, I get a no method
> error. I'm learning both the bindings/kde development/ruby so I have no
> doubt that the problem is my code :)
> Any and all help is greatly appreciated.
> I'm running kde 3.4.1, kdebindings 3.4.1 on Fedora Core 3.
> Here's my code:
The problem is that the connectDCOPSignal method isn't added until the 
constructor is completed. I'm not sure if thats a bug that can be fixed, so 
you need to have a method to do the connection. Also you can't have the arg 
names in a DCOP method signature. I'm not sure what you're intending to do - 
did you mean to define a DCOP signal? For that you need a 'k_dcop_signals' 

    k_dcop_signals 'void notifyHistoryEntry(KonqHistoryEntry, QCString)'
    emit notifyHistoryEntry(entry, saveid)

See the example code in korundum/rubylib/examples/dcop/dcopsignal.rb

The app needs to look like this instead:

require 'Korundum'

class KonqHistory < KDE::ListView
    k_dcop 'void notifyHistoryEntry(KonqHistoryEntry, QCString)'

    def initialize( )
        super( nil, "KonqHistory" )
        addColumn( i18n( "Konqueror History" ) )

    def doConnect( )
        connectDCOPSignal( nil, nil,
        'notifyHistoryEntry(KonqHistoryEntry, QCString)', 
	    'notifyHistoryEntry(KonqHistoryEntry, QCString)', false )
    def notifyHistoryEntry( entry, saveid )
        puts "ENTRY ADDED"

about = KDE::AboutData.new( "KonquerorHistory", "Konqueror History", "0.1" )
KDE::CmdLineArgs.init( ARGV, about )

konqHistory = KDE::UniqueApplication.new( )
list = KonqHistory.new
list.resize( 300, 200 )

konqHistory.mainWidget = list

-- Richard

More information about the Kde-bindings mailing list