summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp91
-rw-r--r--libopie/odevice.h3
2 files changed, 70 insertions, 24 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 80975c9..377945d 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -70,4 +70,4 @@ public:
- QValueList <ODeviceButton> m_buttons;
- uint m_holdtime;
+ QValueList <ODeviceButton> *m_buttons;
+ uint m_holdtime;
};
@@ -78,2 +78,3 @@ protected:
virtual void init ( );
+ virtual void initButtons ( );
@@ -108,2 +109,3 @@ protected:
virtual void init ( );
+ virtual void initButtons ( );
@@ -256,5 +258,3 @@ ODevice::ODevice ( )
d-> m_holdtime = 1000; // 1000ms
-
- QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
- connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
+ d-> m_buttons = 0;
}
@@ -270,4 +270,14 @@ void ODevice::init ( )
{
+}
+
+void ODevice::initButtons ( )
+{
+ if ( d-> m_buttons )
+ return;
+
// 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++ ) {
@@ -282,3 +292,3 @@ void ODevice::init ( )
b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
- d-> m_buttons. append ( b );
+ d-> m_buttons-> append ( b );
}
@@ -286,2 +296,5 @@ void ODevice::init ( )
reloadButtonMapping ( );
+
+ QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
+ connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
}
@@ -476,5 +489,7 @@ int ODevice::lightSensorResolution ( ) const
-const QValueList <ODeviceButton> &ODevice::buttons ( ) const
+const QValueList <ODeviceButton> &ODevice::buttons ( )
{
- return d-> m_buttons;
+ initButtons ( );
+
+ return *d-> m_buttons;
}
@@ -488,3 +503,5 @@ const ODeviceButton *ODevice::buttonForKeycode ( ushort code )
{
- for ( QValueListConstIterator<ODeviceButton> it = d-> m_buttons. begin ( ); it != d-> m_buttons. end ( ); ++it ) {
+ initButtons ( );
+
+ for ( QValueListConstIterator<ODeviceButton> it = d-> m_buttons-> begin ( ); it != d-> m_buttons-> end ( ); ++it ) {
if ( (*it). keycode ( ) == code )
@@ -497,6 +514,8 @@ void ODevice::reloadButtonMapping ( )
{
+ initButtons ( );
+
Config cfg ( "ButtonSettings" );
- for ( uint i = 0; i < d-> m_buttons. count ( ); i++ ) {
- ODeviceButton &b = d-> m_buttons [i];
+ for ( uint i = 0; i < d-> m_buttons-> count ( ); i++ ) {
+ ODeviceButton &b = ( *d-> m_buttons ) [i];
QString group = "Button" + QString::number ( i );
@@ -526,9 +545,10 @@ void ODevice::remapPressedAction ( int button, const OQCopMessage &action )
{
+ initButtons ( );
+
QString mb_chan;
- if ( button >= (int) d-> m_buttons. count ( ))
+ if ( button >= (int) d-> m_buttons-> count ( ))
return;
-
- ODeviceButton &b = d-> m_buttons [button];
+ ODeviceButton &b = ( *d-> m_buttons ) [button];
b. setPressedAction ( action );
@@ -549,6 +569,8 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
{
- if ( button >= (int) d-> m_buttons. count ( ))
+ initButtons ( );
+
+ if ( button >= (int) d-> m_buttons-> count ( ))
return;
- ODeviceButton &b = d-> m_buttons [button];
+ ODeviceButton &b = ( *d-> m_buttons ) [button];
b. setHeldAction ( action );
@@ -630,2 +652,13 @@ void iPAQ::init ( )
+ if ( d-> m_qwsserver )
+ QWSServer::setKeyboardFilter ( this );
+}
+
+void iPAQ::initButtons ( )
+{
+ if ( d-> m_buttons )
+ return;
+
+ d-> m_buttons = new QValueList <ODeviceButton>;
+
for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
@@ -641,11 +674,12 @@ void iPAQ::init ( )
- d-> m_buttons. append ( b );
+ d-> m_buttons-> append ( b );
}
}
- reloadButtonMapping ( );
+ reloadButtonMapping ( );
- if ( d-> m_qwsserver )
- QWSServer::setKeyboardFilter ( this );
+ QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
+ connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
}
+
//#include <linux/h3600_ts.h> // including kernel headers is evil ...
@@ -995,2 +1029,11 @@ void Zaurus::init ( )
}
+ m_leds [0] = Led_Off;
+}
+
+void Zaurus::initButtons ( )
+{
+ if ( d-> m_buttons )
+ return;
+
+ d-> m_buttons = new QValueList <ODeviceButton>;
@@ -1006,7 +1049,9 @@ void Zaurus::init ( )
- d-> m_buttons. append ( b );
+ d-> m_buttons-> append ( b );
}
+
reloadButtonMapping ( );
-
- m_leds [0] = Led_Off;
+
+ QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
+ connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
}
diff --git a/libopie/odevice.h b/libopie/odevice.h
index 575e1fe..ff578d8 100644
--- a/libopie/odevice.h
+++ b/libopie/odevice.h
@@ -105,2 +105,3 @@ protected:
virtual void init ( );
+ virtual void initButtons ( );
@@ -159,3 +160,3 @@ public:
*/
- const QValueList<ODeviceButton> &buttons ( ) const;
+ const QValueList<ODeviceButton> &buttons ( );