author | zecke <zecke> | 2004-03-14 20:08:59 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-03-14 20:08:59 (UTC) |
commit | 0d79c003839718ae70b3b997162044abd5c26bf6 (patch) (side-by-side diff) | |
tree | 19708b041da3a09df8f3b571cd634a846f4ad6d7 /examples/simple-pim | |
parent | 05c8d999941989a97a581fb5822437034ec10fd7 (diff) | |
download | opie-0d79c003839718ae70b3b997162044abd5c26bf6.zip opie-0d79c003839718ae70b3b997162044abd5c26bf6.tar.gz opie-0d79c003839718ae70b3b997162044abd5c26bf6.tar.bz2 |
Update the Examples
-rw-r--r-- | examples/simple-pim/config.in | 2 | ||||
-rw-r--r-- | examples/simple-pim/example.pro | 2 | ||||
-rw-r--r-- | examples/simple-pim/simple.cpp | 39 | ||||
-rw-r--r-- | examples/simple-pim/simple.h | 26 |
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 @@ config SIMPLE_PIM_EXAMPLE boolean "Mainwindow with PIM and QCOP usage" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES && LIBOPIE + 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 @@ -11,7 +11,7 @@ INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include # we now also include opie -LIBS += -lqpe -lopie +LIBS += -lqpe -lopiepim2 -lopieui2 include ( $(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 @@ -16,11 +16,11 @@ #include <qpe/qcopenvelope_qws.h> #include <qpe/datebookmonth.h> #include <qpe/timestring.h> -#include <opie/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching -#include <opie/otabwidget.h> -#include <opie/owait.h> +#include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching +#include <opie2/otabwidget.h> +#include <opie2/owait.h> #include "simple.h" /* @@ -34,8 +34,9 @@ * Depending on the global quick launch setting this will create * either a main method or one for our component plugin system */ +using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) { @@ -49,9 +50,9 @@ MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl ) /* * Tab widget as central */ - m_tab = new OTabWidget(this); + m_tab = new Opie::Ui::OTabWidget(this); setCentralWidget( m_tab ); m_todoView = new PIMListView(m_tab, "Todo view" ); @@ -210,9 +211,9 @@ void MainWindow::slotLoad() { }else m_synced++; /* we will provide a wait scrren */ - m_loading = new OWait(this, "wait screen" ); + m_loading = new Opie::Ui::OWait(this, "wait screen" ); } void MainWindow::slotDesktopReceive(const QCString& cmd, const QByteArray& data ) { /* the bytearray was filled with the QDataStream now @@ -275,9 +276,9 @@ void MainWindow::slotShow() { } /* as answer this slot will be called */ -void MainWindow::slotShowRecord( const OPimRecord& rec) { +void MainWindow::slotShowRecord( const Opie::OPimRecord& rec) { /* got a parent but still is a toplevel MODAL dialog */ QDialog* dia = new QDialog(this,"dialog",TRUE ); QVBoxLayout *box = new QVBoxLayout( dia ); dia->setCaption( tr("View Record") ); @@ -343,30 +344,30 @@ namespace { /* *currently no hierachies are planed for the example * so only one constructor with a QListView as parent */ - PIMListViewItem( QListView*, OPimRecord* record ); + PIMListViewItem( QListView*, Opie::OPimRecord* record ); ~PIMListViewItem(); /* used by the QListViewItem to easily allow identifiying of different * items. Values greater than 1000 should be used */ int rtti()const; - OPimRecord* record()const; + Opie::OPimRecord* record()const; private: - OPimRecord* m_record; + Opie::OPimRecord* m_record; }; - PIMListViewItem::PIMListViewItem( QListView *p, OPimRecord* rec ) + PIMListViewItem::PIMListViewItem( QListView *p, Opie::OPimRecord* rec ) : QListViewItem(p), m_record( rec ) { } PIMListViewItem::~PIMListViewItem() { /* we've the onwership so we need to delete it */ delete m_record; } - OPimRecord* PIMListViewItem::record()const { + Opie::OPimRecord* PIMListViewItem::record()const { return m_record; } } @@ -381,30 +382,30 @@ PIMListView::PIMListView( QWidget* widget, const char* name, WFlags fl ) PIMListView::~PIMListView() { } -void PIMListView::set( OTodoAccess::List list ) { +void PIMListView::set( Opie::OPimTodoAccess::List list ) { /* clear first and then add new items */ clear(); - OTodoAccess::List::Iterator it; + Opie::OPimTodoAccess::List::Iterator it; for (it = list.begin(); it != list.end(); ++it ) { /* * make a new item which automatically gets added to the listview - * and call the copy c'tor to create a new OTodo + * and call the copy c'tor to create a new OPimTodo */ - PIMListViewItem *i = new PIMListViewItem(this, new OTodo( *it ) ); + PIMListViewItem *i = new PIMListViewItem(this, new Opie::OPimTodo( *it ) ); i->setText(0, (*it).summary() ); } } -void PIMListView::set( const OEffectiveEvent::ValueList& lst ) { +void PIMListView::set( const Opie::OEffectiveEvent::ValueList& lst ) { /* clear first and then add items */ clear(); - OEffectiveEvent::ValueList::ConstIterator it; + Opie::OEffectiveEvent::ValueList::ConstIterator it; for ( it = lst.begin(); it != lst.end(); ++it ) { - PIMListViewItem *i = new PIMListViewItem(this, new OEvent( (*it).event() ) ); + PIMListViewItem *i = new PIMListViewItem(this, new Opie::OPimEvent( (*it).event() ) ); i->setText( 0, PIMListView::makeString( (*it) ) ); } } @@ -424,9 +425,9 @@ void PIMListView::showCurrentRecord() { /* finally you see how to emit a signal */ emit showRecord( (*item->record() ) ); } -QString PIMListView::makeString( const OEffectiveEvent& ev ) { +QString PIMListView::makeString( const Opie::OEffectiveEvent& ev ) { QString str; str += ev.description(); if ( !ev.event().isAllDay() ) { if ( ev.startDate() != ev.endDate() ) { 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 @@ -17,18 +17,22 @@ #include <qmainwindow.h> // from this class we will inherit #include <qlistview.h> // A ListView for our PIM records -#include <opie/otodoaccess.h> -#include <opie/odatebookaccess.h> +#include <opie2/otodoaccess.h> +#include <opie2/odatebookaccess.h> class QPushButton; // forward declaration to not include the header. This can save time when compiling class QAction; class PIMListView; class QDate; class QCopChannel; +namespace Opie{ +namespace Ui { class OWait; class OTabWidget; +} +} /* * A mainwindow is a special QWidget it helps layouting * toolbar, statusbar, menubar. Got dockable areas @@ -49,24 +53,24 @@ private slots: void slotLoadForDay(int, int, int ); void slotLoadForDay(const QDate&); void slotShow(); void slotDate(); - void slotShowRecord( const OPimRecord& ); + void slotShowRecord( const Opie::OPimRecord& ); private: void initUI(); QAction *m_fire; QAction *m_dateAction; - OTabWidget* m_tab; + Opie::Ui::OTabWidget* m_tab; - OTodoAccess m_tb; - ODateBookAccess m_db; + Opie::OPimTodoAccess m_tb; + Opie::ODateBookAccess m_db; PIMListView *m_todoView; PIMListView *m_dateView; int m_synced; // a counter for synced objects.. QCopChannel *m_desktopChannel; - OWait *m_loading; + Opie::Ui::OWait *m_loading; }; /* * Instead of the simple QWidgets we will design @@ -79,17 +83,17 @@ public: PIMListView( QWidget* parent, const char* name, WFlags fl= 0 ); ~PIMListView(); - void set( OTodoAccess::List ); - void set( const OEffectiveEvent::ValueList& ); + void set( Opie::OPimTodoAccess::List ); + void set( const Opie::OEffectiveEvent::ValueList& ); void showCurrentRecord(); signals: - void showRecord( const OPimRecord& ); + void showRecord( const Opie::OPimRecord& ); private: - static QString makeString( const OEffectiveEvent& ev ); + static QString makeString( const Opie::OEffectiveEvent& ev ); }; #endif |