summaryrefslogtreecommitdiff
path: root/examples/qpepim-addressbook
authorkergoth <kergoth>2002-06-06 23:31:00 (UTC)
committer kergoth <kergoth>2002-06-06 23:31:00 (UTC)
commitdfb9c76738bb68e235114c5ad43dbd26a59b98ab (patch) (side-by-side diff)
tree25ab1468116e8a092dc402f8aa96a9c6976ebdce /examples/qpepim-addressbook
parent9d6af1137a96d63f71f8e4797fe3bf377d92a15a (diff)
downloadopie-dfb9c76738bb68e235114c5ad43dbd26a59b98ab.zip
opie-dfb9c76738bb68e235114c5ad43dbd26a59b98ab.tar.gz
opie-dfb9c76738bb68e235114c5ad43dbd26a59b98ab.tar.bz2
Initial revision
Diffstat (limited to 'examples/qpepim-addressbook') (more/less context) (show whitespace changes)
-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
7 files changed, 174 insertions, 0 deletions
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