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) (side-by-side diff)
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 @@
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES
+ 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
-LIBS += -lqpe
+LIBS += -lqpe -lopieui2
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 @@
+
+#include "simpleimpl.h"
+
+#include <opie2/otaskbarapplet.h>
+
+#include <qpe/applnk.h> // for AppLnk
+#include <qpe/resource.h> // for Resource loading
+
#include <qlabel.h>
@@ -4,6 +12,3 @@
-#include <qpe/applnk.h> // for AppLnk
-#include <qpe/resource.h> // for Resource loading
-#include "simpleimpl.h"
@@ -73,35 +78,5 @@ void SimpleApplet::paintEvent( QPaintEvent* ) {
/*
- * Here comes the implementation of the interface
+ * We need to add this symbol for the plugin exporter!
*/
-SimpleAppletImpl::SimpleAppletImpl() {
-}
-/* needed cause until it is only pure virtual */
-SimpleAppletImpl::~SimpleAppletImpl() {
- /*
- * we will delete our applets as well
- * setAUtoDelete makes the QList free
- * the objects behind the pointers
- */
- m_applets.setAutoDelete( true );
- m_applets.clear();
-}
-
-/*
- * For the taskbar interface return a Widget
- */
-QWidget* SimpleAppletImpl::applet( QWidget* parent ) {
- /*
- * There are problems with ownership. So we add
- * our ownlist and clear this;
- */
- SimpleApplet* ap = new SimpleApplet( parent );
- m_applets.append( ap );
-
- return ap;
-}
-
-/*
- * A small hint where the Applet Should be displayed
- */
-int SimpleAppletImpl::position()const {
+int SimpleApplet::position(){
return 1;
@@ -110,53 +85,6 @@ int SimpleAppletImpl::position()const {
-/*
- * Now the important QUnkownInterface method without
- * this one your applet won't load
- * @param uuid The uuid of the interface
- * @param iface The pointer to the interface ptr
- */
-QRESULT SimpleAppletImpl::queryInterface( const QUuid& uuid, QUnknownInterface** iface) {
- /* set the pointer to the interface to 0 */
- *iface = 0;
-
- /*
- * we check if we support the requested interface
- * and then assign to the pointer.
- * You may alos create another interface here so
- * *iface = this is only in this simple case true you
- * could also support more interfaces.
- * But this example below is the most common use.
- * Now the caller knows that the Interface Pointer
- * is valid and the interface supported
- */
- if ( uuid == IID_QUnknown )
- *iface = this;
- else if ( uuid == IID_TaskbarApplet )
- *iface = this;
- else
- return QS_FALSE;
-
- if ( *iface )
- (*iface)->addRef();
-
- return QS_OK;
-}
-
/*
- * Finally we need to export the Interface.
- * CREATE_INSTANCE creates a interface and calls
- * queryInterface for the QUnknownInterface once
- * With out this function the applet can't be loaded.
- *
- * NOTE: If your applet does not load it's likely you've an
- * unresolved symbol. Change the .pro TEMPLATE = lib to TEMPLATE= app
- * and recompile. If the linker only complains about a missing
- * main method the problem is more complex. In most cases it'll say
- * you which symbols are missing and you can implement them.
- * The main(int argc, char* argv[] ) does not need to be
- * included in a library so it's ok that the linker complains
+ * Here comes the implementation of the interface
*/
-Q_EXPORT_INTERFACE() {
- Q_CREATE_INSTANCE( SimpleAppletImpl )
-}
-
+EXPORT_OPIE_APPLET_v1( SimpleApplet ) \ No newline at end of file
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 @@
* As example we will use the Taskbar interface
+ * the OTaskBarAppletWrapper implements the factory for us
*/
@@ -47,2 +48,3 @@ public:
~SimpleApplet();
+ static int position();
private:
@@ -53,23 +55,2 @@ private:
-class SimpleAppletImpl : public TaskbarAppletInterface {
-public:
-
- SimpleAppletImpl();
- virtual ~SimpleAppletImpl();
-
- QRESULT queryInterface( const QUuid&, QUnknownInterface** );
-
- QWidget *applet( QWidget* parent );
- int position()const;
-
- /*
- * macro for reference countint
- * if reference drops to zero
- * delete this is called
- */
- Q_REFCOUNT
-
-private:
- QList<SimpleApplet> m_applets;
-};
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 @@
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES && LIBOPIE
+ 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
# we now also include opie
-LIBS += -lqpe -lopie
+LIBS += -lqpe -lopieui2
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 @@
-#include <opie/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching
-#include <opie/otabwidget.h>
+#include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching
+#include <opie2/otabwidget.h>
@@ -28,2 +28,4 @@
+/* The OApplicationFactory is in the Opie::Core namespace */
+using namespace Opie::Core;
OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
@@ -40,3 +42,3 @@ MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl )
*/
- OTabWidget *tab = new OTabWidget(this);
+ Opie::Ui::OTabWidget *tab = new Opie::Ui::OTabWidget(this);
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 @@
-#include <opie/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching
+#include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching
@@ -23,3 +23,3 @@
*/
-
+using namespace Opie::Core;
OPIE_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 @@
-#include <opie/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching
+#include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching
@@ -26,2 +26,3 @@
+using namespace Opie::Core;
OPIE_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 @@
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
@@ -14,3 +14,3 @@ DEPENDPATH += $(OPIEDIR)/include
# we now also include opie
-LIBS += -lqpe -lopie
+LIBS += -lqpe -lopiepim2 -lopieui2
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 @@
-#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>
@@ -37,2 +37,3 @@
+using namespace Opie::Core;
OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
@@ -52,3 +53,3 @@ MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl )
*/
- m_tab = new OTabWidget(this);
+ m_tab = new Opie::Ui::OTabWidget(this);
@@ -213,3 +214,3 @@ void MainWindow::slotLoad() {
/* we will provide a wait scrren */
- m_loading = new OWait(this, "wait screen" );
+ m_loading = new Opie::Ui::OWait(this, "wait screen" );
}
@@ -278,3 +279,3 @@ 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 */
@@ -346,3 +347,3 @@ namespace {
*/
- PIMListViewItem( QListView*, OPimRecord* record );
+ PIMListViewItem( QListView*, Opie::OPimRecord* record );
~PIMListViewItem();
@@ -352,9 +353,9 @@ namespace {
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 ) {
@@ -367,3 +368,3 @@ namespace {
- OPimRecord* PIMListViewItem::record()const {
+ Opie::OPimRecord* PIMListViewItem::record()const {
return m_record;
@@ -384,3 +385,3 @@ PIMListView::~PIMListView() {
-void PIMListView::set( OTodoAccess::List list ) {
+void PIMListView::set( Opie::OPimTodoAccess::List list ) {
/* clear first and then add new items */
@@ -388,3 +389,3 @@ void PIMListView::set( OTodoAccess::List list ) {
- OTodoAccess::List::Iterator it;
+ Opie::OPimTodoAccess::List::Iterator it;
for (it = list.begin(); it != list.end(); ++it ) {
@@ -392,5 +393,5 @@ void PIMListView::set( OTodoAccess::List list ) {
* 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() );
@@ -399,3 +400,3 @@ void PIMListView::set( OTodoAccess::List list ) {
-void PIMListView::set( const OEffectiveEvent::ValueList& lst ) {
+void PIMListView::set( const Opie::OEffectiveEvent::ValueList& lst ) {
/* clear first and then add items */
@@ -403,5 +404,5 @@ void PIMListView::set( const OEffectiveEvent::ValueList& lst ) {
- 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) ) );
@@ -427,3 +428,3 @@ void PIMListView::showCurrentRecord() {
-QString PIMListView::makeString( const OEffectiveEvent& ev ) {
+QString PIMListView::makeString( const Opie::OEffectiveEvent& ev ) {
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 @@
-#include <opie/otodoaccess.h>
-#include <opie/odatebookaccess.h>
+#include <opie2/otodoaccess.h>
+#include <opie2/odatebookaccess.h>
@@ -28,4 +28,8 @@ class QDate;
class QCopChannel;
+namespace Opie{
+namespace Ui {
class OWait;
class OTabWidget;
+}
+}
@@ -52,3 +56,3 @@ private slots:
void slotDate();
- void slotShowRecord( const OPimRecord& );
+ void slotShowRecord( const Opie::OPimRecord& );
@@ -58,6 +62,6 @@ private:
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;
@@ -67,3 +71,3 @@ private:
QCopChannel *m_desktopChannel;
- OWait *m_loading;
+ Opie::Ui::OWait *m_loading;
};
@@ -82,4 +86,4 @@ public:
- void set( OTodoAccess::List );
- void set( const OEffectiveEvent::ValueList& );
+ void set( Opie::OPimTodoAccess::List );
+ void set( const Opie::OEffectiveEvent::ValueList& );
void showCurrentRecord();
@@ -87,6 +91,6 @@ public:
signals:
- void showRecord( const OPimRecord& );
+ void showRecord( const Opie::OPimRecord& );
private:
- static QString makeString( const OEffectiveEvent& ev );
+ static QString makeString( const Opie::OEffectiveEvent& ev );
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 @@
-#include <opie/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching
+#include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching
@@ -22,2 +22,4 @@
+/* The OApplicationFactory is in Opie::Core */
+using namespace Opie::Core;
OPIE_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 @@
default "n"
- depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES && LIBOPIEUI2
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
-LIBS+= -lqpe -lopie
+LIBS+= -lqpe -lopieui2
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 @@
-#include <opie/todayplugininterface.h>
-#include <opie/todayconfigwidget.h>
+#include <opie2/todayplugininterface.h>
+#include <opie2/todayconfigwidget.h>
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 @@
-#include <opie/todayplugininterface.h>
+#include <opie2/todayplugininterface.h>
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 @@
+
ExamplePluginWidget::ExamplePluginWidget( QWidget *parent, const char* name)
@@ -25,3 +26,3 @@ ExamplePluginWidget::ExamplePluginWidget( QWidget *parent, const char* name)
// of course also normal widgets can be used.
- m_exampleLabel = new OClickableLabel( this );
+ m_exampleLabel = new Opie::Ui::OClickableLabel( this );
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 @@
-#include <opie/oclickablelabel.h>
+#include <opie2/oclickablelabel.h>
@@ -28,3 +28,3 @@ private slots:
private:
- OClickableLabel* m_exampleLabel;
+ Opie::Ui::OClickableLabel* m_exampleLabel;
QHBoxLayout* m_layout;