summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/applets/zkbapplet/zkbwidget.cpp21
-rw-r--r--noncore/applets/zkbapplet/zkbwidget.h0
-rw-r--r--noncore/apps/keyz-cfg/zkb.cpp3
3 files changed, 17 insertions, 7 deletions
diff --git a/noncore/applets/zkbapplet/zkbwidget.cpp b/noncore/applets/zkbapplet/zkbwidget.cpp
index 38bfba9..8499500 100644
--- a/noncore/applets/zkbapplet/zkbwidget.cpp
+++ b/noncore/applets/zkbapplet/zkbwidget.cpp
@@ -1,36 +1,43 @@
#include <opie2/otaskbarapplet.h>
+#include <opie2/okeyfilter.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"
using namespace Opie::Ui;
-ZkbWidget::ZkbWidget(QWidget* parent):QLabel(parent),keymap(0),
- disabled(Resource::loadPixmap("zkb-disabled")) {
+
+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() {
+ZkbWidget::~ZkbWidget()
+{
+ if (keymap != 0) {
+ delete keymap;
+ keymap = 0;
+ }
}
int ZkbWidget::position()
{
return 8;
}
bool ZkbWidget::loadKeymap() {
@@ -48,26 +55,28 @@ bool ZkbWidget::loadKeymap() {
delete km;
setPixmap(disabled);
return false;
}
connect(km, SIGNAL(stateChanged(const QString&)),
this, SLOT(stateChanged(const QString&)));
- qwsServer->setKeyboardFilter(km);
+ Opie::Core::OKeyFilter::inst()->addHandler(km);
Keymap* oldkm = keymap;
keymap = km;
if (oldkm != 0) {
delete oldkm;
}
- setText(keymap->getCurrentLabel());
+ QString ltext = keymap->getCurrentLabel();
+ if (ltext.length()==0) ltext = "??";
+ setText(ltext);
labels->clear();
QStringList l = keymap->listLabels();
labels->insertItem(disabled, 0, 0);
int n = 1;
w = 0;
for(QStringList::Iterator it = l.begin(); it != l.end();
++it, n++) {
@@ -152,10 +161,8 @@ void ZkbWidget::signalReceived(const QCString& msg, const QByteArray& data) {
}
void ZkbWidget::reload() {
loadKeymap();
QCopEnvelope("QPE/System", "notBusy()");
}
EXPORT_OPIE_APPLET_v1( ZkbWidget )
-
-
diff --git a/noncore/applets/zkbapplet/zkbwidget.h b/noncore/applets/zkbapplet/zkbwidget.h
index 7c67794..9bce85a 100644
--- a/noncore/applets/zkbapplet/zkbwidget.h
+++ b/noncore/applets/zkbapplet/zkbwidget.h
diff --git a/noncore/apps/keyz-cfg/zkb.cpp b/noncore/apps/keyz-cfg/zkb.cpp
index c9e1dc5..a357b88 100644
--- a/noncore/apps/keyz-cfg/zkb.cpp
+++ b/noncore/apps/keyz-cfg/zkb.cpp
@@ -1,12 +1,13 @@
#include "zkb.h"
/* OPIE */
#include <opie2/odebug.h>
+#include <opie2/okeyfilter.h>
#include <stdio.h>
// Implementation of Action class
Action::Action():state(0), keycode(0), unicode(0), flags(0) {
}
Action::Action(State* s, ushort kc, ushort uni, int f):
@@ -241,16 +242,18 @@ int State::translateKeycode(int keycode) const {
// Implementation of Keymap class
Keymap::Keymap():enabled(true), currentState(0), autoRepeatAction(0), repeater(this) {
repeatDelay=400;
repeatPeriod=80;
connect(&repeater, SIGNAL(timeout()), this, SLOT(autoRepeat()));
}
Keymap::~Keymap() {
+ odebug << "removing keyboard filter for zkb"<<oendl;
+ Opie::Core::OKeyFilter::inst()->remHandler(this);
QMap<QString, State*>::Iterator it;
for(it = states.begin(); it != states.end(); ++it) {
delete it.data();
}
states.clear();
}
bool Keymap::filter(int unicode, int keycode, int modifiers,