summaryrefslogtreecommitdiff
path: root/examples
authorzecke <zecke>2004-03-14 20:08:59 (UTC)
committer zecke <zecke>2004-03-14 20:08:59 (UTC)
commit0d79c003839718ae70b3b997162044abd5c26bf6 (patch) (unidiff)
tree19708b041da3a09df8f3b571cd634a846f4ad6d7 /examples
parent05c8d999941989a97a581fb5822437034ec10fd7 (diff)
downloadopie-0d79c003839718ae70b3b997162044abd5c26bf6.zip
opie-0d79c003839718ae70b3b997162044abd5c26bf6.tar.gz
opie-0d79c003839718ae70b3b997162044abd5c26bf6.tar.bz2
Update the Examples
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
@@ -3,2 +3,2 @@
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
@@ -12,3 +12,3 @@ DEPENDSPATH += $(OPIEDIR)/include
12 12
13LIBS += -lqpe 13LIBS += -lqpe -lopieui2
14 14
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 +1,9 @@
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>
@@ -4,6 +12,3 @@
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
@@ -73,35 +78,5 @@ void SimpleApplet::paintEvent( QPaintEvent* ) {
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;
@@ -110,53 +85,6 @@ int SimpleAppletImpl::position()const {
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
@@ -19,2 +19,3 @@
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 */
@@ -47,2 +48,3 @@ public:
47 ~SimpleApplet(); 48 ~SimpleApplet();
49 static int position();
48private: 50private:
@@ -53,23 +55,2 @@ private:
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
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
@@ -3,2 +3,2 @@
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
@@ -14,3 +14,3 @@ DEPENDPATH += $(OPIEDIR)/include
14# we now also include opie 14# we now also include opie
15LIBS += -lqpe -lopie 15LIBS += -lqpe -lopieui2
16 16
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
@@ -11,4 +11,4 @@
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
@@ -28,2 +28,4 @@
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> )
@@ -40,3 +42,3 @@ MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl )
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*) ),
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
@@ -8,3 +8,3 @@
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
@@ -23,3 +23,3 @@
23 */ 23 */
24 24using namespace Opie::Core;
25OPIE_EXPORT_APP( OApplicationFactory<Simple> ) 25OPIE_EXPORT_APP( OApplicationFactory<Simple> )
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
@@ -10,3 +10,3 @@
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
@@ -26,2 +26,3 @@
26 26
27using namespace Opie::Core;
27OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) 28OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
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
@@ -3,2 +3,2 @@
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
@@ -14,3 +14,3 @@ DEPENDPATH += $(OPIEDIR)/include
14# we now also include opie 14# we now also include opie
15LIBS += -lqpe -lopie 15LIBS += -lqpe -lopiepim2 -lopieui2
16 16
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
@@ -19,5 +19,5 @@
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
@@ -37,2 +37,3 @@
37 37
38using namespace Opie::Core;
38OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) 39OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
@@ -52,3 +53,3 @@ MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl )
52 */ 53 */
53 m_tab = new OTabWidget(this); 54 m_tab = new Opie::Ui::OTabWidget(this);
54 55
@@ -213,3 +214,3 @@ void MainWindow::slotLoad() {
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}
@@ -278,3 +279,3 @@ void MainWindow::slotShow() {
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 */
@@ -346,3 +347,3 @@ namespace {
346 */ 347 */
347 PIMListViewItem( QListView*, OPimRecord* record ); 348 PIMListViewItem( QListView*, Opie::OPimRecord* record );
348 ~PIMListViewItem(); 349 ~PIMListViewItem();
@@ -352,9 +353,9 @@ namespace {
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 ) {
@@ -367,3 +368,3 @@ namespace {
367 368
368 OPimRecord* PIMListViewItem::record()const { 369 Opie::OPimRecord* PIMListViewItem::record()const {
369 return m_record; 370 return m_record;
@@ -384,3 +385,3 @@ PIMListView::~PIMListView() {
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 */
@@ -388,3 +389,3 @@ void PIMListView::set( OTodoAccess::List list ) {
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 ) {
@@ -392,5 +393,5 @@ void PIMListView::set( OTodoAccess::List list ) {
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() );
@@ -399,3 +400,3 @@ void PIMListView::set( OTodoAccess::List list ) {
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 */
@@ -403,5 +404,5 @@ void PIMListView::set( const OEffectiveEvent::ValueList& lst ) {
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) ) );
@@ -427,3 +428,3 @@ void PIMListView::showCurrentRecord() {
427 428
428QString PIMListView::makeString( const OEffectiveEvent& ev ) { 429QString PIMListView::makeString( const Opie::OEffectiveEvent& ev ) {
429 QString str; 430 QString str;
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
@@ -20,4 +20,4 @@
20 20
21#include <opie/otodoaccess.h> 21#include <opie2/otodoaccess.h>
22#include <opie/odatebookaccess.h> 22#include <opie2/odatebookaccess.h>
23 23
@@ -28,4 +28,8 @@ class QDate;
28class QCopChannel; 28class QCopChannel;
29namespace Opie{
30namespace Ui {
29class OWait; 31class OWait;
30class OTabWidget; 32class OTabWidget;
33}
34}
31 35
@@ -52,3 +56,3 @@ private slots:
52 void slotDate(); 56 void slotDate();
53 void slotShowRecord( const OPimRecord& ); 57 void slotShowRecord( const Opie::OPimRecord& );
54 58
@@ -58,6 +62,6 @@ private:
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;
@@ -67,3 +71,3 @@ private:
67 QCopChannel *m_desktopChannel; 71 QCopChannel *m_desktopChannel;
68 OWait *m_loading; 72 Opie::Ui::OWait *m_loading;
69}; 73};
@@ -82,4 +86,4 @@ public:
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();
@@ -87,6 +91,6 @@ public:
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
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
@@ -6,3 +6,3 @@
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
@@ -22,2 +22,4 @@
22 22
23/* The OApplicationFactory is in Opie::Core */
24using namespace Opie::Core;
23OPIE_EXPORT_APP( OApplicationFactory<Simple> ) 25OPIE_EXPORT_APP( OApplicationFactory<Simple> )
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
@@ -3,3 +3,3 @@
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
@@ -11,3 +11,3 @@ DEPENDPATH += $(OPIEDIR)/include
11 11
12LIBS+= -lqpe -lopie 12LIBS+= -lqpe -lopieui2
13 13
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
@@ -14,4 +14,4 @@
14 14
15#include <opie/todayplugininterface.h> 15#include <opie2/todayplugininterface.h>
16#include <opie/todayconfigwidget.h> 16#include <opie2/todayconfigwidget.h>
17 17
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
@@ -10,3 +10,3 @@
10 10
11#include <opie/todayplugininterface.h> 11#include <opie2/todayplugininterface.h>
12 12
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
@@ -12,2 +12,3 @@
12 12
13
13ExamplePluginWidget::ExamplePluginWidget( QWidget *parent, const char* name) 14ExamplePluginWidget::ExamplePluginWidget( QWidget *parent, const char* name)
@@ -25,3 +26,3 @@ ExamplePluginWidget::ExamplePluginWidget( QWidget *parent, const char* name)
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() ) );
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
@@ -12,3 +12,3 @@
12 12
13#include <opie/oclickablelabel.h> 13#include <opie2/oclickablelabel.h>
14 14
@@ -28,3 +28,3 @@ private slots:
28private: 28private:
29 OClickableLabel* m_exampleLabel; 29 Opie::Ui::OClickableLabel* m_exampleLabel;
30 QHBoxLayout* m_layout; 30 QHBoxLayout* m_layout;