[Kde-java] Help
Paul Sprakes
pauls at sprakes.co.uk
Tue Aug 26 20:01:26 CEST 2003
I'm a Java programmer looking to learn KDE programming, eventually in c++,
so I'm giving the bindings a try.
I'm following the KDE tutorial at:
http://devel-home.kde.org/~larrosa/tutorial/index.html
and converting the code to java as I go.
I've got a problem at part 3 of the tutorial where they connect the
File->Open and File->Save menu items to fileOpen() and fileSave() methods.
The code compiles and runs really well, except that when I select either of
the above menu items the application crashes.
Here is the c++ code for fileOpen()
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 identified that the KFileDialog line is the offending one and that
getOpenURL() takes one more parameter (a string) then the c++ version. Can
anyone see what's wrong?
Thanks, Paul.
More information about the Kde-java
mailing list