author | alwin <alwin> | 2004-08-01 10:33:38 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-08-01 10:33:38 (UTC) |
commit | ecd0e7c523c9f190eb2b8765ef2d629aa399d635 (patch) (side-by-side diff) | |
tree | 1ac230cbfd75b94f7d1496dc16ccb1c9af1a81be | |
parent | 142d432ef9f8215636a81c358c828d4b6986a6ad (diff) | |
download | opie-ecd0e7c523c9f190eb2b8765ef2d629aa399d635.zip opie-ecd0e7c523c9f190eb2b8765ef2d629aa399d635.tar.gz opie-ecd0e7c523c9f190eb2b8765ef2d629aa399d635.tar.bz2 |
switched keyboard filter to the new singleton class OKeyFilter from within
opiecore2 so we can better handle it.
-rw-r--r-- | noncore/applets/zkbapplet/zkbwidget.cpp | 21 | ||||
-rw-r--r-- | noncore/applets/zkbapplet/zkbwidget.h | 0 | ||||
-rw-r--r-- | noncore/apps/keyz-cfg/zkb.cpp | 3 |
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,19 +1,21 @@ #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(); @@ -22,13 +24,18 @@ ZkbWidget::ZkbWidget(QWidget* parent):QLabel(parent),keymap(0), 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; } @@ -50,22 +57,24 @@ bool ZkbWidget::loadKeymap() { 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; @@ -154,8 +163,6 @@ 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,10 +1,11 @@ #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) { } @@ -243,12 +244,14 @@ Keymap::Keymap():enabled(true), currentState(0), autoRepeatAction(0), repeater(t 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(); } |