summaryrefslogtreecommitdiff
path: root/core/applets/irdaapplet
authormickeyl <mickeyl>2004-03-01 19:19:37 (UTC)
committer mickeyl <mickeyl>2004-03-01 19:19:37 (UTC)
commitddc3d749af5f7afebf69488b79641771fe246b5b (patch) (side-by-side diff)
tree8ea8614906c568e4677493ef09040724d60dd2d4 /core/applets/irdaapplet
parentfb0981f47e529f9d1dd77fa005ffa3c3ecedff67 (diff)
downloadopie-ddc3d749af5f7afebf69488b79641771fe246b5b.zip
opie-ddc3d749af5f7afebf69488b79641771fe246b5b.tar.gz
opie-ddc3d749af5f7afebf69488b79641771fe246b5b.tar.bz2
remove duplicated boiler plate code in favour of the OTaskbarApplet template
Diffstat (limited to 'core/applets/irdaapplet') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/irdaapplet/irda.cpp17
-rw-r--r--core/applets/irdaapplet/irda.h1
-rw-r--r--core/applets/irdaapplet/irdaapplet.pro14
-rw-r--r--core/applets/irdaapplet/irdaappletimpl.cpp66
-rw-r--r--core/applets/irdaapplet/irdaappletimpl.h45
5 files changed, 23 insertions, 120 deletions
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp
index a47f33d..afc0592 100644
--- a/core/applets/irdaapplet/irda.cpp
+++ b/core/applets/irdaapplet/irda.cpp
@@ -14,15 +14,20 @@
**
**********************************************************************/
+#include "irda.h"
+/* OPIE */
+#include <opie2/otaskbarapplet.h>
#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
+/* QT */
#include <qpainter.h>
#include <qfile.h>
#include <qtimer.h>
#include <qtextstream.h>
+/* STD */
#include <unistd.h>
#include <net/if.h>
#include <netinet/in.h>
@@ -30,8 +35,6 @@
#include <sys/socket.h>
#include <sys/ioctl.h>
-#include "irda.h"
-
//===========================================================================
IrdaApplet::IrdaApplet ( QWidget *parent, const char *name )
@@ -60,6 +63,11 @@ IrdaApplet::IrdaApplet ( QWidget *parent, const char *name )
this, SLOT(slotMessage(const QCString&, const QByteArray& ) ) );
}
+int IrdaApplet::position()
+{
+ return 6;
+}
+
void IrdaApplet::show()
{
QWidget::show ( );
@@ -350,3 +358,8 @@ void IrdaApplet::slotMessage( const QCString& str, const QByteArray& ar ) {
e << list;
}
}
+
+Q_EXPORT_INTERFACE()
+{
+ Q_CREATE_INSTANCE( OTaskbarAppletWrapper<IrdaApplet> );
+}
diff --git a/core/applets/irdaapplet/irda.h b/core/applets/irdaapplet/irda.h
index ec1d32c..f713bbe 100644
--- a/core/applets/irdaapplet/irda.h
+++ b/core/applets/irdaapplet/irda.h
@@ -28,6 +28,7 @@ class IrdaApplet : public QWidget
public:
IrdaApplet( QWidget *parent = 0, const char *name = 0 );
~IrdaApplet();
+ static int position();
virtual void show ( );
diff --git a/core/applets/irdaapplet/irdaapplet.pro b/core/applets/irdaapplet/irdaapplet.pro
index 4e94dfb..31e8691 100644
--- a/core/applets/irdaapplet/irdaapplet.pro
+++ b/core/applets/irdaapplet/irdaapplet.pro
@@ -1,10 +1,10 @@
-TEMPLATE = lib
-CONFIG += qt plugin warn_on release
-HEADERS = irda.h irdaappletimpl.h
-SOURCES = irda.cpp irdaappletimpl.cpp
-TARGET = irdaapplet
-DESTDIR = $(OPIEDIR)/plugins/applets
-INCLUDEPATH += $(OPIEDIR)/include
+TEMPLATE = lib
+CONFIG += qt plugin warn_on release
+HEADERS = irda.h
+SOURCES = irda.cpp
+TARGET = irdaapplet
+DESTDIR = $(OPIEDIR)/plugins/applets
+INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += ../$(OPIEDIR)/include
LIBS += -lqpe
VERSION = 1.0.0
diff --git a/core/applets/irdaapplet/irdaappletimpl.cpp b/core/applets/irdaapplet/irdaappletimpl.cpp
deleted file mode 100644
index 33d98af..0000000
--- a/core/applets/irdaapplet/irdaappletimpl.cpp
+++ b/dev/null
@@ -1,66 +0,0 @@
-/**********************************************************************
-** Copyright (C) 2000 Trolltech AS. All rights reserved.
-**
-** This file is part of Qtopia Environment.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.trolltech.com/gpl/ for GPL licensing information.
-**
-** Contact info@trolltech.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-#include "irda.h"
-#include "irdaappletimpl.h"
-
-
-IrdaAppletImpl::IrdaAppletImpl()
- : irda(0)
-{
-}
-
-IrdaAppletImpl::~IrdaAppletImpl()
-{
- delete irda;
-}
-
-QWidget *IrdaAppletImpl::applet( QWidget *parent )
-{
- if ( !irda )
- irda = new IrdaApplet( parent );
- return irda;
-}
-
-int IrdaAppletImpl::position() const
-{
- return 6;
-}
-
-QRESULT IrdaAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
-{
- *iface = 0;
- if ( uuid == IID_QUnknown )
- *iface = this;
- else if ( uuid == IID_TaskbarApplet )
- *iface = this;
- else
- return QS_FALSE;
-
- if ( *iface )
- (*iface)->addRef();
- return QS_OK;
-}
-
-Q_EXPORT_INTERFACE()
-{
- Q_CREATE_INSTANCE( IrdaAppletImpl )
-}
-
-
diff --git a/core/applets/irdaapplet/irdaappletimpl.h b/core/applets/irdaapplet/irdaappletimpl.h
deleted file mode 100644
index 024cc06..0000000
--- a/core/applets/irdaapplet/irdaappletimpl.h
+++ b/dev/null
@@ -1,45 +0,0 @@
-/**********************************************************************
-** Copyright (C) 2000 Trolltech AS. All rights reserved.
-**
-** This file is part of Qtopia Environment.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.trolltech.com/gpl/ for GPL licensing information.
-**
-** Contact info@trolltech.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-#ifndef IRDAAPPLETIMPL_H
-#define IRDAAPPLETIMPL_H
-
-#include <qwidget.h>
-
-#include <qpe/taskbarappletinterface.h>
-
-class IrdaApplet;
-
-class IrdaAppletImpl : public TaskbarAppletInterface
-{
-public:
- IrdaAppletImpl();
- virtual ~IrdaAppletImpl();
-
- QRESULT queryInterface( const QUuid&, QUnknownInterface** );
- Q_REFCOUNT
-
- virtual QWidget *applet( QWidget *parent );
- virtual int position() const;
-
-private:
- IrdaApplet *irda;
-};
-
-#endif