-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 57 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.h | 49 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 3 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 3 | ||||
-rw-r--r-- | libopie2/opiecore/okeyfilter.h | 7 |
5 files changed, 63 insertions, 56 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index 0068d88..cd3a84c 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp @@ -1,30 +1,30 @@ /* - This file is part of the Opie Project - Copyright (C) The Opie Team <opie-devel@handhelds.org> + This file is part of the Opie Project + Copyright (C) The Opie Team <opie-devel@handhelds.org> =. .=l. - .>+-= - _;:, .> :=|. This program is free software; you can -.> <`_, > . <= redistribute it and/or modify it under -:`=1 )Y*s>-.-- : the terms of the GNU Library General Public -.="- .-=="i, .._ License as published by the Free Software - - . .-<_> .<> Foundation; either version 2 of the License, - ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This program is distributed in the hope that - + . -:. = it will be useful, but WITHOUT ANY WARRANTY; - : .. .:, . . . without even the implied warranty of - =_ + =;=|` MERCHANTABILITY or FITNESS FOR A - _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU -..}^=.= = ; Library General Public License for more -++= -. .` .: details. - : = ...= . :.=- - -. .:....=;==+<; You should have received a copy of the GNU - -_. . . )=. = Library General Public License along with - -- :-=` this library; see the file COPYING.LIB. + .>+-= +_;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software +- . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. +: = ...= . :.=- +-. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "odevice_ipaq.h" @@ -42,12 +42,13 @@ /* OPIE */ #include <qpe/config.h> #include <qpe/resource.h> #include <qpe/sound.h> #include <qpe/qcopenvelope_qws.h> +#include <opie2/okeyfilter.h> /* STD */ #include <fcntl.h> #include <math.h> #include <stdlib.h> #include <signal.h> @@ -673,13 +674,13 @@ void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) Config buttonFile ( "ButtonSettings" ); buttonFile. setGroup ( "Button" + QString::number ( button )); buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan); buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction(). message()); -// buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction(). data())); +// buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction(). data())); QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); } void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) { @@ -693,13 +694,13 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) Config buttonFile ( "ButtonSettings" ); buttonFile. setGroup ( "Button" + QString::number ( button )); buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel()); buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message()); -// buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); +// buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); } void ODevice::virtual_hook(int, void* ){ } @@ -709,9 +710,19 @@ void ODevice::sendSuspendmsg() if ( isQWS() ) return; QCopEnvelope ( "QPE/System", "aboutToSuspend()" ); } +void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter) +{ + Opie::Core::OKeyFilter::inst()->addPreHandler(aFilter); +} + +void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter) +{ + Opie::Core::OKeyFilter::inst()->remPreHandler(aFilter); +} + } } diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index 0465d7e..762d3f1 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h @@ -1,30 +1,30 @@ /* - This file is part of the Opie Project - Copyright (C) The Opie Team <opie-devel@handhelds.org> + This file is part of the Opie Project + Copyright (C) The Opie Team <opie-devel@handhelds.org> =. .=l. - .>+-= - _;:, .> :=|. This program is free software; you can -.> <`_, > . <= redistribute it and/or modify it under -:`=1 )Y*s>-.-- : the terms of the GNU Library General Public -.="- .-=="i, .._ License as published by the Free Software - - . .-<_> .<> Foundation; either version 2 of the License, - ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This program is distributed in the hope that - + . -:. = it will be useful, but WITHOUT ANY WARRANTY; - : .. .:, . . . without even the implied warranty of - =_ + =;=|` MERCHANTABILITY or FITNESS FOR A - _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU -..}^=.= = ; Library General Public License for more -++= -. .` .: details. - : = ...= . :.=- - -. .:....=;==+<; You should have received a copy of the GNU - -_. . . )=. = Library General Public License along with - -- :-=` this library; see the file COPYING.LIB. + .>+-= +_;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software +- . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. +: = ...= . :.=- +-. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ODEVICE_H_ @@ -36,12 +36,13 @@ /* QT */ #include <qnamespace.h> #include <qobject.h> #include <qstring.h> #include <qstrlist.h> +#include <qwindowsystem_qws.h> namespace Opie{ namespace Core{ class ODeviceData; /** @@ -250,15 +251,15 @@ public: virtual bool setDisplayBrightness ( int brightness ); virtual int displayBrightnessResolution() const; virtual bool setDisplayContrast ( int contrast ); virtual int displayContrastResolution() const; // don't add new virtual methods, use this: - // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; + // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; // and in your subclass do do overwrite - // protected virtual int virtual_hook(int, void *) + // protected virtual int virtual_hook(int, void *) // which is defined below // input / output virtual void playAlarmSound(); virtual void playKeySound(); virtual void playTouchSound(); @@ -316,12 +317,14 @@ signals: void buttonMappingChanged(); private slots: void systemMessage ( const QCString &, const QByteArray & ); protected: + void addPreHandler(QWSServer::KeyboardFilter*aFilter); + void remPreHandler(QWSServer::KeyboardFilter*aFilter); void reloadButtonMapping(); /* ugly virtual hook */ virtual void virtual_hook( int id, void* data ); }; class ODeviceData { diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index 791e409..21fed99 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp @@ -166,14 +166,13 @@ void iPAQ::init(const QString& model) void iPAQ::initButtons() { if ( d->m_buttons ) return; if ( isQWS( ) ) { - Opie::Core::OKeyFilter::inst()->addPreHandler(this); - //QWSServer::setKeyboardFilter ( this ); + addPreHandler(this); } d->m_buttons = new QValueList <ODeviceButton>; for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { i_button *ib = ipaq_buttons + i; diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index 6c3253c..bf46e43 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp @@ -144,14 +144,13 @@ void SIMpad::init(const QString&) void SIMpad::initButtons() { if ( d->m_buttons ) return; if ( isQWS( ) ) { - Opie::Core::OKeyFilter::inst()->addPreHandler(this); -// QWSServer::setKeyboardFilter ( this ); + addPreHandler(this); } d->m_buttons = new QValueList <ODeviceButton>; for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { diff --git a/libopie2/opiecore/okeyfilter.h b/libopie2/opiecore/okeyfilter.h index a65bc48..d183641 100644 --- a/libopie2/opiecore/okeyfilter.h +++ b/libopie2/opiecore/okeyfilter.h @@ -30,16 +30,13 @@ _;:, .> :=|. This program is free software; you can #include <qwindowsystem_qws.h> #include <qvaluelist.h> namespace Opie { namespace Core { class ODevice; -namespace Internal { - class iPAQ; - class SIMpad; -} + /** * A singleton which will manage all possible keyboard filters inside opie. * It makes sure that key handlers of odevice are checked first than the * keyfilters of software. * @short a keyfilter proxy @@ -47,14 +44,12 @@ namespace Internal { * @author Rajko Albrecht * @version 1.0 */ class OKeyFilter { friend class Opie::Core::ODevice; - friend class Opie::Core::Internal::iPAQ; - friend class Opie::Core::Internal::SIMpad; protected: /** * Protected constructor - generate class via inst() * @see inst() */ |