[Kde-java] Some questions - long - KScribble in java

Richard Dale kde-java@kde.org
Thu, 14 Feb 2002 00:19:33 +0000


I've checked in Emond's tutorials and example app into 
kdebindings/qtjava/javalib/tutorials and 
kdebindings/qtjava/javalib/examples/application.

And I've checked in Kenneth's KScribble into 
kdebindings/kdejava/koala/examples/kscribble.

Both work fine with Qt 3/KDE 3

On Monday 11 February 2002 9:48 am, KJ P wrote:
> 1)  KScribble uses the following
>
> pFileMenu->insertItem(BarIcon("filenew"), i18n("&New"), ID_FILE_NEW);
> pFileMenu->insertItem(BarIcon("fileopen"), i18n("&Open..."), ID_FILE_OPEN);
>
> I can not find BarIcon.  Is it missing or have I missed something.
Added as static methods KIconLoader.BarIcon(), KIconLoader.BarIconSet() etc

> 2) Does the i18n not exist for java?  KBase.java uses tr() so instead I
> wrote an i18n method which calls tr() that way I did not have to change all
> the i18n code.  Is the tr() method going to be used instead of the i18n?
I added QObject.i18n() as a synonym for tr().

> 4) While reading options and using the readListEntry for recentFiles I get
> a error linkage not satisfied error.  I have tried both versions of the
> method call for java.
>   // initialize the recent file list
>   config->readListEntry("Recent Files",recentFiles);
>
>   My code (example):
>
>   ArrayList recentFiles = new ArrayList();
>   config.readListEntry("Recent Files",recentFiles);
>
> Sorry I can not give the exact error message as I am writing from memory
> and do not have the code here.  I can of course provide this if needed
> later.
KConfig.readListEntry() and writeListEntry() have now been fixed.

> 5) When trying to load an image from open file list in kscribbledoc.cpp
>
>   /////////////////////////////////////////////////
>   // TODO: Add your document opening code here
> 	if(!buffer.load( filename, format ))
> 		return false;
> 	size=buffer.size(); /////////////////////////////////////////////////
>
> I tried the buffer.load( filename, format, conv) method.
>
>    format is difined as a char in the C++ library version but in the java
> binding it is a String.  I could not for the life of me get this to work. 
> I finally used !buffer.load( filename ) and it worked perfectly.
The method KPixmap.load() is correct and works fine - format is 'const char *' 
in C++ which should become a java.lang.String.

Here are some other fixes which came out of testing KScribble with the 
Qt3/KDE3 bindings:

	- QPaintDevice - added missing bitBlt() methods

	- QPopupMenu - added missing insertItem() methods

	- Added missing QPointArray(int) constructor

	- QtSupport - Added extra default parameter to C++ -> java array
           conversions,so an existing java array can be used as a target.

	- KAccel - Fixed java slot connections

	- JNI function name link problems in KURL.directory() and KImageIO.pattern() 
           fixed.

	- Added KMainWindow.memberList() method.

Drag and drop don't work with C++ either with my version of kdelibs, so I 
don't think there is anything wrong with the java version.

Apart from that, it now looks and behaves identically to the original C++ one 
in every way - a really good test.

-- Richard