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

KJ P kde-java@kde.org
Mon, 11 Feb 2002 09:48:14 +0000


Hello

I have been playing around with the java bindings for some time now but have 
not done anything but play.  After receiving the examples from Emond 
Pagegaaij for qt I started the example for KScribble.

It has all gone very well thank you for the bindings.

Some questions as a newbie from QT and KDE and using the bindings.

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.

Also, when looking at KBase.java example it uses KStdAction.  Which is used 
as a standard both or should KStdAction be used?  I guess this is off topic 
for this list but hope to get an answer here.

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?

3) Could someone give me an example of using the QWhatsThis.  In 
kscribble.cpp it is as follows:

QToolButton *btnwhat = QWhatsThis::whatsThisButton(toolBar());
QToolTip::add(btnwhat, i18n("What's this...?"));
toolBar()->insertWidget(ID_HELP_WHATS_THIS, btnwhat->sizeHint().width(), 
btnwhat);

I have tried all sorts of things to get this working but to no avail.

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.

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.

My question is is this an error or have I done something wrong?  Probably I 
did something wrong but just had to ask.

Sorry for so many newbie quesions.  I have others but I like to dig.

The KScribble in java works great so far.  There is no difference in look 
and feel nor speed so far.  This is great.

I will post the code for your examples as soon as I get it cleaned up.  I 
have stuff commented out all over the place and the toolbar does not work 
yet I think because of the BarIcon that I mentioned before.

I did all of this yesterday (Sunday) while learning the Qt and KDE stuff at 
the same time.  I think this is a testimonial to the java bindings.

Thank you and keep up the good work.

Kenneth

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com