-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,4 +1,5 @@ #include <opie2/otaskbarapplet.h> +#include <opie2/okeyfilter.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/applnk.h> #include <qpe/qpeapplication.h> @@ -9,8 +10,9 @@ #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, @@ -25,7 +27,12 @@ ZkbWidget::ZkbWidget(QWidget* parent):QLabel(parent),keymap(0), setFixedHeight ( AppLnk::smallIconSize() ); } -ZkbWidget::~ZkbWidget() { +ZkbWidget::~ZkbWidget() +{ + if (keymap != 0) { + delete keymap; + keymap = 0; + } } int ZkbWidget::position() @@ -53,7 +60,7 @@ bool ZkbWidget::loadKeymap() { 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; @@ -62,7 +69,9 @@ bool ZkbWidget::loadKeymap() { delete oldkm; } - setText(keymap->getCurrentLabel()); + QString ltext = keymap->getCurrentLabel(); + if (ltext.length()==0) ltext = "??"; + setText(ltext); labels->clear(); QStringList l = keymap->listLabels(); @@ -157,5 +166,3 @@ void ZkbWidget::reload() { } 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 @@ -2,6 +2,7 @@ /* OPIE */ #include <opie2/odebug.h> +#include <opie2/okeyfilter.h> #include <stdio.h> @@ -246,6 +247,8 @@ Keymap::Keymap():enabled(true), currentState(0), autoRepeatAction(0), repeater(t } 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(); |