summaryrefslogtreecommitdiffstats
path: root/kapptemplate/kpartapp
diff options
context:
space:
mode:
Diffstat (limited to 'kapptemplate/kpartapp')
-rw-r--r--kapptemplate/kpartapp/Makefile.am10
-rw-r--r--kapptemplate/kpartapp/app-Makefile.am57
-rw-r--r--kapptemplate/kpartapp/app-configure.in.in14
-rw-r--r--kapptemplate/kpartapp/app-desktop11
-rw-r--r--kapptemplate/kpartapp/app.cpp176
-rw-r--r--kapptemplate/kpartapp/app.h70
-rw-r--r--kapptemplate/kpartapp/app_part-desktop9
-rw-r--r--kapptemplate/kpartapp/app_part.cpp148
-rw-r--r--kapptemplate/kpartapp/app_part.h69
-rw-r--r--kapptemplate/kpartapp/app_part.rc17
-rw-r--r--kapptemplate/kpartapp/app_shell.rc32
-rw-r--r--kapptemplate/kpartapp/doc-Makefile.am8
-rw-r--r--kapptemplate/kpartapp/doc-app-Makefile.am9
-rw-r--r--kapptemplate/kpartapp/hi16-app-app.png2
-rw-r--r--kapptemplate/kpartapp/hi32-app-app.png2
-rw-r--r--kapptemplate/kpartapp/hi48-app-app.png2
-rw-r--r--kapptemplate/kpartapp/index.docbook106
-rw-r--r--kapptemplate/kpartapp/lo16-app-app.png2
-rw-r--r--kapptemplate/kpartapp/lo32-app-app.png2
-rw-r--r--kapptemplate/kpartapp/main.cpp55
-rw-r--r--kapptemplate/kpartapp/no-exe/Makefile.am3
-rw-r--r--kapptemplate/kpartapp/no-exe/hi16-app-app.pngbin0 -> 845 bytes
-rw-r--r--kapptemplate/kpartapp/no-exe/hi32-app-app.pngbin0 -> 2595 bytes
-rw-r--r--kapptemplate/kpartapp/no-exe/hi48-app-app.pngbin0 -> 4954 bytes
-rw-r--r--kapptemplate/kpartapp/no-exe/lo16-app-app.pngbin0 -> 628 bytes
-rw-r--r--kapptemplate/kpartapp/no-exe/lo32-app-app.pngbin0 -> 1335 bytes
26 files changed, 804 insertions, 0 deletions
diff --git a/kapptemplate/kpartapp/Makefile.am b/kapptemplate/kpartapp/Makefile.am
new file mode 100644
index 00000000..26e92118
--- /dev/null
+++ b/kapptemplate/kpartapp/Makefile.am
@@ -0,0 +1,10 @@
+SUBDIRS=no-exe
+
+kpartappdir = $(kde_datadir)/kapptemplate/kpartapp
+kpartapp_DATA = app_part.cpp doc-app-Makefile.am \
+ lo32-app-app.png \
+ app-Makefile.am app_part-desktop hi16-app-app.png main.cpp \
+ app-configure.in.in app_part.h hi32-app-app.png \
+ app.cpp app_part.rc hi48-app-app.png \
+ app-desktop app_shell.rc index.docbook \
+ app.h doc-Makefile.am lo16-app-app.png
diff --git a/kapptemplate/kpartapp/app-Makefile.am b/kapptemplate/kpartapp/app-Makefile.am
new file mode 100644
index 00000000..3aa0495f
--- /dev/null
+++ b/kapptemplate/kpartapp/app-Makefile.am
@@ -0,0 +1,57 @@
+echo "Creating $LOCATION_ROOT/$APP_NAME_LC/Makefile.am...";
+cat << EOF > $LOCATION_ROOT/$APP_NAME_LC/Makefile.am
+# this has all of the subdirectories that make will recurse into. if
+# there are none, comment this out
+#SUBDIRS = .
+
+# set the include path for X, qt and KDE
+INCLUDES = \$(all_includes)
+
+# these are the headers for your project
+noinst_HEADERS = ${APP_NAME_LC}.h ${APP_NAME_LC}_part.h
+
+# let automoc handle all of the meta source files (moc)
+METASOURCES = AUTO
+
+messages: rc.cpp
+ \$(XGETTEXT) *.cpp -o \$(podir)/${APP_NAME_LC}.pot
+
+KDE_ICON = ${APP_NAME_LC}
+
+# this Makefile creates both a KPart application and a KPart
+#########################################################################
+# APPLICATION SECTION
+#########################################################################
+# this is the program that gets installed. it's name is used for all
+# of the other Makefile.am variables
+bin_PROGRAMS = ${APP_NAME_LC}
+
+# the application source, library search path, and link libraries
+${APP_NAME_LC}_SOURCES = main.cpp ${APP_NAME_LC}.cpp
+${APP_NAME_LC}_LDFLAGS = \$(KDE_RPATH) \$(all_libraries)
+${APP_NAME_LC}_LDADD = \$(LIB_KPARTS)
+
+# this is where the desktop file will go
+xdg_apps_DATA = ${APP_NAME_LC}.desktop
+
+# this is where the shell's XML-GUI resource file goes
+shellrcdir = \$(kde_datadir)/${APP_NAME_LC}
+shellrc_DATA = ${APP_NAME_LC}_shell.rc
+
+#########################################################################
+# KPART SECTION
+#########################################################################
+kde_module_LTLIBRARIES = lib${APP_NAME_LC}part.la
+
+# the Part's source, library search path, and link libraries
+lib${APP_NAME_LC}part_la_SOURCES = ${APP_NAME_LC}_part.cpp
+lib${APP_NAME_LC}part_la_LDFLAGS = -module \$(KDE_PLUGIN) \$(all_libraries)
+lib${APP_NAME_LC}part_la_LIBADD = \$(LIB_KPARTS) \$(LIB_KFILE)
+
+# this is where the desktop file will go
+partdesktopdir = \$(kde_servicesdir)
+partdesktop_DATA = ${APP_NAME_LC}_part.desktop
+
+# this is where the part's XML-GUI resource file goes
+partrcdir = \$(kde_datadir)/${APP_NAME_LC}part
+partrc_DATA = ${APP_NAME_LC}_part.rc
diff --git a/kapptemplate/kpartapp/app-configure.in.in b/kapptemplate/kpartapp/app-configure.in.in
new file mode 100644
index 00000000..4d050a09
--- /dev/null
+++ b/kapptemplate/kpartapp/app-configure.in.in
@@ -0,0 +1,14 @@
+echo "Creating $LOCATION_ROOT/configure.in.in...";
+cat << EOF > $LOCATION_ROOT/configure.in.in
+#MIN_CONFIG
+
+AM_INIT_AUTOMAKE(${APP_NAME_LC}, ${APP_VERSION})
+
+dnl These are common macros that you might or might not want to use
+
+dnl Checks for header files.
+AC_HEADER_DIRENT
+AC_HEADER_STDC
+AC_HEADER_TIME
+AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h stdlib.h paths.h)
+AC_CHECK_FUNCS(usleep)
diff --git a/kapptemplate/kpartapp/app-desktop b/kapptemplate/kpartapp/app-desktop
new file mode 100644
index 00000000..7b4090f1
--- /dev/null
+++ b/kapptemplate/kpartapp/app-desktop
@@ -0,0 +1,11 @@
+echo "Creating $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}.desktop...";
+cat << EOF > $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}.desktop
+[Desktop Entry]
+Encoding=UTF-8
+Name=${APP_NAME}
+Exec=${APP_NAME_LC} %i %m -caption "%c"
+Icon=${APP_NAME_LC}
+Type=Application
+DocPath=${APP_NAME_LC}/${APP_NAME_LC}.html
+GenericName=A KDE KPart Application
+Terminal=0
diff --git a/kapptemplate/kpartapp/app.cpp b/kapptemplate/kpartapp/app.cpp
new file mode 100644
index 00000000..8b04053e
--- /dev/null
+++ b/kapptemplate/kpartapp/app.cpp
@@ -0,0 +1,176 @@
+echo "Creating $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}.cpp...";
+cat << EOF > $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}.cpp
+/*
+ * ${APP_NAME_LC}.cpp
+ *
+ * Copyright (C) 2004 $AUTHOR <$EMAIL>
+ */
+#include "${APP_NAME_LC}.h"
+#include "${APP_NAME_LC}.moc"
+
+#include <kkeydialog.h>
+#include <kconfig.h>
+#include <kurl.h>
+
+#include <kedittoolbar.h>
+
+#include <kaction.h>
+#include <kstdaction.h>
+
+#include <klibloader.h>
+#include <kmessagebox.h>
+#include <kfiledialog.h>
+#include <kstatusbar.h>
+
+${APP_NAME}::${APP_NAME}()
+ : KParts::MainWindow( 0L, "${APP_NAME}" )
+{
+ // set the shell's ui resource file
+ setXMLFile("${APP_NAME_LC}_shell.rc");
+
+ // then, setup our actions
+ setupActions();
+
+ // this routine will find and load our Part. it finds the Part by
+ // name which is a bad idea usually.. but it's alright in this
+ // case since our Part is made for this Shell
+ KLibFactory *factory = KLibLoader::self()->factory("lib${APP_NAME_LC}part");
+ if (factory)
+ {
+ // now that the Part is loaded, we cast it to a Part to get
+ // our hands on it
+ m_part = static_cast<KParts::ReadWritePart *>(factory->create(this,
+ "${APP_NAME_LC}_part", "KParts::ReadWritePart" ));
+
+ if (m_part)
+ {
+ // tell the KParts::MainWindow that this is indeed the main widget
+ setCentralWidget(m_part->widget());
+
+ // and integrate the part's GUI with the shell's
+ createGUI(m_part);
+ }
+ }
+ else
+ {
+ // if we couldn't find our Part, we exit since the Shell by
+ // itself can't do anything useful
+ KMessageBox::error(this, "Could not find our Part!");
+ kapp->quit();
+ // we return here, cause kapp->quit() only means "exit the
+ // next time we enter the event loop...
+ return;
+ }
+
+ // apply the saved mainwindow settings, if any, and ask the mainwindow
+ // to automatically save settings if changed: window size, toolbar
+ // position, icon size, etc.
+ setAutoSaveSettings();
+}
+
+${APP_NAME}::~${APP_NAME}()
+{
+}
+
+void ${APP_NAME}::load(const KURL& url)
+{
+ m_part->openURL( url );
+}
+
+void ${APP_NAME}::setupActions()
+{
+ KStdAction::openNew(this, SLOT(fileNew()), actionCollection());
+ KStdAction::open(this, SLOT(fileOpen()), actionCollection());
+
+ KStdAction::quit(kapp, SLOT(quit()), actionCollection());
+
+ createStandardStatusBarAction();
+ setStandardToolBarMenuEnabled(true);
+
+ KStdAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection());
+ KStdAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection());
+}
+
+void ${APP_NAME}::saveProperties(KConfig* /*config*/)
+{
+ // the 'config' object points to the session managed
+ // config file. anything you write here will be available
+ // later when this app is restored
+}
+
+void ${APP_NAME}::readProperties(KConfig* /*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'
+}
+
+void ${APP_NAME}::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
+
+ // About this function, the style guide (
+ // http://developer.kde.org/documentation/standards/kde/style/basics/index.html )
+ // says that it should open a new window if the document is _not_
+ // in its initial state. This is what we do here..
+ if ( ! m_part->url().isEmpty() || m_part->isModified() )
+ {
+ (new ${APP_NAME})->show();
+ };
+}
+
+void ${APP_NAME}::optionsConfigureKeys()
+{
+ KKeyDialog dlg( true, this );
+ dlg.insert( actionCollection(), "${APP_NAME_LC}_shell.rc" );
+ dlg.insert( m_part->actionCollection(), "${APP_NAME_LC}_part.rc" );
+ (void) dlg.configure( true );
+}
+
+void ${APP_NAME}::optionsConfigureToolbars()
+{
+ saveMainWindowSettings(KGlobal::config(), autoSaveGroup());
+
+ // use the standard toolbar editor
+ KEditToolbar dlg(factory());
+ connect(&dlg, SIGNAL(newToolbarConfig()),
+ this, SLOT(applyNewToolbarConfig()));
+ dlg.exec();
+}
+
+void ${APP_NAME}::applyNewToolbarConfig()
+{
+ applyMainWindowSettings(KGlobal::config(), autoSaveGroup());
+}
+
+void ${APP_NAME}::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
+ KURL url =
+ KFileDialog::getOpenURL( QString::null, QString::null, this );
+
+ if (url.isEmpty() == false)
+ {
+ // About this function, the style guide (
+ // http://developer.kde.org/documentation/standards/kde/style/basics/index.html )
+ // says that it should open a new window if the document is _not_
+ // in its initial state. This is what we do here..
+ if ( m_part->url().isEmpty() && ! m_part->isModified() )
+ {
+ // we open the file in this window...
+ load( url );
+ }
+ else
+ {
+ // we open the file in a new window...
+ ${APP_NAME}* newWin = new ${APP_NAME};
+ newWin->load( url );
+ newWin->show();
+ }
+ }
+}
diff --git a/kapptemplate/kpartapp/app.h b/kapptemplate/kpartapp/app.h
new file mode 100644
index 00000000..41daea60
--- /dev/null
+++ b/kapptemplate/kpartapp/app.h
@@ -0,0 +1,70 @@
+echo "Creating $LOCATION_ROOT/$APP_NAME_LC/${APP_NAME_LC}.h...";
+cat << EOF > $LOCATION_ROOT/$APP_NAME_LC/${APP_NAME_LC}.h
+#ifndef ${APP_NAME_UC}_H
+#define ${APP_NAME_UC}_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <kapplication.h>
+#include <kparts/mainwindow.h>
+
+/**
+ * This is the application "Shell". It has a menubar, toolbar, and
+ * statusbar but relies on the "Part" to do all the real work.
+ *
+ * @short Application Shell
+ * @author ${AUTHOR} <${EMAIL}>
+ * @version ${APP_VERSION}
+ */
+class ${APP_NAME} : public KParts::MainWindow
+{
+ Q_OBJECT
+public:
+ /**
+ * Default Constructor
+ */
+ ${APP_NAME}();
+
+ /**
+ * Default Destructor
+ */
+ virtual ~${APP_NAME}();
+
+ /**
+ * Use this method to load whatever file/URL you have
+ */
+ void load(const KURL& url);
+
+protected:
+ /**
+ * This method is called when it is time for the app to save its
+ * properties for session management purposes.
+ */
+ void saveProperties(KConfig *);
+
+ /**
+ * This method is called when this app is restored. The KConfig
+ * object points to the session management config file that was saved
+ * with @ref saveProperties
+ */
+ void readProperties(KConfig *);
+
+private slots:
+ void fileNew();
+ void fileOpen();
+ void optionsConfigureKeys();
+ void optionsConfigureToolbars();
+
+ void applyNewToolbarConfig();
+
+private:
+ void setupAccel();
+ void setupActions();
+
+private:
+ KParts::ReadWritePart *m_part;
+};
+
+#endif // ${APP_NAME_UC}_H
diff --git a/kapptemplate/kpartapp/app_part-desktop b/kapptemplate/kpartapp/app_part-desktop
new file mode 100644
index 00000000..6ba3bf54
--- /dev/null
+++ b/kapptemplate/kpartapp/app_part-desktop
@@ -0,0 +1,9 @@
+echo "Creating $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}_part.desktop...";
+cat << EOF > $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}_part.desktop
+[Desktop Entry]
+Encoding=UTF-8
+Name=${APP_NAME}Part
+MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
+ServiceTypes=KParts/ReadOnlyPart,KParts/ReadWritePart
+X-KDE-Library=lib${APP_NAME_LC}part
+Type=Service
diff --git a/kapptemplate/kpartapp/app_part.cpp b/kapptemplate/kpartapp/app_part.cpp
new file mode 100644
index 00000000..c2821950
--- /dev/null
+++ b/kapptemplate/kpartapp/app_part.cpp
@@ -0,0 +1,148 @@
+echo "Creating $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}_part.cpp...";
+cat << EOF > $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}_part.cpp
+#include "${APP_NAME_LC}_part.h"
+
+#include "${APP_NAME_LC}_part.moc"
+
+#include <kinstance.h>
+#include <kaction.h>
+#include <kstdaction.h>
+#include <kfiledialog.h>
+#include <kparts/genericfactory.h>
+
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qmultilineedit.h>
+
+typedef KParts::GenericFactory<${APP_NAME}Part> ${APP_NAME}PartFactory;
+K_EXPORT_COMPONENT_FACTORY( lib${APP_NAME_LC}part, ${APP_NAME}PartFactory )
+
+${APP_NAME}Part::${APP_NAME}Part( QWidget *parentWidget, const char *widgetName,
+ QObject *parent, const char *name,
+ const QStringList & /*args*/ )
+ : KParts::ReadWritePart(parent, name)
+{
+ // we need an instance
+ setInstance( ${APP_NAME}PartFactory::instance() );
+
+ // this should be your custom internal widget
+ m_widget = new QMultiLineEdit( parentWidget, widgetName );
+
+ // notify the part that this is our internal widget
+ setWidget(m_widget);
+
+ // create our actions
+ KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection());
+ KStdAction::save(this, SLOT(save()), actionCollection());
+
+ // set our XML-UI resource file
+ setXMLFile("${APP_NAME_LC}_part.rc");
+
+ // we are read-write by default
+ setReadWrite(true);
+
+ // we are not modified since we haven't done anything yet
+ setModified(false);
+}
+
+${APP_NAME}Part::~${APP_NAME}Part()
+{
+}
+
+void ${APP_NAME}Part::setReadWrite(bool rw)
+{
+ // notify your internal widget of the read-write state
+ m_widget->setReadOnly(!rw);
+ if (rw)
+ connect(m_widget, SIGNAL(textChanged()),
+ this, SLOT(setModified()));
+ else
+ {
+ disconnect(m_widget, SIGNAL(textChanged()),
+ this, SLOT(setModified()));
+ }
+
+ ReadWritePart::setReadWrite(rw);
+}
+
+void ${APP_NAME}Part::setModified(bool modified)
+{
+ // get a handle on our Save action and make sure it is valid
+ KAction *save = actionCollection()->action(KStdAction::stdName(KStdAction::Save));
+ if (!save)
+ return;
+
+ // if so, we either enable or disable it based on the current
+ // state
+ if (modified)
+ save->setEnabled(true);
+ else
+ save->setEnabled(false);
+
+ // in any event, we want our parent to do it's thing
+ ReadWritePart::setModified(modified);
+}
+
+KAboutData *${APP_NAME}Part::createAboutData()
+{
+ // the non-i18n name here must be the same as the directory in
+ // which the part's rc file is installed ('partrcdir' in the
+ // Makefile)
+ KAboutData *aboutData = new KAboutData("${APP_NAME_LC}part", I18N_NOOP("${APP_NAME}Part"), "${APP_VERSION}");
+ aboutData->addAuthor("${AUTHOR}", 0, "${EMAIL}");
+ return aboutData;
+}
+
+bool ${APP_NAME}Part::openFile()
+{
+ // m_file is always local so we can use QFile on it
+ QFile file(m_file);
+ if (file.open(IO_ReadOnly) == false)
+ return false;
+
+ // our example widget is text-based, so we use QTextStream instead
+ // of a raw QDataStream
+ QTextStream stream(&file);
+ QString str;
+ while (!stream.eof())
+ str += stream.readLine() + "\n";
+
+ file.close();
+
+ // now that we have the entire file, display it
+ m_widget->setText(str);
+
+ // just for fun, set the status bar
+ emit setStatusBarText( m_url.prettyURL() );
+
+ return true;
+}
+
+bool ${APP_NAME}Part::saveFile()
+{
+ // if we aren't read-write, return immediately
+ if (isReadWrite() == false)
+ return false;
+
+ // m_file is always local, so we use QFile
+ QFile file(m_file);
+ if (file.open(IO_WriteOnly) == false)
+ return false;
+
+ // use QTextStream to dump the text to the file
+ QTextStream stream(&file);
+ stream << m_widget->text();
+
+ file.close();
+
+ return true;
+}
+
+void ${APP_NAME}Part::fileSaveAs()
+{
+ // this slot is called whenever the File->Save As menu is selected,
+ QString file_name = KFileDialog::getSaveFileName();
+ if (file_name.isEmpty() == false)
+ saveAs(file_name);
+}
+
diff --git a/kapptemplate/kpartapp/app_part.h b/kapptemplate/kpartapp/app_part.h
new file mode 100644
index 00000000..18841510
--- /dev/null
+++ b/kapptemplate/kpartapp/app_part.h
@@ -0,0 +1,69 @@
+echo "Creating $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}_part.h...";
+cat << EOF > $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}_part.h
+#ifndef ${APP_NAME_UC}PART_H
+#define ${APP_NAME_UC}PART_H
+
+#include <kparts/part.h>
+
+class QWidget;
+class QPainter;
+class KURL;
+class QMultiLineEdit;
+class KAboutData;
+
+/**
+ * This is a "Part". It that does all the real work in a KPart
+ * application.
+ *
+ * @short Main Part
+ * @author ${AUTHOR} <${EMAIL}>
+ * @version ${APP_VERSION}
+ */
+class ${APP_NAME}Part : public KParts::ReadWritePart
+{
+ Q_OBJECT
+public:
+ /**
+ * Default constructor
+ */
+ ${APP_NAME}Part(QWidget *parentWidget, const char *widgetName,
+ QObject *parent, const char *name, const QStringList &args);
+
+ /**
+ * Destructor
+ */
+ virtual ~${APP_NAME}Part();
+
+ /**
+ * This is a virtual function inherited from KParts::ReadWritePart.
+ * A shell will use this to inform this Part if it should act
+ * read-only
+ */
+ virtual void setReadWrite(bool rw);
+
+ /**
+ * Reimplemented to disable and enable Save action
+ */
+ virtual void setModified(bool modified);
+
+ static KAboutData *createAboutData();
+
+protected:
+ /**
+ * This must be implemented by each part
+ */
+ virtual bool openFile();
+
+ /**
+ * This must be implemented by each read-write part
+ */
+ virtual bool saveFile();
+
+protected slots:
+ void fileSaveAs();
+
+private:
+ QMultiLineEdit *m_widget;
+};
+
+#endif // ${APP_NAME_UC}PART_H
diff --git a/kapptemplate/kpartapp/app_part.rc b/kapptemplate/kpartapp/app_part.rc
new file mode 100644
index 00000000..793fe772
--- /dev/null
+++ b/kapptemplate/kpartapp/app_part.rc
@@ -0,0 +1,17 @@
+echo "Creating $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}_part.rc...";
+cat << EOF > $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}_part.rc
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="${APP_NAME_LC}_part" version="1">
+<MenuBar>
+ <Menu name="file">
+ <Action name="file_save"/>
+ <Action name="file_save_as"/>
+ </Menu>
+</MenuBar>
+<ToolBar name="mainToolBar">
+ <Action name="file_open"/>
+ <Action name="file_save"/>
+ <Action name="file_print"/>
+ <Separator/>
+</ToolBar>
+</kpartgui>
diff --git a/kapptemplate/kpartapp/app_shell.rc b/kapptemplate/kpartapp/app_shell.rc
new file mode 100644
index 00000000..22b95aad
--- /dev/null
+++ b/kapptemplate/kpartapp/app_shell.rc
@@ -0,0 +1,32 @@
+echo "Creating $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}_shell.rc...";
+cat << EOF > $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}_shell.rc
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="${APP_NAME_LC}_shell" version="1">
+<MenuBar>
+ <Menu noMerge="1" name="file"><text>&amp;File</text>
+ <Action name="file_new"/>
+ <Action name="file_open"/>
+ <Separator/>
+ <Merge/>
+ <Separator/>
+ <Action name="file_quit"/>
+ </Menu>
+ <Menu noMerge="1" name="settings"><text>&amp;Settings</text>
+ <Action name="options_show_toolbar"/>
+ <Action name="options_show_statusbar"/>
+ <Merge name="show_merge"/>
+ <Separator/>
+ <Action name="options_configure_keybinding"/>
+ <Action name="options_configure_toolbars"/>
+ <Action name="options_configure"/>
+ <Merge name="configure_merge"/>
+ <Separator/>
+ <Merge/>
+ </Menu>
+</MenuBar>
+<ToolBar noMerge="1" name="mainToolBar"><text>Main Toolbar</text>
+ <Action name="file_new"/>
+ <Merge/>
+ <Action name="help"/>
+</ToolBar>
+</kpartgui>
diff --git a/kapptemplate/kpartapp/doc-Makefile.am b/kapptemplate/kpartapp/doc-Makefile.am
new file mode 100644
index 00000000..02611d03
--- /dev/null
+++ b/kapptemplate/kpartapp/doc-Makefile.am
@@ -0,0 +1,8 @@
+echo "Creating $LOCATION_ROOT/doc/Makefile.am...";
+$MKDIR $LOCATION_ROOT/doc
+cat << EOF > $LOCATION_ROOT/doc/Makefile.am
+
+SUBDIRS = \$(AUTODIRS)
+KDE_DOCS = $APP_NAME_LC
+KDE_LANG = en
+
diff --git a/kapptemplate/kpartapp/doc-app-Makefile.am b/kapptemplate/kpartapp/doc-app-Makefile.am
new file mode 100644
index 00000000..0356a93a
--- /dev/null
+++ b/kapptemplate/kpartapp/doc-app-Makefile.am
@@ -0,0 +1,9 @@
+echo "Creating $LOCATION_ROOT/doc/$APP_NAME_LC/Makefile.am...";
+$MKDIR $LOCATION_ROOT/doc/$APP_NAME_LC
+cat << EOF > $LOCATION_ROOT/doc/$APP_NAME_LC/Makefile.am
+
+# the SUBDIRS is filled automatically by am_edit. If files are
+# in this directory they are installed into the english dir
+KDE_LANG = en
+KDE_DOCS = $APP_NAME_LC
+SUBDIRS = \$(AUTODIRS)
diff --git a/kapptemplate/kpartapp/hi16-app-app.png b/kapptemplate/kpartapp/hi16-app-app.png
new file mode 100644
index 00000000..2f82a953
--- /dev/null
+++ b/kapptemplate/kpartapp/hi16-app-app.png
@@ -0,0 +1,2 @@
+echo "Creating $LOCATION_ROOT/$APP_NAME_LC/hi16-app-$APP_NAME_LC.png...";
+cp $SHARE_DIR/kapp/no-exe/hi16-app-app.png $LOCATION_ROOT/$APP_NAME_LC/hi16-app-$APP_NAME_LC.png
diff --git a/kapptemplate/kpartapp/hi32-app-app.png b/kapptemplate/kpartapp/hi32-app-app.png
new file mode 100644
index 00000000..767c9448
--- /dev/null
+++ b/kapptemplate/kpartapp/hi32-app-app.png
@@ -0,0 +1,2 @@
+echo "Creating $LOCATION_ROOT/$APP_NAME_LC/hi32-app-$APP_NAME_LC.png...";
+cp $SHARE_DIR/kapp/no-exe/hi32-app-app.png $LOCATION_ROOT/$APP_NAME_LC/hi32-app-$APP_NAME_LC.png
diff --git a/kapptemplate/kpartapp/hi48-app-app.png b/kapptemplate/kpartapp/hi48-app-app.png
new file mode 100644
index 00000000..08970c62
--- /dev/null
+++ b/kapptemplate/kpartapp/hi48-app-app.png
@@ -0,0 +1,2 @@
+echo "Creating $LOCATION_ROOT/$APP_NAME_LC/hi48-app-$APP_NAME_LC.png...";
+cp $SHARE_DIR/kapp/no-exe/hi48-app-app.png $LOCATION_ROOT/$APP_NAME_LC/hi48-app-$APP_NAME_LC.png
diff --git a/kapptemplate/kpartapp/index.docbook b/kapptemplate/kpartapp/index.docbook
new file mode 100644
index 00000000..86d1ee8d
--- /dev/null
+++ b/kapptemplate/kpartapp/index.docbook
@@ -0,0 +1,106 @@
+echo "Creating $LOCATION_ROOT/doc/$APP_NAME_LC/index.docbook...";
+echo "It is better to use template.docbook instead of this - please replace it"
+cat << EOF > $LOCATION_ROOT/doc/$APP_NAME_LC/index.docbook
+<?xml version="1.0" ?>
+<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1-Based Variant V1.0//EN" "dtd/kdex.dtd" [
+ <!ENTITY kappname "&$APP_NAME;">
+ <!ENTITY % addindex "IGNORE">
+ <!ENTITY % English "INCLUDE" > <!-- change language only here -->
+]>
+<!-- Important note: please use template.docbook instead of this file.
+ This is only the conversion of app.sgml into DocBook SGML.
+ template.docbook gives you more information on what you can and
+ should do. Thanks. -->
+
+<book lang="&language;">
+
+<bookinfo>
+<title>The $APP_NAME Handbook</title>
+<authorgroup>
+<author>
+<firstname></firstname>
+<surname>$AUTHOR</surname>
+<affiliation><address><email>$EMAIL</email></address></affiliation>
+</author>
+</authorgroup>
+<date>`date "+%Y-%m-%d"`</date>
+<releaseinfo>$APP_VERSION</releaseinfo>
+<abstract>
+<para>SHORT DESCRIPTION GOES HERE</para>
+</abstract>
+<keywordset>
+<keyword>KDE</keyword>
+<keyword>$APP_NAME</keyword>
+</keywordset>
+</bookinfo>
+
+ <chapter id="introduction">
+ <title>Introduction</title>
+
+ <sect1 id="features">
+ <title>Features</title>
+ <para></para>
+ </sect1>
+ </chapter>
+
+ <chapter id="installation">
+ <title>Installation</title>
+
+ <sect1 id="how-to-obtain-$APP_NAME">
+ <title>How to obtain $APP_NAME</title>
+ <para></para>
+ </sect1>
+
+ <sect1 id="requirements">
+ <title>Requirements</title>
+ <para></para>
+ </sect1>
+
+ <sect1 id="compilation-and-installation">
+ <title>Compilation and Installation</title>
+
+ <para>Compiling $APP_NAME is very easy. The following should do
+ it: <screen>
+<prompt>%</prompt> <userinput><command>./configure</command></userinput>
+<prompt>%</prompt> <userinput><command>make</command></userinput>
+<prompt>%</prompt> <userinput><command>make</command> install</userinput></screen>
+ </para>
+
+ <para>That should do it! Should you run into any problems,
+ please report them to the <ulink
+ url="mailto:$EMAIL">author</ulink></para>
+ </sect1>
+ </chapter>
+
+ <chapter id="using-$APP_NAME">
+ <title>Using $APP_NAME</title>
+ <para></para>
+ </chapter>
+
+ <chapter id="questionsanswersandtips">
+ <title>Questions, Answers, and Tips</title>
+
+ <qandaset id="faq">
+ <title>Frequently asked questions</title>
+ <qandaentry>
+ <question>
+ <para>Question 1</para>
+ </question>
+ <answer>
+ <para>The answer</para>
+ </answer>
+ </qandaentry>
+ </qandaset>
+
+ </chapter>
+ &documentation.index;
+</book>
+<!--
+Local Variables:
+mode: sgml
+sgml-omittag: nil
+sgml-shorttag: t
+sgml-general-insert-case: lower
+End:
+-->
+
diff --git a/kapptemplate/kpartapp/lo16-app-app.png b/kapptemplate/kpartapp/lo16-app-app.png
new file mode 100644
index 00000000..c495e509
--- /dev/null
+++ b/kapptemplate/kpartapp/lo16-app-app.png
@@ -0,0 +1,2 @@
+echo "Creating $LOCATION_ROOT/$APP_NAME_LC/lo16-app-$APP_NAME_LC.png...";
+cp $SHARE_DIR/kapp/no-exe/lo16-app-app.png $LOCATION_ROOT/$APP_NAME_LC/lo16-app-$APP_NAME_LC.png
diff --git a/kapptemplate/kpartapp/lo32-app-app.png b/kapptemplate/kpartapp/lo32-app-app.png
new file mode 100644
index 00000000..6faac157
--- /dev/null
+++ b/kapptemplate/kpartapp/lo32-app-app.png
@@ -0,0 +1,2 @@
+echo "Creating $LOCATION_ROOT/$APP_NAME_LC/lo32-app-$APP_NAME_LC.png...";
+cp $SHARE_DIR/kapp/no-exe/lo32-app-app.png $LOCATION_ROOT/$APP_NAME_LC/lo32-app-$APP_NAME_LC.png
diff --git a/kapptemplate/kpartapp/main.cpp b/kapptemplate/kpartapp/main.cpp
new file mode 100644
index 00000000..14bbf216
--- /dev/null
+++ b/kapptemplate/kpartapp/main.cpp
@@ -0,0 +1,55 @@
+echo "Creating $LOCATION_ROOT/${APP_NAME_LC}/main.cpp...";
+cat << EOF > $LOCATION_ROOT/${APP_NAME_LC}/main.cpp
+#include "${APP_NAME_LC}.h"
+#include <kapplication.h>
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <klocale.h>
+
+static const char description[] =
+ I18N_NOOP("A KDE KPart Application");
+
+static const char version[] = "v${APP_VERSION}";
+
+static KCmdLineOptions options[] =
+{
+ { "+[URL]", I18N_NOOP( "Document to open" ), 0 },
+ KCmdLineLastOption
+};
+
+int main(int argc, char **argv)
+{
+ KAboutData about("${APP_NAME_LC}", I18N_NOOP("${APP_NAME}"), version, description, KAboutData::License_GPL, "(C) 2004 ${AUTHOR}", 0, 0, "${EMAIL}");
+ about.addAuthor( "${AUTHOR}", 0, "${EMAIL}" );
+ KCmdLineArgs::init(argc, argv, &about);
+ KCmdLineArgs::addCmdLineOptions( options );
+ KApplication app;
+
+ // see if we are starting with session management
+ if (app.isRestored())
+ RESTORE(${APP_NAME})
+ else
+ {
+ // no session.. just start up normally
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
+ if ( args->count() == 0 )
+ {
+ ${APP_NAME} *widget = new ${APP_NAME};
+ widget->show();
+ }
+ else
+ {
+ int i = 0;
+ for (; i < args->count(); i++ )
+ {
+ ${APP_NAME} *widget = new ${APP_NAME};
+ widget->show();
+ widget->load( args->url( i ) );
+ }
+ }
+ args->clear();
+ }
+
+ return app.exec();
+}
diff --git a/kapptemplate/kpartapp/no-exe/Makefile.am b/kapptemplate/kpartapp/no-exe/Makefile.am
new file mode 100644
index 00000000..7e993c96
--- /dev/null
+++ b/kapptemplate/kpartapp/no-exe/Makefile.am
@@ -0,0 +1,3 @@
+kpartappdir = $(kde_datadir)/kapptemplate/kpartapp/no-exe
+kpartapp_DATA = hi32-app-app.png lo16-app-app.png hi16-app-app.png \
+ hi48-app-app.png lo32-app-app.png
diff --git a/kapptemplate/kpartapp/no-exe/hi16-app-app.png b/kapptemplate/kpartapp/no-exe/hi16-app-app.png
new file mode 100644
index 00000000..43eab761
--- /dev/null
+++ b/kapptemplate/kpartapp/no-exe/hi16-app-app.png
Binary files differ
diff --git a/kapptemplate/kpartapp/no-exe/hi32-app-app.png b/kapptemplate/kpartapp/no-exe/hi32-app-app.png
new file mode 100644
index 00000000..ce9df987
--- /dev/null
+++ b/kapptemplate/kpartapp/no-exe/hi32-app-app.png
Binary files differ
diff --git a/kapptemplate/kpartapp/no-exe/hi48-app-app.png b/kapptemplate/kpartapp/no-exe/hi48-app-app.png
new file mode 100644
index 00000000..6464fb39
--- /dev/null
+++ b/kapptemplate/kpartapp/no-exe/hi48-app-app.png
Binary files differ
diff --git a/kapptemplate/kpartapp/no-exe/lo16-app-app.png b/kapptemplate/kpartapp/no-exe/lo16-app-app.png
new file mode 100644
index 00000000..e21db293
--- /dev/null
+++ b/kapptemplate/kpartapp/no-exe/lo16-app-app.png
Binary files differ
diff --git a/kapptemplate/kpartapp/no-exe/lo32-app-app.png b/kapptemplate/kpartapp/no-exe/lo32-app-app.png
new file mode 100644
index 00000000..4ecd9ce3
--- /dev/null
+++ b/kapptemplate/kpartapp/no-exe/lo32-app-app.png
Binary files differ