[Kde-bindings] KDE/kdebindings/ruby/korundum/examples
Andreas Pakulat
apaku at gmx.de
Sun Mar 30 02:17:34 UTC 2008
SVN commit 791649 by apaku:
Fix the code for Korundum4, the only thing I couldn't find out how to do is
adding the cmdline option. Ruby always complained about "add" being an
undefined method on that object.
CCMAIL:kde-bindings at kde.org
M +30 -30 kurldemo.rb
--- trunk/KDE/kdebindings/ruby/korundum/examples/kurldemo.rb #791648:791649
@@ -31,7 +31,7 @@
copyright holder.
=end
-require 'Korundum'
+require 'korundum4'
class MainWin < KDE::MainWindow
def initialize(*args)
@@ -43,46 +43,46 @@
edit = KDE::TextEdit.new(self)
setCentralWidget(edit)
- edit.insert("KURL Demo\n")
- edit.insert("\nAdding these urls:\n\n")
+ edit.insertPlainText("KURL Demo\n")
+ edit.insertPlainText("\nAdding these urls:\n\n")
@urls.each do |url|
- edit.insert(" #{url}\n")
+ edit.insertPlainText(" #{url}\n")
end
- edit.insert("\nCreating KURLs (iterating to print):\n\n")
+ edit.insertPlainText("\nCreating KURLs (iterating to print):\n\n")
urlList = []
@urls.each do |url|
- urlList << KDE::URL.new(url)
+ urlList << KDE::Url.new(url)
end
urlList.each do |url|
- edit.insert(" #{url.url()}\n")
+ edit.insertPlainText(" #{url.url()}\n")
end
- edit.insert("\nFirst url -- urlList [0]:\n\n")
- edit.insert(" #{urlList[0].to_s}\n")
- edit.insert(" #{urlList[0].url()}\n")
+ edit.insertPlainText("\nFirst url -- urlList [0]:\n\n")
+ edit.insertPlainText(" #{urlList[0].to_s}\n")
+ edit.insertPlainText(" #{urlList[0].url()}\n")
- edit.insert("\nLast url -- urlList [-1]:\n\n")
- edit.insert(" #{urlList[-1].to_s}\n")
- edit.insert(" #{urlList[-1].url()}\n")
+ edit.insertPlainText("\nLast url -- urlList [-1]:\n\n")
+ edit.insertPlainText(" #{urlList[-1].to_s}\n")
+ edit.insertPlainText(" #{urlList[-1].url()}\n")
- edit.insert("\nMiddle urls -- urlList [2,4]:\n\n")
+ edit.insertPlainText("\nMiddle urls -- urlList [2,4]:\n\n")
ulist = urlList[2,4]
ulist.each do |url|
- edit.insert(" #{url.to_s}\n")
- edit.insert(" #{url.url()}\n")
+ edit.insertPlainText(" #{url.to_s}\n")
+ edit.insertPlainText(" #{url.url()}\n")
end
- edit.insert("\nLength of urlList -- len (urlList):\n\n")
- edit.insert(" Length = #{urlList.length}\n")
+ edit.insertPlainText("\nLength of urlList -- len (urlList):\n\n")
+ edit.insertPlainText(" Length = #{urlList.length}\n")
- edit.insert("\nurl in urlList? -- KURL (\"http://yahoo.com\") in urlList\n\n")
- edit.insert(" KDE::URL.new(\"http://yahoo.com\") in urlList = ")
- tmp = KDE::URL.new("http://yahoo.com")
+ edit.insertPlainText("\nurl in urlList? -- KURL (\"http://yahoo.com\") in urlList\n\n")
+ edit.insertPlainText(" KDE::URL.new(\"http://yahoo.com\") in urlList = ")
+ tmp = KDE::Url.new("http://yahoo.com")
urlList.each do |url|
if url.url == tmp.url
- edit.insert("true")
+ edit.insertPlainText("true")
end
end
end
@@ -93,18 +93,18 @@
description = "A basic application template"
version = "1.0"
-aboutData = KDE::AboutData.new("", "",
- version, description, KDE::AboutData::License_GPL,
- "(C) 2003 whoever the author is")
+aboutData = KDE::AboutData.new("urldemo", "", KDE.ki18n("URL demo app"),
+ version, KDE.ki18n(description),KDE::AboutData::License_GPL,KDE.ki18n("(C) 2003 whoever the author is"))
-aboutData.addAuthor("author1", "whatever they did", "email at somedomain")
-aboutData.addAuthor("author2", "they did something else", "another at email.address")
+aboutData.addAuthor(KDE.ki18n("author1"), KDE.ki18n("whatever they did"), "email at somedomain")
+aboutData.addAuthor(KDE.ki18n("author2"), KDE.ki18n("they did something else"), "another at email.address")
KDE::CmdLineArgs.init(ARGV, aboutData)
+cmdlineoptions = KDE::CmdLineOptions.new()
+#cmdlineoptions.add("+files", KDE.ki18n("File to open"))
+KDE::CmdLineArgs.addCmdLineOptions(cmdlineoptions)
-KDE::CmdLineArgs.addCmdLineOptions([["+files", "File to open", ""]])
-
app = KDE::Application.new()
-mainWindow = MainWin.new(nil, "main window")
+mainWindow = MainWin.new(nil)
mainWindow.show()
app.exec()
More information about the Kde-bindings
mailing list