summaryrefslogtreecommitdiff
path: root/examples
authorkergoth <kergoth>2002-06-06 23:31:00 (UTC)
committer kergoth <kergoth>2002-06-06 23:31:00 (UTC)
commitdfb9c76738bb68e235114c5ad43dbd26a59b98ab (patch) (unidiff)
tree25ab1468116e8a092dc402f8aa96a9c6976ebdce /examples
parent9d6af1137a96d63f71f8e4797fe3bf377d92a15a (diff)
downloadopie-dfb9c76738bb68e235114c5ad43dbd26a59b98ab.zip
opie-dfb9c76738bb68e235114c5ad43dbd26a59b98ab.tar.gz
opie-dfb9c76738bb68e235114c5ad43dbd26a59b98ab.tar.bz2
Initial revision
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 @@
1See /opt/Qtopia/doc/index.html for help.
2See 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 @@
1Files: bin/example apps/Applications/example.desktop pics/Example.png help/html/example.html
2Priority: optional
3Section: qpe/applications
4Maintainer: Your Name <you@your.domain.com>
5Architecture: arm
6Version: 1.0.0
7Depends: qpe-base ($QPE_VERSION)
8License: Public Domain
9Description: Example program
10 An example program for the Qtopia environment.
11 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 @@
1#include "example.h"
2#include <qpushbutton.h>
3
4/*
5 * Constructs a Example which is a child of 'parent', with the
6 * name 'name' and widget flags set to 'f'
7 */
8Example::Example( QWidget* parent, const char* name, WFlags fl )
9 : ExampleBase( parent, name, fl )
10{
11 connect(quit, SIGNAL(clicked()), this, SLOT(goodBye()));
12}
13
14/*
15 * Destroys the object and frees any allocated resources
16 */
17Example::~Example()
18{
19 // no need to delete child widgets, Qt does it all for us
20}
21
22/*
23 * A simple slot... not very interesting.
24 */
25void Example::goodBye()
26{
27 close();
28}
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 @@
1[Desktop Entry]
2Comment=An Example Program
3Exec=example
4Icon=Example
5Type=Application
6Name=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 @@
1#ifndef EXAMPLE_H
2#define EXAMPLE_H
3#include "examplebase.h"
4
5class Example : public ExampleBase
6{
7 Q_OBJECT
8
9public:
10 Example( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
11 ~Example();
12
13private slots:
14 void goodBye();
15};
16
17#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 @@
1<html>
2<h1>Example</h1>
3
4<p>This is the help for the Example program.
5
6<p>To user this application:
7
8<ol>
9 <li>Press the <img width=12 height=12 src=Example.png> icon in the Qtopia launcher.
10 <li>Read the label.
11 <li>Press the button.
12 <li>Read the source code provided.
13</ol>
14
15Now 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 @@
1 TEMPLATE= app
2 #CONFIG = qt warn_on debug
3 CONFIG = qt warn_on release
4 HEADERS = example.h
5 SOURCES = main.cpp example.cpp
6 INCLUDEPATH+= $(QPEDIR)/include
7 DEPENDPATH+= $(QPEDIR)/include
8LIBS += -lqpe
9 INTERFACES= examplebase.ui
10 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 @@
1<!DOCTYPE UI><UI>
2<class>ExampleBase</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>ExampleBase</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>196</width>
15 <height>245</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Example</string>
21 </property>
22 <vbox>
23 <property stdset="1">
24 <name>margin</name>
25 <number>11</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property>
31 <widget>
32 <class>QLabel</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>TextLabel1</cstring>
36 </property>
37 <property stdset="1">
38 <name>text</name>
39 <string>&lt;p&gt;This is just an &lt;i&gt;example&lt;/i&gt;. It doesn't do anything interesting at all.</string>
40 </property>
41 </widget>
42 <widget>
43 <class>QPushButton</class>
44 <property stdset="1">
45 <name>name</name>
46 <cstring>quit</cstring>
47 </property>
48 <property stdset="1">
49 <name>text</name>
50 <string>Quit</string>
51 </property>
52 </widget>
53 </vbox>
54</widget>
55</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 @@
1<h1 align=center><small>Welcome to the</small><br>Qtopia SDK</h1>
2
3<h3>API Documentation</h3>
4<p>
5For API documentation, point a web browser at
6/opt/Qtopia/doc/html/qtopia/index.html
7
8<h3>Application Documentation</h3>
9Put English documentation for applications in:
10
11<p>
12&nbsp;&nbsp;&nbsp;$QPEDIR/help/html/<i>appname</i>.html
13
14<p>
15Put non-English documentation for applications in:
16
17<p>
18&nbsp;&nbsp;&nbsp;$QPEDIR/help/<i>lang</i>/html/<i>appname</i>.html
19
20<p>
21Where <i>lang</i> is the language specifier (eg. "de" for German),
22and <i>appname</i> is the program name of your application.
23
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 @@
1#include "example.h"
2#include <qpe/qpeapplication.h>
3
4int main( int argc, char ** argv )
5{
6 QPEApplication a( argc, argv );
7
8 Example mw;
9 a.showMainWidget( &mw );
10
11 return a.exec();
12}
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 @@
1[Desktop Entry]
2Comment=Simple QPEPIM Example
3Exec=abexample
4Icon=abexample
5Type=Application
6Name=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 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include <qpe/contact.h>
22#include <qvaluelist.h>
23#include "addressbookdumper.h"
24
25AddressBookDumper::AddressBookDumper(QWidget* parent) : QMultiLineEdit(parent) {
26 // connect(&m_ABAccess, SIGNAL(addressbookUpdated()), this, SLOT(abChanged()));
27}
28
29AddressBookDumper::~AddressBookDumper() {
30}
31
32void AddressBookDumper::abChanged() {
33 QString newText;
34 QValueList<Contact> contacts = m_ABAccess.contacts();
35 QValueListConstIterator<Contact> it;
36 for (it = contacts.begin() ; it != contacts.end(); it++) {
37 newText.append((*it).firstName() + " " + (*it).lastName() + "\n");
38 }
39 setText(newText);
40}
41
42void AddressBookDumper::startBigEdit() {
43 if (m_ABAccess.startBlockEdit())
44 qDebug("*** Block edit successfully started.");
45 else
46 qDebug("*** Block edit start failed.");
47}
48
49void AddressBookDumper::endBigEdit() {
50 if (m_ABAccess.endBlockEdit())
51 qDebug("*** Block edit successfully ended.");
52 else
53 qDebug("*** Block edit end failed.");
54}
55
56void AddressBookDumper::addContact() {
57 Contact foo;
58 foo.setFirstName("Foo");
59 foo.setLastName("Bar");
60 foo.setFileAs();
61 if (m_ABAccess.addContact(foo))
62 qDebug("*** Add succeeded..");
63 else
64 qDebug("*** Add failed..");
65}
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 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include <qmultilineedit.h>
22#include <qpe/pim/addressbookaccess.h>
23
24class AddressBookDumper : public QMultiLineEdit {
25 Q_OBJECT
26
27 public:
28 AddressBookDumper(QWidget* parent);
29 ~AddressBookDumper();
30
31 public slots:
32 void abChanged();
33 void startBigEdit();
34 void endBigEdit();
35 void addContact();
36
37 private:
38 AddressBookAccess m_ABAccess;
39};
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 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include <qpe/qpeapplication.h>
22#ifdef QWS
23#include <qpe/qcopenvelope_qws.h>
24#endif
25#include <qapplication.h>
26#include <qpe/pim/addressbookaccess.h>
27#include "addressbookdumper.h"
28#include <qvbox.h>
29#include <qpushbutton.h>
30
31int main( int argc, char ** argv )
32{
33 QPEApplication a( argc, argv );
34 QVBox* vbox = new QVBox(0L);
35 QPushButton* clicker = new QPushButton("Refresh", vbox);
36 QPushButton* startBigEditButton = new QPushButton("Start Big Edit", vbox);
37 QPushButton* endBigEditButton = new QPushButton("End Big Edit", vbox);
38 QPushButton* addContactButton = new QPushButton("Add Contact", vbox);
39 AddressBookDumper* abDumper = new AddressBookDumper(vbox);
40 QObject::connect(clicker, SIGNAL(clicked()), abDumper, SLOT(abChanged()));
41 QObject::connect(startBigEditButton, SIGNAL(clicked()), abDumper, SLOT(startBigEdit()));
42 QObject::connect(endBigEditButton, SIGNAL(clicked()), abDumper, SLOT(endBigEdit()));
43 QObject::connect(addContactButton, SIGNAL(clicked()), abDumper, SLOT(addContact()));
44 a.setMainWidget(vbox);
45 vbox->show();
46 return a.exec();
47}
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 @@
1Files: bin/abexample apps/Applications/abexample.desktop
2Priority: optional
3Section: qpe/applications
4Maintainer: Warwick Allison <warwick@trolltech.com>
5Architecture: arm
6Version: $QPE_VERSION-1
7Depends: qpe-pim, qpe-base ($QPE_VERSION)
8Description: Example Addressbook reader
9 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 @@
1TEMPLATE = app
2CONFIG = qt warn_on debug
3
4HEADERS = addressbookdumper.h
5SOURCES = main.cpp addressbookdumper.cpp
6TARGET = abexample
7INCLUDEPATH = $(QPEDIR)/include
8LIBS += -lqpepim -lqpe -lqte