summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 8f954b1..0e1c0dd 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -257,48 +257,50 @@ ODevice::ODevice ( )
257 257
258 d-> m_holdtime = 1000; // 1000ms 258 d-> m_holdtime = 1000; // 1000ms
259 d-> m_buttons = 0; 259 d-> m_buttons = 0;
260} 260}
261 261
262void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) 262void ODevice::systemMessage ( const QCString &msg, const QByteArray & )
263{ 263{
264 if ( msg == "deviceButtonMappingChanged()" ) { 264 if ( msg == "deviceButtonMappingChanged()" ) {
265 reloadButtonMapping ( ); 265 reloadButtonMapping ( );
266 } 266 }
267} 267}
268 268
269void ODevice::init ( ) 269void ODevice::init ( )
270{ 270{
271} 271}
272 272
273/** 273/**
274 * This method initialises the button mapping 274 * This method initialises the button mapping
275 */ 275 */
276void ODevice::initButtons ( ) 276void ODevice::initButtons ( )
277{ 277{
278 if ( d-> m_buttons ) 278 if ( d-> m_buttons )
279 return; 279 return;
280 280
281 d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false;
282
281 // Simulation uses iPAQ 3660 device buttons 283 // Simulation uses iPAQ 3660 device buttons
282 284
283 qDebug ( "init Buttons" ); 285 qDebug ( "init Buttons" );
284 d-> m_buttons = new QValueList <ODeviceButton>; 286 d-> m_buttons = new QValueList <ODeviceButton>;
285 287
286 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 288 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
287 i_button *ib = ipaq_buttons + i; 289 i_button *ib = ipaq_buttons + i;
288 ODeviceButton b; 290 ODeviceButton b;
289 291
290 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { 292 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) {
291 b. setKeycode ( ib-> code ); 293 b. setKeycode ( ib-> code );
292 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 294 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
293 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 295 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
294 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 296 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
295 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 297 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
296 d-> m_buttons-> append ( b ); 298 d-> m_buttons-> append ( b );
297 } 299 }
298 } 300 }
299 reloadButtonMapping ( ); 301 reloadButtonMapping ( );
300 302
301 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 303 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
302 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 304 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
303} 305}
304 306
@@ -741,57 +743,60 @@ void iPAQ::init ( )
741 743
742 f. close ( ); 744 f. close ( );
743 } else { 745 } else {
744 f. setName ( "/etc/oz_version" ); 746 f. setName ( "/etc/oz_version" );
745 747
746 if ( f. open ( IO_ReadOnly )) { 748 if ( f. open ( IO_ReadOnly )) {
747 d-> m_systemstr = "OpenEmbedded/iPaq"; 749 d-> m_systemstr = "OpenEmbedded/iPaq";
748 d-> m_system = System_Familiar; 750 d-> m_system = System_Familiar;
749 751
750 QTextStream ts ( &f ); 752 QTextStream ts ( &f );
751 ts.setDevice ( &f ); 753 ts.setDevice ( &f );
752 d-> m_sysverstr = ts. readLine ( ); 754 d-> m_sysverstr = ts. readLine ( );
753 f. close ( ); 755 f. close ( );
754 } 756 }
755 } 757 }
756 758
757 759
758 760
759 761
760 762
761 m_leds [0] = m_leds [1] = Led_Off; 763 m_leds [0] = m_leds [1] = Led_Off;
762 764
763 m_power_timer = 0; 765 m_power_timer = 0;
764 766
765 if ( d-> m_qwsserver )
766 QWSServer::setKeyboardFilter ( this );
767} 767}
768 768
769void iPAQ::initButtons ( ) 769void iPAQ::initButtons ( )
770{ 770{
771 if ( d-> m_buttons ) 771 if ( d-> m_buttons )
772 return; 772 return;
773 773
774 d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false;
775
776 if ( d-> m_qwsserver )
777 QWSServer::setKeyboardFilter ( this );
778
774 d-> m_buttons = new QValueList <ODeviceButton>; 779 d-> m_buttons = new QValueList <ODeviceButton>;
775 780
776 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 781 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
777 i_button *ib = ipaq_buttons + i; 782 i_button *ib = ipaq_buttons + i;
778 ODeviceButton b; 783 ODeviceButton b;
779 784
780 if (( ib-> model & d-> m_model ) == d-> m_model ) { 785 if (( ib-> model & d-> m_model ) == d-> m_model ) {
781 b. setKeycode ( ib-> code ); 786 b. setKeycode ( ib-> code );
782 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 787 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
783 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 788 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
784 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 789 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
785 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 790 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
786 791
787 d-> m_buttons-> append ( b ); 792 d-> m_buttons-> append ( b );
788 } 793 }
789 } 794 }
790 reloadButtonMapping ( ); 795 reloadButtonMapping ( );
791 796
792 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 797 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
793 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 798 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
794} 799}
795 800
796 801
797//#include <linux/h3600_ts.h> // including kernel headers is evil ... 802//#include <linux/h3600_ts.h> // including kernel headers is evil ...
@@ -1128,48 +1133,50 @@ void Zaurus::init ( )
1128 1133
1129 switch ( d-> m_model ) { 1134 switch ( d-> m_model ) {
1130 case Model_Zaurus_SLA300: 1135 case Model_Zaurus_SLA300:
1131 d-> m_rotation = Rot0; 1136 d-> m_rotation = Rot0;
1132 break; 1137 break;
1133 case Model_Zaurus_SLC700: 1138 case Model_Zaurus_SLC700:
1134 /* note for C700, we must check the display rotation 1139 /* note for C700, we must check the display rotation
1135 * sensor to set an appropriate value 1140 * sensor to set an appropriate value
1136 */ 1141 */
1137 case Model_Zaurus_SLB600: 1142 case Model_Zaurus_SLB600:
1138 case Model_Zaurus_SL5500: 1143 case Model_Zaurus_SL5500:
1139 case Model_Zaurus_SL5000: 1144 case Model_Zaurus_SL5000:
1140 default: 1145 default:
1141 d-> m_rotation = Rot270; 1146 d-> m_rotation = Rot270;
1142 break; 1147 break;
1143 } 1148 }
1144 m_leds [0] = Led_Off; 1149 m_leds [0] = Led_Off;
1145} 1150}
1146 1151
1147void Zaurus::initButtons ( ) 1152void Zaurus::initButtons ( )
1148{ 1153{
1149 if ( d-> m_buttons ) 1154 if ( d-> m_buttons )
1150 return; 1155 return;
1151 1156
1157 d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false;
1158
1152 d-> m_buttons = new QValueList <ODeviceButton>; 1159 d-> m_buttons = new QValueList <ODeviceButton>;
1153 1160
1154 for ( uint i = 0; i < ( sizeof( z_buttons ) / sizeof( z_button )); i++ ) { 1161 for ( uint i = 0; i < ( sizeof( z_buttons ) / sizeof( z_button )); i++ ) {
1155 z_button *zb = z_buttons + i; 1162 z_button *zb = z_buttons + i;
1156 ODeviceButton b; 1163 ODeviceButton b;
1157 1164
1158 b. setKeycode ( zb-> code ); 1165 b. setKeycode ( zb-> code );
1159 b. setUserText ( QObject::tr ( "Button", zb-> utext )); 1166 b. setUserText ( QObject::tr ( "Button", zb-> utext ));
1160 b. setPixmap ( Resource::loadPixmap ( zb-> pix )); 1167 b. setPixmap ( Resource::loadPixmap ( zb-> pix ));
1161 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), zb-> fpressedaction )); 1168 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), zb-> fpressedaction ));
1162 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), zb-> fheldaction )); 1169 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), zb-> fheldaction ));
1163 1170
1164 d-> m_buttons-> append ( b ); 1171 d-> m_buttons-> append ( b );
1165 } 1172 }
1166 1173
1167 reloadButtonMapping ( ); 1174 reloadButtonMapping ( );
1168 1175
1169 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 1176 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
1170 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 1177 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
1171} 1178}
1172 1179
1173#include <unistd.h> 1180#include <unistd.h>
1174#include <fcntl.h> 1181#include <fcntl.h>
1175#include <sys/ioctl.h> 1182#include <sys/ioctl.h>