diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 90825e2392b2d70e43c7a25b8a3752299a933894 (patch) | |
tree | e33aa27f02b74604afbfd0ea4f1cfca8833d882a /korundum/rubylib/examples/xmlgui.rb | |
download | tdebindings-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/examples/xmlgui.rb')
-rwxr-xr-x | korundum/rubylib/examples/xmlgui.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/korundum/rubylib/examples/xmlgui.rb b/korundum/rubylib/examples/xmlgui.rb new file mode 100755 index 00000000..8f021ccf --- /dev/null +++ b/korundum/rubylib/examples/xmlgui.rb @@ -0,0 +1,42 @@ +#!/usr/bin/env ruby + +require 'Korundum' +require 'tempfile' + +about = KDE::AboutData.new("one", "two", "three") +#KDE::CmdLineArgs.init(about) +KDE::CmdLineArgs.init(ARGV, about) +app = KDE::Application.new() + +class Receiver < Qt::Object + slots "pressed_up()", "close()", "quit()" + def initialize main, *k + super(*k) + @main = main + end + def quit + @main.close + end +end + +RAction = Struct.new :xmlgui_name, :string, :accel, :something +class RAction + def create receiver, slot, action_collection + p self.string + KDE::Action.new self.string, self.accel, receiver, slot, action_collection, self.xmlgui_name + end +end + +# { Quit, KStdAccel::Quit, "file_quit", I18N_NOOP("&Quit"), 0, "exit" }, +std_actions = { :quit => RAction.new( "file_quit", ("&Quit"), KDE::Shortcut.new(), "exit" ) } + +begin + m = KDE::MainWindow.new + @r = Receiver.new m + mActionCollection = m.actionCollection + action = std_actions[:quit].create @r, SLOT("quit()"), mActionCollection + m.createGUI Dir.pwd + "/xmlgui.rc" + app.setMainWidget(m) + m.show + app.exec() +end |