From 90825e2392b2d70e43c7a25b8a3752299a933894 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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 --- korundum/rubylib/tutorials/p3/p3.rb | 61 +++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 korundum/rubylib/tutorials/p3/p3.rb (limited to 'korundum/rubylib/tutorials/p3') diff --git a/korundum/rubylib/tutorials/p3/p3.rb b/korundum/rubylib/tutorials/p3/p3.rb new file mode 100644 index 00000000..fc575878 --- /dev/null +++ b/korundum/rubylib/tutorials/p3/p3.rb @@ -0,0 +1,61 @@ +require 'Korundum' + +class MainWindow < KDE::MainWindow + slots 'fileOpen()', 'fileSave()' + + def initialize( name ) + super(nil, name) + setCaption("KDE Tutorial - p3") + + filemenu = Qt::PopupMenu.new + filemenu.insertItem( i18n( "&Open" ), self, SLOT('fileOpen()') ) + filemenu.insertItem( i18n( "&Save" ), self, SLOT('fileSave()') ) + filemenu.insertItem( i18n( "&Quit" ), $kapp, SLOT('quit()') ) + + about = + i18n("p3 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 ) + + hello = Qt::TextEdit.new( + i18n("

Hello World !


This is a simple" + + " window with Rich Text" + + " capabilities
Try to resize" + + " this window, all this is automatic !"), "", self ) + setCentralWidget(hello) + end + + def fileOpen() + filename = KDE::FileDialog.getOpenURL( nil, "*", self ) + msg = i18n("Now this app should open the url #{filename.url()}") + KDE::MessageBox.information( nil, msg, i18n( "Information" ), + "fileOpenInformationDialog" ) + end + + def fileSave() + filename = KDE::FileDialog.getSaveURL( nil, "*", self ) + end +end + + about = KDE::AboutData.new("p3", "Tutorial - p3", "0.1") + KDE::CmdLineArgs.init(ARGV, about) + a = KDE::Application.new() + window = MainWindow.new( "Tutorial - p3" ) + window.resize( 400, 300 ) + + a.mainWidget = window + window.show + + a.exec -- cgit v1.2.1