summaryrefslogtreecommitdiff
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
parent7b0bdb05e4ae29b2643d73e3b8f20a86a86dcccc (diff)
downloadopie-77af6f58d59011e123309c82b684695508a46787.zip
opie-77af6f58d59011e123309c82b684695508a46787.tar.gz
opie-77af6f58d59011e123309c82b684695508a46787.tar.bz2
remove boiler plate code in favour of a template
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/applets/autorotateapplet/autorotate.cpp11
-rw-r--r--noncore/applets/autorotateapplet/autorotate.h3
-rw-r--r--noncore/applets/autorotateapplet/autorotateapplet.pro4
-rw-r--r--noncore/applets/autorotateapplet/autorotateimpl.cpp42
-rw-r--r--noncore/applets/autorotateapplet/autorotateimpl.h18
-rw-r--r--noncore/applets/memoryapplet/memoryapplet.pro4
-rw-r--r--noncore/applets/memoryapplet/memoryappletimpl.cpp65
-rw-r--r--noncore/applets/memoryapplet/memoryappletimpl.h43
-rw-r--r--noncore/applets/memoryapplet/memorymeter.cpp14
-rw-r--r--noncore/applets/memoryapplet/memorymeter.h1
-rw-r--r--noncore/applets/notesapplet/notes.cpp10
-rw-r--r--noncore/applets/notesapplet/notes.h1
-rw-r--r--noncore/applets/notesapplet/notesapplet.pro8
-rw-r--r--noncore/applets/notesapplet/notesappletimpl.cpp53
-rw-r--r--noncore/applets/notesapplet/notesappletimpl.h35
-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
21 files changed, 61 insertions, 348 deletions
diff --git a/noncore/applets/autorotateapplet/autorotate.cpp b/noncore/applets/autorotateapplet/autorotate.cpp
index 5152904..94be0ae 100644
--- a/noncore/applets/autorotateapplet/autorotate.cpp
+++ b/noncore/applets/autorotateapplet/autorotate.cpp
@@ -1,61 +1,67 @@
/*
* copyright : (c) 2003 by Greg Gilbert
* email : greg@treke.net
* based on the cardmon applet by Max Reiss
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
*************************************************************************/
#include "autorotate.h"
/* OPIE */
#include <opie2/odevice.h>
+#include <opie2/otaskbarapplet.h>
#include <qpe/applnk.h>
#include <qpe/config.h>
#include <qpe/resource.h>
/* QT */
#include <qpainter.h>
using namespace Opie;
AutoRotate::AutoRotate(QWidget * parent):QWidget(parent)
{
setFixedWidth( AppLnk::smallIconSize() );
setFixedHeight( AppLnk::smallIconSize() );
enabledPm.convertFromImage( Resource::loadImage("autorotate/rotate").smoothScale( height(), width() ) );
disabledPm.convertFromImage( Resource::loadImage("autorotate/norotate").smoothScale( height(), width() ) );
repaint(true);
popupMenu = 0;
show();
}
AutoRotate::~AutoRotate()
{
if (popupMenu) {
delete popupMenu;
}
}
+int AutoRotate::position()
+{
+ return 7;
+}
+
void AutoRotate::mousePressEvent(QMouseEvent *)
{
QPopupMenu *menu = new QPopupMenu(this);
menu->insertItem( isRotateEnabled()? "Disable Rotation" : "Enable Rotation" ,1 );
QPoint p = mapToGlobal(QPoint(0, 0));
QSize s = menu->sizeHint();
int opt = menu->exec(QPoint(p.x() + (width() / 2) - (s.width() / 2), p.y() - s.height()), 0);
if (opt==1)
{
setRotateEnabled( !isRotateEnabled() );
repaint(true);
}
delete menu;
@@ -75,16 +81,21 @@ void AutoRotate::setRotateEnabled(bool status)
}
bool AutoRotate::isRotateEnabled()
{
Config cfg( "qpe" );
cfg.setGroup( "Appearance" );
bool res = cfg.readBoolEntry( "rotateEnabled" );
if (res )
qDebug("Enabled");
else
qDebug("Disabled");
return res;
}
+Q_EXPORT_INTERFACE()
+{
+ Q_CREATE_INSTANCE( OTaskbarAppletWrapper<AutoRotate> );
+}
+
diff --git a/noncore/applets/autorotateapplet/autorotate.h b/noncore/applets/autorotateapplet/autorotate.h
index e05e7a0..ef322a6 100644
--- a/noncore/applets/autorotateapplet/autorotate.h
+++ b/noncore/applets/autorotateapplet/autorotate.h
@@ -9,33 +9,32 @@
* (at your option) any later version. *
* *
*************************************************************************/
#ifndef AUTOROTATE_H
#define AUTOROTATE_H
#include <qwidget.h>
#include <qpixmap.h>
#include <qpopupmenu.h>
class AutoRotate : public QWidget {
Q_OBJECT
public:
AutoRotate( QWidget *parent = 0 );
~AutoRotate();
-
-private slots:
+ static int position();
protected:
void paintEvent( QPaintEvent* );
void mousePressEvent( QMouseEvent * );
private:
bool isRotateEnabled();
void setRotateEnabled(bool);
QPixmap enabledPm;
QPixmap disabledPm;
void iconShow();
QPopupMenu *popupMenu;
};
#endif
diff --git a/noncore/applets/autorotateapplet/autorotateapplet.pro b/noncore/applets/autorotateapplet/autorotateapplet.pro
index 0ccbeba..465b165 100644
--- a/noncore/applets/autorotateapplet/autorotateapplet.pro
+++ b/noncore/applets/autorotateapplet/autorotateapplet.pro
@@ -1,13 +1,13 @@
TEMPLATE = lib
CONFIG += qt plugin warn_on release
-HEADERS = autorotate.h autorotateimpl.h
-SOURCES = autorotate.cpp autorotateimpl.cpp
+HEADERS = autorotate.h
+SOURCES = autorotate.cpp
TARGET = autorotateapplet
DESTDIR = $(OPIEDIR)/plugins/applets
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include ../launcher
LIBS += -lqpe -lopiecore2
VERSION = 1.0.0
include ( $(OPIEDIR)/include.pro )
target.path = $$prefix/plugins/applets
diff --git a/noncore/applets/autorotateapplet/autorotateimpl.cpp b/noncore/applets/autorotateapplet/autorotateimpl.cpp
deleted file mode 100644
index 305ac50..0000000
--- a/noncore/applets/autorotateapplet/autorotateimpl.cpp
+++ b/dev/null
@@ -1,42 +0,0 @@
-#include "autorotate.h"
-#include "autorotateimpl.h"
-
-
-AutoRotateImpl::AutoRotateImpl()
- : autoRotate(0){
- qDebug ("here");
-}
-
-AutoRotateImpl::~AutoRotateImpl() {
- delete autoRotate;
-}
-
-QWidget *AutoRotateImpl::applet( QWidget *parent ) {
- if ( !autoRotate ) {
- autoRotate = new AutoRotate( parent );
- }
- return autoRotate;
-}
-
-int AutoRotateImpl::position() const {
- return 7;
-}
-
-QRESULT AutoRotateImpl::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( AutoRotateImpl )
-}
diff --git a/noncore/applets/autorotateapplet/autorotateimpl.h b/noncore/applets/autorotateapplet/autorotateimpl.h
deleted file mode 100644
index fde23a9..0000000
--- a/noncore/applets/autorotateapplet/autorotateimpl.h
+++ b/dev/null
@@ -1,18 +0,0 @@
-#include <qpe/taskbarappletinterface.h>
-
-class AutoRotate;
-
-class AutoRotateImpl : public TaskbarAppletInterface {
-public:
- AutoRotateImpl();
- virtual ~AutoRotateImpl();
-
- QRESULT queryInterface( const QUuid&, QUnknownInterface** );
- Q_REFCOUNT
-
- virtual QWidget *applet( QWidget *parent );
- virtual int position() const;
-
-private:
- AutoRotate *autoRotate;
-};
diff --git a/noncore/applets/memoryapplet/memoryapplet.pro b/noncore/applets/memoryapplet/memoryapplet.pro
index 6031386..3cd7839 100644
--- a/noncore/applets/memoryapplet/memoryapplet.pro
+++ b/noncore/applets/memoryapplet/memoryapplet.pro
@@ -1,24 +1,22 @@
TEMPLATE = lib
CONFIG += qt plugin warn_on release
HEADERS = ../../settings/sysinfo/graph.h \
../../settings/sysinfo/load.h \
../../settings/sysinfo/memory.h \
- memoryappletimpl.h \
memorymeter.h \
memorystatus.h \
swapfile.h
SOURCES = ../../settings/sysinfo/graph.cpp \
../../settings/sysinfo/load.cpp \
../../settings/sysinfo/memory.cpp \
- memoryappletimpl.cpp \
memorymeter.cpp \
memorystatus.cpp \
swapfile.cpp
TARGET = memoryapplet
DESTDIR = $(OPIEDIR)/plugins/applets
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += ../$(OPIEDIR)/include
VERSION = 1.0.0
-LIBS += -lqpe -lopieui2
+LIBS += -lqpe -lopiecore2 -lopieui2
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/applets/memoryapplet/memoryappletimpl.cpp b/noncore/applets/memoryapplet/memoryappletimpl.cpp
deleted file mode 100644
index a117e7f..0000000
--- a/noncore/applets/memoryapplet/memoryappletimpl.cpp
+++ b/dev/null
@@ -1,65 +0,0 @@
-/**********************************************************************
-** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
-**
-** This file is part of the 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 "memorymeter.h"
-#include "memoryappletimpl.h"
-
-MemoryAppletImpl::MemoryAppletImpl()
- : memory(0)
-{
-}
-
-MemoryAppletImpl::~MemoryAppletImpl()
-{
- delete memory;
-}
-
-QWidget *MemoryAppletImpl::applet( QWidget *parent )
-{
- if ( !memory )
- memory = new MemoryMeter( parent );
-
- return memory;
-}
-
-int MemoryAppletImpl::position() const
-{
- return 8;
-}
-
-QRESULT MemoryAppletImpl::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;
-
- (*iface)->addRef();
-
- return QS_OK;
-}
-
-Q_EXPORT_INTERFACE()
-{
- Q_CREATE_INSTANCE( MemoryAppletImpl )
-}
-
diff --git a/noncore/applets/memoryapplet/memoryappletimpl.h b/noncore/applets/memoryapplet/memoryappletimpl.h
deleted file mode 100644
index 2db7dbe..0000000
--- a/noncore/applets/memoryapplet/memoryappletimpl.h
+++ b/dev/null
@@ -1,43 +0,0 @@
-/**********************************************************************
-** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
-**
-** This file is part of the 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 MEMORYAPPLETIMPL_H
-#define MEMORYAPPLETIMPL_H
-
-#include <qtopia/taskbarappletinterface.h>
-
-class MemoryMeter;
-
-class /*QTOPIA_PLUGIN_EXPORT*/ MemoryAppletImpl : public TaskbarAppletInterface
-{
-public:
- MemoryAppletImpl();
- virtual ~MemoryAppletImpl();
-
- QRESULT queryInterface( const QUuid&, QUnknownInterface** );
- Q_REFCOUNT
-
- virtual QWidget *applet( QWidget *parent );
- virtual int position() const;
-
-private:
- MemoryMeter *memory;
-};
-
-#endif
diff --git a/noncore/applets/memoryapplet/memorymeter.cpp b/noncore/applets/memoryapplet/memorymeter.cpp
index 54b5c52..9299f49 100644
--- a/noncore/applets/memoryapplet/memorymeter.cpp
+++ b/noncore/applets/memoryapplet/memorymeter.cpp
@@ -7,38 +7,36 @@
** 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 "memorymeter.h"
#include "memorystatus.h"
+#include <opie2/otaskbarapplet.h>
#include <qtopia/power.h>
#include <qtopia/config.h>
-
-#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
#include <qtopia/qcopenvelope_qws.h>
-#endif
#include <qpainter.h>
#include <qtimer.h>
#include <qapplication.h>
#include <qtopia/applnk.h>
MemoryMeter::MemoryMeter( QWidget *parent )
: QWidget( parent ), memoryView(0)
{
bvsz = QSize();
if ( qApp->desktop()->height() >= 300 )
{
memoryView = new MemoryStatus( 0, WStyle_StaysOnTop | WType_Popup );
memoryView->setFrameStyle( QFrame::Panel | QFrame::Raised );
}
@@ -53,32 +51,37 @@ MemoryMeter::MemoryMeter( QWidget *parent )
low = config.readNumEntry("low", 40);
critical = config.readNumEntry("critical", 20);
startTimer( 10000 );
setFixedWidth(10);
setFixedHeight(AppLnk::smallIconSize());
usageTimer = new QTimer( this );
connect( usageTimer, SIGNAL(timeout()), this, SLOT(usageTimeout()) );
timerEvent(0);
}
MemoryMeter::~MemoryMeter()
{
delete (QWidget *) memoryView;
}
+int MemoryMeter::position()
+{
+ return 7;
+}
+
QSize MemoryMeter::sizeHint() const
{
return QSize(10, AppLnk::smallIconSize());
}
bool MemoryMeter::updateMemoryViewGeometry()
{
if (memoryView != 0)
{
QSize sz = memoryView->sizeHint();
if ( sz != bvsz )
{
bvsz = sz;
QRect r(memoryView->pos(), memoryView->sizeHint());
if ( qApp->desktop()->height() >= 300 )
{
@@ -224,16 +227,21 @@ void MemoryMeter::paintEvent( QPaintEvent* )
{
int unused_offset = used_height + batt_yoffset;
int unused_height = batt_height - used_height;
p.setPen(NoPen);
p.setBrush(c);
p.drawRect(batt_xoffset, unused_offset, band_width, unused_height);
p.drawRect(batt_xoffset + 2 * band_width, unused_offset, band_width, unused_height);
p.setBrush(lightc);
p.drawRect(batt_xoffset + band_width, unused_offset, band_width, unused_height);
p.setBrush(darkc);
p.drawRect(batt_xoffset + 3 * band_width, unused_offset, band_width, unused_height);
}
}
+Q_EXPORT_INTERFACE()
+{
+ Q_CREATE_INSTANCE( OTaskbarAppletWrapper<MemoryMeter> );
+}
+
diff --git a/noncore/applets/memoryapplet/memorymeter.h b/noncore/applets/memoryapplet/memorymeter.h
index 0f3cb0b..ed541f0 100644
--- a/noncore/applets/memoryapplet/memorymeter.h
+++ b/noncore/applets/memoryapplet/memorymeter.h
@@ -18,32 +18,33 @@
**
**********************************************************************/
#ifndef MEMORY_H
#define MEMORY_H
#include <qwidget.h>
class MemoryStatus;
class QTimer;
class MemoryMeter : public QWidget
{
Q_OBJECT
public:
MemoryMeter( QWidget *parent = 0 );
~MemoryMeter();
+ static int position();
QSize sizeHint() const;
MemoryStatus* memoryView;
protected:
void timerEvent( QTimerEvent * );
void paintEvent( QPaintEvent* );
void mousePressEvent( QMouseEvent * );
protected slots:
void usageTimeout();
protected:
QTimer *usageTimer;
int percent, low, critical;
QSize bvsz;
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp
index 7b8bdd9..1142028 100644
--- a/noncore/applets/notesapplet/notes.cpp
+++ b/noncore/applets/notesapplet/notes.cpp
@@ -6,32 +6,33 @@
** 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.
**
**********************************************************************/
#include "notes.h"
#include <qapplication.h>
#include <stdlib.h>
#include <qstringlist.h>
+#include <opie2/otaskbarapplet.h>
#include <qpe/filemanager.h>
#include <qpe/qpeapplication.h>
#include <qpe/timestring.h>
#include <qpe/applnk.h>
#include <qpe/ir.h>
#include <qpe/config.h>
// #include <qsocket.h>
// #include <qclipboard.h>
#include <qmultilineedit.h>
#include <qlistbox.h>
#include <qpopupmenu.h>
#include <qmessagebox.h>
#include <qdir.h>
#include <qfile.h>
@@ -453,32 +454,37 @@ void NotesControl::slotSearch() {
// QWidget::keyReleaseEvent(e);
// }
//===========================================================================
NotesApplet::NotesApplet( QWidget *parent, const char *name )
: QWidget( parent, name ) {
setFixedHeight( 18 );
setFixedWidth( 14 );
vc = new NotesControl;
}
NotesApplet::~NotesApplet() {
delete vc;
}
+int NotesApplet::position()
+{
+ return 6;
+}
+
void NotesApplet::mousePressEvent( QMouseEvent *) {
if( !vc->isHidden()) {
vc->doPopulate=false;
vc->save();
vc->close();
} else {
// vc = new NotesControl;
// QPoint curPos = mapToGlobal( rect().topLeft() );
if(vc->showMax) {
qDebug("show max");
vc->showMaximized();
} else {
qDebug("no show max");
QWidget *wid = QPEApplication::desktop();
QRect rect = QApplication::desktop()->geometry();
vc->setGeometry( ( wid->width() / 2) - ( vc->width() / 2 ) , 28 , wid->width() -10 , 180);
@@ -489,16 +495,20 @@ void NotesApplet::mousePressEvent( QMouseEvent *) {
vc->doPopulate=true;
vc->populateBox();
vc->doPopulate=false;
vc->loaded=false;
vc->load();
// this->setFocus();
vc->view->setFocus();
}
}
void NotesApplet::paintEvent( QPaintEvent* ) {
QPainter p(this);
p.drawPixmap( 0, 1, ( const char** ) notes_xpm );
}
+Q_EXPORT_INTERFACE()
+{
+ Q_CREATE_INSTANCE( OTaskbarAppletWrapper<NotesApplet> );
+}
diff --git a/noncore/applets/notesapplet/notes.h b/noncore/applets/notesapplet/notes.h
index 08253cb..ed1f98c 100644
--- a/noncore/applets/notesapplet/notes.h
+++ b/noncore/applets/notesapplet/notes.h
@@ -63,31 +63,32 @@ private slots:
void slotDeleteButtonClicked();
void slotNewButton();
void boxPressed(int, QListBoxItem *, const QPoint&);
void showMenu();
void loadDoc( const DocLnk &);
void slotViewEdited();
void slotBoxSelected(const QString &);
// void keyReleaseEvent( QKeyEvent *);
};
class NotesApplet : public QWidget {
Q_OBJECT
public:
NotesApplet( QWidget *parent = 0, const char *name=0 );
~NotesApplet();
+ static int position();
NotesControl *vc;
public slots:
private:
void mousePressEvent( QMouseEvent * );
void paintEvent( QPaintEvent* );
private:
QPixmap notesPixmap;
private slots:
};
#endif // __NOTES_APPLET_H__
diff --git a/noncore/applets/notesapplet/notesapplet.pro b/noncore/applets/notesapplet/notesapplet.pro
index 3075948..38ba184 100644
--- a/noncore/applets/notesapplet/notesapplet.pro
+++ b/noncore/applets/notesapplet/notesapplet.pro
@@ -1,16 +1,12 @@
TEMPLATE = lib
CONFIG += qt plugin warn_on release
-HEADERS = notes.h notesappletimpl.h
-SOURCES = notes.cpp notesappletimpl.cpp
+HEADERS = notes.h
+SOURCES = notes.cpp
TARGET = notesapplet
DESTDIR = $(OPIEDIR)/plugins/applets
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe
VERSION = 1.0.0
-MOC_DIR=opieobj
-OBJECTS_DIR=opieobj
-
-
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/applets/notesapplet/notesappletimpl.cpp b/noncore/applets/notesapplet/notesappletimpl.cpp
deleted file mode 100644
index 8a9da7f..0000000
--- a/noncore/applets/notesapplet/notesappletimpl.cpp
+++ b/dev/null
@@ -1,53 +0,0 @@
-/**********************************************************************
-** Copyright (C) 2002 L.J. Potter <llornkcor@handhelds.org>
-**
-**
-** 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.
-**
-**
-**********************************************************************/
-#include "notes.h"
-#include "notesappletimpl.h"
-
-
-NotesAppletImpl::NotesAppletImpl()
- : notes(0){
-}
-
-NotesAppletImpl::~NotesAppletImpl() {
- // not needed though cause we should have a valid parent
- delete notes;
-}
-
-QWidget *NotesAppletImpl::applet( QWidget *parent ) {
- if ( !notes )
- notes = new NotesApplet( parent );
- return notes;
-}
-
-int NotesAppletImpl::position() const {
- return 6;
-}
-
-QRESULT NotesAppletImpl::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( NotesAppletImpl )
-}
-
-
diff --git a/noncore/applets/notesapplet/notesappletimpl.h b/noncore/applets/notesapplet/notesappletimpl.h
deleted file mode 100644
index a87118c..0000000
--- a/noncore/applets/notesapplet/notesappletimpl.h
+++ b/dev/null
@@ -1,35 +0,0 @@
-/**********************************************************************
-** Copyright (C) 2002 L.J. Potter <llornkcor@handhelds.org>
-**
-**
-** 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.
-**
-**
-**********************************************************************/
-#ifndef NOTESAPPLETIMPL_H
-#define NOTESAPPLETIMPL_H
-
-#include <qpe/taskbarappletinterface.h>
-
-class NotesApplet;
-
-class NotesAppletImpl : public TaskbarAppletInterface
-{
-public:
- NotesAppletImpl();
- virtual ~NotesAppletImpl();
-
- QRESULT queryInterface( const QUuid&, QUnknownInterface** );
- Q_REFCOUNT
-
- virtual QWidget *applet( QWidget *parent );
- virtual int position() const;
-
-private:
- NotesApplet *notes;
-};
-
-#endif
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,22 +1,20 @@
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 \
../../apps/keyz-cfg/zkb.cpp
TARGET = zkbapplet
DESTDIR = $(OPIEDIR)/plugins/applets
INCLUDEPATH += $(OPIEDIR)/include ../../apps/keyz-cfg
DEPENDPATH += ../$(OPIEDIR)/include
VERSION = 0.6.0
LIBS += -lqpe
include ( $(OPIEDIR)/include.pro )
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,44 +1,50 @@
+#include <opie2/otaskbarapplet.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/applnk.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <stdio.h>
#include <unistd.h>
#include "zkbwidget.h"
#include "zkbcfg.h"
ZkbWidget::ZkbWidget(QWidget* parent):QLabel(parent),keymap(0),
disabled(Resource::loadPixmap("zkb-disabled")) {
labels = new QPopupMenu();
connect(labels, SIGNAL(activated(int)), this,
SLOT(labelChanged(int)));
loadKeymap();
channel = new QCopChannel("QPE/zkb", this);
connect(channel, SIGNAL(received(const QCString&, const QByteArray&)),
this, SLOT(signalReceived(const QCString&, const QByteArray&)));
setFixedWidth ( AppLnk::smallIconSize() );
setFixedHeight ( AppLnk::smallIconSize() );
}
ZkbWidget::~ZkbWidget() {
}
+int ZkbWidget::position()
+{
+ return 8;
+}
+
bool ZkbWidget::loadKeymap() {
ZkbConfig c(QPEApplication::qpeDir()+"/share/zkb");
QFontMetrics fm(font());
if (keymap != 0) {
delete keymap;
keymap = 0;
}
Keymap* km = new Keymap();
if (!c.load("zkb.xml", *km, "")) {
delete km;
setPixmap(disabled);
return false;
}
@@ -135,16 +141,22 @@ void ZkbWidget::signalReceived(const QCString& msg, const QByteArray& data) {
State* state = keymap->getStateByLabel(lbl);
if (state != 0) {
keymap->setCurrentState(state);
setText(lbl);
}
}
} else if (msg == "debug(QString)") {
QString flag;
stream >> flag;
}
}
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
@@ -2,32 +2,33 @@
#define ZKBWIDGET_H
#include <qwidget.h>
#include <qlabel.h>
#include <qpopupmenu.h>
#include <qpixmap.h>
#include <qcopchannel_qws.h>
#include "zkb.h"
class ZkbWidget : public QLabel {
Q_OBJECT
public:
ZkbWidget(QWidget* parent);
~ZkbWidget();
+ static int position();
QSize sizeHint() const;
protected:
QLabel* label;
Keymap* keymap;
QPopupMenu* labels;
QCopChannel* channel;
int w, h;
QPixmap disabled;
bool loadKeymap();
void mouseReleaseEvent(QMouseEvent*);
protected slots:
void stateChanged(const QString&);