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); }
public Browser(string name) : base((QWidget) null) { ObjectName = name; SetCaption("KDE Tutorial - p9"); QMenu filemenu = new QMenu(KDE.I18n("&File"), this); KAction setDefaultPageAction = new KAction(this); setDefaultPageAction.Text = KDE.I18n("&Set default page"); ActionCollection().AddAction("set_default_page", setDefaultPageAction); Connect( setDefaultPageAction, SIGNAL("triggered(bool)"), this, SLOT("FileSetDefaultPage()") ); addBookmarkAction = KStandardAction.AddBookmark(this, SLOT("BookLocation()"), ActionCollection()); backAction = KStandardAction.Back(this, SLOT("GotoPreviousPage()"), ActionCollection()); backAction.Enabled = false; quitAction = KStandardAction.Quit(KApplication.kApplication(), SLOT("quit()"), ActionCollection()); string about = KDE.I18n("p9 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); ToolBar().AddAction(quitAction); ToolBar().AddAction(addBookmarkAction); ToolBar().AddAction(backAction); StandardToolBarMenuEnabled = true; location = new QLineEdit(); config = new KConfigGroup(KGlobal.Config(), "Settings"); location.Text = config.ReadEntry("defaultPage", "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); 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); SetupGUI(); }