Diffstat (limited to 'noncore/applets/zkbapplet/zkbwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/applets/zkbapplet/zkbwidget.cpp | 21 |
1 files changed, 14 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 ) - - |