From 114a878c64ce6f8223cfd22d76a20eb16d177e5e 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/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- .../cpp/app_templates/kofficepart/.kdev_ignore | 0 .../cpp/app_templates/kofficepart/Makefile.am | 21 ++ .../app_templates/kofficepart/kde-configure.in.in | 42 ++++ .../cpp/app_templates/kofficepart/kopart.desktop | 9 + .../cpp/app_templates/kofficepart/kopart.kdevelop | 113 ++++++++++ .../app_templates/kofficepart/kopart.kdevtemplate | 231 +++++++++++++++++++++ languages/cpp/app_templates/kofficepart/kopart.png | Bin 0 -> 10017 bytes languages/cpp/app_templates/kofficepart/kopart.rc | 10 + .../app_templates/kofficepart/kopart_aboutdata.h | 24 +++ .../app_templates/kofficepart/kopart_factory.cpp | 76 +++++++ .../cpp/app_templates/kofficepart/kopart_factory.h | 33 +++ .../cpp/app_templates/kofficepart/kopart_part.cpp | 69 ++++++ .../cpp/app_templates/kofficepart/kopart_part.h | 30 +++ .../cpp/app_templates/kofficepart/kopart_view.cpp | 52 +++++ .../cpp/app_templates/kofficepart/kopart_view.h | 34 +++ languages/cpp/app_templates/kofficepart/main.cpp | 33 +++ .../cpp/app_templates/kofficepart/src-Makefile.am | 41 ++++ languages/cpp/app_templates/kofficepart/subdirs | 3 + .../cpp/app_templates/kofficepart/x-kopart.desktop | 40 ++++ 19 files changed, 861 insertions(+) create mode 100644 languages/cpp/app_templates/kofficepart/.kdev_ignore create mode 100644 languages/cpp/app_templates/kofficepart/Makefile.am create mode 100644 languages/cpp/app_templates/kofficepart/kde-configure.in.in create mode 100644 languages/cpp/app_templates/kofficepart/kopart.desktop create mode 100644 languages/cpp/app_templates/kofficepart/kopart.kdevelop create mode 100644 languages/cpp/app_templates/kofficepart/kopart.kdevtemplate create mode 100644 languages/cpp/app_templates/kofficepart/kopart.png create mode 100644 languages/cpp/app_templates/kofficepart/kopart.rc create mode 100644 languages/cpp/app_templates/kofficepart/kopart_aboutdata.h create mode 100644 languages/cpp/app_templates/kofficepart/kopart_factory.cpp create mode 100644 languages/cpp/app_templates/kofficepart/kopart_factory.h create mode 100644 languages/cpp/app_templates/kofficepart/kopart_part.cpp create mode 100644 languages/cpp/app_templates/kofficepart/kopart_part.h create mode 100644 languages/cpp/app_templates/kofficepart/kopart_view.cpp create mode 100644 languages/cpp/app_templates/kofficepart/kopart_view.h create mode 100644 languages/cpp/app_templates/kofficepart/main.cpp create mode 100644 languages/cpp/app_templates/kofficepart/src-Makefile.am create mode 100644 languages/cpp/app_templates/kofficepart/subdirs create mode 100644 languages/cpp/app_templates/kofficepart/x-kopart.desktop (limited to 'languages/cpp/app_templates/kofficepart') diff --git a/languages/cpp/app_templates/kofficepart/.kdev_ignore b/languages/cpp/app_templates/kofficepart/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/kofficepart/Makefile.am b/languages/cpp/app_templates/kofficepart/Makefile.am new file mode 100644 index 00000000..96280d88 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/Makefile.am @@ -0,0 +1,21 @@ +dataFiles = kopart.kdevelop kopart_aboutdata.h kopart_part.cpp kopart_view.h \ + src-Makefile.am kopart.png kopart_factory.cpp kopart_part.h \ + subdirs kopart.desktop kopart.rc kopart_factory.h \ + kopart_view.cpp x-kopart.desktop kde-configure.in.in \ + main.cpp + +templateName = kopart + +### 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 \ No newline at end of file diff --git a/languages/cpp/app_templates/kofficepart/kde-configure.in.in b/languages/cpp/app_templates/kofficepart/kde-configure.in.in new file mode 100644 index 00000000..ec8e8bea --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kde-configure.in.in @@ -0,0 +1,42 @@ +#MIN_CONFIG + +AM_INIT_AUTOMAKE(kotest, 0.1) + +AC_CHECK_HEADERS(unistd.h sys/param.h floatingpoint.h paths.h) +KDE_CHECK_KIMGIO +AC_C_BIGENDIAN +AC_CHECK_KDEMAXPATHLEN + +dnl AC_DEFINE(USE_QFD, 1, [Define if you prefer the Qt provided file dialog]) +KWMF_INCLUDES='-I$(KDEDIR)/lib/kwmf -I$(KDEDIR)/lib/kwmf' +AC_SUBST(KWMF_INCLUDES) + +KSTORE_INCLUDES='-I$(KDEDIR)/include' +AC_SUBST(KSTORE_INCLUDES) + +KOFFICECORE_INCLUDES='-I$(KDEDIR)/include' +AC_SUBST(KOFFICECORE_INCLUDES) + +KOFFICEUI_INCLUDES='-I$(KDEDIR)/include' +AC_SUBST(KOFFICEUI_INCLUDES) + +LIB_KOFFICEUI='$(KDEDIR)/lib/libkofficeui.la' +LIB_KOFFICECORE='$(KDEDIR)/lib/libkofficecore.la' +LIB_KSTORE='$(KDEDIR)/lib/libkstore.la' +LIB_KWMF='$(KDEDIR)/lib/libkwmf.la' +AC_SUBST(LIB_KOFFICEUI) +AC_SUBST(LIB_KOFFICECORE) +AC_SUBST(LIB_KSTORE) +AC_SUBST(LIB_KWMF) + +KOFFICE_LIBS='$(LIB_KOFFICEUI) $(LIB_KOFFICECORE) $(LIB_KSTORE)' +AC_SUBST(KOFFICE_LIBS) + +KOFFICE_INCLUDES='$(KOFFICEUI_INCLUDES) $(KOFFICECORE_INCLUDES) $(KSTORE_INCLUDES) $(KWMF_INCLUDES)' +AC_SUBST(KOFFICE_INCLUDES) + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_CHECK_HEADERS(streambuf streambuf.h) +AC_LANG_RESTORE + diff --git a/languages/cpp/app_templates/kofficepart/kopart.desktop b/languages/cpp/app_templates/kofficepart/kopart.desktop new file mode 100644 index 00000000..8b2be99e --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=%{APPNAME} +Exec=%{APPNAMELC} +X-KDE-Library=lib%{APPNAMELC}part +MimeType=application/x-%{APPNAMELC}; +Type=Application +Icon=%{APPNAMELC} +ServiceTypes=KOfficePart,KParts/ReadOnlyPart,KParts/ReadWritePart +X-KDE-NativeMimeType=application/x-%{APPNAMELC} diff --git a/languages/cpp/app_templates/kofficepart/kopart.kdevelop b/languages/cpp/app_templates/kofficepart/kopart.kdevelop new file mode 100644 index 00000000..bf70fc63 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart.kdevelop @@ -0,0 +1,113 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + kioslave + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/lib%{APPNAMELC}part.la + debug + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + stl + sw + w3c-dom-level2-html + w3c-svg + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kofficepart/kopart.kdevtemplate b/languages/cpp/app_templates/kofficepart/kopart.kdevtemplate new file mode 100644 index 00000000..9d5ecba4 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart.kdevtemplate @@ -0,0 +1,231 @@ +# KDE Config File +[General] +Name=KOffice Part +Name[br]=Perzh KOffice +Name[ca]=Part per a KOffice +Name[da]=KOffice part +Name[de]=KOffice-Komponente +Name[el]=Τμήμα KOffice +Name[es]=Part de KOffice +Name[et]=KOffice'i komponent +Name[eu]=KOffice zatia +Name[fa]=جزء KOffice +Name[fr]=Composant KOffice +Name[ga]=Páirt KOffice +Name[gl]='Part' para KOffice +Name[hu]=KOffice-objektum +Name[it]=Part di KOffice +Name[nds]=KOffice-Komponent +Name[ne]=केडीई अफिस भाग +Name[nl]=Koffice-part +Name[pt]=Componente do KOffice +Name[pt_BR]=Componente do KOffice +Name[ru]=Приложение KOffice +Name[sr]=KOffice део +Name[sr@Latn]=KOffice deo +Name[sv]=Koffice-delprogram +Name[tr]=KOffice Bileşeni +Name[zh_CN]=KOffice 部件 +Name[zh_TW]=KOffice 元件 +Icon=kopart.png +Category=C++/KDE +Comment=Generates a framework for a full KOffice Application. +Comment[ca]=Genera una infraestructura per a una completa aplicació de KOffice. +Comment[da]=Genererer et skelet for et fuldstændigt KOffice-program. +Comment[de]=Erstellt ein Grundgerüst für eine vollwertige KOffice-Anwendung +Comment[el]=Δημιουργεί ένα πλαίσιο για μια πλήρης εφαρμογή του KOffice. +Comment[es]=Genera una infraestructura para una aplicación completa de KOffice. +Comment[et]=KOffice'i rakenduse raamistiku loomine. +Comment[eu]=KOffice-en aplikazio batentzat lan-marko oso bat sortzen du. +Comment[fa]=چارچوبی را برای کاربرد کامل KOffice تولید می‌کند. +Comment[fr]=Génère une infrastructure pour une application KOffice complète. +Comment[gl]=Xera un contorno de traballo para unha aplicación KOffice completa. +Comment[hu]=Létrehoz egy kiindulási keretprogramot teljes KOffice-alkalmazás készítéséhez. +Comment[it]=Genera l'infrastruttura per un'applicazione completa di KOffice. +Comment[nds]=Stellt dat Rahmenwark för en heel KOffice-Programm op. +Comment[ne]=पूर्ण केडीई अफिस अनुप्रयोगका लागि फ्रेमवर्क उत्पन्न गर्दछ +Comment[nl]=Genereert een framework voor een volledige KOffice-toepassing +Comment[pl]=Generuje szablon pełnego programu KOffice. +Comment[pt]=Gera a plataforma para uma aplicação completa do KOffice. +Comment[pt_BR]=Gera a plataforma para uma aplicação completa do KOffice. +Comment[ru]=Создание приложения KOffice. +Comment[sk]=Vygeneruje framework pre kompletnú aplikáciu KOffice. +Comment[sl]=Ustvari ogrodje za poln program KOffice +Comment[sr]=Прави радни оквир за пуни KOffice програм. +Comment[sr@Latn]=Pravi radni okvir za puni KOffice program. +Comment[sv]=Skapar ett ramverk för ett fullständigt Koffice-program. +Comment[tr]=Tam bir KOffice Uygulaması için bir çatı yaratır. +Comment[zh_CN]=生成一个全功能的 KOffice 应用程序框架。 +Comment[zh_TW]=產生一個完整的 KOffice 應用程式的框架 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}_part.cpp +Archive=kopart.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/kopart.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE9] +Type=install +Source=%{src}/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[FILE10] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE11] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE12] +Type=install +Source=%{src}/kopart_view.cpp +Dest=%{dest}/src/%{APPNAMELC}_view.cpp + +[FILE13] +Type=install +Source=%{src}/kopart_view.h +Dest=%{dest}/src/%{APPNAMELC}_view.h + +[FILE14] +Type=install +Source=%{src}/kopart_part.cpp +Dest=%{dest}/src/%{APPNAMELC}_part.cpp + +[FILE15] +Type=install +Source=%{src}/kopart_part.h +Dest=%{dest}/src/%{APPNAMELC}_part.h + +[FILE16] +Type=install +Source=%{src}/kopart_factory.cpp +Dest=%{dest}/src/%{APPNAMELC}_factory.cpp + +[FILE17] +Type=install +Source=%{src}/kopart_factory.h +Dest=%{dest}/src/%{APPNAMELC}_factory.h + +[FILE18] +Type=install +Source=%{src}/kopart_aboutdata.h +Dest=%{dest}/src/%{APPNAMELC}_aboutdata.h + +[FILE19] +Type=install +EscapeXML=true +Source=%{src}/kopart.rc +Dest=%{dest}/src/%{APPNAMELC}.rc + +[FILE20] +Type=install +Source=%{src}/kopart.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE21] +Type=install +Source=%{src}/x-kopart.desktop +Dest=%{dest}/src/x-%{APPNAMELC}.desktop + +[FILE22] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[MSG] +Type=message +Comment=A KOffice part was created in %{dest} +Comment[ca]=Una part per a KOffice ha estat creada en %{dest} +Comment[da]=En KOffice part blev oprettet i %{dest} +Comment[de]=Eine KOffice-Komponente wurde in %{dest} erstellt. +Comment[el]=Ένα τμήμα του KOffice δημιουργήθηκε στο %{dest} +Comment[es]=Un Part de KOffice ha sido creado en %{dest} +Comment[et]=KOffice'i komponent loodi asukohta %{dest} +Comment[eu]=KOffice zati bat sortu da hemen: %{dest} +Comment[fa]=یک جزء KOffice در %{dest} ایجاد شد +Comment[fr]=Un composant KOffice a été créé dans %{dest} +Comment[ga]=Cruthaíodh páirt KDE i %{dest} +Comment[gl]=Creouse unha 'part' para KOffice en %{dest} +Comment[hu]=Létrejött egy KOffice-objektum itt: %{dest} +Comment[it]=È stata creata una part di KOffice in %{dest} +Comment[ja]=KOffice パートを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en KOffice-Komponent opstellt +Comment[ne]=केडीई अफिस भाग %{dest} मा सिर्जना गरियो +Comment[nl]=Een KOffice-part is aangemaakt in %{dest} +Comment[pl]=KOffice part została utworzona w %{dest} +Comment[pt]=Foi criado um componente do KOffice em %{dest} +Comment[pt_BR]=Foi criado um componente do KOffice em %{dest} +Comment[ru]=Приложение KOffice создано в %{dest} +Comment[sk]=KOffice Part bol vytvorený v %{dest} +Comment[sr]=KOffice део је направљен у %{dest} +Comment[sr@Latn]=KOffice deo je napravljen u %{dest} +Comment[sv]=Ett Koffice-delprogram skapades i %{dest} +Comment[tr]=Bir KOffice bileşeni %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个 KOffice 部件 +Comment[zh_TW]=一個 KOffice 元件已建立於 %{dest} diff --git a/languages/cpp/app_templates/kofficepart/kopart.png b/languages/cpp/app_templates/kofficepart/kopart.png new file mode 100644 index 00000000..fa45e5c3 Binary files /dev/null and b/languages/cpp/app_templates/kofficepart/kopart.png differ diff --git a/languages/cpp/app_templates/kofficepart/kopart.rc b/languages/cpp/app_templates/kofficepart/kopart.rc new file mode 100644 index 00000000..d03230ec --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart.rc @@ -0,0 +1,10 @@ + + + Edit + + + +Edit + + + diff --git a/languages/cpp/app_templates/kofficepart/kopart_aboutdata.h b/languages/cpp/app_templates/kofficepart/kopart_aboutdata.h new file mode 100644 index 00000000..ab66d088 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart_aboutdata.h @@ -0,0 +1,24 @@ + +/* This template is based off of the KOffice example written by Torben Weis +*/ + +#ifndef %{APPNAME}_ABOUTDATA +#define %{APPNAME}_ABOUTDATA + +#include +#include + +static const char description[] = I18N_NOOP("%{APPNAME} KOffice Program"); +static const char version[] = "%{VERSION}"; + +KAboutData * new%{APPNAME}AboutData() +{ + KAboutData * aboutData=new KAboutData( "%{APPNAMELC}", I18N_NOOP("%{APPNAME}"), + version, description, KAboutData::License_%{LICENSE}, + "(c) %{YEAR}, %{AUTHOR}"); + aboutData->addAuthor("%{AUTHOR}",0, "%{EMAIL}"); + return aboutData; +} + +#endif diff --git a/languages/cpp/app_templates/kofficepart/kopart_factory.cpp b/languages/cpp/app_templates/kofficepart/kopart_factory.cpp new file mode 100644 index 00000000..bd79c317 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart_factory.cpp @@ -0,0 +1,76 @@ + +/* This template is based off of the KOffice example written by Torben Weis +*/ +#include <%{APPNAMELC}_factory.h> +#include <%{APPNAMELC}_part.h> +#include <%{APPNAMELC}_aboutdata.h> +#include +#include +#include +#include +#include + +extern "C" +{ + void* init_lib%{APPNAMELC}part() + { + KGlobal::locale()->insertCatalogue("%{APPNAMELC}"); + return new %{APPNAME}Factory; + } +}; + +KInstance* %{APPNAME}Factory::s_global = 0L; +KAboutData* %{APPNAME}Factory::s_aboutData = 0L; + +%{APPNAME}Factory::%{APPNAME}Factory( QObject* parent, const char* name ) + : KoFactory( parent, name ) +{ + global(); +} + +%{APPNAME}Factory::~%{APPNAME}Factory() +{ + delete s_aboutData; + s_aboutData = 0L; + delete s_global; + s_global = 0L; +} + +KParts::Part* %{APPNAME}Factory::createPartObject( QWidget *parentWidget, const char *widgetName, QObject* parent, const char* name, const char* classname, const QStringList & ) +{ + // If classname is "KoDocument", our host is a koffice application + // otherwise, the host wants us as a simple part, so switch to readonly and single view. + bool bWantKoDocument = ( strcmp( classname, "KoDocument" ) == 0 ); + + // parentWidget and widgetName are used by KoDocument for the "readonly+singleView" case. + %{APPNAME}Part *part = new %{APPNAME}Part( parentWidget, widgetName, parent, name, !bWantKoDocument ); + + if ( !bWantKoDocument ) + part->setReadWrite( false ); + + return part; +} + +KAboutData* %{APPNAME}Factory::aboutData() +{ + if ( !s_aboutData ) + // Change this, of course + s_aboutData = new%{APPNAME}AboutData(); + return s_aboutData; +} + +KInstance* %{APPNAME}Factory::global() +{ + if ( !s_global ) + { + s_global = new KInstance( aboutData() ); + // Add any application-specific resource directories here + + // Tell the iconloader about share/apps/koffice/icons + s_global->iconLoader()->addAppDir("koffice"); + } + return s_global; +} + +#include <%{APPNAMELC}_factory.moc> diff --git a/languages/cpp/app_templates/kofficepart/kopart_factory.h b/languages/cpp/app_templates/kofficepart/kopart_factory.h new file mode 100644 index 00000000..45f1f649 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart_factory.h @@ -0,0 +1,33 @@ + +/* This template is based off of the KOffice example written by Torben Weis +*/ + +#ifndef %{APPNAME}_FACTORY_H +#define %{APPNAME}_FACTORY_H + +#include + +class KInstance; +class KAboutData; + +class %{APPNAME}Factory : public KoFactory +{ + Q_OBJECT +public: + %{APPNAME}Factory( QObject* parent = 0, const char* name = 0 ); + ~%{APPNAME}Factory(); + + virtual KParts::Part *createPartObject( QWidget *parentWidget = 0, const char *widgetName = 0, QObject *parent = 0, const char *name = 0, const char *classname = "KoDocument", const QStringList &args = QStringList() ); + + static KInstance* global(); + + // _Creates_ a KAboutData but doesn't keep ownership + static KAboutData* aboutData(); + +private: + static KInstance* s_global; + static KAboutData* s_aboutData; +}; + +#endif diff --git a/languages/cpp/app_templates/kofficepart/kopart_part.cpp b/languages/cpp/app_templates/kofficepart/kopart_part.cpp new file mode 100644 index 00000000..500179f3 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart_part.cpp @@ -0,0 +1,69 @@ + +/* This template is based off of the KOffice example written by Torben Weis +*/ + +#include "%{APPNAMELC}_part.h" +#include "%{APPNAMELC}_view.h" + +#include + +%{APPNAME}Part::%{APPNAME}Part( QWidget *parentWidget, const char *widgetName, QObject* parent, const char* name, bool singleViewMode ) + : KoDocument( parentWidget, widgetName, parent, name, singleViewMode ) +{ +} + +bool %{APPNAME}Part::initDoc( InitDocFlags flags, QWidget* parentWidget ) +{ + // If nothing is loaded, do initialize here + return TRUE; +} + +KoView* %{APPNAME}Part::createViewInstance( QWidget* parent, const char* name ) +{ + return new %{APPNAME}View( this, parent, name ); +} + +bool %{APPNAME}Part::loadOasis( const QDomDocument & doc, KoOasisStyles& oasisStyles, const QDomDocument & settings, KoStore* store ) +{ + /// @todo load the document using the OASIS format + return true; +} + +bool %{APPNAME}Part::loadXML( QIODevice *, const QDomDocument & ) +{ + /// @todo load the document from the QDomDocument + return true; +} + +QDomDocument %{APPNAME}Part::saveXML() +{ + /// @todo save the document into a QDomDocument + return QDomDocument(); +} + +bool %{APPNAME}Part::saveOasis( KoStore* store, KoXmlWriter* manifestWriter ) +{ + /// @todo save the document using the OASIS format + return true; +} + + +void %{APPNAME}Part::paintContent( QPainter& painter, const QRect& rect, bool /*transparent*/, + double /*zoomX*/, double /*zoomY*/ ) +{ + // ####### handle transparency + + // Need to draw only the document rectangle described in the parameter rect. + int left = rect.left() / 20; + int right = rect.right() / 20 + 1; + int top = rect.top() / 20; + int bottom = rect.bottom() / 20 + 1; + + for( int x = left; x < right; ++x ) + painter.drawLine( x * 20, top * 20, x * 20, bottom * 20 ); + for( int y = left; y < right; ++y ) + painter.drawLine( left * 20, y * 20, right * 20, y * 20 ); +} + +#include "%{APPNAMELC}_part.moc" diff --git a/languages/cpp/app_templates/kofficepart/kopart_part.h b/languages/cpp/app_templates/kofficepart/kopart_part.h new file mode 100644 index 00000000..03361ca7 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart_part.h @@ -0,0 +1,30 @@ + +/* This template is based off of the KOffice example written by Torben Weis +*/ + +#ifndef %{APPNAME}_PART_H +#define %{APPNAME}_PART_H + +#include + +class %{APPNAME}Part : public KoDocument +{ + Q_OBJECT +public: + %{APPNAME}Part( QWidget *parentWidget = 0, const char *widgetName = 0, QObject* parent = 0, const char* name = 0, bool singleViewMode = false ); + + virtual void paintContent( QPainter& painter, const QRect& rect, bool transparent = FALSE, double zoomX = 1.0, double zoomY = 1.0 ); + + virtual bool initDoc( InitDocFlags flags, QWidget* parentWidget = 0 ); + + virtual bool loadOasis( const QDomDocument & doc, KoOasisStyles& oasisStyles, const QDomDocument & settings, KoStore* store ); + virtual bool loadXML( QIODevice *, const QDomDocument & ); + virtual QDomDocument saveXML(); + virtual bool saveOasis( KoStore* store, KoXmlWriter* manifestWriter ); + +protected: + virtual KoView* createViewInstance( QWidget* parent, const char* name ); +}; + +#endif diff --git a/languages/cpp/app_templates/kofficepart/kopart_view.cpp b/languages/cpp/app_templates/kofficepart/kopart_view.cpp new file mode 100644 index 00000000..28c0b42f --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart_view.cpp @@ -0,0 +1,52 @@ + +/* This template is based off of the KOffice example written by Torben Weis +*/ +#include "%{APPNAMELC}_view.h" +#include "%{APPNAMELC}_factory.h" +#include "%{APPNAMELC}_part.h" + +#include +#include +#include +#include +#include +#include + +%{APPNAME}View::%{APPNAME}View( %{APPNAME}Part* part, QWidget* parent, const char* name ) + : KoView( part, parent, name ) +{ + setInstance( %{APPNAME}Factory::global() ); + setXMLFile( "%{APPNAMELC}.rc" ); + KStdAction::cut(this, SLOT( cut() ), actionCollection(), "cut" ); + // Note: Prefer KStdAction::* to any custom action if possible. + //m_cut = new KAction( i18n("&Cut"), "editcut", 0, this, SLOT( cut() ), + // actionCollection(), "cut"); +} + +void %{APPNAME}View::paintEvent( QPaintEvent* ev ) +{ + QPainter painter; + painter.begin( this ); + + /// @todo Scaling + + // Let the document do the drawing + koDocument()->paintEverything( painter, ev->rect(), FALSE, this ); + + painter.end(); +} + +void %{APPNAME}View::updateReadWrite( bool /*readwrite*/ ) +{ +#ifdef __GNUC__ +#warning TODO +#endif +} + +void %{APPNAME}View::cut() +{ + kdDebug(31000) << "%{APPNAME}View::cut(): CUT called" << endl; +} + +#include "%{APPNAMELC}_view.moc" diff --git a/languages/cpp/app_templates/kofficepart/kopart_view.h b/languages/cpp/app_templates/kofficepart/kopart_view.h new file mode 100644 index 00000000..eb14763f --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart_view.h @@ -0,0 +1,34 @@ + +/* This template is based off of the KOffice example written by Torben Weis +*/ + +#ifndef %{APPNAME}_VIEW +#define %{APPNAME}_VIEW + +#include + +class KAction; +class QPaintEvent; + +class %{APPNAME}Part; + +class %{APPNAME}View : public KoView +{ + Q_OBJECT +public: + %{APPNAME}View( %{APPNAME}Part* part, QWidget* parent = 0, const char* name = 0 ); + +protected slots: + void cut(); + +protected: + void paintEvent( QPaintEvent* ); + + virtual void updateReadWrite( bool readwrite ); + +private: + //KAction* m_cut; +}; + +#endif diff --git a/languages/cpp/app_templates/kofficepart/main.cpp b/languages/cpp/app_templates/kofficepart/main.cpp new file mode 100644 index 00000000..1561922a --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/main.cpp @@ -0,0 +1,33 @@ + +/* This template is based off of the KOffice example written by Torben Weis +*/ + +#include +#include +#include +#include +#include +#include +#include "%{APPNAMELC}_aboutdata.h" + + +static const KCmdLineOptions options[]= +{ + {"+[file]", I18N_NOOP("File to open"),0}, + KCmdLineLastOption +}; + +int main( int argc, char **argv ) +{ + KCmdLineArgs::init( argc, argv, new%{APPNAME}AboutData() ); + KCmdLineArgs::addCmdLineOptions( options ); + KoApplication app; + + app.dcopClient()->attach(); + app.dcopClient()->registerAs( "%{APPNAMELC}" ); + + if (!app.start()) // parses command line args, create initial docs and shells + return 1; + return app.exec(); +} diff --git a/languages/cpp/app_templates/kofficepart/src-Makefile.am b/languages/cpp/app_templates/kofficepart/src-Makefile.am new file mode 100644 index 00000000..19d38267 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/src-Makefile.am @@ -0,0 +1,41 @@ + +INCLUDES = $(KOFFICE_INCLUDES) $(all_includes) + +## The part +kde_module_LTLIBRARIES = lib%{APPNAMELC}part.la +lib%{APPNAMELC}part_la_SOURCES = %{APPNAMELC}_part.cpp \ + %{APPNAMELC}_view.cpp %{APPNAMELC}_factory.cpp +lib%{APPNAMELC}part_la_LDFLAGS = $(KDE_PLUGIN) +lib%{APPNAMELC}part_la_LIBADD = -lkofficeui + +## The kdeinit loadable module +lib_LTLIBRARIES = %{APPNAMELC}.la +%{APPNAMELC}_la_SOURCES = %{APPNAMELC}.cpp +%{APPNAMELC}_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries) +%{APPNAMELC}_la_LIBADD = -lkofficecore + +## The executable +bin_PROGRAMS = %{APPNAMELC} +%{APPNAMELC}_SOURCES = dummy.cpp +%{APPNAMELC}_LDFLAGS = $(all_libraries) $(KDE_RPATH) +%{APPNAMELC}_LDADD = %{APPNAMELC}.la + +dummy.cpp: + echo > dummy.cpp + +METASOURCES = AUTO +noinst_HEADERS = %{APPNAMELC}_part.h \ + %{APPNAMELC}_view.h %{APPNAMELC}_factory.h %{APPNAMELC}_aboutdata.h + +kdelnk_DATA = %{APPNAMELC}.desktop +kdelnkdir = $(kde_appsdir)/Office + +kdemime_DATA = x-%{APPNAMELC}.desktop +kdemimedir = $(kde_mimedir)/application + +rc_DATA = %{APPNAMELC}.rc +rcdir = $(kde_datadir)/%{APPNAMELC} + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp %{APPNAMELC}_aboutdata.h -o $(podir)/%{APPNAMELC}.pot diff --git a/languages/cpp/app_templates/kofficepart/subdirs b/languages/cpp/app_templates/kofficepart/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/kofficepart/x-kopart.desktop b/languages/cpp/app_templates/kofficepart/x-kopart.desktop new file mode 100644 index 00000000..f4e15e79 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/x-kopart.desktop @@ -0,0 +1,40 @@ +# KDE Config File +[Desktop Entry] +MimeType=application/x-%{APPNAMELC} +Comment= A really awesome KOffice application +Comment[ca]=Una aplicació de KOffice realment interessant +Comment[da]=Et helt fantastisk KOffice program +Comment[de]=Eine wirklich großartige KOffice-Anwendung +Comment[el]= Μια πραγματικά όμορφη εφαρμογή KOffice +Comment[es]=Una aplicación de KOffice realmente intesesante +Comment[et]=Tõesti imeline KOffice'i rakendus +Comment[eu]=KOffice aplikazio harrigarri bat +Comment[fa]=کاربرد واقعاً بیمناک KOffice +Comment[fr]=Une application pour KOffice vraiment superbe +Comment[ga]= Feidhmchlár sármhaith KOffice +Comment[gl]=Unha aplicación de KOffice realmente impresionante +Comment[hu]=Egy bámulatos KOffice-alkalmazás +Comment[it]=Un'applicazione di KOffice veramente bella +Comment[nds]=En redig deegt KOffice-Programm +Comment[ne]= वास्तवमै प्रभावकारी केडीई अफिस अनुप्रयोग +Comment[nl]=Een fantastische KOffice-toepassing +Comment[pl]=Wspaniały program KOffice +Comment[pt]=Uma aplicação fantástica para o KOffice +Comment[pt_BR]=Um aplicativo realmente do tipo do KOffice +Comment[ru]=Приложение KOffice +Comment[sk]=Naozaj hrozná KOffice aplikácia +Comment[sl]=Sijajen program za KOffice +Comment[sr]=Стварно сјајан KOffice програм +Comment[sr@Latn]=Stvarno sjajan KOffice program +Comment[sv]=Ett riktigt suveränt Koffice-program +Comment[tr]=Gerçekten harika bir KOffice uygulaması +Comment[zh_CN]=一个非常杰出的 KOffice 应用程序 +Comment[zh_TW]=一個十分完美的 KOffice 應用程式 +Type=MimeType +#You need to change the mime type below to match what your application will handle... +Patterns=*.xmpl; +X-KDE-AutoEmbed=false +[Property::X-KDE-NativeExtension] +Type=QString +#You need to change the mime type below to match what your application will handle... +Value=.xmpl -- cgit v1.2.1