[Kde-java] Help
Paul Sprakes
pauls at sprakes.co.uk
Wed Aug 27 20:02:48 CEST 2003
> > >void MainWindow::fileOpen()
> > >{
> > > KURL filename = KFileDialog::getOpenURL( QString::null, "*", this
> > > ); QString msg = QString( i18n("Now this app should open the url %1 .")
> > > ).arg(filename.url());
> > > KMessageBox::information( 0, msg, i18n( "Information" ),
> > > "fileOpenInformationDialog" );
> > >}
> > >
> > >and here is my java version
> > >
> > >
> > >public void fileOpen() {
> > > KURL filename = KFileDialog.getOpenURL(null, "*", this, null);
> > > String msg = i18n("Now this app should open the url %1 . ") +
> > >filename.url();
> > > KMessageBox.information(null, i18n("Information"),
> > >"fileOpenInformationDialog");
> > >}
I've found out that both the KFileDialog.getOpenURL() and
KFileDialog.getSaveURL() methods will crash the application if the first
parameter (startDir) is null. When called with a String (i.e.
QDir.currentDirPath()) the application will not crash.
The KFileDialog API reference has this to say about the startDir param:
"QString::null to start in the current working directory, or the last
directory where a file has been selected. "
So it should be able to take a null argument.
I have tested this with both the blackdown 1.4.1 JDK and Sun's 1.4.2 JDK.
Using Mandrake 9.1
Another strange occurence is with the blackdown JDK. My app was originally a
single class which extended KMainWindow. It also had it's own main() method
which created the KApllication and my custom KMainWindow. With the blackdown
JDK the application would terminate with no error/warning info on the
constructor call of my custom KMainWindow. However, if I extract the main()
method (along with the static initializer) into it's own class (Main.java) it
will then run OK. This problem doesn't occur with Sun's JDK.
Cheers, Paul.
P.S. When I've finished the KDE tutorial I'm planning on writing a kde-java
version of it, which hopefully will lower the point of entry for kde-java
programming and possibly kde c++ too. Would it be possibly for this to be
uploaded to the kdebindings web site? I would obviously maintain it for
future releases.
More information about the Kde-java
mailing list