diff options
Diffstat (limited to 'kommander/working/plugintemplate')
-rw-r--r-- | kommander/working/plugintemplate/Makefile.am | 17 | ||||
-rw-r--r-- | kommander/working/plugintemplate/README.dox | 55 | ||||
-rw-r--r-- | kommander/working/plugintemplate/app.kdevelop | 116 | ||||
-rw-r--r-- | kommander/working/plugintemplate/kommanderplugin.kdevtemplate | 66 | ||||
-rw-r--r-- | kommander/working/plugintemplate/kommanderplugin.png | bin | 0 -> 7232 bytes | |||
-rw-r--r-- | kommander/working/plugintemplate/plugin.cpp | 29 | ||||
-rw-r--r-- | kommander/working/plugintemplate/src-Makefile.am | 19 | ||||
-rw-r--r-- | kommander/working/plugintemplate/widget.cpp | 116 | ||||
-rw-r--r-- | kommander/working/plugintemplate/widget.h | 46 |
9 files changed, 464 insertions, 0 deletions
diff --git a/kommander/working/plugintemplate/Makefile.am b/kommander/working/plugintemplate/Makefile.am new file mode 100644 index 00000000..14e3c0a8 --- /dev/null +++ b/kommander/working/plugintemplate/Makefile.am @@ -0,0 +1,17 @@ +dataFiles = src-Makefile.am plugin.cpp \ + widget.h widget.cpp app.kdevelop +templateName = kommanderplugin + +### 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/kommander/working/plugintemplate/README.dox b/kommander/working/plugintemplate/README.dox new file mode 100644 index 00000000..86968add --- /dev/null +++ b/kommander/working/plugintemplate/README.dox @@ -0,0 +1,55 @@ +/** \class %{APPNAME} +Put a brief description here, the brief description ends at the first dot. +Put a more detailed description of your part in these lines. It can span +over several lines. You can even use some html commands in these lines like: +<code>This is code</code>, html links <a href="http://somelocation">link text</a>, +and images. + +\authors <a href="mailto:%{EMAIL}">%{AUTHOR}</a> +\authors <a href="mailto:2nd author AT provider.com">2nd author full name</a> +... +\authors <a href="mailto:nth author AT provider.com">nth author full name</a> + +\maintainer <a href="mailto:%{EMAIL}">%{AUTHOR}</a> +\maintainer <a href="mailto:2nd maintainer AT provider.com">2nd maintainer full name</a> +... +\maintainer <a href="mailto:nth maintainer AT provider.com">nth maintainer full name</a> + +\feature Describe the first feature +\feature Describe the second feature +... +\feature Describe the last feature + +\bug bugs in <a href="http://bugs.kde.org/buglist.cgi?product=kdevelop&component=YOUR_COMPONENT_NAME& +bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=Bug+Number"> +YOUR_COMPONENT_NAME at Bugzilla database</a> +\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet. +.. +\bug Describe a the nth bug that you know of, but probably hasn't been reported yet. + +\requirement Describe a the 1st requirement of your part. +\requirement Describe a the 2nd requirement of your part. +... +\requirement Describe a the nth requirement of your part. + +\todo Describe a the 1st TODO of your part. +\todo Describe a the 2nd TODO of your part. +... +\todo Describe a the nth TODO of your part. + +\faq <b>First frequenly asked question about your part ?</b> Answer. +\faq <b>Second frequenly asked question about your part ?</b> Answer. +... +\faq <b>Last frequenly asked question about your part ?</b> Answer. + +\note First note text. +\note Second note text. +... +\note Last note text. + +\warning First warning text. +\warning Second warning text. +... +\warning Last warning text. + +*/ diff --git a/kommander/working/plugintemplate/app.kdevelop b/kommander/working/plugintemplate/app.kdevelop new file mode 100644 index 00000000..29beaf21 --- /dev/null +++ b/kommander/working/plugintemplate/app.kdevelop @@ -0,0 +1,116 @@ +<?xml version="1.0"?> +<kdevelop> + <general> + <author>%{AUTHOR}</author> + <email>%{EMAIL}</email> + <version>%{VERSION}</version> + <projectmanagement>KDevKDEAutoProject</projectmanagement> + <primarylanguage>C++</primarylanguage> + <keywords> + <keyword>C++</keyword> + <keyword>Code</keyword> + <keyword>Qt</keyword> + <keyword>KDE</keyword> + <keyword>KDevelop</keyword> + </keywords> + </general> + <kdevcppsupport> + <qt> + <version>3</version> + <used>true</used> + <includestyle>3</includestyle> + <designerintegration>EmbeddedKDevDesigner</designerintegration> + </qt> + </kdevcppsupport> + + <kdevautoproject> + <general> + <activetarget>src/%{APPNAMELC}</activetarget> + <useconfiguration>debug</useconfiguration> + </general> + <run> + <mainprogram>src/%{APPNAMELC}</mainprogram> + </run> + <configurations> + <optimized> + <builddir>optimized</builddir> + <ccompiler>kdevgccoptions</ccompiler> + <cxxcompiler>kdevgppoptions</cxxcompiler> + <f77compiler>kdevg77options</f77compiler> + <cxxflags>-O2 -g0</cxxflags> + </optimized> + <debug> + <configargs>--enable-debug=full</configargs> + <builddir>debug</builddir> + <ccompiler>kdevgccoptions</ccompiler> + <cxxcompiler>kdevgppoptions</cxxcompiler> + <f77compiler>kdevg77options</f77compiler> + <cxxflags>-O0 -g3</cxxflags> + </debug> + </configurations> +</kdevautoproject> + <kdevfileview> + <groups> + <group pattern="*.cpp;*.cxx;*.h" name="Sources" /> + <group pattern="*.ui" name="User Interface" /> + <group pattern="*.png" name="Icons" /> + <group pattern="*.po;*.ts" name="Translations" /> + <group pattern="*" name="Others" /> + </groups> + </kdevfileview> + <kdevdoctreeview> + <ignoretocs> + <toc>ada</toc> + <toc>ada_bugs_gcc</toc> + <toc>bash</toc> + <toc>bash_bugs</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>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>ruby</toc> + <toc>ruby_bugs</toc> + <toc>sdl</toc> + <toc>w3c-svg</toc> + <toc>sw</toc> + <toc>w3c-uaag10</toc> + <toc>wxwidgets_bugs</toc> + </ignoretocs> + <ignoreqt_xml> + <toc>qmake User Guide</toc> + </ignoreqt_xml> + </kdevdoctreeview> + <kdevdebugger> + <general> + <dbgshell>libtool</dbgshell> + </general> + </kdevdebugger> + <kdevfilecreate> + <filetypes/> + <useglobaltypes> + <type ext="ui" /> + <type ext="cpp" /> + <type ext="h" /> + </useglobaltypes> + </kdevfilecreate> + <kdevdocumentation> + <projectdoc> + <docsystem>Doxygen Documentation Collection</docsystem> + <docurl>%{APPNAMELC}.tag</docurl> + </projectdoc> + </kdevdocumentation> +</kdevelop> diff --git a/kommander/working/plugintemplate/kommanderplugin.kdevtemplate b/kommander/working/plugintemplate/kommanderplugin.kdevtemplate new file mode 100644 index 00000000..1eb9917f --- /dev/null +++ b/kommander/working/plugintemplate/kommanderplugin.kdevtemplate @@ -0,0 +1,66 @@ +# KDE Config File +[General] +Name=Kommander Plugin +Category=C++/Kommander/ +Comment=This generates a plugin for Kommander +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/%{APPNAMELC}.cpp +Archive=kommanderplugin.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE3] +Type=install +Source=%{src}/widget.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE4] +Type=install +Source=%{src}/widget.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE5] +Type=install +Source=%{src}/plugin.cpp +Dest=%{dest}/src/%{APPNAMELC}plugin.cpp + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + + +[MSG] +Type=message +Comment=A Kommander plugin was created in %{dest} diff --git a/kommander/working/plugintemplate/kommanderplugin.png b/kommander/working/plugintemplate/kommanderplugin.png Binary files differnew file mode 100644 index 00000000..2cbd68ee --- /dev/null +++ b/kommander/working/plugintemplate/kommanderplugin.png diff --git a/kommander/working/plugintemplate/plugin.cpp b/kommander/working/plugintemplate/plugin.cpp new file mode 100644 index 00000000..e6b506cc --- /dev/null +++ b/kommander/working/plugintemplate/plugin.cpp @@ -0,0 +1,29 @@ +%{CPP_TEMPLATE} +#include "%{APPNAMELC}.h" + +#include <kommanderplugin.h> +#include <kglobal.h> +#include <kiconloader.h> +#include <klocale.h> +#include "%{APPNAMELC}.h" + +class %{APPNAME}Plugin : public KommanderPlugin +{ +public: + %{APPNAME}Plugin(); + virtual QWidget *create( const QString &className, QWidget *parent = 0, const char *name = 0); +}; + +%{APPNAME}Plugin::%{APPNAME}Plugin() +{ + addWidget( "%{APPNAME}", "Custom", i18n("Kommander %{APPNAME} plugin."), new QIconSet(KGlobal::iconLoader()->loadIcon("%{APPNAMELC}", KIcon::NoGroup, KIcon::SizeMedium)) ); +} + +QWidget *%{APPNAME}Plugin::create( const QString &className, QWidget *parent, const char *name) +{ + if (className == "%{APPNAME}") + return new %{APPNAME}(parent, name); + return 0; +} + +KOMMANDER_EXPORT_PLUGIN(%{APPNAME}Plugin) diff --git a/kommander/working/plugintemplate/src-Makefile.am b/kommander/working/plugintemplate/src-Makefile.am new file mode 100644 index 00000000..eb7dbe9d --- /dev/null +++ b/kommander/working/plugintemplate/src-Makefile.am @@ -0,0 +1,19 @@ +lib_LTLIBRARIES = libkmdr%{APPNAMELC}.la + +# the library search path. +libkmdr%{APPNAMELC}_la_LDFLAGS = -module $(KDE_PLUGIN) \ + $(HK_LDFLAGS) $(all_libraries) + +# the libraries to link against. +libkmdr%{APPNAMELC}_la_LIBADD = -lkommanderwidget -lkommanderplugin \ + $(LIB_KPARTS) $(LIB_KDEUI) + +# which sources should be compiled for widgets +libkmdr%{APPNAMELC}_la_SOURCES = %{APPNAMELC}.cpp %{APPNAMELC}plugin.cpp + +# these are the headers for your project that won't be installed + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO +AM_CXXFLAGS= -DHAVE_SSTREAM +AM_CPPFLAGS= $(all_includes) diff --git a/kommander/working/plugintemplate/widget.cpp b/kommander/working/plugintemplate/widget.cpp new file mode 100644 index 00000000..73ec0278 --- /dev/null +++ b/kommander/working/plugintemplate/widget.cpp @@ -0,0 +1,116 @@ +%{CPP_TEMPLATE} +#include "%{APPNAMELC}.h" + +#include <kommanderplugin.h> +#include <specials.h> + +#include <kglobal.h> +#include <kiconloader.h> +#include <klocale.h> + + +enum Functions { + FirstFunction = 11001, //CHANGE THIS NUMBE TO AN UNIQUE ONE!!! + Function1, + Function2, + LastFunction +}; + +%{APPNAME}::%{APPNAME}(QWidget *parent, const char *name) + : QWidget(parent, name), KommanderWidget(this) +{ + QStringList states; + states << "default"; + setStates(states); + setDisplayStates(states); + +//enable the below code to show a different widget in editor +/* + if (KommanderWidget::inEditor) + { + setPixmap(KGlobal::iconLoader()->loadIcon("%{APPNAMELC}", KIcon::NoGroup, KIcon::SizeMedium)); + setFrameStyle(QFrame::Box | QFrame::Plain); + setLineWidth(1); + setAlignment(Qt::AlignCenter); + } + else + setHidden(true); +*/ + + KommanderPlugin::setDefaultGroup(Group::DCOP); + +//CHANGE THE BELOW LINES TO MATCH YOUR FUNCTIONS NAMES AND SIGNATURE + KommanderPlugin::registerFunction(Function1, "function1(QString widget, QString arg1, int arg2)", i18n("Call function1 with two arguments, second is optional."), 2, 3); + KommanderPlugin::registerFunction(Function2, "function2(QString widget)", i18n("Get a QString as a result of function2."), 1); + +} + +%{APPNAME}::~%{APPNAME}() +{ +} + +QString %{APPNAME}::currentState() const +{ + return QString("default"); +} + +bool %{APPNAME}::isKommanderWidget() const +{ + return true; +} + +QStringList %{APPNAME}::associatedText() const +{ + return KommanderWidget::associatedText(); +} + +void %{APPNAME}::setAssociatedText(const QStringList& a_atext) +{ + KommanderWidget::setAssociatedText(a_atext); +} + +void %{APPNAME}::setPopulationText(const QString& a_text) +{ + KommanderWidget::setPopulationText(a_text); +} + +QString %{APPNAME}::populationText() const +{ + return KommanderWidget::populationText(); +} + +void %{APPNAME}::populate() +{ + KommanderWidget::evalAssociatedText(populationText()); +} + +void %{APPNAME}::contextMenuEvent( QContextMenuEvent * e ) +{ + e->accept(); + QPoint p = e->globalPos(); + emit contextMenuRequested(p.x(), p.y()); +} + + +bool %{APPNAME}::isFunctionSupported(int f) +{ + return (f >= FirstFunction && f <= LastFunction); //see specials.h for other DCOP functions you might want to support +} + +QString %{APPNAME}::handleDCOP(int function, const QStringList& args) +{ + switch (function) + { + case Function1: + //do something for Function1, like handleFunction1(arg[0], arg[1].toInt()); + break; + case Function2: + //do something for Function2, like return handleFunction2(); + break; + default: + return KommanderWidget::handleDCOP(function, args); + } + return QString::null; +} + +#include "%{APPNAMELC}.moc" diff --git a/kommander/working/plugintemplate/widget.h b/kommander/working/plugintemplate/widget.h new file mode 100644 index 00000000..56e87f91 --- /dev/null +++ b/kommander/working/plugintemplate/widget.h @@ -0,0 +1,46 @@ +%{H_TEMPLATE} +#ifndef %{APPNAMEUC}_WIDGET_H +#define %{APPNAMEUC}_WIDGET_H + +#include <qwidget.h> +#include <qstring.h> + +#include <kparts/part.h> + +#include <kommanderwidget.h> + +class QStringList; + +//replace QWidget with the widget you want to derive from +class %{APPNAME}: public QWidget, public KommanderWidget +{ + Q_OBJECT + + Q_PROPERTY(QString populationText READ populationText WRITE setPopulationText DESIGNABLE false) + Q_PROPERTY(QStringList associations READ associatedText WRITE setAssociatedText DESIGNABLE false) + Q_PROPERTY(bool KommanderWidget READ isKommanderWidget) + +public: + %{APPNAME}(QWidget *parent, const char* name); + ~%{APPNAME}(); + + virtual bool isKommanderWidget() const; + virtual void setAssociatedText(const QStringList&); + virtual QStringList associatedText() const; + virtual QString currentState() const; + virtual QString populationText() const; + virtual void setPopulationText(const QString&); + virtual void populate(); + + virtual QString handleDCOP(int function, const QStringList& args); + virtual bool isFunctionSupported(int function); + +signals: + void contextMenuRequested(int xpos, int ypos); + +protected: + void contextMenuEvent( QContextMenuEvent * e ); +}; + + +#endif |