diff options
Diffstat (limited to 'languages/ruby/app_templates/kapp')
19 files changed, 1058 insertions, 0 deletions
diff --git a/languages/ruby/app_templates/kapp/CMakeLists.txt b/languages/ruby/app_templates/kapp/CMakeLists.txt new file mode 100644 index 00000000..6817278b --- /dev/null +++ b/languages/ruby/app_templates/kapp/CMakeLists.txt @@ -0,0 +1,27 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_custom_target( kappruby.tar.gz ALL + COMMAND tar zcf kappruby.tar.gz -C ${CMAKE_CURRENT_SOURCE_DIR} + app_client.rb appiface.rb app.rb appview.rb main.rb pref.rb + app.cpp appui.rc app.desktop app.tdevelop app-Makefile.am + app-configure.in.in src-Makefile.am subdirs README +) + + +install( FILES + ${CMAKE_CURRENT_BINARY_DIR}/kappruby.tar.gz kappruby.png + DESTINATION ${DATA_INSTALL_DIR}/kdevappwizard ) + + +install( FILES + kappruby.kdevtemplate + DESTINATION ${DATA_INSTALL_DIR}/kdevappwizard/templates ) diff --git a/languages/ruby/app_templates/kapp/Makefile.am b/languages/ruby/app_templates/kapp/Makefile.am new file mode 100644 index 00000000..9dbc37b5 --- /dev/null +++ b/languages/ruby/app_templates/kapp/Makefile.am @@ -0,0 +1,19 @@ +dataFiles = app_client.rb appiface.rb app.rb appview.rb main.rb pref.rb app.cpp \ + appui.rc app.desktop app.tdevelop app-Makefile.am app-configure.in.in \ + src-Makefile.am subdirs README + +templateName = kappruby + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/ruby/app_templates/kapp/README b/languages/ruby/app_templates/kapp/README new file mode 100644 index 00000000..39de8b2f --- /dev/null +++ b/languages/ruby/app_templates/kapp/README @@ -0,0 +1,81 @@ +----------------------------------------------- +Kde application framework template quickstart +Author: Thomas Nagy +Date: 2004-03-22 +----------------------------------------------- + +This README file explains you basic things for starting with +this application template. + + +** Building and installing ** + +* Build the configure script by "make -f Makefile.cvs" + +* To clean, use "make clean", and to clean everything +(remove the makefiles, etc), use "make distclean" + +* To distribute your program, try "make dist". +This will make a compact tarball archive of your release with the +necessary scripts inside. + +* Modifying the auto-tools scripts +for automake scripts there is an excellent tutorial there : +http://developer.kde.org/documentation/other/makefile_am_howto.html + +* Simplify your life : install the project in your home directory for +testing purposes. +./configure --prefix=/home/user/dummyfolder/ +In the end when you finished the development you can +rm -rf /home/user/dummyfolder/ +without fear. + + +** Technologies ** + +* Build the menus of your application easily +kde applications now use an xml file (*ui.rc file) to build the menus. +This allow a great customization of the application. However, when +programming the menu is shown only after a "make install" + +For more details, consult : +http://devel-home.kde.org/~larrosa/tutorial/p9.html +http://developer.kde.org/documentation/tutorials/xmlui/preface.html + +* Use TDEConfig XT to create your configuration dialogs and make +them more maintainable. + +For more details, consult : +http://developer.kde.org/documentation/tutorials/tdeconfigxt/tdeconfigxt.html + +* With KParts, you can embed other kde components in your program, or make your program +embeddable in other apps. For example, the kmplayer kpart can be called to play videos +in your app. + +For more details, consult : +http://www-106.ibm.com/developerworks/library/l-tdeparts/ +http://developer.kde.org/documentation/tutorials/dot/writing-plugins.html +http://developer.kde.org/documentation/tutorials/developing-a-plugin-structure/index.html + +* With dcop, you can control your app from other applications +Make sure to include K_DCOP and a kdcop: section in your .h file +http://developer.kde.org/documentation/tutorials/dot/dcopiface/dcop-interface.html + + +** Documentation ** + +* For the translations : +1. Download a patched gettext which can be found at: + http://public.kde.planetmirror.com/pub/kde/devel/gettext-kde/ +2. Install that gettext in ~/bin/ +3. cd ~/yourproject, export PATH=~/bin:$PATH, export +TDEDIR=/where_your_KDE3_is +4. make -f admin/Makefile.common package-messages +5. make package-messages +6. Translate the po files (not the pot!!) with kbabel or xemacs + +* Do not forget to write the documentation for your kde app +edit the documentation template index.docbook in doc/ + + + diff --git a/languages/ruby/app_templates/kapp/app-Makefile.am b/languages/ruby/app_templates/kapp/app-Makefile.am new file mode 100644 index 00000000..bfe1c599 --- /dev/null +++ b/languages/ruby/app_templates/kapp/app-Makefile.am @@ -0,0 +1 @@ +SUBDIRS = $(TOPSUBDIRS) diff --git a/languages/ruby/app_templates/kapp/app-configure.in.in b/languages/ruby/app_templates/kapp/app-configure.in.in new file mode 100644 index 00000000..7d849466 --- /dev/null +++ b/languages/ruby/app_templates/kapp/app-configure.in.in @@ -0,0 +1,45 @@ +#MIN_CONFIG(3.0.0) + +AM_INIT_AUTOMAKE(%{APPNAMELC}, 0.1) +AC_C_BIGENDIAN +AC_CHECK_KDEMAXPATHLEN + +AC_PROG_MAKE_SET + +AC_CHECK_PROG(RUBY, ruby, ruby) + +if test -z "$RUBY"; then + DO_NOT_COMPILE="$DO_NOT_COMPILE qtruby" +else + AC_MSG_CHECKING(for ruby dirs) + RUBY_ARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"archdir"@:>@)'` + RUBY_SITEARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitearchdir"@:>@)'` + RUBY_SITEDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitelibdir"@:>@)'` + RUBY_LIBDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"libdir"@:>@)'` + RUBY_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'` + AC_MSG_RESULT([archdir $RUBY_ARCHDIR, sitearchdir $RUBY_SITEARCHDIR, sitedir $RUBY_SITEDIR, libdir $RUBY_LIBDIR, librubyarg $RUBY_LIBRUBYARG]) + AC_SUBST(RUBY_ARCHDIR) + AC_SUBST(RUBY_SITEARCHDIR) + AC_SUBST(RUBY_SITEDIR) + AC_SUBST(RUBY_LIBDIR) + AC_SUBST(RUBY_LIBRUBYARG) +fi + +# Korundum check +AC_MSG_CHECKING([whether Korundum is installed]) +korundum_present=no +cat >korundumtest.rb <<END +require 'Korundum' +END +${RUBY} korundumtest.rb >/dev/null 2>&1 && korundum_present=yes +AC_MSG_RESULT([$korundum_present]) + +# rbuic check +AC_PATH_PROG([RBUIC],[rbuic]) +if test -z "${RBUIC}" ; then + AC_MSG_ERROR([cannot find rbuic (part of the QtRuby package)]) +fi +AC_SUBST([RBUIC]) +AC_SUBST([RUBY]) + + diff --git a/languages/ruby/app_templates/kapp/app.cpp b/languages/ruby/app_templates/kapp/app.cpp new file mode 100644 index 00000000..04770335 --- /dev/null +++ b/languages/ruby/app_templates/kapp/app.cpp @@ -0,0 +1,30 @@ +#include <ruby.h> + +#include <tqstring.h> +#include <tqfileinfo.h> +#include <kinstance.h> +#include <kstandarddirs.h> + +int main(int argc, char **argv) { + TDEInstance * instance = new TDEInstance("%{APPNAMELC}"); + TQString appdir = ::locate("data", "%{APPNAMELC}/main.rb", instance); + delete instance; + if (appdir.isNull()) { + tqFatal("Error: Can't find \"%{APPNAMELC}/main.rb\"\n"); + } + TQFileInfo program(appdir); + + char ** rubyargs = (char **) calloc(argc+4, sizeof(char *)); + rubyargs[0] = strdup(argv[0]); + rubyargs[1] = strdup("-KU"); + rubyargs[2] = strdup(TQString("-C%1").arg(program.dirPath()).latin1()); + rubyargs[3] = strdup(TQString("-I%1").arg(program.dirPath()).latin1()); + rubyargs[4] = strdup(program.fileName().latin1()); + for (int i = 1; i < argc; i++) { + rubyargs[i+4] = argv[i]; + } + + ruby_init(); + ruby_options(argc+4, rubyargs); + ruby_run(); +} diff --git a/languages/ruby/app_templates/kapp/app.desktop b/languages/ruby/app_templates/kapp/app.desktop new file mode 100644 index 00000000..4587fd3c --- /dev/null +++ b/languages/ruby/app_templates/kapp/app.desktop @@ -0,0 +1,44 @@ +[Desktop Entry] +Name=%{APPNAME} +Exec=ruby %{APPNAMELC}/main.rb %i -caption "%c" +Icon=%{APPNAMELC} +Type=Application +DocPath=%{APPNAMELC}/%{APPNAMELC}.html +Comment=A TDE KPart Application +Comment[br]=Ur meziant Kpart evit TDE +Comment[ca]=Una aplicació KPart per al TDE +Comment[cy]=Cymhwysiad KPart TDE +Comment[da]=Et TDE KPart-program +Comment[de]=Eine auf der Komponententechnik KPart basierende TDE-Anwendung +Comment[el]=Μια εφαρμογή KPart του TDE +Comment[es]=Una aplicación KPart de TDE +Comment[et]=TDE KPart rakendus +Comment[eu]=TDE KPart aplikazio bat +Comment[fa]=یک کاربرد TDE KPart +Comment[fr]=Une application KPart pour TDE +Comment[ga]=Feidhmchlár KPart TDE +Comment[gl]=Unha aplicación KPart de TDE +Comment[hi]=एक केडीई के-पार्ट अनुप्रयोग +Comment[hu]=KPart-alapú TDE-alkalmazás +Comment[is]=TDE KPart forrit +Comment[it]=Applicazione KPart di TDE +Comment[ja]=TDE KPart アプリケーション +Comment[lt]=TDE KPart programa +Comment[nds]=En KPart-Deelprogramm för TDE +Comment[ne]=एउटा केडीई KPart अनुप्रयोग +Comment[nl]=Een TDE KPart-toepassing +Comment[pl]=Osadzalny element KPart TDE +Comment[pt]=Uma Aplicação KPart do TDE +Comment[pt_BR]=Um Aplicativo KPart do TDE +Comment[ru]=Приложение KPart для TDE +Comment[sk]=TDE KPart aplikácia +Comment[sl]=Program KPart za TDE +Comment[sr]=TDE KPart програм +Comment[sr@Latn]=TDE KPart program +Comment[sv]=Ett TDE Kpart-program +Comment[ta]=கெடி கெபார்ட் பயன்பாடு +Comment[tg]=Ба кор андохтани KPart барои TDE +Comment[tr]=Bir TDE KPart Uygulaması +Comment[zh_CN]=一个 TDE KPart 应用程序 +Comment[zh_TW]=TDE KPart 應用程式 +Terminal=false diff --git a/languages/ruby/app_templates/kapp/app.rb b/languages/ruby/app_templates/kapp/app.rb new file mode 100644 index 00000000..61531be2 --- /dev/null +++ b/languages/ruby/app_templates/kapp/app.rb @@ -0,0 +1,216 @@ +=begin + This class serves as the main window for %{APPNAME}. It handles the + menus, toolbars, and status bars. + + @short Main window class + @author %{AUTHOR} <%{EMAIL}> + @version %{VERSION} +=end + +class %{APPNAMESC} < KDE::MainWindow + + Q_SLOTS 'fileNew()', + 'fileOpen()', + 'fileSave()', + 'fileSaveAs()', + 'filePrint()', + 'optionsPreferences()', + 'changeStatusbar(const QString&)', + 'changeCaption(const QString&)' + + def initialize() + super( nil, "%{APPNAMESC}" ) + @view = %{APPNAMESC}View.new(self) + @printer = nil + # accept dnd + setAcceptDrops(true) + + # tell the KDE::MainWindow that this is indeed the main widget + setCentralWidget(@view) + + # then, setup our actions + setupActions() + + # and a status bar + statusBar().show() + + # Apply the create the main window and ask the mainwindow to + # automatically save settings if changed: window size, toolbar + # position, icon size, etc. Also to add actions for the statusbar + # toolbar, and keybindings if necessary. + setupGUI(); + + # allow the view to change the statusbar and caption + connect(@view, SIGNAL('signalChangeStatusbar(const QString&)'), + self, SLOT('changeStatusbar(const QString&)')) + connect(@view, SIGNAL('signalChangeCaption(const QString&)'), + self, SLOT('changeCaption(const QString&)')) + + end + + + def load(url) + target = "" + # the below code is what you should normally do. in this + # example when, we want the url to our own. you probably + # want to use this code instead for your app + + if false + # download the contents + if TDEIO::NetAccess.download(url, target, self) + # set our caption + setCaption(url.url) + + # load in the file (target is always local) + @view.openURL(KDE::URL.new(target)) + + # and remove the temp file + TDEIO::NetAccess.removeTempFile(target) + end + end + + setCaption(url.prettyURL()) + @view.openURL(url) + end + + def setupActions() + KDE::StdAction.openNew(self, SLOT('fileNew()'), actionCollection()) + KDE::StdAction.open(self, SLOT('fileOpen()'), actionCollection()) + KDE::StdAction.save(self, SLOT('fileSave()'), actionCollection()) + KDE::StdAction.saveAs(self, SLOT('fileSaveAs()'), actionCollection()) + KDE::StdAction.print(self, SLOT('filePrint()'), actionCollection()) + KDE::StdAction.quit($kapp, SLOT('quit()'), actionCollection()) + + KDE::StdAction.preferences(self, SLOT('optionsPreferences()'), actionCollection()) + + # this doesn't do anything useful. it's just here to illustrate + # how to insert a custom menu and menu item + custom = KDE::Action.new(i18n("Cus&tom Menuitem"), KDE::Shortcut.new(), + self, SLOT('optionsPreferences()'), + actionCollection(), "custom_action") + end + + def saveProperties(config) + # the 'config' object points to the session managed + # config file. anything you write here will be available + # later when this app is restored + + if !@view.currentURL().empty? + config.writeEntry("lastURL", @view.currentURL()) + end + end + + def readProperties(config) + # the 'config' object points to the session managed + # config file. This function is automatically called whenever + # the app is being restored. read in here whatever you wrote + # in 'saveProperties' + + url = config.readPathEntry("lastURL") + + if !url.empty? + @view.openURL(KDE::URL.new(url)) + end + end + + def dragEnterEvent(event) + # accept uri drops only + event.accept(KDE::URLDrag.canDecode(event)) + end + + def dropEvent(event) + # This is a very simplistic implementation of a drop event. we + # will only accept a dropped URL. the Qt dnd code can do *much* + # much more, so please read the docs there + urls = [] + + # see if we can decode a URI.. if not, just ignore it + if KDE::URLDrag.decode(event, urls) && !urls.empty? + # okay, we have a URI.. process it + url = urls.shift + + # load in the file + load(url) + end + end + + def fileNew() + # This slot is called whenever the File.New menu is selected, + # the New shortcut is pressed (usually CTRL+N) or the New toolbar + # button is clicked + + # create a new window + %{APPNAMESC}.new.show() + end + + def fileOpen() + # This slot is called whenever the File.Open menu is selected, + # the Open shortcut is pressed (usually CTRL+O) or the Open toolbar + # button is clicked + + # This brings up the generic open dialog + url = KDE::URLRequesterDlg.getURL(nil, self, i18n("Open Location") ) + + # standard filedialog + url = KDE::FileDialog.getOpenURL(nil, nil, self, i18n("Open Location")) + if !url.empty? + @view.openURL(url) + end + end + + def fileSave() + # This slot is called whenever the File.Save menu is selected, + # the Save shortcut is pressed (usually CTRL+S) or the Save toolbar + # button is clicked + + # save the current file + end + + def fileSaveAs() + # This slot is called whenever the File.Save As menu is selected, + file_url = KDE::FileDialog.getSaveURL() + if !file_url.empty? && file_url.valid? + # save your info, here + end + end + + def filePrint() + # This slot is called whenever the File.Print menu is selected, + # the Print shortcut is pressed (usually CTRL+P) or the Print toolbar + # button is clicked + if @printer.nil? then @printer = KDE::Printer.new end + if @printer.setup(self) + # setup the printer. with Qt, you always "print" to a + # Qt::Painter.. whether the output medium is a pixmap, a screen, + # or paper + p = Qt::Painter.new + p.begin(@printer) + + # we let our view do the actual printing + metrics = Qt::PaintDeviceMetrics.new(@printer) + @view.print(p, metrics.height(), metrics.width()) + + # and send the result to the printer + p.end() + end + end + + def optionsPreferences() + # popup some sort of preference dialog, here + dlg = %{APPNAMESC}Preferences.new + if dlg.exec() + # redo your settings + end + end + + def changeStatusbar(text) + # display the text on the statusbar + statusBar().message(text) + end + + def changeCaption(text) + # display the text on the caption + setCaption(text) + end + +end diff --git a/languages/ruby/app_templates/kapp/app.tdevelop b/languages/ruby/app_templates/kapp/app.tdevelop new file mode 100644 index 00000000..5c57b8fb --- /dev/null +++ b/languages/ruby/app_templates/kapp/app.tdevelop @@ -0,0 +1,90 @@ +<?xml version="1.0"?> +<tdevelop> + <general> + <author>%{AUTHOR}</author> + <email>%{EMAIL}</email> + <version>%{VERSION}</version> + <projectmanagement>KDevAutoProject</projectmanagement> + <primarylanguage>Ruby</primarylanguage> + <keywords> + <keyword>Ruby</keyword> + <keyword>Qt</keyword> + <keyword>KDE</keyword> + </keywords> + <ignoreparts> + <part>KDevDoxygen</part> + <part>KDevdistpart</part> + <part>KDevVisualBoyAdvance</part> + <part>KDevDebugger</part> + </ignoreparts> + </general> + <kdevautoproject> + <general> + <activedir/> + </general> + <run> + <mainprogram>src/%{APPNAMELC}</mainprogram> + </run> + </kdevautoproject> + <kdevfileview> + <tree> + <hidenonprojectfiles>false</hidenonprojectfiles> + <hidepatterns>CVS,.svn</hidepatterns> + </tree> + <groups> + <group pattern="*.rb" name="Ruby files" /> + <group pattern="*.ui" name="QT Designer files" /> + </groups> + </kdevfileview> + <kdevdoctreeview> + <ignoretocs> + <toc>ada</toc> + <toc>ada_bugs_gcc</toc> + <toc>bash</toc> + <toc>bash_bugs</toc> + <toc>c++_bugs_gcc</toc> + <toc>clanlib</toc> + <toc>w3c-dom-level2-html</toc> + <toc>fortran_bugs_gcc</toc> + <toc>gnome1</toc> + <toc>gnustep</toc> + <toc>gtk</toc> + <toc>gtk_bugs</toc> + <toc>haskell</toc> + <toc>haskell_bugs_ghc</toc> + <toc>java_bugs_gcc</toc> + <toc>java_bugs_sun</toc> + <toc>kde2book</toc> + <toc>libc</toc> + <toc>libstdc++</toc> + <toc>opengl</toc> + <toc>pascal_bugs_fp</toc> + <toc>php</toc> + <toc>php_bugs</toc> + <toc>perl</toc> + <toc>perl_bugs</toc> + <toc>python</toc> + <toc>python_bugs</toc> + <toc>sdl</toc> + <toc>stl</toc> + <toc>w3c-svg</toc> + <toc>sw</toc> + <toc>w3c-uaag10</toc> + <toc>wxwindows_bugs</toc> + </ignoretocs> + </kdevdoctreeview> + <kdevfilecreate> + <useglobaltypes> + <type ext="rb"/> + <type ext="ui"/> + </useglobaltypes> + </kdevfilecreate> + <kdevrubysupport> + <run> + <interpreter>ruby</interpreter> + <terminal>false</terminal> + <charactercoding>3</charactercoding> + <mainprogram>src/main.rb</mainprogram> + </run> + </kdevrubysupport> +</tdevelop> diff --git a/languages/ruby/app_templates/kapp/app_client.rb b/languages/ruby/app_templates/kapp/app_client.rb new file mode 100644 index 00000000..b08e9b21 --- /dev/null +++ b/languages/ruby/app_templates/kapp/app_client.rb @@ -0,0 +1,18 @@ +require 'Korundum' +include KDE + +about = AboutData.new("%{APPNAMELC}_client", "%{APPNAME} client", "0.1") +CmdLineArgs.init(ARGV, about) + +app = Application.new + +# get our DCOP client and attach so that we may use it +client = app.dcopClient +client.attach + +# do a 'send' for now +dcopRef = DCOPRef.new("%{APPNAMELC}", "%{APPNAMESC}Iface") +dcopRef.openURL("http://www.kde.org") + +app.exec + diff --git a/languages/ruby/app_templates/kapp/appiface.rb b/languages/ruby/app_templates/kapp/appiface.rb new file mode 100644 index 00000000..a8be16b5 --- /dev/null +++ b/languages/ruby/app_templates/kapp/appiface.rb @@ -0,0 +1,14 @@ +class %{APPNAMESC}Iface < KDE::DCOPObject
+
+ k_dcop 'void openURL(QString)'
+
+ def initialize(app)
+ super("%{APPNAMESC}Iface")
+ @app = app
+ end
+
+ def openURL(url)
+ @app.openURL(url)
+ end
+end
+
diff --git a/languages/ruby/app_templates/kapp/appui.rc b/languages/ruby/app_templates/kapp/appui.rc new file mode 100644 index 00000000..ceb4f14e --- /dev/null +++ b/languages/ruby/app_templates/kapp/appui.rc @@ -0,0 +1,8 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="%{APPNAMELC}" version="1"> +<MenuBar> + <Menu name="custom"><text>C&ustom</text> + <Action name="custom_action" /> + </Menu> +</MenuBar> +</kpartgui> diff --git a/languages/ruby/app_templates/kapp/appview.rb b/languages/ruby/app_templates/kapp/appview.rb new file mode 100644 index 00000000..e7aabe3c --- /dev/null +++ b/languages/ruby/app_templates/kapp/appview.rb @@ -0,0 +1,103 @@ + +=begin + This is the main view class for %{APPNAME}. Most of the non-menu, + non-toolbar, and non-statusbar (e.g., non frame) GUI code should go + here. + + This %{APPNAMELC} uses an HTML component as an example. + + @short Main view + @author %{AUTHOR} <%{EMAIL}> + @version %{VERSION} +=end +class %{APPNAMESC}View < Qt::Widget + + # + # Use this signal to change the content of the statusbar + # + Q_SIGNALS 'signalChangeStatusbar(const QString&)' + + # + # Use this signal to change the content of the caption + # + Q_SIGNALS 'signalChangeCaption(const QString&)' + + Q_SLOTS 'slotOnURL(const QString&)', + 'slotSetTitle(const QString&)' + + def initialize(parent) + super(parent) + + # keep a reference to the DCOP Interface so it doesn't get gc'd + @dcop = %{APPNAMESC}Iface.new(self) + + # setup our layout manager to automatically add our widgets + top_layout = Qt::HBoxLayout.new(self) + top_layout.setAutoAdd(true) + + # we want to look for all components that satisfy our needs. the + # trader will actually search through *all* registered KDE + # applications and components -- not just KParts. So we have to + # specify two things: a service type and a constraint + # + # the service type is like a mime type. we say that we want all + # applications and components that can handle HTML -- 'text/html' + # + # however, by itself, this will return such things as Netscape.. + # not what we wanted. so we constrain it by saying that the + # string 'KParts/ReadOnlyPart' must be found in the ServiceTypes + # field. with this, only components of the type we want will be + # returned. + offers = KDE::Trader.self().query("text/html", "'KParts/ReadOnlyPart' in ServiceTypes") + + factory = nil + # in theory, we only care about the first one.. but let's try all + # offers just in when the first can't be loaded for some reason + offers.each do |ptr| + # we now know that our offer can handle HTML and is a part. + # since it is a part, it must also have a library... let's try to + # load that now + factory = KDE::LibLoader.self().factory( ptr.library() ) + if ! factory.nil? + @html = factory.create(self, ptr.name(), "KParts::ReadOnlyPart") + break + end + end + + # if our factory is invalid, then we never found our component + # and we might as well just exit now + if factory.nil? + KDE::MessageBox.error(self, i18n("Could not find a suitable HTML component")) + return + end + + connect(@html, SIGNAL('setWindowCaption(const QString&)'), + self, SLOT('slotSetTitle(const QString&)')) + connect(@html, SIGNAL('setStatusBarText(const QString&)'), + self, SLOT('slotOnURL(const QString&)')) + + end + + + def print(p, height, width) + # do the actual printing, here + # p.drawText(etc..) + end + + def currentURL() + return @html.url().url() + end + + def openURL(url) + @html.openURL(KDE::URL.new(url)) + end + + def slotOnURL(url) + emit signalChangeStatusbar(url) + end + + def slotSetTitle(title) + emit signalChangeCaption(title) + end + +end diff --git a/languages/ruby/app_templates/kapp/kappruby.kdevtemplate b/languages/ruby/app_templates/kapp/kappruby.kdevtemplate new file mode 100644 index 00000000..368e0705 --- /dev/null +++ b/languages/ruby/app_templates/kapp/kappruby.kdevtemplate @@ -0,0 +1,238 @@ +# KDE Config File +[General] +Name=Application framework +Name[ca]=Infraestructura d'aplicacions +Name[da]=Programskelet +Name[de]=Anwendungsgrundgerüst +Name[el]=Πλαίσιο εφαρμογής +Name[es]=Infraestructura de aplicación +Name[et]=Rakenduse raamistik +Name[eu]=Aplikazioen lan-markoa +Name[fa]=چارچوب کاربرد +Name[fr]=Infrastructure d'application +Name[ga]=Creatlach feidhmchláir +Name[gl]=Entorno de traballo para aplicación +Name[hu]=Alkalmazás-keretrendszer +Name[it]=Infrastruttura applicativa +Name[ja]=アプリケーションフレームワーク +Name[nds]=Programmrahmenwark +Name[ne]=अनुप्रयोग फ्रेमवर्क +Name[nl]=Applicationframework +Name[pl]=Szablon programu +Name[pt]=Plataforma de aplicações +Name[pt_BR]=Plataforma de aplicações +Name[ru]=Приложение KDE +Name[sk]=Aplikačný framework +Name[sl]=Ogrodje programa +Name[sr]=Радни оквир програма +Name[sr@Latn]=Radni okvir programa +Name[sv]=Programramverk +Name[tr]=Uygulama Çatısı +Name[zh_CN]=应用程序框架 +Name[zh_TW]=應用程式框架 +Icon=kapp.png +Category=Ruby/KDE +Comment=Generates a simple Korundum application with one toplevel window, menus and toolbars. A DCOP interface is also provided, so that your application can provide a scripting interface +Comment[ca]=Genera una simple aplicació Korundum amb una finestra principal, menús i barres d'eines. També es proveeix la interfície DCOP, de manera que la vostra aplicació podrà proveir d'una interfície per a scripts +Comment[da]=Generere et simpelt Korundum program med et vindue på topniveau, menuer og værktøjslinjer. Der sørges også for en DCOP-grænseflade, så dit program kan give en script-grænseflade +Comment[de]=Erstellt eine einfache Korundum-Anwendung mit einem Toplevel-Fenster, Menüs und Werkzeugleisten. Dazu kommt eine DCOP-Schnittstelle, so dass Ihre Anwendung eine Schnittstelle für Skripte anbieten kann. +Comment[el]=Δημιουργεί μια απλή εφαρμογή Korundum με ένα ανώτερο παράθυρο, μενού και γραμμές εργαλείων. Προσφέρεται επίσης μια διασύνδεση DCOP, έτσι ώστε η εφαρμογή σας να προσφέρει ένα περιβάλλον γραφής σεναρίων +Comment[es]=Genera una sencilla aplicación Korundum con una ventana principal, menús y barras de herramientas. También se proporciona una interfaz DCOP para que su aplicación pueda proporcionar una interfaz para guiones de órdenes. +Comment[et]=Lihtsa Korundumi rakenduse loomine ühe tipptaseme akna, menüüde ja tööriistaribadega. Lisatakse ka DCOP-liides, mis võimaldab rakendusel pakkuda skriptikeelte toetust +Comment[eu]=Goi-mailako lehio bat, menuak eta tresna-barrak dituen Korundum aplikazio sinple bat sortzen du . DCOP interfazea ere sortzen du, eta beraz, zure aplikazioak script-interfaze bat eskainiko du +Comment[fa]=یک کاربرد سادۀ Korundum با یک پنجرۀ سطح بالا، گزینگان و میله ابزارها تولید میکند. همچنین یک واسط DCOP فراهم است. بنابراین، کاربرد شما یک واسط دستنوشتهای را میتواند فراهم کند +Comment[fr]=Génère une application Korundum simple comprenant une fenêtre de premier niveau, des menus et des barres d'outils. Une interface DCOP est également fournie, afin que votre application puisse offrir une interface de scriptage +Comment[gl]=Xera unha aplicación sinxela Korundum cunha fiestra, menús e barras de ferramentas. Proporciónase tamén unha interface DCOP de modo que a súa aplicación poida ofrecer unha interface de scripting. +Comment[hu]=Létrehoz egy egyszerű Korundum-alkalmazást egy főablakkal, menükkel és eszköztárakkal. DCOP-felület is tartozik az alkalmazáshoz, így könnyen kialakítható hozzá szkriptelési felület. +Comment[it]=Genera una semplice applicazione Korundum con una finestra toplevel, menu e barre degli strumenti. È anche fornita un'interfaccia DCOP, così che l'applicazione può fornire una interfaccia di scripting +Comment[nds]=Stellt en eenfach Korundum-Programm mit een böverst Finster, Menüs un Warktüüchbalkens op. Ok warrt noch en DCOP-Koppelsteed praatstellt, so dat Dien Programm en Skriptkoppelsteed anbeden kann. +Comment[ne]=एउटा उच्च तह सञ्झ्याल, मेनु र उपकरणपट्टीसँग साधारण Korundum अनुप्रयोग उत्पन्न गर्दछ । DCOP इन्टरफेस पनि प्रदान गरिन्छ, जसले गर्दा तपाईँको अनुप्रयोगले स्क्रिप्टिङ इन्टरफेस प्रदान गर्न सक्छ । +Comment[nl]=Dit genereert een eenvoudige Korundum-toepassing met één toplevel window, menu's en toolbars. Een DCOP-interface wordt ook aangeleverd, zodat uw toepassing een scripting interface kan aanleveren. +Comment[pl]=Generuje prosty program Korundum z jednym oknem, menu i paskami narzędzi. Dostępny jest także interfejs DCOP, więc Twój program może umożliwiać korzystanie ze skryptów +Comment[pt]=Gera uma aplicação Korundum simples com uma janela de topo, menus e barras de ferramentas. Também é fornecida uma interface de DCOP, para que a sua aplicação possa oferecer uma interface de programação +Comment[pt_BR]=Gera uma aplicação Korundum simples com uma janela de topo, menus e barras de ferramentas. Também é fornecida uma interface de DCOP, para que a sua aplicação possa oferecer uma interface de programação +Comment[ru]=Создание простого приложения Korundum с окном, меню, панелями инструментов и сервисом DCOP +Comment[sk]=Vygeneruje jednoduchú Korundum aplikáciu s jedným oknom, menu a panelom nástrojov. Taktiež bude poskytnuté DCOP rozhranie, takže aj aplikáciamôže poskytnúť skriptovacie rozhranie +Comment[sr]=Прави једноставан Korundum програм са једним прозором највишег нивоа, менијима и тракама са алатом. Дат је и DCOP интерфејс, тако да ваш програм може да омогући скриптовање +Comment[sr@Latn]=Pravi jednostavan Korundum program sa jednim prozorom najvišeg nivoa, menijima i trakama sa alatom. Dat je i DCOP interfejs, tako da vaš program može da omogući skriptovanje +Comment[sv]=Skapar ett enkelt Korundum-program med ett toppnivåfönster, menyer och verktygsrader. Ett DCOP-gränssnitt tillhandahålls också, så att programmet kan tillhandahålla ett skriptgränssnitt. +Comment[tr]=Bir üst seviye penceresi, menüleri ve araç çubukları olan basit bir Korundum uygulaması yaratır. Uygulamanızın bir betik arayüzü sağlayabilmesi için bir DCOP arayüzü de sağlanmıştır. +Comment[zh_TW]=產生一個簡單的 Korundum 應用程式,內含頂層視窗、選單與工具列。另外提供一個 DCOP 介面,讓您的應用程式可以使用文稿介面。 +FileTemplates=rb,ShellStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.rb +Archive=kappruby.tar.gz + +[ADMIN] +Type=include +File=%{tdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{tdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{tdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{tdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{tdevelop}/template-common/tde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/app.tdevelop +Dest=%{dest}/%{APPNAMELC}.tdevelop + +[FILE5] +Type=install +Source=%{tdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE6] +Type=install +Source=%{tdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE7] +Type=install +Source=%{src}/app-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE8] +Type=install +Source=%{tdevelop}/template-common/tde-app.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE9] +Type=install +Source=%{tdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[FILE10] +Type=install +Source=%{tdevelop}/template-common/hi16-app-app.png +Dest=%{dest}/src/hi16-app-%{APPNAMELC}.png +Process=false + +[FILE11] +Type=install +Source=%{tdevelop}/template-common/hi32-app-app.png +Dest=%{dest}/src/hi32-app-%{APPNAMELC}.png +Process=false + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE12] +Type=install +Source=%{tdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE13] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE14] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE15] +Type=install +Source=%{src}/app.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE16] +Type=install +Source=%{src}/app.rb +Dest=%{dest}/src/%{APPNAMELC}.rb + +[FILE17] +Type=install +Source=%{src}/appview.rb +Dest=%{dest}/src/%{APPNAMELC}view.rb + +[FILE18] +Type=install +Source=%{src}/appiface.rb +Dest=%{dest}/src/%{APPNAMELC}iface.rb + +[FILE19] +Type=install +Source=%{src}/app_client.rb +Dest=%{dest}/src/%{APPNAMELC}_client.rb + +[FILE20] +Type=install +Source=%{src}/pref.rb +Dest=%{dest}/src/pref.rb + +[FILE21] +Type=install +Source=%{src}/main.rb +Dest=%{dest}/src/main.rb + +[FILE22] +Type=install +EscapeXML=true +Source=%{src}/appui.rc +Dest=%{dest}/src/%{APPNAMELC}ui.rc + +[FILE23] +Type=install +Source=%{src}/README +Dest=%{dest}/src/README + +[MSG] +Type=message +Comment=A Korundum Application was created at %{dest} +Comment[ca]=Una aplicació Korundum ha estat creada a %{dest} +Comment[da]=Et Korundum program blev oprettet i %{dest} +Comment[de]=Eine Korundum-Anwendung wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή Korundum δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación Korundum ha sido creada en %{dest} +Comment[et]=Korundumi rakendus loodi asukohta %{dest} +Comment[eu]=Korundum aplikazio bat sortu da hemen: %{dest} +Comment[fa]=یک کاربرد Korundum در %{dest} ایجاد شد +Comment[fr]=Une application Korundum a été créée dans %{dest} +Comment[ga]=Cruthaíodh Feidhmchlár Korundum ag %{dest} +Comment[gl]=Creouse unha aplicación Korundum en %{dest} +Comment[hu]=Létrejött egy Korundum-alapú alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione Korundum in %{dest} +Comment[ja]=Korundum アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Korundum-Programm opstellt. +Comment[ne]=Korundum अनुप्रयोग %{dest} मा सिर्जना गरियो +Comment[nl]=Een Korundum-toepassing is aangemaakt in %{dest} +Comment[pl]=Program Korundum został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação Korundum em %{dest} +Comment[pt_BR]=Foi criada uma aplicação Korundum em %{dest} +Comment[ru]=Приложение Korundum создано в %{dest} +Comment[sk]=Korundum aplikácia bola vytvorená v %{dest} +Comment[sr]=Korundum програм је направљен у %{dest} +Comment[sr@Latn]=Korundum program je napravljen u %{dest} +Comment[sv]=Ett Korundum-program skapades i %{dest} +Comment[tr]=Bir Korundum Uygulaması %{dest} içinde yaratıldı. +Comment[zh_TW]=一個 Korundum 應用程式已建立於 %{dest} diff --git a/languages/ruby/app_templates/kapp/kappruby.png b/languages/ruby/app_templates/kapp/kappruby.png Binary files differnew file mode 100644 index 00000000..913ebb87 --- /dev/null +++ b/languages/ruby/app_templates/kapp/kappruby.png diff --git a/languages/ruby/app_templates/kapp/main.rb b/languages/ruby/app_templates/kapp/main.rb new file mode 100644 index 00000000..47235013 --- /dev/null +++ b/languages/ruby/app_templates/kapp/main.rb @@ -0,0 +1,40 @@ +#!/usr/bin/env ruby + +require 'Korundum' + +require '%{APPNAMELC}iface.rb' +require '%{APPNAMELC}.rb' +require '%{APPNAMELC}view.rb' +require 'pref.rb' + +description = I18N_NOOP("A TDE Application") +version = "%{VERSION}" +options = [ [ "+[URL]", I18N_NOOP( "Document to open" ), "" ] ] + +about = KDE::AboutData.new("%{APPNAMELC}", I18N_NOOP("%{APPNAME}"), version, description, + KDE::AboutData.License_%{LICENSE}, "(C) %{YEAR} %{AUTHOR}", nil, nil, "%{EMAIL}") +about.addAuthor( "%{AUTHOR}", nil, "%{EMAIL}" ) +KDE::CmdLineArgs.init(ARGV, about) +KDE::CmdLineArgs.addCmdLineOptions(options) +app = KDE::Application.new + +# see if we are starting with session management +if app.restored? + RESTORE(%{APPNAMESC}) +else + # no session.. just start up normally + args = KDE::CmdLineArgs.parsedArgs + if args.count == 0 + widget = %{APPNAMESC}.new + widget.show + else + for i in 0...args.count do + widget = %{APPNAMESC}.new + widget.show + widget.load(args.url(i)) + end + end +end + +app.exec + diff --git a/languages/ruby/app_templates/kapp/pref.rb b/languages/ruby/app_templates/kapp/pref.rb new file mode 100644 index 00000000..98669ad2 --- /dev/null +++ b/languages/ruby/app_templates/kapp/pref.rb @@ -0,0 +1,38 @@ + +class %{APPNAMESC}Preferences < KDE::DialogBase + + def initialize() + super(TreeList, i18n("%{APPNAMESC} Preferences"), + Help|Default|Ok|Apply|Cancel, Ok) + # this is the base class for your preferences dialog. it is now + # a Treelist dialog.. but there are a number of other + # possibilities (including Tab, Swallow, and just Plain) + frame = addPage(i18n("First Page"), i18n("Page One Options")) + @pageOne = %{APPNAMESC}PrefPageOne.new(frame) + + frame = addPage(i18n("Second Page"), i18n("Page Two Options")) + @pageTwo = %{APPNAMESC}PrefPageTwo.new(frame) + end +end + +class %{APPNAMESC}PrefPageOne < Qt::Frame + + def initialize(parent) + super(parent) + layout = Qt::HBoxLayout.new(self) + layout.setAutoAdd(true) + + Qt::Label.new(i18n("Add something here"), self) + end +end + +class %{APPNAMESC}PrefPageTwo < Qt::Frame + + def initialize(parent) + super(parent) + layout = Qt::HBoxLayout.new(self) + layout.setAutoAdd(true) + + Qt::Label.new(i18n("Add something here"), self) + end +end diff --git a/languages/ruby/app_templates/kapp/src-Makefile.am b/languages/ruby/app_templates/kapp/src-Makefile.am new file mode 100644 index 00000000..acb41899 --- /dev/null +++ b/languages/ruby/app_templates/kapp/src-Makefile.am @@ -0,0 +1,43 @@ +## Makefile.am for %{APPNAMELC} + +# this is the program that gets installed. it's name is used for all +# of the other Makefile.am variables +bin_PROGRAMS = %{APPNAMELC} + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) -I$(RUBY_ARCHDIR) + +# the library search path. +%{APPNAMELC}_LDFLAGS = $(all_libraries) $(KDE_RPATH) -L$(RUBY_LIBDIR) + +# the libraries to link against. +%{APPNAMELC}_LDADD = $(LIB_TDEFILE) $(LIB_TDEPRINT) $(RUBY_LIBRUBYARG) + +# which sources should be compiled for %{APPNAMELC} +%{APPNAMELC}_SOURCES = %{APPNAMELC}.cpp + +# let automoc handle all of the meta source files ((moc)) +METASOURCES = AUTO + +KDE_ICON = AUTO + +# this is where the kdelnk file will go +kdelnkdir = $(kde_appsdir)/Utilities +kdelnk_DATA = %{APPNAMELC}.desktop + +# this is where the XML-GUI resource file goes +rcdir = $(kde_datadir)/%{APPNAMELC} +rc_DATA = %{APPNAMELC}ui.rc + +rubysrc_DATA = main.rb %{APPNAMELC}.rb %{APPNAMELC}_client.rb %{APPNAMELC}iface.rb \ + %{APPNAMELC}view.rb pref.rb + +rubysrcdir = $(kde_datadir)/%{APPNAMELC} + +rubyui_DATA = + +rubyuidir = $(kde_datadir)/%{APPNAMELC} + +%.rb: %.ui + $(RBUIC) -tr ${UIC_TR} -kde $< -o $@ + diff --git a/languages/ruby/app_templates/kapp/subdirs b/languages/ruby/app_templates/kapp/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/ruby/app_templates/kapp/subdirs @@ -0,0 +1,3 @@ +doc +po +src |