summaryrefslogtreecommitdiff
path: root/examples/simple-pim
authorzecke <zecke>2004-03-14 20:08:59 (UTC)
committer zecke <zecke>2004-03-14 20:08:59 (UTC)
commit0d79c003839718ae70b3b997162044abd5c26bf6 (patch) (unidiff)
tree19708b041da3a09df8f3b571cd634a846f4ad6d7 /examples/simple-pim
parent05c8d999941989a97a581fb5822437034ec10fd7 (diff)
downloadopie-0d79c003839718ae70b3b997162044abd5c26bf6.zip
opie-0d79c003839718ae70b3b997162044abd5c26bf6.tar.gz
opie-0d79c003839718ae70b3b997162044abd5c26bf6.tar.bz2
Update the Examples
Diffstat (limited to 'examples/simple-pim') (more/less context) (ignore whitespace changes)
-rw-r--r--examples/simple-pim/config.in2
-rw-r--r--examples/simple-pim/example.pro2
-rw-r--r--examples/simple-pim/simple.cpp39
-rw-r--r--examples/simple-pim/simple.h26
4 files changed, 37 insertions, 32 deletions
diff --git a/examples/simple-pim/config.in b/examples/simple-pim/config.in
index 5d80f21..aa1a426 100644
--- a/examples/simple-pim/config.in
+++ b/examples/simple-pim/config.in
@@ -1,4 +1,4 @@
1 config SIMPLE_PIM_EXAMPLE 1 config SIMPLE_PIM_EXAMPLE
2 boolean "Mainwindow with PIM and QCOP usage" 2 boolean "Mainwindow with PIM and QCOP usage"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES && LIBOPIE 4 depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES && LIBOPIEPIM2
diff --git a/examples/simple-pim/example.pro b/examples/simple-pim/example.pro
index c3aab53..ebcdb2b 100644
--- a/examples/simple-pim/example.pro
+++ b/examples/simple-pim/example.pro
@@ -12,6 +12,6 @@ DEPENDPATH += $(OPIEDIR)/include
12 12
13 13
14# we now also include opie 14# we now also include opie
15LIBS += -lqpe -lopie 15LIBS += -lqpe -lopiepim2 -lopieui2
16 16
17include ( $(OPIEDIR)/include.pro ) 17include ( $(OPIEDIR)/include.pro )
diff --git a/examples/simple-pim/simple.cpp b/examples/simple-pim/simple.cpp
index 029e71b..50905bf 100644
--- a/examples/simple-pim/simple.cpp
+++ b/examples/simple-pim/simple.cpp
@@ -17,9 +17,9 @@
17#include <qpe/datebookmonth.h> 17#include <qpe/datebookmonth.h>
18#include <qpe/timestring.h> 18#include <qpe/timestring.h>
19 19
20#include <opie/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching 20#include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching
21#include <opie/otabwidget.h> 21#include <opie2/otabwidget.h>
22#include <opie/owait.h> 22#include <opie2/owait.h>
23 23
24#include "simple.h" 24#include "simple.h"
25 25
@@ -35,6 +35,7 @@
35 * either a main method or one for our component plugin system 35 * either a main method or one for our component plugin system
36 */ 36 */
37 37
38using namespace Opie::Core;
38OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) 39OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
39 40
40MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl ) 41MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl )
@@ -50,7 +51,7 @@ MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl )
50 /* 51 /*
51 * Tab widget as central 52 * Tab widget as central
52 */ 53 */
53 m_tab = new OTabWidget(this); 54 m_tab = new Opie::Ui::OTabWidget(this);
54 55
55 setCentralWidget( m_tab ); 56 setCentralWidget( m_tab );
56 57
@@ -211,7 +212,7 @@ void MainWindow::slotLoad() {
211 m_synced++; 212 m_synced++;
212 213
213 /* we will provide a wait scrren */ 214 /* we will provide a wait scrren */
214 m_loading = new OWait(this, "wait screen" ); 215 m_loading = new Opie::Ui::OWait(this, "wait screen" );
215} 216}
216 217
217void MainWindow::slotDesktopReceive(const QCString& cmd, const QByteArray& data ) { 218void MainWindow::slotDesktopReceive(const QCString& cmd, const QByteArray& data ) {
@@ -276,7 +277,7 @@ void MainWindow::slotShow() {
276} 277}
277 278
278/* as answer this slot will be called */ 279/* as answer this slot will be called */
279void MainWindow::slotShowRecord( const OPimRecord& rec) { 280void MainWindow::slotShowRecord( const Opie::OPimRecord& rec) {
280 /* got a parent but still is a toplevel MODAL dialog */ 281 /* got a parent but still is a toplevel MODAL dialog */
281 QDialog* dia = new QDialog(this,"dialog",TRUE ); 282 QDialog* dia = new QDialog(this,"dialog",TRUE );
282 QVBoxLayout *box = new QVBoxLayout( dia ); 283 QVBoxLayout *box = new QVBoxLayout( dia );
@@ -344,19 +345,19 @@ namespace {
344 *currently no hierachies are planed for the example 345 *currently no hierachies are planed for the example
345 * so only one constructor with a QListView as parent 346 * so only one constructor with a QListView as parent
346 */ 347 */
347 PIMListViewItem( QListView*, OPimRecord* record ); 348 PIMListViewItem( QListView*, Opie::OPimRecord* record );
348 ~PIMListViewItem(); 349 ~PIMListViewItem();
349 350
350 /* used by the QListViewItem to easily allow identifiying of different 351 /* used by the QListViewItem to easily allow identifiying of different
351 * items. Values greater than 1000 should be used */ 352 * items. Values greater than 1000 should be used */
352 int rtti()const; 353 int rtti()const;
353 OPimRecord* record()const; 354 Opie::OPimRecord* record()const;
354 355
355 private: 356 private:
356 OPimRecord* m_record; 357 Opie::OPimRecord* m_record;
357 }; 358 };
358 359
359 PIMListViewItem::PIMListViewItem( QListView *p, OPimRecord* rec ) 360 PIMListViewItem::PIMListViewItem( QListView *p, Opie::OPimRecord* rec )
360 : QListViewItem(p), m_record( rec ) { 361 : QListViewItem(p), m_record( rec ) {
361 } 362 }
362 363
@@ -365,7 +366,7 @@ namespace {
365 delete m_record; 366 delete m_record;
366 } 367 }
367 368
368 OPimRecord* PIMListViewItem::record()const { 369 Opie::OPimRecord* PIMListViewItem::record()const {
369 return m_record; 370 return m_record;
370 } 371 }
371 372
@@ -382,28 +383,28 @@ PIMListView::~PIMListView() {
382 383
383} 384}
384 385
385void PIMListView::set( OTodoAccess::List list ) { 386void PIMListView::set( Opie::OPimTodoAccess::List list ) {
386 /* clear first and then add new items */ 387 /* clear first and then add new items */
387 clear(); 388 clear();
388 389
389 OTodoAccess::List::Iterator it; 390 Opie::OPimTodoAccess::List::Iterator it;
390 for (it = list.begin(); it != list.end(); ++it ) { 391 for (it = list.begin(); it != list.end(); ++it ) {
391 /* 392 /*
392 * make a new item which automatically gets added to the listview 393 * make a new item which automatically gets added to the listview
393 * and call the copy c'tor to create a new OTodo 394 * and call the copy c'tor to create a new OPimTodo
394 */ 395 */
395 PIMListViewItem *i = new PIMListViewItem(this, new OTodo( *it ) ); 396 PIMListViewItem *i = new PIMListViewItem(this, new Opie::OPimTodo( *it ) );
396 i->setText(0, (*it).summary() ); 397 i->setText(0, (*it).summary() );
397 } 398 }
398} 399}
399 400
400void PIMListView::set( const OEffectiveEvent::ValueList& lst ) { 401void PIMListView::set( const Opie::OEffectiveEvent::ValueList& lst ) {
401 /* clear first and then add items */ 402 /* clear first and then add items */
402 clear(); 403 clear();
403 404
404 OEffectiveEvent::ValueList::ConstIterator it; 405 Opie::OEffectiveEvent::ValueList::ConstIterator it;
405 for ( it = lst.begin(); it != lst.end(); ++it ) { 406 for ( it = lst.begin(); it != lst.end(); ++it ) {
406 PIMListViewItem *i = new PIMListViewItem(this, new OEvent( (*it).event() ) ); 407 PIMListViewItem *i = new PIMListViewItem(this, new Opie::OPimEvent( (*it).event() ) );
407 i->setText( 0, PIMListView::makeString( (*it) ) ); 408 i->setText( 0, PIMListView::makeString( (*it) ) );
408 } 409 }
409 410
@@ -425,7 +426,7 @@ void PIMListView::showCurrentRecord() {
425 emit showRecord( (*item->record() ) ); 426 emit showRecord( (*item->record() ) );
426} 427}
427 428
428QString PIMListView::makeString( const OEffectiveEvent& ev ) { 429QString PIMListView::makeString( const Opie::OEffectiveEvent& ev ) {
429 QString str; 430 QString str;
430 str += ev.description(); 431 str += ev.description();
431 if ( !ev.event().isAllDay() ) { 432 if ( !ev.event().isAllDay() ) {
diff --git a/examples/simple-pim/simple.h b/examples/simple-pim/simple.h
index bf9ede7..2a6e8ce 100644
--- a/examples/simple-pim/simple.h
+++ b/examples/simple-pim/simple.h
@@ -18,16 +18,20 @@
18#include <qmainwindow.h> // from this class we will inherit 18#include <qmainwindow.h> // from this class we will inherit
19#include <qlistview.h> // A ListView for our PIM records 19#include <qlistview.h> // A ListView for our PIM records
20 20
21#include <opie/otodoaccess.h> 21#include <opie2/otodoaccess.h>
22#include <opie/odatebookaccess.h> 22#include <opie2/odatebookaccess.h>
23 23
24class QPushButton; // forward declaration to not include the header. This can save time when compiling 24class QPushButton; // forward declaration to not include the header. This can save time when compiling
25class QAction; 25class QAction;
26class PIMListView; 26class PIMListView;
27class QDate; 27class QDate;
28class QCopChannel; 28class QCopChannel;
29namespace Opie{
30namespace Ui {
29class OWait; 31class OWait;
30class OTabWidget; 32class OTabWidget;
33}
34}
31 35
32/* 36/*
33 * A mainwindow is a special QWidget it helps layouting 37 * A mainwindow is a special QWidget it helps layouting
@@ -50,22 +54,22 @@ private slots:
50 void slotLoadForDay(const QDate&); 54 void slotLoadForDay(const QDate&);
51 void slotShow(); 55 void slotShow();
52 void slotDate(); 56 void slotDate();
53 void slotShowRecord( const OPimRecord& ); 57 void slotShowRecord( const Opie::OPimRecord& );
54 58
55private: 59private:
56 void initUI(); 60 void initUI();
57 QAction *m_fire; 61 QAction *m_fire;
58 QAction *m_dateAction; 62 QAction *m_dateAction;
59 OTabWidget* m_tab; 63 Opie::Ui::OTabWidget* m_tab;
60 64
61 OTodoAccess m_tb; 65 Opie::OPimTodoAccess m_tb;
62 ODateBookAccess m_db; 66 Opie::ODateBookAccess m_db;
63 PIMListView *m_todoView; 67 PIMListView *m_todoView;
64 PIMListView *m_dateView; 68 PIMListView *m_dateView;
65 69
66 int m_synced; // a counter for synced objects.. 70 int m_synced; // a counter for synced objects..
67 QCopChannel *m_desktopChannel; 71 QCopChannel *m_desktopChannel;
68 OWait *m_loading; 72 Opie::Ui::OWait *m_loading;
69}; 73};
70 74
71/* 75/*
@@ -80,15 +84,15 @@ public:
80 ~PIMListView(); 84 ~PIMListView();
81 85
82 86
83 void set( OTodoAccess::List ); 87 void set( Opie::OPimTodoAccess::List );
84 void set( const OEffectiveEvent::ValueList& ); 88 void set( const Opie::OEffectiveEvent::ValueList& );
85 void showCurrentRecord(); 89 void showCurrentRecord();
86 90
87signals: 91signals:
88 void showRecord( const OPimRecord& ); 92 void showRecord( const Opie::OPimRecord& );
89 93
90private: 94private:
91 static QString makeString( const OEffectiveEvent& ev ); 95 static QString makeString( const Opie::OEffectiveEvent& ev );
92 96
93}; 97};
94 98