public MainWindow(string name)
: base((QWidget) null)
{
ObjectName = name;
SetCaption("KDE Tutorial - p5");
QMenu filemenu = new QMenu(KDE.I18n("&File"), this);
filemenu.AddAction(KDE.I18n("&Quit"), KApplication.kApplication(), SLOT("quit()"));
string about = KDE.I18n("p5 1.0\n\n" +
"(C) 1999-2002 Antonio Larrosa Jimenez\n" +
"[email protected]\t\[email protected]\n" +
"Malaga (Spain)\n\n" +
"Simple KDE Tutorial\n" +
"This tutorial comes with ABSOLUTELY NO WARRANTY\n" +
"This is free software, and you are welcome to redistribute it\n" +
"under certain conditions\n");
QMenu helpmenu = HelpMenu(about);
KMenuBar menu = MenuBar();
menu.AddMenu(filemenu);
menu.AddSeparator();
menu.AddMenu(helpmenu);
location = new QLineEdit();
location.Text = "http://localhost";
Connect( location , SIGNAL("returnPressed()"),
this, SLOT("changeLocation()") );
QSplitter split = new QSplitter();
split.OpaqueResize = true;
QWidget widget = new QWidget(this);
QVBoxLayout vbox = new QVBoxLayout(widget);
vbox.AddWidget(location);
vbox.AddWidget(split);
QPushButton bookmark = new QPushButton(KDE.I18n("Add to Bookmarks"), split);
Connect(bookmark, SIGNAL("clicked()"), this, SLOT("BookLocation()"));
browser = new KHTMLPart(split);
browser.OpenUrl(new KUrl(location.Text));
Connect( browser.BrowserExtension(),
SIGNAL("openUrlRequest(KUrl, KParts::OpenUrlArguments)"),
this, SLOT("OpenUrlRequest(KUrl, KParts::OpenUrlArguments)") );
SetCentralWidget(widget);
}