summaryrefslogtreecommitdiffstats
path: root/korundum/rubylib/tutorials/p4/p4.rb
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit90825e2392b2d70e43c7a25b8a3752299a933894 (patch)
treee33aa27f02b74604afbfd0ea4f1cfca8833d882a /korundum/rubylib/tutorials/p4/p4.rb
downloadtdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.tar.gz
tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'korundum/rubylib/tutorials/p4/p4.rb')
-rw-r--r--korundum/rubylib/tutorials/p4/p4.rb67
1 files changed, 67 insertions, 0 deletions
diff --git a/korundum/rubylib/tutorials/p4/p4.rb b/korundum/rubylib/tutorials/p4/p4.rb
new file mode 100644
index 00000000..63777872
--- /dev/null
+++ b/korundum/rubylib/tutorials/p4/p4.rb
@@ -0,0 +1,67 @@
+require 'Korundum'
+
+class MainWindow < KDE::MainWindow
+ slots 'changeLocation()',
+ 'openURLRequest(const KURL &, const KParts::URLArgs & )'
+
+ def initialize( name )
+ super(nil, name)
+ setCaption("KDE Tutorial - p4")
+
+ filemenu = Qt::PopupMenu.new
+ filemenu.insertItem( i18n( "&Quit" ), $kapp, SLOT( 'quit()' ) )
+ about =
+ i18n("p4 1.0\n\n" +
+ "(C) 1999-2002 Antonio Larrosa Jimenez\n" +
+ "larrosa@kde.org\t\tantlarr@supercable.es\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");
+
+ helpmenu = helpMenu(about)
+ menu = menuBar()
+ menu.insertItem( i18n( "&File" ), filemenu)
+ menu.insertSeparator()
+ menu.insertItem(i18n("&Help"), helpmenu)
+
+ vbox = Qt::VBox.new( self )
+
+ @location = Qt::LineEdit.new( vbox )
+ @location.setText( "http://localhost" )
+
+ @browser = KDE::HTMLPart.new( vbox )
+ @browser.openURL( KDE::URL.new(@location.text()) )
+
+ connect( @location , SIGNAL( 'returnPressed()' ),
+ self, SLOT( 'changeLocation()' ) )
+
+ connect( @browser.browserExtension(),
+ SIGNAL( 'openURLRequest( const KURL &, const KParts::URLArgs & )' ),
+ self, SLOT( 'openURLRequest(const KURL &, const KParts::URLArgs & )' ) )
+
+ setCentralWidget(vbox)
+ end
+
+ def changeLocation()
+ @browser.openURL( KDE::URL.new(@location.text()) )
+ end
+
+ def openURLRequest(url, part)
+ @location.text = url.url()
+ changeLocation()
+ end
+end
+
+ about = KDE::AboutData.new("p4", "Tutorial - p4", "0.1")
+ KDE::CmdLineArgs.init(ARGV, about)
+ a = KDE::Application.new()
+
+ window = MainWindow.new( "Tutorial - p4" )
+ window.resize( 300, 200 )
+
+ a.mainWidget = window
+ window.show
+
+ a.exec \ No newline at end of file