-rw-r--r-- | libopie/odevice.cpp | 11 |
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 @@ -273,16 +273,18 @@ void ODevice::init ( ) /** * This method initialises the button mapping */ void ODevice::initButtons ( ) { if ( d-> m_buttons ) return; + d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; + // Simulation uses iPAQ 3660 device buttons qDebug ( "init Buttons" ); d-> m_buttons = new QValueList <ODeviceButton>; for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { i_button *ib = ipaq_buttons + i; ODeviceButton b; @@ -757,25 +759,28 @@ void iPAQ::init ( ) m_leds [0] = m_leds [1] = Led_Off; m_power_timer = 0; - if ( d-> m_qwsserver ) - QWSServer::setKeyboardFilter ( this ); } void iPAQ::initButtons ( ) { if ( d-> m_buttons ) return; + d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; + + if ( d-> m_qwsserver ) + QWSServer::setKeyboardFilter ( 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; ODeviceButton b; if (( ib-> model & d-> m_model ) == d-> m_model ) { b. setKeycode ( ib-> code ); @@ -1144,16 +1149,18 @@ void Zaurus::init ( ) m_leds [0] = Led_Off; } void Zaurus::initButtons ( ) { if ( d-> m_buttons ) return; + d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; + d-> m_buttons = new QValueList <ODeviceButton>; for ( uint i = 0; i < ( sizeof( z_buttons ) / sizeof( z_button )); i++ ) { z_button *zb = z_buttons + i; ODeviceButton b; b. setKeycode ( zb-> code ); b. setUserText ( QObject::tr ( "Button", zb-> utext )); |