summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp57
-rw-r--r--libopie2/opiecore/device/odevice.h49
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp3
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp3
-rw-r--r--libopie2/opiecore/okeyfilter.h7
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,32 +1,32 @@
1/* 1/*
2                 This file is part of the Opie Project 2 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org> 3 Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6 .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7_;:, .> :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11- . .-<_> .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13    .%`+i>       _;_. 13 .%`+i> _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++=   -.     .`     .: details. 20++= -. .` .: details.
21 :     =  ...= . :.=- 21: = ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22-. .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice_ipaq.h" 30#include "odevice_ipaq.h"
31#include "odevice_jornada.h" 31#include "odevice_jornada.h"
32#include "odevice_ramses.h" 32#include "odevice_ramses.h"
@@ -40,16 +40,17 @@
40#include <qtextstream.h> 40#include <qtextstream.h>
41#include <qwindowsystem_qws.h> 41#include <qwindowsystem_qws.h>
42 42
43/* OPIE */ 43/* OPIE */
44#include <qpe/config.h> 44#include <qpe/config.h>
45#include <qpe/resource.h> 45#include <qpe/resource.h>
46#include <qpe/sound.h> 46#include <qpe/sound.h>
47#include <qpe/qcopenvelope_qws.h> 47#include <qpe/qcopenvelope_qws.h>
48#include <opie2/okeyfilter.h>
48 49
49/* STD */ 50/* STD */
50#include <fcntl.h> 51#include <fcntl.h>
51#include <math.h> 52#include <math.h>
52#include <stdlib.h> 53#include <stdlib.h>
53#include <signal.h> 54#include <signal.h>
54#include <sys/ioctl.h> 55#include <sys/ioctl.h>
55#include <sys/time.h> 56#include <sys/time.h>
@@ -671,17 +672,17 @@ void ODevice::remapPressedAction ( int button, const OQCopMessage &action )
671 672
672 mb_chan=b. pressedAction(). channel(); 673 mb_chan=b. pressedAction(). channel();
673 674
674 Config buttonFile ( "ButtonSettings" ); 675 Config buttonFile ( "ButtonSettings" );
675 buttonFile. setGroup ( "Button" + QString::number ( button )); 676 buttonFile. setGroup ( "Button" + QString::number ( button ));
676 buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan); 677 buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan);
677 buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction(). message()); 678 buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction(). message());
678 679
679 //buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction(). data())); 680// buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction(). data()));
680 681
681 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); 682 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
682} 683}
683 684
684void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) 685void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
685{ 686{
686 initButtons(); 687 initButtons();
687 688
@@ -691,27 +692,37 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
691 ODeviceButton &b = ( *d->m_buttons ) [button]; 692 ODeviceButton &b = ( *d->m_buttons ) [button];
692 b. setHeldAction ( action ); 693 b. setHeldAction ( action );
693 694
694 Config buttonFile ( "ButtonSettings" ); 695 Config buttonFile ( "ButtonSettings" );
695 buttonFile. setGroup ( "Button" + QString::number ( button )); 696 buttonFile. setGroup ( "Button" + QString::number ( button ));
696 buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel()); 697 buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel());
697 buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message()); 698 buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message());
698 699
699 //buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); 700// buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data()));
700 701
701 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); 702 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
702} 703}
703void ODevice::virtual_hook(int, void* ){ 704void ODevice::virtual_hook(int, void* ){
704 705
705} 706}
706 707
707void ODevice::sendSuspendmsg() 708void ODevice::sendSuspendmsg()
708{ 709{
709 if ( isQWS() ) 710 if ( isQWS() )
710 return; 711 return;
711 712
712 QCopEnvelope ( "QPE/System", "aboutToSuspend()" ); 713 QCopEnvelope ( "QPE/System", "aboutToSuspend()" );
713} 714}
714 715
716void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter)
717{
718 Opie::Core::OKeyFilter::inst()->addPreHandler(aFilter);
719}
720
721void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter)
722{
723 Opie::Core::OKeyFilter::inst()->remPreHandler(aFilter);
724}
725
715 726
716} 727}
717} 728}
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,32 +1,32 @@
1/* 1/*
2                 This file is part of the Opie Project 2 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org> 3 Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6 .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7_;:, .> :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11- . .-<_> .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13    .%`+i>       _;_. 13 .%`+i> _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++=   -.     .`     .: details. 20++= -. .` .: details.
21 :     =  ...= . :.=- 21: = ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22-. .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#ifndef ODEVICE_H_ 30#ifndef ODEVICE_H_
31#define ODEVICE_H_ 31#define ODEVICE_H_
32 32
@@ -34,16 +34,17 @@
34#include <opie2/odevicebutton.h> 34#include <opie2/odevicebutton.h>
35#include <qpe/qpeapplication.h> /* for Transformation enum.. */ 35#include <qpe/qpeapplication.h> /* for Transformation enum.. */
36 36
37/* QT */ 37/* QT */
38#include <qnamespace.h> 38#include <qnamespace.h>
39#include <qobject.h> 39#include <qobject.h>
40#include <qstring.h> 40#include <qstring.h>
41#include <qstrlist.h> 41#include <qstrlist.h>
42#include <qwindowsystem_qws.h>
42 43
43namespace Opie{ 44namespace Opie{
44namespace Core{ 45namespace Core{
45 46
46 class ODeviceData; 47 class ODeviceData;
47/** 48/**
48 * The available devices 49 * The available devices
49 */ 50 */
@@ -248,19 +249,19 @@ public:
248 249
249 virtual bool setDisplayStatus ( bool on ); 250 virtual bool setDisplayStatus ( bool on );
250 virtual bool setDisplayBrightness ( int brightness ); 251 virtual bool setDisplayBrightness ( int brightness );
251 virtual int displayBrightnessResolution() const; 252 virtual int displayBrightnessResolution() const;
252 virtual bool setDisplayContrast ( int contrast ); 253 virtual bool setDisplayContrast ( int contrast );
253 virtual int displayContrastResolution() const; 254 virtual int displayContrastResolution() const;
254 255
255 // don't add new virtual methods, use this: 256 // don't add new virtual methods, use this:
256 ///*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; 257 // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); };
257 // and in your subclass do do overwrite 258 // and in your subclass do do overwrite
258 //protected virtual int virtual_hook(int, void *) 259 // protected virtual int virtual_hook(int, void *)
259 // which is defined below 260 // which is defined below
260 261
261 // input / output 262 // input / output
262 virtual void playAlarmSound(); 263 virtual void playAlarmSound();
263 virtual void playKeySound(); 264 virtual void playKeySound();
264 virtual void playTouchSound(); 265 virtual void playTouchSound();
265 266
266 virtual QValueList <OLed> ledList() const; 267 virtual QValueList <OLed> ledList() const;
@@ -314,16 +315,18 @@ public:
314 315
315signals: 316signals:
316 void buttonMappingChanged(); 317 void buttonMappingChanged();
317 318
318private slots: 319private slots:
319 void systemMessage ( const QCString &, const QByteArray & ); 320 void systemMessage ( const QCString &, const QByteArray & );
320 321
321protected: 322protected:
323 void addPreHandler(QWSServer::KeyboardFilter*aFilter);
324 void remPreHandler(QWSServer::KeyboardFilter*aFilter);
322 void reloadButtonMapping(); 325 void reloadButtonMapping();
323 /* ugly virtual hook */ 326 /* ugly virtual hook */
324 virtual void virtual_hook( int id, void* data ); 327 virtual void virtual_hook( int id, void* data );
325}; 328};
326 329
327class ODeviceData { 330class ODeviceData {
328 331
329 public: 332 public:
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
@@ -164,18 +164,17 @@ void iPAQ::init(const QString& model)
164} 164}
165 165
166void iPAQ::initButtons() 166void iPAQ::initButtons()
167{ 167{
168 if ( d->m_buttons ) 168 if ( d->m_buttons )
169 return; 169 return;
170 170
171 if ( isQWS( ) ) { 171 if ( isQWS( ) ) {
172 Opie::Core::OKeyFilter::inst()->addPreHandler(this); 172 addPreHandler(this);
173 //QWSServer::setKeyboardFilter ( this );
174 } 173 }
175 174
176 d->m_buttons = new QValueList <ODeviceButton>; 175 d->m_buttons = new QValueList <ODeviceButton>;
177 176
178 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 177 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
179 i_button *ib = ipaq_buttons + i; 178 i_button *ib = ipaq_buttons + i;
180 ODeviceButton b; 179 ODeviceButton b;
181 180
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
@@ -142,18 +142,17 @@ void SIMpad::init(const QString&)
142} 142}
143 143
144void SIMpad::initButtons() 144void SIMpad::initButtons()
145{ 145{
146 if ( d->m_buttons ) 146 if ( d->m_buttons )
147 return; 147 return;
148 148
149 if ( isQWS( ) ) { 149 if ( isQWS( ) ) {
150 Opie::Core::OKeyFilter::inst()->addPreHandler(this); 150 addPreHandler(this);
151// QWSServer::setKeyboardFilter ( this );
152 } 151 }
153 152
154 153
155 d->m_buttons = new QValueList <ODeviceButton>; 154 d->m_buttons = new QValueList <ODeviceButton>;
156 155
157 for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { 156 for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) {
158 s_button *sb = simpad_buttons + i; 157 s_button *sb = simpad_buttons + i;
159 ODeviceButton b; 158 ODeviceButton b;
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
@@ -28,35 +28,30 @@ _;:, .> :=|. This program is free software; you can
28 28
29/* QT */ 29/* QT */
30#include <qwindowsystem_qws.h> 30#include <qwindowsystem_qws.h>
31#include <qvaluelist.h> 31#include <qvaluelist.h>
32 32
33namespace Opie { 33namespace Opie {
34namespace Core { 34namespace Core {
35 class ODevice; 35 class ODevice;
36namespace Internal { 36
37 class iPAQ;
38 class SIMpad;
39}
40 37
41/** 38/**
42 * A singleton which will manage all possible keyboard filters inside opie. 39 * A singleton which will manage all possible keyboard filters inside opie.
43 * It makes sure that key handlers of odevice are checked first than the 40 * It makes sure that key handlers of odevice are checked first than the
44 * keyfilters of software. 41 * keyfilters of software.
45 * @short a keyfilter proxy 42 * @short a keyfilter proxy
46 * @see QWSServer::KeyboardFilter 43 * @see QWSServer::KeyboardFilter
47 * @author Rajko Albrecht 44 * @author Rajko Albrecht
48 * @version 1.0 45 * @version 1.0
49 */ 46 */
50class OKeyFilter 47class OKeyFilter
51{ 48{
52 friend class Opie::Core::ODevice; 49 friend class Opie::Core::ODevice;
53 friend class Opie::Core::Internal::iPAQ;
54 friend class Opie::Core::Internal::SIMpad;
55 50
56protected: 51protected:
57 /** 52 /**
58 * Protected constructor - generate class via inst() 53 * Protected constructor - generate class via inst()
59 * @see inst() 54 * @see inst()
60 */ 55 */
61 OKeyFilter(); 56 OKeyFilter();
62 /** 57 /**