summaryrefslogtreecommitdiff
path: root/examples
Unidiff
Diffstat (limited to 'examples') (more/less context) (ignore whitespace changes)
-rw-r--r--examples/applet/config.in2
-rw-r--r--examples/applet/example.pro2
-rw-r--r--examples/applet/simpleimpl.cpp96
-rw-r--r--examples/applet/simpleimpl.h23
-rw-r--r--examples/main-tab/config.in2
-rw-r--r--examples/main-tab/example.pro2
-rw-r--r--examples/main-tab/simple.cpp8
-rw-r--r--examples/simple-icon/simple.cpp4
-rw-r--r--examples/simple-main/simple.cpp3
-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
-rw-r--r--examples/simple/simple.cpp4
-rw-r--r--examples/todayplugin/config.in2
-rw-r--r--examples/todayplugin/example.pro2
-rw-r--r--examples/todayplugin/exampleplugin.h4
-rw-r--r--examples/todayplugin/examplepluginimpl.h2
-rw-r--r--examples/todayplugin/examplepluginwidget.cpp3
-rw-r--r--examples/todayplugin/examplepluginwidget.h4
20 files changed, 76 insertions, 156 deletions
diff --git a/examples/applet/config.in b/examples/applet/config.in
index 177de27..c3fb6dd 100644
--- a/examples/applet/config.in
+++ b/examples/applet/config.in
@@ -1,4 +1,4 @@
1 config APPLET_EXAMPLE 1 config APPLET_EXAMPLE
2 boolean "Taskbar Applet Example" 2 boolean "Taskbar Applet Example"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIEUI2 &&EXAMPLES
diff --git a/examples/applet/example.pro b/examples/applet/example.pro
index 3efd31e..5ae540b 100644
--- a/examples/applet/example.pro
+++ b/examples/applet/example.pro
@@ -7,10 +7,10 @@ TARGET = example
7SOURCES = simpleimpl.cpp 7SOURCES = simpleimpl.cpp
8HEADERS = simpleimpl.h 8HEADERS = simpleimpl.h
9 9
10INCLUDEPATH += $(OPIEDIR)/include 10INCLUDEPATH += $(OPIEDIR)/include
11DEPENDSPATH += $(OPIEDIR)/include 11DEPENDSPATH += $(OPIEDIR)/include
12 12
13LIBS += -lqpe 13LIBS += -lqpe -lopieui2
14 14
15 15
16include ( $(OPIEDIR)/include.pro ) 16include ( $(OPIEDIR)/include.pro )
diff --git a/examples/applet/simpleimpl.cpp b/examples/applet/simpleimpl.cpp
index 82fc6e5..62d9bf7 100644
--- a/examples/applet/simpleimpl.cpp
+++ b/examples/applet/simpleimpl.cpp
@@ -1,14 +1,19 @@
1
2#include "simpleimpl.h"
3
4#include <opie2/otaskbarapplet.h>
5
6#include <qpe/applnk.h> // for AppLnk
7#include <qpe/resource.h> // for Resource loading
8
1#include <qlabel.h> 9#include <qlabel.h>
2#include <qpainter.h> 10#include <qpainter.h>
3#include <qmessagebox.h> 11#include <qmessagebox.h>
4 12
5#include <qpe/applnk.h> // for AppLnk
6#include <qpe/resource.h> // for Resource loading
7 13
8#include "simpleimpl.h"
9 14
10 15
11SimpleApplet::SimpleApplet(QWidget *parent) 16SimpleApplet::SimpleApplet(QWidget *parent)
12 : QWidget( parent, "Simple Applet" ) { 17 : QWidget( parent, "Simple Applet" ) {
13/* 18/*
14 * we will load an Image, scale it for the right usage 19 * we will load an Image, scale it for the right usage
@@ -68,95 +73,18 @@ void SimpleApplet::paintEvent( QPaintEvent* ) {
68 73
69 /* simpy draw the pixmap from the start of this widget */ 74 /* simpy draw the pixmap from the start of this widget */
70 p.drawPixmap(0, 0, *m_pix ); 75 p.drawPixmap(0, 0, *m_pix );
71} 76}
72 77
73/* 78/*
74 * Here comes the implementation of the interface 79 * We need to add this symbol for the plugin exporter!
75 */ 80 */
76SimpleAppletImpl::SimpleAppletImpl() { 81int SimpleApplet::position(){
77}
78/* needed cause until it is only pure virtual */
79SimpleAppletImpl::~SimpleAppletImpl() {
80 /*
81 * we will delete our applets as well
82 * setAUtoDelete makes the QList free
83 * the objects behind the pointers
84 */
85 m_applets.setAutoDelete( true );
86 m_applets.clear();
87}
88
89/*
90 * For the taskbar interface return a Widget
91 */
92QWidget* SimpleAppletImpl::applet( QWidget* parent ) {
93 /*
94 * There are problems with ownership. So we add
95 * our ownlist and clear this;
96 */
97 SimpleApplet* ap = new SimpleApplet( parent );
98 m_applets.append( ap );
99
100 return ap;
101}
102
103/*
104 * A small hint where the Applet Should be displayed
105 */
106int SimpleAppletImpl::position()const {
107 return 1; 82 return 1;
108} 83}
109 84
110 85
111/*
112 * Now the important QUnkownInterface method without
113 * this one your applet won't load
114 * @param uuid The uuid of the interface
115 * @param iface The pointer to the interface ptr
116 */
117QRESULT SimpleAppletImpl::queryInterface( const QUuid& uuid, QUnknownInterface** iface) {
118 /* set the pointer to the interface to 0 */
119 *iface = 0;
120
121 /*
122 * we check if we support the requested interface
123 * and then assign to the pointer.
124 * You may alos create another interface here so
125 * *iface = this is only in this simple case true you
126 * could also support more interfaces.
127 * But this example below is the most common use.
128 * Now the caller knows that the Interface Pointer
129 * is valid and the interface supported
130 */
131 if ( uuid == IID_QUnknown )
132 *iface = this;
133 else if ( uuid == IID_TaskbarApplet )
134 *iface = this;
135 else
136 return QS_FALSE;
137
138 if ( *iface )
139 (*iface)->addRef();
140
141 return QS_OK;
142}
143
144 86
145/* 87/*
146 * Finally we need to export the Interface. 88 * Here comes the implementation of the interface
147 * CREATE_INSTANCE creates a interface and calls
148 * queryInterface for the QUnknownInterface once
149 * With out this function the applet can't be loaded.
150 *
151 * NOTE: If your applet does not load it's likely you've an
152 * unresolved symbol. Change the .pro TEMPLATE = lib to TEMPLATE= app
153 * and recompile. If the linker only complains about a missing
154 * main method the problem is more complex. In most cases it'll say
155 * you which symbols are missing and you can implement them.
156 * The main(int argc, char* argv[] ) does not need to be
157 * included in a library so it's ok that the linker complains
158 */ 89 */
159Q_EXPORT_INTERFACE() { 90EXPORT_OPIE_APPLET_v1( SimpleApplet ) \ No newline at end of file
160 Q_CREATE_INSTANCE( SimpleAppletImpl )
161}
162
diff --git a/examples/applet/simpleimpl.h b/examples/applet/simpleimpl.h
index f58e2af..90c632f 100644
--- a/examples/applet/simpleimpl.h
+++ b/examples/applet/simpleimpl.h
@@ -14,12 +14,13 @@
14 * a dynamic shared object ( dso / plugin ) 14 * a dynamic shared object ( dso / plugin )
15 * For tasks like loading Applications, InputMethods, Today, MenuButton, 15 * For tasks like loading Applications, InputMethods, Today, MenuButton,
16 * Taskbar, Style, Email Client there are specefic Interfaces you 16 * Taskbar, Style, Email Client there are specefic Interfaces you
17 * need to implement. The interfaces inherits from QUnknownInterface and 17 * need to implement. The interfaces inherits from QUnknownInterface and
18 * you'll need inherit from the interface. 18 * you'll need inherit from the interface.
19 * As example we will use the Taskbar interface 19 * As example we will use the Taskbar interface
20 * the OTaskBarAppletWrapper implements the factory for us
20 */ 21 */
21 22
22#ifndef SIMPLE_OPIE_EXAMPLE_APPLET_H 23#ifndef SIMPLE_OPIE_EXAMPLE_APPLET_H
23#define SIMPLE_OPIE_EXAMPLE_APPLET_H 24#define SIMPLE_OPIE_EXAMPLE_APPLET_H
24 25
25/* 26/*
@@ -42,36 +43,16 @@
42 */ 43 */
43class SimpleApplet : public QWidget { 44class SimpleApplet : public QWidget {
44 Q_OBJECT 45 Q_OBJECT
45public: 46public:
46 SimpleApplet(QWidget *parent); 47 SimpleApplet(QWidget *parent);
47 ~SimpleApplet(); 48 ~SimpleApplet();
49 static int position();
48private: 50private:
49 void mousePressEvent( QMouseEvent* ); 51 void mousePressEvent( QMouseEvent* );
50 void paintEvent( QPaintEvent* ); 52 void paintEvent( QPaintEvent* );
51 QPixmap *m_pix; 53 QPixmap *m_pix;
52}; 54};
53 55
54class SimpleAppletImpl : public TaskbarAppletInterface {
55public:
56
57 SimpleAppletImpl();
58 virtual ~SimpleAppletImpl();
59
60 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
61
62 QWidget *applet( QWidget* parent );
63 int position()const;
64
65 /*
66 * macro for reference countint
67 * if reference drops to zero
68 * delete this is called
69 */
70 Q_REFCOUNT
71
72private:
73 QList<SimpleApplet> m_applets;
74};
75 56
76 57
77#endif 58#endif
diff --git a/examples/main-tab/config.in b/examples/main-tab/config.in
index e021d59..3a67bcb 100644
--- a/examples/main-tab/config.in
+++ b/examples/main-tab/config.in
@@ -1,4 +1,4 @@
1 config MAIN_TAB_EXAMPLE 1 config MAIN_TAB_EXAMPLE
2 boolean "Mainwindow with OTabWidget example" 2 boolean "Mainwindow with OTabWidget example"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES && LIBOPIE 4 depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES && LIBOPIEUI2
diff --git a/examples/main-tab/example.pro b/examples/main-tab/example.pro
index 3cafc20..87abf22 100644
--- a/examples/main-tab/example.pro
+++ b/examples/main-tab/example.pro
@@ -9,9 +9,9 @@ SOURCES = simple.cpp
9 9
10INCLUDEPATH += $(OPIEDIR)/include 10INCLUDEPATH += $(OPIEDIR)/include
11DEPENDPATH += $(OPIEDIR)/include 11DEPENDPATH += $(OPIEDIR)/include
12 12
13 13
14# we now also include opie 14# we now also include opie
15LIBS += -lqpe -lopie 15LIBS += -lqpe -lopieui2
16 16
17include ( $(OPIEDIR)/include.pro ) 17include ( $(OPIEDIR)/include.pro )
diff --git a/examples/main-tab/simple.cpp b/examples/main-tab/simple.cpp
index c5a6d5a..7edb557 100644
--- a/examples/main-tab/simple.cpp
+++ b/examples/main-tab/simple.cpp
@@ -6,14 +6,14 @@
6#include <qlayout.h> 6#include <qlayout.h>
7 7
8#include <qpe/qpeapplication.h> // the QPEApplication 8#include <qpe/qpeapplication.h> // the QPEApplication
9#include <qpe/resource.h> 9#include <qpe/resource.h>
10#include <qpe/sound.h> 10#include <qpe/sound.h>
11 11
12#include <opie/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching 12#include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching
13#include <opie/otabwidget.h> 13#include <opie2/otabwidget.h>
14 14
15#include "simple.h" 15#include "simple.h"
16 16
17/* 17/*
18 * implementation of simple 18 * implementation of simple
19 */ 19 */
@@ -23,25 +23,27 @@
23 * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro 23 * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro
24 * 24 *
25 * Depending on the global quick launch setting this will create 25 * Depending on the global quick launch setting this will create
26 * either a main method or one for our component plugin system 26 * either a main method or one for our component plugin system
27 */ 27 */
28 28
29/* The OApplicationFactory is in the Opie::Core namespace */
30using namespace Opie::Core;
29OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) 31OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
30 32
31MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl ) 33MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl )
32 : QMainWindow( parent, name, fl ) { 34 : QMainWindow( parent, name, fl ) {
33 setCaption(tr("My MainWindow") ); 35 setCaption(tr("My MainWindow") );
34 36
35 initUI(); 37 initUI();
36 38
37 39
38 /* 40 /*
39 * Tab widget as central 41 * Tab widget as central
40 */ 42 */
41 OTabWidget *tab = new OTabWidget(this); 43 Opie::Ui::OTabWidget *tab = new Opie::Ui::OTabWidget(this);
42 connect(tab, SIGNAL(currentChanged(QWidget*) ), 44 connect(tab, SIGNAL(currentChanged(QWidget*) ),
43 this, SLOT( slotCurrentChanged(QWidget*) ) ); 45 this, SLOT( slotCurrentChanged(QWidget*) ) );
44 setCentralWidget( tab ); 46 setCentralWidget( tab );
45 47
46 Simple1 *simple1 = new Simple1( this ); 48 Simple1 *simple1 = new Simple1( this );
47 tab->addTab( simple1, "new", tr("Simple1") ); 49 tab->addTab( simple1, "new", tr("Simple1") );
diff --git a/examples/simple-icon/simple.cpp b/examples/simple-icon/simple.cpp
index 054ade8..fec1823 100644
--- a/examples/simple-icon/simple.cpp
+++ b/examples/simple-icon/simple.cpp
@@ -3,13 +3,13 @@
3#include <qlayout.h> 3#include <qlayout.h>
4 4
5#include <qpe/qpeapplication.h> // the QPEApplication 5#include <qpe/qpeapplication.h> // the QPEApplication
6#include <qpe/resource.h> // for loading icon 6#include <qpe/resource.h> // for loading icon
7#include <qpe/sound.h> // for playing a sound 7#include <qpe/sound.h> // for playing a sound
8 8
9#include <opie/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching 9#include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching
10 10
11#include "simple.h" 11#include "simple.h"
12 12
13/* 13/*
14 * implementation of simple 14 * implementation of simple
15 */ 15 */
@@ -18,13 +18,13 @@
18 * The factory is used for quicklaunching 18 * The factory is used for quicklaunching
19 * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro 19 * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro
20 * 20 *
21 * Depending on the global quick launch setting this will create 21 * Depending on the global quick launch setting this will create
22 * either a main method or one for our component plugin system 22 * either a main method or one for our component plugin system
23 */ 23 */
24 24using namespace Opie::Core;
25OPIE_EXPORT_APP( OApplicationFactory<Simple> ) 25OPIE_EXPORT_APP( OApplicationFactory<Simple> )
26 26
27Simple::Simple( QWidget* parent, const char* name, WFlags fl ) 27Simple::Simple( QWidget* parent, const char* name, WFlags fl )
28 : QWidget( parent, name, fl ) { 28 : QWidget( parent, name, fl ) {
29 29
30 /* 30 /*
diff --git a/examples/simple-main/simple.cpp b/examples/simple-main/simple.cpp
index 8de911f..cf00cc6 100644
--- a/examples/simple-main/simple.cpp
+++ b/examples/simple-main/simple.cpp
@@ -5,13 +5,13 @@
5#include <qpushbutton.h> // the header file for the QPushButton 5#include <qpushbutton.h> // the header file for the QPushButton
6#include <qlayout.h> 6#include <qlayout.h>
7 7
8#include <qpe/qpeapplication.h> // the QPEApplication 8#include <qpe/qpeapplication.h> // the QPEApplication
9#include <qpe/resource.h> 9#include <qpe/resource.h>
10 10
11#include <opie/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching 11#include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching
12 12
13#include "simple.h" 13#include "simple.h"
14 14
15/* 15/*
16 * implementation of simple 16 * implementation of simple
17 */ 17 */
@@ -21,12 +21,13 @@
21 * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro 21 * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro
22 * 22 *
23 * Depending on the global quick launch setting this will create 23 * Depending on the global quick launch setting this will create
24 * either a main method or one for our component plugin system 24 * either a main method or one for our component plugin system
25 */ 25 */
26 26
27using namespace Opie::Core;
27OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) 28OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
28 29
29MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl ) 30MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl )
30 : QMainWindow( parent, name, fl ) { 31 : QMainWindow( parent, name, fl ) {
31 setCaption(tr("My MainWindow") ); 32 setCaption(tr("My MainWindow") );
32 setIcon( Resource::loadPixmap("new") ); 33 setIcon( Resource::loadPixmap("new") );
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
@@ -9,9 +9,9 @@ SOURCES = simple.cpp
9 9
10INCLUDEPATH += $(OPIEDIR)/include 10INCLUDEPATH += $(OPIEDIR)/include
11DEPENDPATH += $(OPIEDIR)/include 11DEPENDPATH += $(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
@@ -14,15 +14,15 @@
14#include <qpe/resource.h> 14#include <qpe/resource.h>
15#include <qpe/sound.h> 15#include <qpe/sound.h>
16#include <qpe/qcopenvelope_qws.h> 16#include <qpe/qcopenvelope_qws.h>
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
26/* 26/*
27 * implementation of simple 27 * implementation of simple
28 */ 28 */
@@ -32,12 +32,13 @@
32 * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro 32 * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro
33 * 33 *
34 * Depending on the global quick launch setting this will create 34 * Depending on the global quick launch setting this will create
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 )
41 : QMainWindow( parent, name, fl ) { 42 : QMainWindow( parent, name, fl ) {
42 setCaption(tr("My MainWindow") ); 43 setCaption(tr("My MainWindow") );
43 44
@@ -47,13 +48,13 @@ MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl )
47 initUI(); 48 initUI();
48 49
49 50
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
57 m_todoView = new PIMListView(m_tab, "Todo view" ); 58 m_todoView = new PIMListView(m_tab, "Todo view" );
58 m_tab->addTab( m_todoView,"todo/TodoList", tr("Todos") ); 59 m_tab->addTab( m_todoView,"todo/TodoList", tr("Todos") );
59 60
@@ -208,13 +209,13 @@ void MainWindow::slotLoad() {
208 if ( QCopChannel::isRegistered("QPE/Application/datebook") ) { 209 if ( QCopChannel::isRegistered("QPE/Application/datebook") ) {
209 QCopEnvelope env("QPE/Application/datebook", "flush()" ); 210 QCopEnvelope env("QPE/Application/datebook", "flush()" );
210 }else 211 }else
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 ) {
218 /* the bytearray was filled with the QDataStream now 219 /* the bytearray was filled with the QDataStream now
219 * we open it read only to get the value(s) 220 * we open it read only to get the value(s)
220 */ 221 */
@@ -273,13 +274,13 @@ void MainWindow::slotShow() {
273 /* ask the view to send a signal */ 274 /* ask the view to send a signal */
274 view->showCurrentRecord(); 275 view->showCurrentRecord();
275 276
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 );
283 dia->setCaption( tr("View Record") ); 284 dia->setCaption( tr("View Record") );
284 285
285 286
@@ -341,34 +342,34 @@ namespace {
341 */ 342 */
342 struct PIMListViewItem : public QListViewItem { 343 struct PIMListViewItem : public QListViewItem {
343 /* 344 /*
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
363 PIMListViewItem::~PIMListViewItem() { 364 PIMListViewItem::~PIMListViewItem() {
364 /* we've the onwership so we need to delete it */ 365 /* we've the onwership so we need to delete it */
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
372} 373}
373 374
374 375
@@ -379,34 +380,34 @@ PIMListView::PIMListView( QWidget* widget, const char* name, WFlags fl )
379} 380}
380 381
381PIMListView::~PIMListView() { 382PIMListView::~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
410} 411}
411 412
412void PIMListView::showCurrentRecord() { 413void PIMListView::showCurrentRecord() {
@@ -422,13 +423,13 @@ void PIMListView::showCurrentRecord() {
422 PIMListViewItem *item = static_cast<PIMListViewItem*>( currentItem() ); 423 PIMListViewItem *item = static_cast<PIMListViewItem*>( currentItem() );
423 424
424 /* finally you see how to emit a signal */ 425 /* finally you see how to emit a signal */
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() ) {
432 if ( ev.startDate() != ev.endDate() ) { 433 if ( ev.startDate() != ev.endDate() ) {
433 str += tr("Start ") + TimeString::timeString( ev.event().startDateTime().time() ); 434 str += tr("Start ") + TimeString::timeString( ev.event().startDateTime().time() );
434 str += " - " + TimeString::longDateString( ev.startDate() ); 435 str += " - " + TimeString::longDateString( ev.startDate() );
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
@@ -15,22 +15,26 @@
15 15
16 16
17 17
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
34 * toolbar, statusbar, menubar. Got dockable areas 38 * toolbar, statusbar, menubar. Got dockable areas
35 * So in one sentence it is a MainWindow :) 39 * So in one sentence it is a MainWindow :)
36 */ 40 */
@@ -47,28 +51,28 @@ private slots:
47 void slotDesktopReceive( const QCString&, const QByteArray& ); 51 void slotDesktopReceive( const QCString&, const QByteArray& );
48 void slotLoad(); 52 void slotLoad();
49 void slotLoadForDay(int, int, int ); 53 void slotLoadForDay(int, int, int );
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/*
72 * Instead of the simple QWidgets we will design 76 * Instead of the simple QWidgets we will design
73 * a new widget based on a QListView 77 * a new widget based on a QListView
74 * it should show either Todos or EffectiveEvents 78 * it should show either Todos or EffectiveEvents
@@ -77,19 +81,19 @@ class PIMListView : public QListView {
77 Q_OBJECT 81 Q_OBJECT
78public: 82public:
79 PIMListView( QWidget* parent, const char* name, WFlags fl= 0 ); 83 PIMListView( QWidget* parent, const char* name, WFlags fl= 0 );
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
95#endif 99#endif
diff --git a/examples/simple/simple.cpp b/examples/simple/simple.cpp
index a0bc308..faf13c9 100644
--- a/examples/simple/simple.cpp
+++ b/examples/simple/simple.cpp
@@ -1,13 +1,13 @@
1#include <qlabel.h> // a label 1#include <qlabel.h> // a label
2#include <qpushbutton.h> // the header file for the QPushButton 2#include <qpushbutton.h> // the header file for the QPushButton
3#include <qlayout.h> 3#include <qlayout.h>
4 4
5#include <qpe/qpeapplication.h> // the QPEApplication 5#include <qpe/qpeapplication.h> // the QPEApplication
6 6
7#include <opie/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching 7#include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching
8 8
9#include "simple.h" 9#include "simple.h"
10 10
11/* 11/*
12 * implementation of simple 12 * implementation of simple
13 */ 13 */
@@ -17,12 +17,14 @@
17 * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro 17 * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro
18 * 18 *
19 * Depending on the global quick launch setting this will create 19 * Depending on the global quick launch setting this will create
20 * either a main method or one for our component plugin system 20 * either a main method or one for our component plugin system
21 */ 21 */
22 22
23/* The OApplicationFactory is in Opie::Core */
24using namespace Opie::Core;
23OPIE_EXPORT_APP( OApplicationFactory<Simple> ) 25OPIE_EXPORT_APP( OApplicationFactory<Simple> )
24 26
25Simple::Simple( QWidget* parent, const char* name, WFlags fl ) 27Simple::Simple( QWidget* parent, const char* name, WFlags fl )
26 : QWidget( parent, name, fl ) { 28 : QWidget( parent, name, fl ) {
27 29
28 /* 30 /*
diff --git a/examples/todayplugin/config.in b/examples/todayplugin/config.in
index 53004cb..0a6a573 100644
--- a/examples/todayplugin/config.in
+++ b/examples/todayplugin/config.in
@@ -1,5 +1,5 @@
1 config TODAY_EXAMPLE 1 config TODAY_EXAMPLE
2 boolean "Opie-Today Plugin Example" 2 boolean "Opie-Today Plugin Example"
3 default "n" 3 default "n"
4 depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES && LIBOPIE 4 depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES && LIBOPIEUI2
5 5
diff --git a/examples/todayplugin/example.pro b/examples/todayplugin/example.pro
index 4c8c942..f4bca36 100644
--- a/examples/todayplugin/example.pro
+++ b/examples/todayplugin/example.pro
@@ -6,12 +6,12 @@ CONFIG += qt release
6HEADERS = exampleplugin.h examplepluginimpl.h examplepluginwidget.h 6HEADERS = exampleplugin.h examplepluginimpl.h examplepluginwidget.h
7SOURCES = exampleplugin.cpp examplepluginimpl.cpp examplepluginwidget.cpp 7SOURCES = exampleplugin.cpp examplepluginimpl.cpp examplepluginwidget.cpp
8 8
9INCLUDEPATH += $(OPIEDIR)/include 9INCLUDEPATH += $(OPIEDIR)/include
10DEPENDPATH += $(OPIEDIR)/include 10DEPENDPATH += $(OPIEDIR)/include
11 11
12LIBS+= -lqpe -lopie 12LIBS+= -lqpe -lopieui2
13 13
14DESTDIR = $(OPIEDIR)/plugins/today 14DESTDIR = $(OPIEDIR)/plugins/today
15TARGET = todayexampleplugin 15TARGET = todayexampleplugin
16 16
17include ( $(OPIEDIR)/include.pro ) 17include ( $(OPIEDIR)/include.pro )
diff --git a/examples/todayplugin/exampleplugin.h b/examples/todayplugin/exampleplugin.h
index a1df923..94f5b37 100644
--- a/examples/todayplugin/exampleplugin.h
+++ b/examples/todayplugin/exampleplugin.h
@@ -9,14 +9,14 @@
9#ifndef EXAMPLE_PLUGIN_H 9#ifndef EXAMPLE_PLUGIN_H
10#define EXAMPLE_PLUGIN_H 10#define EXAMPLE_PLUGIN_H
11 11
12#include <qwidget.h> 12#include <qwidget.h>
13#include <qguardedptr.h> 13#include <qguardedptr.h>
14 14
15#include <opie/todayplugininterface.h> 15#include <opie2/todayplugininterface.h>
16#include <opie/todayconfigwidget.h> 16#include <opie2/todayconfigwidget.h>
17 17
18#include "examplepluginwidget.h" 18#include "examplepluginwidget.h"
19 19
20// implementation of the today plugin interface 20// implementation of the today plugin interface
21class ExamplePlugin : public TodayPluginObject { 21class ExamplePlugin : public TodayPluginObject {
22 22
diff --git a/examples/todayplugin/examplepluginimpl.h b/examples/todayplugin/examplepluginimpl.h
index 77ec4f6..31f8907 100644
--- a/examples/todayplugin/examplepluginimpl.h
+++ b/examples/todayplugin/examplepluginimpl.h
@@ -5,13 +5,13 @@
5 * 5 *
6 */ 6 */
7 7
8#ifndef EXAMPLE_PLUGIN_IMPL_H 8#ifndef EXAMPLE_PLUGIN_IMPL_H
9#define EXAMPLE_PLUGIN_IMPL_H 9#define EXAMPLE_PLUGIN_IMPL_H
10 10
11#include <opie/todayplugininterface.h> 11#include <opie2/todayplugininterface.h>
12 12
13class ExamplePlugin; 13class ExamplePlugin;
14 14
15class ExamplePluginImpl : public TodayPluginInterface{ 15class ExamplePluginImpl : public TodayPluginInterface{
16 16
17public: 17public:
diff --git a/examples/todayplugin/examplepluginwidget.cpp b/examples/todayplugin/examplepluginwidget.cpp
index d66a11a..10fd39a 100644
--- a/examples/todayplugin/examplepluginwidget.cpp
+++ b/examples/todayplugin/examplepluginwidget.cpp
@@ -7,12 +7,13 @@
7 7
8#include <qpe/config.h> 8#include <qpe/config.h>
9#include <qpe/qcopenvelope_qws.h> 9#include <qpe/qcopenvelope_qws.h>
10 10
11#include "examplepluginwidget.h" 11#include "examplepluginwidget.h"
12 12
13
13ExamplePluginWidget::ExamplePluginWidget( QWidget *parent, const char* name) 14ExamplePluginWidget::ExamplePluginWidget( QWidget *parent, const char* name)
14 : QWidget(parent, name ) { 15 : QWidget(parent, name ) {
15 16
16 m_exampleLabel = 0l; 17 m_exampleLabel = 0l;
17 m_layout = 0l; 18 m_layout = 0l;
18 19
@@ -20,13 +21,13 @@ ExamplePluginWidget::ExamplePluginWidget( QWidget *parent, const char* name)
20 delete m_exampleLabel; 21 delete m_exampleLabel;
21 } 22 }
22 23
23 // since here a OClickableLabel is used, the plugin part will be clickable, and the actions 24 // since here a OClickableLabel is used, the plugin part will be clickable, and the actions
24 // that should be triggered when clicked are defined in slotClicked() 25 // that should be triggered when clicked are defined in slotClicked()
25 // of course also normal widgets can be used. 26 // of course also normal widgets can be used.
26 m_exampleLabel = new OClickableLabel( this ); 27 m_exampleLabel = new Opie::Ui::OClickableLabel( this );
27 connect( m_exampleLabel, SIGNAL( clicked() ), this, SLOT( slotClicked() ) ); 28 connect( m_exampleLabel, SIGNAL( clicked() ), this, SLOT( slotClicked() ) );
28 29
29 if ( m_layout ) { 30 if ( m_layout ) {
30 delete m_layout; 31 delete m_layout;
31 } 32 }
32 m_layout = new QHBoxLayout( this ); 33 m_layout = new QHBoxLayout( this );
diff --git a/examples/todayplugin/examplepluginwidget.h b/examples/todayplugin/examplepluginwidget.h
index eb3c660..70e717e 100644
--- a/examples/todayplugin/examplepluginwidget.h
+++ b/examples/todayplugin/examplepluginwidget.h
@@ -7,13 +7,13 @@
7 7
8#ifndef EXAMPLE_PLUGIN_WIDGET_H 8#ifndef EXAMPLE_PLUGIN_WIDGET_H
9#define EXAMPLE_PLUGIN_WIDGET_H 9#define EXAMPLE_PLUGIN_WIDGET_H
10 10
11#include <qlayout.h> 11#include <qlayout.h>
12 12
13#include <opie/oclickablelabel.h> 13#include <opie2/oclickablelabel.h>
14 14
15class ExamplePluginWidget : public QWidget { 15class ExamplePluginWidget : public QWidget {
16 16
17 Q_OBJECT 17 Q_OBJECT
18 18
19public: 19public:
@@ -23,13 +23,13 @@ public:
23 void refresh(); 23 void refresh();
24 24
25private slots: 25private slots:
26 void slotClicked(); 26 void slotClicked();
27 27
28private: 28private:
29 OClickableLabel* m_exampleLabel; 29 Opie::Ui::OClickableLabel* m_exampleLabel;
30 QHBoxLayout* m_layout; 30 QHBoxLayout* m_layout;
31 void readConfig(); 31 void readConfig();
32 void getInfo(); 32 void getInfo();
33}; 33};
34 34
35#endif 35#endif