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

Richard Dale kde-java@kde.org
Thu, 14 Feb 2002 13:03:14 +0000


On Thursday 14 February 2002 10:32 am, KJ P wrote:
> Thanks Richard
>
> You cleaned up the code as well.  I have finally contributed something to
> the KDE project!!!!
Yes, thanks - I'll change the kdejava/README to use KScribble as a demo 
app/confidence test. It goes well with having QtScribble as the equivalent 
example for Qt.

> I still need to add the other excellorator keys.
Send me any fixes/additions, and I'll put them in the cvs.

> Also, UserIcon() is missing.  I think that is a static method of the
> KGlobal class.  It works fine as the following:
KIconLoader.UserIcon() is one of the new static methods added to 
KIconLoader.java:

/**  Load a user icon.
*/
	public static native QPixmap UserIcon( String name, KInstanceInterface 
instance);

So it should work ok now.

-- Richard

> Sorry but code from memory again.
>
> private KIconLoader ki;
>    .
>    .
>    .
>
> // the next part is very important as I found out after
> //   a few hours
> KInstance ki = new KInstance();
> ki.setApp("myapp");
> ki= ki.iconLoader();
>
> QPixmap pix = UserIcon("something");
>
>    ... do something with pixmap
>
> // a private class using loadIcon of the KIconLoader obtained
> //    from the KInstance object
> private QPixmap UserIcon(String icon) {
>
>    return k.loadIcon(icon);
> }
>
> I think the code is right.
>
> Regards
>
> Kenneth
>
>
> From: Richard Dale <Richard_Dale@tipitina.demon.co.uk>
>
> >Reply-To: kde-java@kde.org
> >To: kde-java@kde.org
> >Subject: Re: [Kde-java] Some questions - long - KScribble in java
> >Date: 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
> >_______________________________________________
> >Kde-java mailing list
> >Kde-java@mail.kde.org
> >http://mail.kde.org/mailman/listinfo/kde-java
>
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx
>
> _______________________________________________
> Kde-java mailing list
> Kde-java@mail.kde.org
> http://mail.kde.org/mailman/listinfo/kde-java