-rw-r--r-- | libopie/odevice.cpp | 15 | ||||
-rw-r--r-- | libopie/odevicebutton.cpp | 3 |
2 files changed, 12 insertions, 6 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 9e97c56..d5e3c5c 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp @@ -280,7 +280,6 @@ void ODevice::init ( ) b. setPixmap ( Resource::loadPixmap ( ib-> pix )); b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); - d-> m_buttons. append ( b ); } } @@ -516,23 +515,29 @@ void ODevice::reloadButtonMapping ( ) hm = cfg. readEntry ( "HeldActionMessage" ). latin1 ( ); // hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" )); } - + b. setPressedAction ( OQCopMessage ( pch, pm, pdata )); + b. setHeldAction ( OQCopMessage ( hch, hm, hdata )); } } void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) { + QString mb_chan; + if ( button >= (int) d-> m_buttons. count ( )) return; + ODeviceButton &b = d-> m_buttons [button]; - b. setPressedAction ( action ); + b. setPressedAction ( action ); + + mb_chan=b. pressedAction ( ). channel ( ); Config buttonFile ( "ButtonSettings" ); buttonFile. setGroup ( "Button" + QString::number ( button )); - buttonFile. writeEntry ( "PressedActionChannel", (const char*) b. pressedAction ( ). channel ( )); + buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan); buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction ( ). message ( )); // buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction ( ). data ( ))); @@ -546,7 +551,7 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) return; ODeviceButton &b = d-> m_buttons [button]; - b. setHeldAction ( action ); + b. setHeldAction ( action ); Config buttonFile ( "ButtonSettings" ); buttonFile. setGroup ( "Button" + QString::number ( button )); diff --git a/libopie/odevicebutton.cpp b/libopie/odevicebutton.cpp index 2270343..4b22358 100644 --- a/libopie/odevicebutton.cpp +++ b/libopie/odevicebutton.cpp @@ -70,7 +70,7 @@ void OQCopMessage::init ( const QCString &ch, const QCString &m, const QByteArra bool OQCopMessage::send ( ) { - if ( d-> m_channel. isEmpty ( ) || d-> m_message. isEmpty ( )) + if ( d-> m_channel. isEmpty ( ) || d-> m_message. isEmpty ( ) ) return false; QCopEnvelope e ( d-> m_channel, d-> m_message ); @@ -218,6 +218,7 @@ void ODeviceButton::setFactoryPresetPressedAction(const OQCopMessage& action) m_FactoryPresetPressedAction = action; } + void ODeviceButton::setPressedAction(const OQCopMessage& action) { m_PressedAction = action; |