[Kde-java] More help

Paul Sprakes pauls at sprakes.co.uk
Tue Aug 26 20:03:06 CEST 2003


I'm also having problems further on in the tutorial with regards to
connecting a khtml part to my class.

This is the c++ code:

connect( browser->browserExtension(),
        SIGNAL( openURLRequest( const KURL &, const KParts::URLArgs & ) ),
        this, SLOT( openURLRequest(const KURL &, const KParts::URLArgs & ) )
);

And here's my java version:

connect(browser.browserExtension(), SIGNAL("openURLRequest(KURL,
org.kde.koala.URLArgs)"), this, SLOT("openURLRequest(KURL,
org.kde.koala.URLArgs)") ) ;

The code compiles and runs however the signal is never emmited.

Looking at the source for BrowserExtensionSignals, the openURLRequest method
is defined as:

void openURLRequest( KURL url, int arg1 );

Why is the second parameter an int and not URLArgs? I've tried changing my
code to use int as the second parameter but to no effect.


Would it not be better that the Java signal/slot mechanism be defined with
Signal/Slot objects? i.e.:

SIGNAL signal = new SIGNAL("openUrlRequest", new Class[] {KURL.class,
URLArgs.class});

SLOT slot = new SLOT("openUrlRequest", new Class[] {KURL.class,
URLArgs.class});

connect(browser, signal, this, slot);

The signals could also be predefined in their respective classes i.e:

connect(browser, BrowserExtensionSignals.openURLRequestSIGNAL, this, slot);


I'd appreciate any help with this or my previous post.

Paul.



More information about the Kde-java mailing list