summaryrefslogtreecommitdiff
authoralwin <alwin>2004-08-01 10:33:38 (UTC)
committer alwin <alwin>2004-08-01 10:33:38 (UTC)
commitecd0e7c523c9f190eb2b8765ef2d629aa399d635 (patch) (unidiff)
tree1ac230cbfd75b94f7d1496dc16ccb1c9af1a81be
parent142d432ef9f8215636a81c358c828d4b6986a6ad (diff)
downloadopie-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.
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,4 +1,5 @@
1#include <opie2/otaskbarapplet.h> 1#include <opie2/otaskbarapplet.h>
2#include <opie2/okeyfilter.h>
2#include <qpe/qcopenvelope_qws.h> 3#include <qpe/qcopenvelope_qws.h>
3#include <qpe/applnk.h> 4#include <qpe/applnk.h>
4#include <qpe/qpeapplication.h> 5#include <qpe/qpeapplication.h>
@@ -9,8 +10,9 @@
9#include "zkbcfg.h" 10#include "zkbcfg.h"
10 11
11using namespace Opie::Ui; 12using namespace Opie::Ui;
12ZkbWidget::ZkbWidget(QWidget* parent):QLabel(parent),keymap(0), 13
13 disabled(Resource::loadPixmap("zkb-disabled")) { 14ZkbWidget::ZkbWidget(QWidget* parent)
15 :QLabel(parent),keymap(0),disabled(Resource::loadPixmap("zkb-disabled")) {
14 16
15 labels = new QPopupMenu(); 17 labels = new QPopupMenu();
16 connect(labels, SIGNAL(activated(int)), this, 18 connect(labels, SIGNAL(activated(int)), this,
@@ -25,7 +27,12 @@ ZkbWidget::ZkbWidget(QWidget* parent):QLabel(parent),keymap(0),
25 setFixedHeight ( AppLnk::smallIconSize() ); 27 setFixedHeight ( AppLnk::smallIconSize() );
26} 28}
27 29
28ZkbWidget::~ZkbWidget() { 30ZkbWidget::~ZkbWidget()
31{
32 if (keymap != 0) {
33 delete keymap;
34 keymap = 0;
35 }
29} 36}
30 37
31int ZkbWidget::position() 38int ZkbWidget::position()
@@ -53,7 +60,7 @@ bool ZkbWidget::loadKeymap() {
53 connect(km, SIGNAL(stateChanged(const QString&)), 60 connect(km, SIGNAL(stateChanged(const QString&)),
54 this, SLOT(stateChanged(const QString&))); 61 this, SLOT(stateChanged(const QString&)));
55 62
56 qwsServer->setKeyboardFilter(km); 63 Opie::Core::OKeyFilter::inst()->addHandler(km);
57 64
58 Keymap* oldkm = keymap; 65 Keymap* oldkm = keymap;
59 keymap = km; 66 keymap = km;
@@ -62,7 +69,9 @@ bool ZkbWidget::loadKeymap() {
62 delete oldkm; 69 delete oldkm;
63 } 70 }
64 71
65 setText(keymap->getCurrentLabel()); 72 QString ltext = keymap->getCurrentLabel();
73 if (ltext.length()==0) ltext = "??";
74 setText(ltext);
66 75
67 labels->clear(); 76 labels->clear();
68 QStringList l = keymap->listLabels(); 77 QStringList l = keymap->listLabels();
@@ -157,5 +166,3 @@ void ZkbWidget::reload() {
157} 166}
158 167
159EXPORT_OPIE_APPLET_v1( ZkbWidget ) 168EXPORT_OPIE_APPLET_v1( ZkbWidget )
160
161
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 @@
2 2
3/* OPIE */ 3/* OPIE */
4#include <opie2/odebug.h> 4#include <opie2/odebug.h>
5#include <opie2/okeyfilter.h>
5 6
6#include <stdio.h> 7#include <stdio.h>
7 8
@@ -246,6 +247,8 @@ Keymap::Keymap():enabled(true), currentState(0), autoRepeatAction(0), repeater(t
246} 247}
247 248
248Keymap::~Keymap() { 249Keymap::~Keymap() {
250 odebug << "removing keyboard filter for zkb"<<oendl;
251 Opie::Core::OKeyFilter::inst()->remHandler(this);
249 QMap<QString, State*>::Iterator it; 252 QMap<QString, State*>::Iterator it;
250 for(it = states.begin(); it != states.end(); ++it) { 253 for(it = states.begin(); it != states.end(); ++it) {
251 delete it.data(); 254 delete it.data();