summaryrefslogtreecommitdiff
path: root/noncore/applets/zkbapplet
authormickeyl <mickeyl>2004-03-01 21:10:13 (UTC)
committer mickeyl <mickeyl>2004-03-01 21:10:13 (UTC)
commit77af6f58d59011e123309c82b684695508a46787 (patch) (side-by-side diff)
tree1eeb3b323bc14581af7da9fe5b58c4c611b00575 /noncore/applets/zkbapplet
parent7b0bdb05e4ae29b2643d73e3b8f20a86a86dcccc (diff)
downloadopie-77af6f58d59011e123309c82b684695508a46787.zip
opie-77af6f58d59011e123309c82b684695508a46787.tar.gz
opie-77af6f58d59011e123309c82b684695508a46787.tar.bz2
remove boiler plate code in favour of a template
Diffstat (limited to 'noncore/applets/zkbapplet') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/zkbapplet/.cvsignore6
-rw-r--r--noncore/applets/zkbapplet/zkbapplet.cpp49
-rw-r--r--noncore/applets/zkbapplet/zkbapplet.h23
-rw-r--r--noncore/applets/zkbapplet/zkbapplet.pro6
-rw-r--r--noncore/applets/zkbapplet/zkbwidget.cpp12
-rw-r--r--noncore/applets/zkbapplet/zkbwidget.h1
6 files changed, 21 insertions, 76 deletions
diff --git a/noncore/applets/zkbapplet/.cvsignore b/noncore/applets/zkbapplet/.cvsignore
new file mode 100644
index 0000000..0f79c04
--- a/dev/null
+++ b/noncore/applets/zkbapplet/.cvsignore
@@ -0,0 +1,6 @@
+Makefile*
+advancedconfigbase.cpp
+advancedconfigbase.h
+moc_*
+.moc
+.obj
diff --git a/noncore/applets/zkbapplet/zkbapplet.cpp b/noncore/applets/zkbapplet/zkbapplet.cpp
deleted file mode 100644
index 6c71568..0000000
--- a/noncore/applets/zkbapplet/zkbapplet.cpp
+++ b/dev/null
@@ -1,49 +0,0 @@
-#include <stdio.h>
-#include <qlabel.h>
-#include <qbutton.h>
-#include <qwindowsystem_qws.h>
-#include "zkbapplet.h"
-#include "zkbwidget.h"
-
-
-ZkbApplet::ZkbApplet() : app(0){
-}
-
-ZkbApplet::~ZkbApplet()
-{
- if (app) delete app;
-}
-
-QWidget* ZkbApplet::applet(QWidget* parent) {
- if (app == 0) {
- app = new ZkbWidget(parent);
- }
-
- return app;
-}
-
-int ZkbApplet::position() const {
- return 8;
-}
-
-QRESULT ZkbApplet::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(ZkbApplet)
-}
diff --git a/noncore/applets/zkbapplet/zkbapplet.h b/noncore/applets/zkbapplet/zkbapplet.h
deleted file mode 100644
index fcf03b5..0000000
--- a/noncore/applets/zkbapplet/zkbapplet.h
+++ b/dev/null
@@ -1,23 +0,0 @@
-#include "qpe/taskbarappletinterface.h"
-
-#ifndef ZKBAPPLET_H
-#define ZKBAPPLET_H
-
-class ZkbWidget;
-
-class ZkbApplet : public TaskbarAppletInterface {
-public:
- ZkbApplet();
- virtual ~ZkbApplet();
-
- QRESULT queryInterface(const QUuid&, QUnknownInterface**);
- Q_REFCOUNT
-
- virtual QWidget* applet(QWidget*);
- virtual int position() const;
-
-protected:
- ZkbWidget* app;
-};
-
-#endif
diff --git a/noncore/applets/zkbapplet/zkbapplet.pro b/noncore/applets/zkbapplet/zkbapplet.pro
index 22615d0..8cc1b58 100644
--- a/noncore/applets/zkbapplet/zkbapplet.pro
+++ b/noncore/applets/zkbapplet/zkbapplet.pro
@@ -1,13 +1,11 @@
TEMPLATE = lib
CONFIG += qt plugin warn_on release
-HEADERS = zkbapplet.h\
- zkbwidget.h \
+HEADERS = zkbwidget.h \
../../apps/keyz-cfg/zkbcfg.h \
../../apps/keyz-cfg/zkbnames.h \
../../apps/keyz-cfg/zkbxml.h \
../../apps/keyz-cfg/zkb.h
-SOURCES = zkbapplet.cpp \
- zkbwidget.cpp \
+SOURCES = zkbwidget.cpp \
../../apps/keyz-cfg/zkbcfg.cpp \
../../apps/keyz-cfg/zkbnames.cpp \
../../apps/keyz-cfg/zkbxml.cpp \
diff --git a/noncore/applets/zkbapplet/zkbwidget.cpp b/noncore/applets/zkbapplet/zkbwidget.cpp
index 05a76e7..0b5ab78 100644
--- a/noncore/applets/zkbapplet/zkbwidget.cpp
+++ b/noncore/applets/zkbapplet/zkbwidget.cpp
@@ -1,3 +1,4 @@
+#include <opie2/otaskbarapplet.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/applnk.h>
#include <qpe/qpeapplication.h>
@@ -26,6 +27,11 @@ ZkbWidget::ZkbWidget(QWidget* parent):QLabel(parent),keymap(0),
ZkbWidget::~ZkbWidget() {
}
+int ZkbWidget::position()
+{
+ return 8;
+}
+
bool ZkbWidget::loadKeymap() {
ZkbConfig c(QPEApplication::qpeDir()+"/share/zkb");
QFontMetrics fm(font());
@@ -148,3 +154,9 @@ void ZkbWidget::reload() {
loadKeymap();
QCopEnvelope("QPE/System", "notBusy()");
}
+
+Q_EXPORT_INTERFACE()
+{
+ Q_CREATE_INSTANCE( OTaskbarAppletWrapper<ZkbWidget> );
+}
+
diff --git a/noncore/applets/zkbapplet/zkbwidget.h b/noncore/applets/zkbapplet/zkbwidget.h
index a943563..7c67794 100644
--- a/noncore/applets/zkbapplet/zkbwidget.h
+++ b/noncore/applets/zkbapplet/zkbwidget.h
@@ -15,6 +15,7 @@ Q_OBJECT
public:
ZkbWidget(QWidget* parent);
~ZkbWidget();
+ static int position();
QSize sizeHint() const;