author | zecke <zecke> | 2004-08-14 17:15:44 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-08-14 17:15:44 (UTC) |
commit | 74363a9e1d5688d65286e7fea156227b68a28002 (patch) (side-by-side diff) | |
tree | 3926a1a3bd42bebb2f67b3334735bc3b3931f796 | |
parent | 7657b6986a600ec1b3626c83e8f19036bf69e493 (diff) | |
download | opie-74363a9e1d5688d65286e7fea156227b68a28002.zip opie-74363a9e1d5688d65286e7fea156227b68a28002.tar.gz opie-74363a9e1d5688d65286e7fea156227b68a28002.tar.bz2 |
-Remove the KeyFilter on destruction
Alwin could we either add a 'QObject' as a owner so that we could use
QGuardedPtr or look for the deleteEvent ourselves.
Or let us create a KeyFilter ourselves that auto registers (maybe) but
cleans up itself in any case?
-rw-r--r-- | development/keyview/keyboardimpl.cpp | 4 | ||||
-rw-r--r-- | development/keyview/keyview.cpp | 7 | ||||
-rw-r--r-- | development/keyview/keyview.h | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/development/keyview/keyboardimpl.cpp b/development/keyview/keyboardimpl.cpp index 673eaa5..0216110 100644 --- a/development/keyview/keyboardimpl.cpp +++ b/development/keyview/keyboardimpl.cpp @@ -163,8 +163,10 @@ QString KeyboardImpl::name() } void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) { + Q_UNUSED( receiver ); + Q_CONST_UNUSED( slot ); //if ( input ) //QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); } @@ -175,8 +177,10 @@ QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **ifa if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_InputMethod ) *iface = this; + else + return QS_FALSE; if ( *iface ) (*iface)->addRef(); return QS_OK; diff --git a/development/keyview/keyview.cpp b/development/keyview/keyview.cpp index 8187744..cf082a8 100644 --- a/development/keyview/keyview.cpp +++ b/development/keyview/keyview.cpp @@ -64,13 +64,18 @@ void Keyview::updateItems(int u, int k, int m, bool p, bool a) { KeyFilter::KeyFilter(QObject * parent, const char *name) : QObject( parent, name ) { } +KeyFilter::~KeyFilter() { + /* we need to remove the KeyFilter */ + Opie::Core::OKeyFilter::inst()->remHandler( this ); +} + bool KeyFilter::filter(int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat) { qDebug( "unicode: %d, keycode: %d, modifiers: %0x, isPress: %d, autoRepeat: %d", - unicode, keycode, modifiers, isPress ); + unicode, keycode, modifiers, isPress, autoRepeat ); emit keyPressed(unicode, keycode, modifiers, isPress, autoRepeat); return 0; // return 1 to stop key emiting } diff --git a/development/keyview/keyview.h b/development/keyview/keyview.h index 5f1e943..87c0d15 100644 --- a/development/keyview/keyview.h +++ b/development/keyview/keyview.h @@ -22,17 +22,17 @@ private: QLineEdit *keycode; QLineEdit *modifiers; QLineEdit *isPress; QLineEdit *autoRepeat; - }; class KeyFilter : public QObject, public QWSServer::KeyboardFilter { Q_OBJECT public: KeyFilter( QObject* parent, const char* name = 0); + virtual ~KeyFilter(); virtual bool filter(int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat); signals: |