/*
 *  SPL - The SPL Programming Language
 *  Copyright (C) 2004, 2005  Clifford Wolf <clifford@clifford.at>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *  qtdemo006.spl: A simple demo for writing kde applications
 */

load "kde";

var sites = [
	[ name: "The SPL Homepage", url: "http://www.clifford.at/spl/" ],
	[ name: "SPL Module Docs", url: "http://www.clifford.at/spl/spldoc/" ],
	[ name: "Qt Reference Docs", url: "http://doc.trolltech.com/" ],
	[ name: "KDE Reference Docs", url: "http://developer.kde.org/documentation/" ]
];

qt_kdeinit("simplebrowser", "Simple HTML browser application", "1.0");

var kapp = new qt.KApplication();

var win = new qt.QVBox();
win.resize(800, 600);

var selector = new qt.QComboBox(win);
foreach i (sites)
	selector.insertItem(sites[i].name, i);

var browser = new qt.KHTMLPart(win);

qt_signal_callback(selector, "activated(int)",
	function(i) { browser.openURL(new qt.KURL(sites[i].url)); });

qt_signal_callback(browser.browserExtension(),
	"openURLRequest(const KURL&,const KParts::URLArgs&)",
	function(url) { browser.openURL(new qt.KURL(url)); });

browser.openURL(new qt.KURL("http://www.clifford.at/spl/"));

win.show();
kapp.setMainWidget(win);

kapp.exec();

