-rw-r--r-- | libopie/odevice.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 501b601..62e3569 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp @@ -53,14 +53,12 @@ #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) using namespace Opie; class ODeviceData { public: - bool m_qwsserver : 1; - QString m_vendorstr; OVendor m_vendor; QString m_modelstr; OModel m_model; @@ -236,14 +234,16 @@ static QCString makeChannel ( const char *str ) if ( str && !::strchr ( str, '/' )) return QCString ( "QPE/Application/" ) + str; else return str; } - - +static inline bool isQWS() +{ + return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; +} ODevice *ODevice::inst ( ) { static ODevice *dev = 0; if ( !dev ) { @@ -268,14 +268,12 @@ ODevice *ODevice::inst ( ) ODevice::ODevice ( ) { d = new ODeviceData; - d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; - d-> m_modelstr = "Unknown"; d-> m_model = Model_Unknown; d-> m_vendorstr = "Unknown"; d-> m_vendor = Vendor_Unknown; d-> m_systemstr = "Unknown"; d-> m_system = System_Unknown; @@ -303,14 +301,12 @@ void ODevice::init ( ) */ 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++ ) { @@ -356,13 +352,13 @@ bool ODevice::setSoftSuspend ( bool /*soft*/ ) * device and return once the device got woken up * * @return if the device got suspended */ bool ODevice::suspend ( ) { - if ( !d-> m_qwsserver ) // only qwsserver is allowed to suspend + if ( !isQWS( ) ) // only qwsserver is allowed to suspend return false; if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices return false; bool res = false; @@ -804,15 +800,13 @@ void iPAQ::init ( ) void iPAQ::initButtons ( ) { if ( d-> m_buttons ) return; - d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; - - if ( d-> m_qwsserver ) + if ( isQWS( ) ) 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; @@ -1204,14 +1198,12 @@ void Zaurus::init ( ) void Zaurus::initButtons ( ) { if ( d-> m_buttons ) return; - d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; - d-> m_buttons = new QValueList <ODeviceButton>; struct z_button * pz_buttons; int buttoncount; switch ( d-> m_model ) { case Model_Zaurus_SLC700: |