summaryrefslogtreecommitdiffstats
path: root/kapptemplate/kapp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbd9e6617827818fd043452c08c606f07b78014a0 (patch)
tree425bb4c3168f9c02f10150f235d2cb998dcc6108 /kapptemplate/kapp
downloadtdesdk-bd9e6617827818fd043452c08c606f07b78014a0.tar.gz
tdesdk-bd9e6617827818fd043452c08c606f07b78014a0.zip
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/kdesdk@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kapptemplate/kapp')
-rw-r--r--kapptemplate/kapp/Makefile.am9
-rw-r--r--kapptemplate/kapp/app-Makefile.am47
-rw-r--r--kapptemplate/kapp/app-configure.in.in14
-rw-r--r--kapptemplate/kapp/app-desktop11
-rw-r--r--kapptemplate/kapp/app.cpp263
-rw-r--r--kapptemplate/kapp/app.h90
-rw-r--r--kapptemplate/kapp/app_client.cpp26
-rw-r--r--kapptemplate/kapp/appiface.h17
-rw-r--r--kapptemplate/kapp/apppref.cpp42
-rw-r--r--kapptemplate/kapp/apppref.h37
-rw-r--r--kapptemplate/kapp/appui.rc10
-rw-r--r--kapptemplate/kapp/appview.cpp106
-rw-r--r--kapptemplate/kapp/appview.h77
-rw-r--r--kapptemplate/kapp/doc-Makefile.am8
-rw-r--r--kapptemplate/kapp/doc-app-Makefile.am9
-rw-r--r--kapptemplate/kapp/hi16-app-app.png2
-rw-r--r--kapptemplate/kapp/hi32-app-app.png2
-rw-r--r--kapptemplate/kapp/hi48-app-app.png2
-rw-r--r--kapptemplate/kapp/index.docbook106
-rw-r--r--kapptemplate/kapp/lo16-app-app.png2
-rw-r--r--kapptemplate/kapp/lo32-app-app.png2
-rw-r--r--kapptemplate/kapp/main.cpp58
-rw-r--r--kapptemplate/kapp/no-exe/Makefile.am3
-rw-r--r--kapptemplate/kapp/no-exe/hi16-app-app.pngbin0 -> 845 bytes
-rw-r--r--kapptemplate/kapp/no-exe/hi32-app-app.pngbin0 -> 2595 bytes
-rw-r--r--kapptemplate/kapp/no-exe/hi48-app-app.pngbin0 -> 4954 bytes
-rw-r--r--kapptemplate/kapp/no-exe/lo16-app-app.pngbin0 -> 628 bytes
-rw-r--r--kapptemplate/kapp/no-exe/lo32-app-app.pngbin0 -> 1335 bytes
-rw-r--r--kapptemplate/kapp/pics-Makefile.am8
29 files changed, 951 insertions, 0 deletions
diff --git a/kapptemplate/kapp/Makefile.am b/kapptemplate/kapp/Makefile.am
new file mode 100644
index 00000000..6d1a196c
--- /dev/null
+++ b/kapptemplate/kapp/Makefile.am
@@ -0,0 +1,9 @@
+SUBDIRS=no-exe
+
+kappdir = $(kde_datadir)/kapptemplate/kapp
+kapp_DATA = app_client.cpp appview.h index.docbook \
+ app-Makefile.am appiface.h doc-Makefile.am lo16-app-app.png \
+ app-configure.in.in apppref.cpp doc-app-Makefile.am \
+ lo32-app-app.png app.cpp apppref.h hi16-app-app.png main.cpp \
+ app-desktop appui.rc hi32-app-app.png app.h appview.cpp \
+ hi48-app-app.png pics-Makefile.am
diff --git a/kapptemplate/kapp/app-Makefile.am b/kapptemplate/kapp/app-Makefile.am
new file mode 100644
index 00000000..9ed82a08
--- /dev/null
+++ b/kapptemplate/kapp/app-Makefile.am
@@ -0,0 +1,47 @@
+echo "Creating $LOCATION_ROOT/$APP_NAME_LC/Makefile.am...";
+cat << EOF > $LOCATION_ROOT/$APP_NAME_LC/Makefile.am
+## Makefile.am for $APP_NAME_LC
+
+# this has all of the subdirectories that make will recurse into. if
+# there are none, comment this out
+SUBDIRS = . pics
+
+# 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 ${APP_NAME_LC}_client
+
+# set the include path for X, qt and KDE
+INCLUDES = \$(all_includes)
+
+# the library search path.
+${APP_NAME_LC}_LDFLAGS = \$(KDE_RPATH) \$(all_libraries)
+
+# the libraries to link against.
+${APP_NAME_LC}_LDADD = \$(LIB_KFILE) -lkdeprint
+
+# which sources should be compiled for $APP_NAME_LC
+${APP_NAME_LC}_SOURCES = main.cpp ${APP_NAME_LC}.cpp ${APP_NAME_LC}view.cpp \\
+ ${APP_NAME_LC}pref.cpp ${APP_NAME_LC}iface.skel
+
+# these are the headers for your project
+noinst_HEADERS = ${APP_NAME_LC}.h ${APP_NAME_LC}view.h ${APP_NAME_LC}pref.h
+
+# client stuff
+${APP_NAME_LC}_client_LDFLAGS = \$(KDE_RPATH) \$(all_libraries)
+${APP_NAME_LC}_client_LDADD = \$(LIB_KDECORE)
+${APP_NAME_LC}_client_SOURCES = ${APP_NAME_LC}_client.cpp
+
+# 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 is where the kdelnk file will go
+xdg_apps_data = ${APP_NAME_LC}.desktop
+
+# this is where the XML-GUI resource file goes
+rcdir = \$(kde_datadir)/${APP_NAME_LC}
+rc_DATA = ${APP_NAME_LC}ui.rc
diff --git a/kapptemplate/kapp/app-configure.in.in b/kapptemplate/kapp/app-configure.in.in
new file mode 100644
index 00000000..4d050a09
--- /dev/null
+++ b/kapptemplate/kapp/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/kapp/app-desktop b/kapptemplate/kapp/app-desktop
new file mode 100644
index 00000000..118e0211
--- /dev/null
+++ b/kapptemplate/kapp/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 Application
+Terminal=0
diff --git a/kapptemplate/kapp/app.cpp b/kapptemplate/kapp/app.cpp
new file mode 100644
index 00000000..58ed3415
--- /dev/null
+++ b/kapptemplate/kapp/app.cpp
@@ -0,0 +1,263 @@
+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}pref.h"
+
+#include <kprinter.h>
+#include <qpainter.h>
+#include <qpaintdevicemetrics.h>
+
+#include <kdeversion.h>
+#include <kglobal.h>
+#include <klocale.h>
+#include <kiconloader.h>
+#include <kmenubar.h>
+#include <kstatusbar.h>
+#include <kaccel.h>
+#include <kio/netaccess.h>
+#include <kfiledialog.h>
+#include <kconfig.h>
+#include <kurl.h>
+#include <kurldrag.h>
+#include <kurlrequesterdlg.h>
+
+#include <kedittoolbar.h>
+
+#include <kstdaccel.h>
+#include <kaction.h>
+#include <kstdaction.h>
+
+${APP_NAME}::${APP_NAME}()
+ : KMainWindow( 0, "${APP_NAME}" ),
+ m_view(new ${APP_NAME}View(this)),
+ m_printer(0)
+{
+ // accept dnd
+ setAcceptDrops(true);
+
+ // tell the KMainWindow that this is indeed the main widget
+ setCentralWidget(m_view);
+
+ // then, setup our actions
+ setupActions();
+
+ // Add typical actions and save size/toolbars/statusbar
+ setupGUI();
+
+ // allow the view to change the statusbar and caption
+ connect(m_view, SIGNAL(signalChangeStatusbar(const QString&)),
+ this, SLOT(changeStatusbar(const QString&)));
+ connect(m_view, SIGNAL(signalChangeCaption(const QString&)),
+ this, SLOT(changeCaption(const QString&)));
+
+}
+
+${APP_NAME}::~${APP_NAME}()
+{
+ delete m_printer;
+}
+
+void ${APP_NAME}::load(const KURL& url)
+{
+ QString target;
+ // the below code is what you should normally do. in this
+ // example case, we want the url to our own. you probably
+ // want to use this code instead for your app
+
+ #if 0
+ // download the contents
+ if (KIO::NetAccess::download(url, target))
+ {
+ // set our caption
+ setCaption(url.prettyURL());
+
+ // load in the file (target is always local)
+ loadFile(target);
+
+ // and remove the temp file
+ KIO::NetAccess::removeTempFile(target);
+ }
+ #endif
+
+ setCaption(url.prettyURL());
+ m_view->openURL(url);
+}
+
+void ${APP_NAME}::setupActions()
+{
+ KStdAction::openNew(this, SLOT(fileNew()), actionCollection());
+ KStdAction::open(this, SLOT(fileOpen()), actionCollection());
+ KStdAction::save(this, SLOT(fileSave()), actionCollection());
+ KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection());
+ KStdAction::print(this, SLOT(filePrint()), actionCollection());
+ KStdAction::quit(kapp, SLOT(quit()), actionCollection());
+
+ KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection());
+
+ // this doesn't do anything useful. it's just here to illustrate
+ // how to insert a custom menu and menu item
+ KAction *custom = new KAction(i18n("Cus&tom Menuitem"), 0,
+ this, SLOT(optionsPreferences()),
+ actionCollection(), "custom_action");
+}
+
+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
+
+ if (!m_view->currentURL().isNull()) {
+#if KDE_IS_VERSION(3,1,3)
+ config->writePathEntry("lastURL", m_view->currentURL());
+#else
+ config->writeEntry("lastURL", m_view->currentURL());
+#endif
+ }
+}
+
+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'
+
+ QString url = config->readPathEntry("lastURL");
+
+ if (!url.isEmpty())
+ m_view->openURL(KURL::fromPathOrURL(url));
+}
+
+void ${APP_NAME}::dragEnterEvent(QDragEnterEvent *event)
+{
+ // accept uri drops only
+ event->accept(KURLDrag::canDecode(event));
+}
+
+void ${APP_NAME}::dropEvent(QDropEvent *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
+ KURL::List urls;
+
+ // see if we can decode a URI.. if not, just ignore it
+ if (KURLDrag::decode(event, urls) && !urls.isEmpty())
+ {
+ // okay, we have a URI.. process it
+ const KURL &url = urls.first();
+
+ // load in the file
+ load(url);
+ }
+}
+
+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
+
+ // create a new window
+ (new ${APP_NAME})->show();
+}
+
+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 = KURLRequesterDlg::getURL(QString::null, this, i18n("Open Location") );
+ if (!url.isEmpty())
+ m_view->openURL(url);
+}
+
+void ${APP_NAME}::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
+}
+
+void ${APP_NAME}::fileSaveAs()
+{
+ // this slot is called whenever the File->Save As menu is selected,
+ KURL file_url = KFileDialog::getSaveURL();
+ if (!file_url.isEmpty() && file_url.isValid())
+ {
+ // save your info, here
+ }
+}
+
+void ${APP_NAME}::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 (!m_printer) m_printer = new KPrinter;
+ if (m_printer->setup(this))
+ {
+ // setup the printer. with Qt, you always "print" to a
+ // QPainter.. whether the output medium is a pixmap, a screen,
+ // or paper
+ QPainter p;
+ p.begin(m_printer);
+
+ // we let our view do the actual printing
+ QPaintDeviceMetrics metrics(m_printer);
+ m_view->print(&p, metrics.height(), metrics.width());
+
+ // and send the result to the printer
+ p.end();
+ }
+}
+
+void ${APP_NAME}::optionsConfigureToolbars()
+{
+ // use the standard toolbar editor
+ saveMainWindowSettings( KGlobal::config(), autoSaveGroup() );
+ KEditToolbar dlg(actionCollection());
+ connect(&dlg, SIGNAL(newToolbarConfig()), this, SLOT(newToolbarConfig()));
+ dlg.exec();
+}
+
+void ${APP_NAME}::newToolbarConfig()
+{
+ // this slot is called when user clicks "Ok" or "Apply" in the toolbar editor.
+ // recreate our GUI, and re-apply the settings (e.g. "text under icons", etc.)
+ createGUI();
+ applyMainWindowSettings( KGlobal::config(), autoSaveGroup() );
+}
+
+void ${APP_NAME}::optionsPreferences()
+{
+ // popup some sort of preference dialog, here
+ ${APP_NAME}Preferences dlg;
+ if (dlg.exec())
+ {
+ // redo your settings
+ }
+}
+
+void ${APP_NAME}::changeStatusbar(const QString& text)
+{
+ // display the text on the statusbar
+ statusBar()->message(text);
+}
+
+void ${APP_NAME}::changeCaption(const QString& text)
+{
+ // display the text on the caption
+ setCaption(text);
+}
+
+#include "${APP_NAME_LC}.moc"
diff --git a/kapptemplate/kapp/app.h b/kapptemplate/kapp/app.h
new file mode 100644
index 00000000..7f7b0d39
--- /dev/null
+++ b/kapptemplate/kapp/app.h
@@ -0,0 +1,90 @@
+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 <kmainwindow.h>
+
+#include "${APP_NAME_LC}view.h"
+
+class KPrinter;
+class KURL;
+
+/**
+ * This class serves as the main window for ${APP_NAME}. It handles the
+ * menus, toolbars, and status bars.
+ *
+ * @short Main window class
+ * @author $AUTHOR <$EMAIL>
+ * @version $APP_VERSION
+ */
+class ${APP_NAME} : public KMainWindow
+{
+ 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:
+ /**
+ * Overridden virtuals for Qt drag 'n drop (XDND)
+ */
+ virtual void dragEnterEvent(QDragEnterEvent *event);
+ virtual void dropEvent(QDropEvent *event);
+
+protected:
+ /**
+ * This function is called when it is time for the app to save its
+ * properties for session management purposes.
+ */
+ void saveProperties(KConfig *);
+
+ /**
+ * This function 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 fileSave();
+ void fileSaveAs();
+ void filePrint();
+ void optionsConfigureToolbars();
+ void optionsPreferences();
+ void newToolbarConfig();
+
+ void changeStatusbar(const QString& text);
+ void changeCaption(const QString& text);
+
+private:
+ void setupAccel();
+ void setupActions();
+
+private:
+ ${APP_NAME}View *m_view;
+
+ KPrinter *m_printer;
+};
+
+#endif // ${APP_NAME_UC}_H
diff --git a/kapptemplate/kapp/app_client.cpp b/kapptemplate/kapp/app_client.cpp
new file mode 100644
index 00000000..cd5e065d
--- /dev/null
+++ b/kapptemplate/kapp/app_client.cpp
@@ -0,0 +1,26 @@
+echo "Creating $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}_client.cpp...";
+cat << EOF > $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}_client.cpp
+#include <kapplication.h>
+#include <dcopclient.h>
+#include <qdatastream.h>
+#include <qstring.h>
+
+int main(int argc, char **argv)
+{
+ KApplication app(argc, argv, "${APP_NAME_LC}_client", false);
+
+ // get our DCOP client and attach so that we may use it
+ DCOPClient *client = app.dcopClient();
+ client->attach();
+
+ // do a 'send' for now
+ QByteArray data;
+ QDataStream ds(data, IO_WriteOnly);
+ if (argc > 1)
+ ds << QString(argv[1]);
+ else
+ ds << QString("http://www.kde.org");
+ client->send("${APP_NAME_LC}", "${APP_NAME}Iface", "openURL(QString)", data);
+
+ return app.exec();
+}
diff --git a/kapptemplate/kapp/appiface.h b/kapptemplate/kapp/appiface.h
new file mode 100644
index 00000000..2601df94
--- /dev/null
+++ b/kapptemplate/kapp/appiface.h
@@ -0,0 +1,17 @@
+echo "Creating $LOCATION_ROOT/$APP_NAME_LC/${APP_NAME_LC}iface.h...";
+cat << EOF > $LOCATION_ROOT/$APP_NAME_LC/${APP_NAME_LC}iface.h
+#ifndef ${APP_NAME_UC}IFACE_H
+#define ${APP_NAME_UC}IFACE_H
+
+#include <dcopobject.h>
+
+class ${APP_NAME}Iface : virtual public DCOPObject
+{
+ K_DCOP
+public:
+
+k_dcop:
+ virtual void openURL(QString url) = 0;
+};
+
+#endif // ${APP_NAME_UC}IFACE_H
diff --git a/kapptemplate/kapp/apppref.cpp b/kapptemplate/kapp/apppref.cpp
new file mode 100644
index 00000000..b025924a
--- /dev/null
+++ b/kapptemplate/kapp/apppref.cpp
@@ -0,0 +1,42 @@
+echo "Creating $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}pref.cpp...";
+cat << EOF > $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}pref.cpp
+#include "${APP_NAME_LC}pref.h"
+
+#include <klocale.h>
+
+#include <qlayout.h>
+#include <qlabel.h>
+
+${APP_NAME}Preferences::${APP_NAME}Preferences()
+ : KDialogBase(TreeList, "${APP_NAME} 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)
+ QFrame *frame;
+ frame = addPage(i18n("First Page"), i18n("Page One Options"));
+ m_pageOne = new ${APP_NAME}PrefPageOne(frame);
+
+ frame = addPage(i18n("Second Page"), i18n("Page Two Options"));
+ m_pageTwo = new ${APP_NAME}PrefPageTwo(frame);
+}
+
+${APP_NAME}PrefPageOne::${APP_NAME}PrefPageOne(QWidget *parent)
+ : QFrame(parent)
+{
+ QHBoxLayout *layout = new QHBoxLayout(this);
+ layout->setAutoAdd(true);
+
+ new QLabel("Add something here", this);
+}
+
+${APP_NAME}PrefPageTwo::${APP_NAME}PrefPageTwo(QWidget *parent)
+ : QFrame(parent)
+{
+ QHBoxLayout *layout = new QHBoxLayout(this);
+ layout->setAutoAdd(true);
+
+ new QLabel("Add something here", this);
+}
+#include "${APP_NAME_LC}pref.moc"
diff --git a/kapptemplate/kapp/apppref.h b/kapptemplate/kapp/apppref.h
new file mode 100644
index 00000000..97371936
--- /dev/null
+++ b/kapptemplate/kapp/apppref.h
@@ -0,0 +1,37 @@
+echo "Creating $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}pref.h...";
+cat << EOF > $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}pref.h
+#ifndef ${APP_NAME_UC}PREF_H
+#define ${APP_NAME_UC}PREF_H
+
+#include <kdialogbase.h>
+#include <qframe.h>
+
+class ${APP_NAME}PrefPageOne;
+class ${APP_NAME}PrefPageTwo;
+
+class ${APP_NAME}Preferences : public KDialogBase
+{
+ Q_OBJECT
+public:
+ ${APP_NAME}Preferences();
+
+private:
+ ${APP_NAME}PrefPageOne *m_pageOne;
+ ${APP_NAME}PrefPageTwo *m_pageTwo;
+};
+
+class ${APP_NAME}PrefPageOne : public QFrame
+{
+ Q_OBJECT
+public:
+ ${APP_NAME}PrefPageOne(QWidget *parent = 0);
+};
+
+class ${APP_NAME}PrefPageTwo : public QFrame
+{
+ Q_OBJECT
+public:
+ ${APP_NAME}PrefPageTwo(QWidget *parent = 0);
+};
+
+#endif // ${APP_NAME_UC}PREF_H
diff --git a/kapptemplate/kapp/appui.rc b/kapptemplate/kapp/appui.rc
new file mode 100644
index 00000000..f8914570
--- /dev/null
+++ b/kapptemplate/kapp/appui.rc
@@ -0,0 +1,10 @@
+echo "Creating $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}ui.rc...";
+cat << EOF > $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}ui.rc
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="${APP_NAME_LC}" version="1">
+<MenuBar>
+ <Menu name="custom"><text>C&amp;ustom</text>
+ <Action name="custom_action" />
+ </Menu>
+</MenuBar>
+</kpartgui>
diff --git a/kapptemplate/kapp/appview.cpp b/kapptemplate/kapp/appview.cpp
new file mode 100644
index 00000000..575e8a5d
--- /dev/null
+++ b/kapptemplate/kapp/appview.cpp
@@ -0,0 +1,106 @@
+echo "Creating $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}view.cpp...";
+cat << EOF > $LOCATION_ROOT/${APP_NAME_LC}/${APP_NAME_LC}view.cpp
+#include "${APP_NAME_LC}view.h"
+
+#include <qpainter.h>
+#include <qlayout.h>
+
+#include <kurl.h>
+
+#include <ktrader.h>
+#include <klibloader.h>
+#include <kmessagebox.h>
+#include <krun.h>
+
+${APP_NAME}View::${APP_NAME}View(QWidget *parent)
+ : QWidget(parent),
+ DCOPObject("${APP_NAME}Iface")
+{
+ // setup our layout manager to automatically add our widgets
+ QHBoxLayout *top_layout = new QHBoxLayout(this);
+ 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.
+ KTrader::OfferList offers = KTrader::self()->query("text/html", "'KParts/ReadOnlyPart' in ServiceTypes");
+
+ KLibFactory *factory = 0;
+ // in theory, we only care about the first one.. but let's try all
+ // offers just in case the first can't be loaded for some reason
+ KTrader::OfferList::Iterator it(offers.begin());
+ for( ; it != offers.end(); ++it)
+ {
+ KService::Ptr ptr = (*it);
+
+ // 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 = KLibLoader::self()->factory( ptr->library() );
+ if (factory)
+ {
+ m_html = static_cast<KParts::ReadOnlyPart *>(factory->create(this, ptr->name(), "KParts::ReadOnlyPart"));
+ break;
+ }
+ }
+
+ // if our factory is invalid, then we never found our component
+ // and we might as well just exit now
+ if (!factory)
+ {
+ KMessageBox::error(this, "Could not find a suitable HTML component");
+ return;
+ }
+
+ connect(m_html, SIGNAL(setWindowCaption(const QString&)),
+ this, SLOT(slotSetTitle(const QString&)));
+ connect(m_html, SIGNAL(setStatusBarText(const QString&)),
+ this, SLOT(slotOnURL(const QString&)));
+
+}
+
+${APP_NAME}View::~${APP_NAME}View()
+{
+}
+
+void ${APP_NAME}View::print(QPainter *p, int height, int width)
+{
+ // do the actual printing, here
+ // p->drawText(etc..)
+}
+
+QString ${APP_NAME}View::currentURL()
+{
+ return m_html->url().url();
+}
+
+void ${APP_NAME}View::openURL(QString url)
+{
+ openURL(KURL(url));
+}
+
+void ${APP_NAME}View::openURL(const KURL& url)
+{
+ m_html->openURL(url);
+}
+
+void ${APP_NAME}View::slotOnURL(const QString& url)
+{
+ emit signalChangeStatusbar(url);
+}
+
+void ${APP_NAME}View::slotSetTitle(const QString& title)
+{
+ emit signalChangeCaption(title);
+}
+#include "${APP_NAME_LC}view.moc"
diff --git a/kapptemplate/kapp/appview.h b/kapptemplate/kapp/appview.h
new file mode 100644
index 00000000..881b979c
--- /dev/null
+++ b/kapptemplate/kapp/appview.h
@@ -0,0 +1,77 @@
+echo "Creating $LOCATION_ROOT/$APP_NAME_LC/${APP_NAME_LC}view.h...";
+cat << EOF > $LOCATION_ROOT/$APP_NAME_LC/${APP_NAME_LC}view.h
+#ifndef ${APP_NAME_UC}VIEW_H
+#define ${APP_NAME_UC}VIEW_H
+
+#include <qwidget.h>
+#include <kparts/part.h>
+#include <${APP_NAME_LC}iface.h>
+
+class QPainter;
+class KURL;
+
+/**
+ * This is the main view class for ${APP_NAME}. Most of the non-menu,
+ * non-toolbar, and non-statusbar (e.g., non frame) GUI code should go
+ * here.
+ *
+ * This ${APP_NAME_LC} uses an HTML component as an example.
+ *
+ * @short Main view
+ * @author $AUTHOR <$EMAIL>
+ * @version $APP_VERSION
+ */
+class ${APP_NAME}View : public QWidget, public ${APP_NAME}Iface
+{
+ Q_OBJECT
+public:
+ /**
+ * Default constructor
+ */
+ ${APP_NAME}View(QWidget *parent);
+
+ /**
+ * Destructor
+ */
+ virtual ~${APP_NAME}View();
+
+ /**
+ * Random 'get' function
+ */
+ QString currentURL();
+
+ /**
+ * Random 'set' function accessed by DCOP
+ */
+ virtual void openURL(QString url);
+
+ /**
+ * Random 'set' function
+ */
+ virtual void openURL(const KURL& url);
+
+ /**
+ * Print this view to any medium -- paper or not
+ */
+ void print(QPainter *, int height, int width);
+
+signals:
+ /**
+ * Use this signal to change the content of the statusbar
+ */
+ void signalChangeStatusbar(const QString& text);
+
+ /**
+ * Use this signal to change the content of the caption
+ */
+ void signalChangeCaption(const QString& text);
+
+private slots:
+ void slotOnURL(const QString& url);
+ void slotSetTitle(const QString& title);
+
+private:
+ KParts::ReadOnlyPart *m_html;
+};
+
+#endif // ${APP_NAME_UC}VIEW_H
diff --git a/kapptemplate/kapp/doc-Makefile.am b/kapptemplate/kapp/doc-Makefile.am
new file mode 100644
index 00000000..02611d03
--- /dev/null
+++ b/kapptemplate/kapp/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/kapp/doc-app-Makefile.am b/kapptemplate/kapp/doc-app-Makefile.am
new file mode 100644
index 00000000..0356a93a
--- /dev/null
+++ b/kapptemplate/kapp/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/kapp/hi16-app-app.png b/kapptemplate/kapp/hi16-app-app.png
new file mode 100644
index 00000000..2f82a953
--- /dev/null
+++ b/kapptemplate/kapp/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/kapp/hi32-app-app.png b/kapptemplate/kapp/hi32-app-app.png
new file mode 100644
index 00000000..767c9448
--- /dev/null
+++ b/kapptemplate/kapp/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/kapp/hi48-app-app.png b/kapptemplate/kapp/hi48-app-app.png
new file mode 100644
index 00000000..08970c62
--- /dev/null
+++ b/kapptemplate/kapp/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/kapp/index.docbook b/kapptemplate/kapp/index.docbook
new file mode 100644
index 00000000..5f8071ff
--- /dev/null
+++ b/kapptemplate/kapp/index.docbook
@@ -0,0 +1,106 @@
+echo "Creating $LOCATION_ROOT/doc/$APP_NAME_LC/index.docbook...";
+$MKDIR $LOCATION_ROOT/doc/$APP_NAME_LC
+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.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
+ <!ENTITY $APP_NAME_LC "$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_LC; 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_LC</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_LC">
+ <title>How to obtain &$APP_NAME_LC;</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_LC; 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_LC">
+ <title>Using &$APP_NAME_LC;</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/kapp/lo16-app-app.png b/kapptemplate/kapp/lo16-app-app.png
new file mode 100644
index 00000000..c495e509
--- /dev/null
+++ b/kapptemplate/kapp/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/kapp/lo32-app-app.png b/kapptemplate/kapp/lo32-app-app.png
new file mode 100644
index 00000000..6faac157
--- /dev/null
+++ b/kapptemplate/kapp/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/kapp/main.cpp b/kapptemplate/kapp/main.cpp
new file mode 100644
index 00000000..40118215
--- /dev/null
+++ b/kapptemplate/kapp/main.cpp
@@ -0,0 +1,58 @@
+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 <dcopclient.h>
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <klocale.h>
+
+static const char description[] =
+ I18N_NOOP("A KDE 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;
+
+ // register ourselves as a dcop client
+ app.dcopClient()->registerAs(app.name(), false);
+
+ // 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/kapp/no-exe/Makefile.am b/kapptemplate/kapp/no-exe/Makefile.am
new file mode 100644
index 00000000..a377e92a
--- /dev/null
+++ b/kapptemplate/kapp/no-exe/Makefile.am
@@ -0,0 +1,3 @@
+kappdir = $(kde_datadir)/kapptemplate/kapp/no-exe
+kapp_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/kapp/no-exe/hi16-app-app.png b/kapptemplate/kapp/no-exe/hi16-app-app.png
new file mode 100644
index 00000000..43eab761
--- /dev/null
+++ b/kapptemplate/kapp/no-exe/hi16-app-app.png
Binary files differ
diff --git a/kapptemplate/kapp/no-exe/hi32-app-app.png b/kapptemplate/kapp/no-exe/hi32-app-app.png
new file mode 100644
index 00000000..ce9df987
--- /dev/null
+++ b/kapptemplate/kapp/no-exe/hi32-app-app.png
Binary files differ
diff --git a/kapptemplate/kapp/no-exe/hi48-app-app.png b/kapptemplate/kapp/no-exe/hi48-app-app.png
new file mode 100644
index 00000000..6464fb39
--- /dev/null
+++ b/kapptemplate/kapp/no-exe/hi48-app-app.png
Binary files differ
diff --git a/kapptemplate/kapp/no-exe/lo16-app-app.png b/kapptemplate/kapp/no-exe/lo16-app-app.png
new file mode 100644
index 00000000..e21db293
--- /dev/null
+++ b/kapptemplate/kapp/no-exe/lo16-app-app.png
Binary files differ
diff --git a/kapptemplate/kapp/no-exe/lo32-app-app.png b/kapptemplate/kapp/no-exe/lo32-app-app.png
new file mode 100644
index 00000000..4ecd9ce3
--- /dev/null
+++ b/kapptemplate/kapp/no-exe/lo32-app-app.png
Binary files differ
diff --git a/kapptemplate/kapp/pics-Makefile.am b/kapptemplate/kapp/pics-Makefile.am
new file mode 100644
index 00000000..93c2257e
--- /dev/null
+++ b/kapptemplate/kapp/pics-Makefile.am
@@ -0,0 +1,8 @@
+echo "Creating $LOCATION_ROOT/$APP_NAME_LC/pics/Makefile.am...";
+$MKDIR $LOCATION_ROOT/$APP_NAME_LC/pics
+cat << EOF > $LOCATION_ROOT/$APP_NAME_LC/pics/Makefile.am
+# Add all of your pixmaps here
+#picsdata_DATA =
+
+# This is where it will all be installed
+#picsdatadir = \$(kde_datadir)/$APP_NAME_LC/pics