summaryrefslogtreecommitdiff
path: root/examples
Side-by-side diff
Diffstat (limited to 'examples') (more/less context) (ignore whitespace changes)
-rw-r--r--examples/application/Example.pngbin0 -> 1262 bytes
-rw-r--r--examples/application/README2
-rw-r--r--examples/application/example.control11
-rw-r--r--examples/application/example.cpp28
-rw-r--r--examples/application/example.desktop6
-rw-r--r--examples/application/example.h17
-rw-r--r--examples/application/example.html15
-rw-r--r--examples/application/example.pro10
-rw-r--r--examples/application/examplebase.ui55
-rw-r--r--examples/application/index.html23
-rw-r--r--examples/application/main.cpp12
-rw-r--r--examples/qpepim-addressbook/abexample.desktop6
-rw-r--r--examples/qpepim-addressbook/abexample.pngbin0 -> 1262 bytes
-rw-r--r--examples/qpepim-addressbook/addressbookdumper.cpp65
-rw-r--r--examples/qpepim-addressbook/addressbookdumper.h39
-rw-r--r--examples/qpepim-addressbook/main.cpp47
-rw-r--r--examples/qpepim-addressbook/qpepim-abexample.control9
-rw-r--r--examples/qpepim-addressbook/qpepim-addressbook.pro8
18 files changed, 353 insertions, 0 deletions
diff --git a/examples/application/Example.png b/examples/application/Example.png
new file mode 100644
index 0000000..f63d0bc
--- a/dev/null
+++ b/examples/application/Example.png
Binary files differ
diff --git a/examples/application/README b/examples/application/README
new file mode 100644
index 0000000..63986f4
--- a/dev/null
+++ b/examples/application/README
@@ -0,0 +1,2 @@
+See /opt/Qtopia/doc/index.html for help.
+See doc.trolltech.com for more recent documentation updates.
diff --git a/examples/application/example.control b/examples/application/example.control
new file mode 100644
index 0000000..e79c6f6
--- a/dev/null
+++ b/examples/application/example.control
@@ -0,0 +1,11 @@
+Files: bin/example apps/Applications/example.desktop pics/Example.png help/html/example.html
+Priority: optional
+Section: qpe/applications
+Maintainer: Your Name <you@your.domain.com>
+Architecture: arm
+Version: 1.0.0
+Depends: qpe-base ($QPE_VERSION)
+License: Public Domain
+Description: Example program
+ An example program for the Qtopia environment.
+ Does nothing interesting.
diff --git a/examples/application/example.cpp b/examples/application/example.cpp
new file mode 100644
index 0000000..1e0bbe9
--- a/dev/null
+++ b/examples/application/example.cpp
@@ -0,0 +1,28 @@
+#include "example.h"
+#include <qpushbutton.h>
+
+/*
+ * Constructs a Example which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ */
+Example::Example( QWidget* parent, const char* name, WFlags fl )
+ : ExampleBase( parent, name, fl )
+{
+ connect(quit, SIGNAL(clicked()), this, SLOT(goodBye()));
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+Example::~Example()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ * A simple slot... not very interesting.
+ */
+void Example::goodBye()
+{
+ close();
+}
diff --git a/examples/application/example.desktop b/examples/application/example.desktop
new file mode 100644
index 0000000..f1e6f06
--- a/dev/null
+++ b/examples/application/example.desktop
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Comment=An Example Program
+Exec=example
+Icon=Example
+Type=Application
+Name=Example
diff --git a/examples/application/example.h b/examples/application/example.h
new file mode 100644
index 0000000..24c58c0
--- a/dev/null
+++ b/examples/application/example.h
@@ -0,0 +1,17 @@
+#ifndef EXAMPLE_H
+#define EXAMPLE_H
+#include "examplebase.h"
+
+class Example : public ExampleBase
+{
+ Q_OBJECT
+
+public:
+ Example( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~Example();
+
+private slots:
+ void goodBye();
+};
+
+#endif // EXAMPLE_H
diff --git a/examples/application/example.html b/examples/application/example.html
new file mode 100644
index 0000000..9163573
--- a/dev/null
+++ b/examples/application/example.html
@@ -0,0 +1,15 @@
+<html>
+<h1>Example</h1>
+
+<p>This is the help for the Example program.
+
+<p>To user this application:
+
+<ol>
+ <li>Press the <img width=12 height=12 src=Example.png> icon in the Qtopia launcher.
+ <li>Read the label.
+ <li>Press the button.
+ <li>Read the source code provided.
+</ol>
+
+Now you know how to make a Qtopia application!
diff --git a/examples/application/example.pro b/examples/application/example.pro
new file mode 100644
index 0000000..2d89311
--- a/dev/null
+++ b/examples/application/example.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+#CONFIG = qt warn_on debug
+CONFIG = qt warn_on release
+HEADERS = example.h
+SOURCES = main.cpp example.cpp
+INCLUDEPATH += $(QPEDIR)/include
+DEPENDPATH += $(QPEDIR)/include
+LIBS += -lqpe
+INTERFACES = examplebase.ui
+TARGET = example
diff --git a/examples/application/examplebase.ui b/examples/application/examplebase.ui
new file mode 100644
index 0000000..b47d20c
--- a/dev/null
+++ b/examples/application/examplebase.ui
@@ -0,0 +1,55 @@
+<!DOCTYPE UI><UI>
+<class>ExampleBase</class>
+<widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ExampleBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>196</width>
+ <height>245</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Example</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&lt;p&gt;This is just an &lt;i&gt;example&lt;/i&gt;. It doesn't do anything interesting at all.</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>quit</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Quit</string>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+</UI>
diff --git a/examples/application/index.html b/examples/application/index.html
new file mode 100644
index 0000000..ad97378
--- a/dev/null
+++ b/examples/application/index.html
@@ -0,0 +1,23 @@
+<h1 align=center><small>Welcome to the</small><br>Qtopia SDK</h1>
+
+<h3>API Documentation</h3>
+<p>
+For API documentation, point a web browser at
+/opt/Qtopia/doc/html/qtopia/index.html
+
+<h3>Application Documentation</h3>
+Put English documentation for applications in:
+
+<p>
+&nbsp;&nbsp;&nbsp;$QPEDIR/help/html/<i>appname</i>.html
+
+<p>
+Put non-English documentation for applications in:
+
+<p>
+&nbsp;&nbsp;&nbsp;$QPEDIR/help/<i>lang</i>/html/<i>appname</i>.html
+
+<p>
+Where <i>lang</i> is the language specifier (eg. "de" for German),
+and <i>appname</i> is the program name of your application.
+
diff --git a/examples/application/main.cpp b/examples/application/main.cpp
new file mode 100644
index 0000000..b705c44
--- a/dev/null
+++ b/examples/application/main.cpp
@@ -0,0 +1,12 @@
+#include "example.h"
+#include <qpe/qpeapplication.h>
+
+int main( int argc, char ** argv )
+{
+ QPEApplication a( argc, argv );
+
+ Example mw;
+ a.showMainWidget( &mw );
+
+ return a.exec();
+}
diff --git a/examples/qpepim-addressbook/abexample.desktop b/examples/qpepim-addressbook/abexample.desktop
new file mode 100644
index 0000000..24b44d1
--- a/dev/null
+++ b/examples/qpepim-addressbook/abexample.desktop
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Comment=Simple QPEPIM Example
+Exec=abexample
+Icon=abexample
+Type=Application
+Name=AB QPEPIM
diff --git a/examples/qpepim-addressbook/abexample.png b/examples/qpepim-addressbook/abexample.png
new file mode 100644
index 0000000..f63d0bc
--- a/dev/null
+++ b/examples/qpepim-addressbook/abexample.png
Binary files differ
diff --git a/examples/qpepim-addressbook/addressbookdumper.cpp b/examples/qpepim-addressbook/addressbookdumper.cpp
new file mode 100644
index 0000000..c47e05c
--- a/dev/null
+++ b/examples/qpepim-addressbook/addressbookdumper.cpp
@@ -0,0 +1,65 @@
+/**********************************************************************
+** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
+**
+** This file is part of the Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qpe/contact.h>
+#include <qvaluelist.h>
+#include "addressbookdumper.h"
+
+AddressBookDumper::AddressBookDumper(QWidget* parent) : QMultiLineEdit(parent) {
+ // connect(&m_ABAccess, SIGNAL(addressbookUpdated()), this, SLOT(abChanged()));
+}
+
+AddressBookDumper::~AddressBookDumper() {
+}
+
+void AddressBookDumper::abChanged() {
+ QString newText;
+ QValueList<Contact> contacts = m_ABAccess.contacts();
+ QValueListConstIterator<Contact> it;
+ for (it = contacts.begin() ; it != contacts.end(); it++) {
+ newText.append((*it).firstName() + " " + (*it).lastName() + "\n");
+ }
+ setText(newText);
+}
+
+void AddressBookDumper::startBigEdit() {
+ if (m_ABAccess.startBlockEdit())
+ qDebug("*** Block edit successfully started.");
+ else
+ qDebug("*** Block edit start failed.");
+}
+
+void AddressBookDumper::endBigEdit() {
+ if (m_ABAccess.endBlockEdit())
+ qDebug("*** Block edit successfully ended.");
+ else
+ qDebug("*** Block edit end failed.");
+}
+
+void AddressBookDumper::addContact() {
+ Contact foo;
+ foo.setFirstName("Foo");
+ foo.setLastName("Bar");
+ foo.setFileAs();
+ if (m_ABAccess.addContact(foo))
+ qDebug("*** Add succeeded..");
+ else
+ qDebug("*** Add failed..");
+}
diff --git a/examples/qpepim-addressbook/addressbookdumper.h b/examples/qpepim-addressbook/addressbookdumper.h
new file mode 100644
index 0000000..cc83d32
--- a/dev/null
+++ b/examples/qpepim-addressbook/addressbookdumper.h
@@ -0,0 +1,39 @@
+/**********************************************************************
+** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
+**
+** This file is part of the Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qmultilineedit.h>
+#include <qpe/pim/addressbookaccess.h>
+
+class AddressBookDumper : public QMultiLineEdit {
+ Q_OBJECT
+
+ public:
+ AddressBookDumper(QWidget* parent);
+ ~AddressBookDumper();
+
+ public slots:
+ void abChanged();
+ void startBigEdit();
+ void endBigEdit();
+ void addContact();
+
+ private:
+ AddressBookAccess m_ABAccess;
+};
diff --git a/examples/qpepim-addressbook/main.cpp b/examples/qpepim-addressbook/main.cpp
new file mode 100644
index 0000000..590fffe
--- a/dev/null
+++ b/examples/qpepim-addressbook/main.cpp
@@ -0,0 +1,47 @@
+/**********************************************************************
+** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
+**
+** This file is part of the Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qpe/qpeapplication.h>
+#ifdef QWS
+#include <qpe/qcopenvelope_qws.h>
+#endif
+#include <qapplication.h>
+#include <qpe/pim/addressbookaccess.h>
+#include "addressbookdumper.h"
+#include <qvbox.h>
+#include <qpushbutton.h>
+
+int main( int argc, char ** argv )
+{
+ QPEApplication a( argc, argv );
+ QVBox* vbox = new QVBox(0L);
+ QPushButton* clicker = new QPushButton("Refresh", vbox);
+ QPushButton* startBigEditButton = new QPushButton("Start Big Edit", vbox);
+ QPushButton* endBigEditButton = new QPushButton("End Big Edit", vbox);
+ QPushButton* addContactButton = new QPushButton("Add Contact", vbox);
+ AddressBookDumper* abDumper = new AddressBookDumper(vbox);
+ QObject::connect(clicker, SIGNAL(clicked()), abDumper, SLOT(abChanged()));
+ QObject::connect(startBigEditButton, SIGNAL(clicked()), abDumper, SLOT(startBigEdit()));
+ QObject::connect(endBigEditButton, SIGNAL(clicked()), abDumper, SLOT(endBigEdit()));
+ QObject::connect(addContactButton, SIGNAL(clicked()), abDumper, SLOT(addContact()));
+ a.setMainWidget(vbox);
+ vbox->show();
+ return a.exec();
+}
diff --git a/examples/qpepim-addressbook/qpepim-abexample.control b/examples/qpepim-addressbook/qpepim-abexample.control
new file mode 100644
index 0000000..5a31c97
--- a/dev/null
+++ b/examples/qpepim-addressbook/qpepim-abexample.control
@@ -0,0 +1,9 @@
+Files: bin/abexample apps/Applications/abexample.desktop
+Priority: optional
+Section: qpe/applications
+Maintainer: Warwick Allison <warwick@trolltech.com>
+Architecture: arm
+Version: $QPE_VERSION-1
+Depends: qpe-pim, qpe-base ($QPE_VERSION)
+Description: Example Addressbook reader
+ Simple example for using the QPEPIM access library.
diff --git a/examples/qpepim-addressbook/qpepim-addressbook.pro b/examples/qpepim-addressbook/qpepim-addressbook.pro
new file mode 100644
index 0000000..7e918e0
--- a/dev/null
+++ b/examples/qpepim-addressbook/qpepim-addressbook.pro
@@ -0,0 +1,8 @@
+TEMPLATE = app
+CONFIG = qt warn_on debug
+
+HEADERS = addressbookdumper.h
+SOURCES = main.cpp addressbookdumper.cpp
+TARGET = abexample
+INCLUDEPATH = $(QPEDIR)/include
+LIBS += -lqpepim -lqpe -lqte