-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 | |||
@@ -279,9 +279,8 @@ void ODevice::init ( ) | |||
279 | b. setUserText ( qApp-> translate ( "Button", ib-> utext )); | 279 | b. setUserText ( qApp-> translate ( "Button", ib-> utext )); |
280 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); | 280 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); |
281 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); | 281 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); |
282 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); | 282 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); |
283 | |||
284 | d-> m_buttons. append ( b ); | 283 | d-> m_buttons. append ( b ); |
285 | } | 284 | } |
286 | } | 285 | } |
287 | reloadButtonMapping ( ); | 286 | reloadButtonMapping ( ); |
@@ -515,25 +514,31 @@ void ODevice::reloadButtonMapping ( ) | |||
515 | hch = cfg. readEntry ( "HeldActionChannel" ). latin1 ( ); | 514 | hch = cfg. readEntry ( "HeldActionChannel" ). latin1 ( ); |
516 | hm = cfg. readEntry ( "HeldActionMessage" ). latin1 ( ); | 515 | hm = cfg. readEntry ( "HeldActionMessage" ). latin1 ( ); |
517 | // hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" )); | 516 | // hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" )); |
518 | } | 517 | } |
519 | 518 | ||
520 | b. setPressedAction ( OQCopMessage ( pch, pm, pdata )); | 519 | b. setPressedAction ( OQCopMessage ( pch, pm, pdata )); |
520 | |||
521 | b. setHeldAction ( OQCopMessage ( hch, hm, hdata )); | 521 | b. setHeldAction ( OQCopMessage ( hch, hm, hdata )); |
522 | } | 522 | } |
523 | } | 523 | } |
524 | 524 | ||
525 | void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) | 525 | void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) |
526 | { | 526 | { |
527 | QString mb_chan; | ||
528 | |||
527 | if ( button >= (int) d-> m_buttons. count ( )) | 529 | if ( button >= (int) d-> m_buttons. count ( )) |
528 | return; | 530 | return; |
531 | |||
529 | 532 | ||
530 | ODeviceButton &b = d-> m_buttons [button]; | 533 | ODeviceButton &b = d-> m_buttons [button]; |
531 | b. setPressedAction ( action ); | 534 | b. setPressedAction ( action ); |
535 | |||
536 | mb_chan=b. pressedAction ( ). channel ( ); | ||
532 | 537 | ||
533 | Config buttonFile ( "ButtonSettings" ); | 538 | Config buttonFile ( "ButtonSettings" ); |
534 | buttonFile. setGroup ( "Button" + QString::number ( button )); | 539 | buttonFile. setGroup ( "Button" + QString::number ( button )); |
535 | buttonFile. writeEntry ( "PressedActionChannel", (const char*) b. pressedAction ( ). channel ( )); | 540 | buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan); |
536 | buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction ( ). message ( )); | 541 | buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction ( ). message ( )); |
537 | 542 | ||
538 | //buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction ( ). data ( ))); | 543 | //buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction ( ). data ( ))); |
539 | 544 | ||
@@ -545,9 +550,9 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) | |||
545 | if ( button >= (int) d-> m_buttons. count ( )) | 550 | if ( button >= (int) d-> m_buttons. count ( )) |
546 | return; | 551 | return; |
547 | 552 | ||
548 | ODeviceButton &b = d-> m_buttons [button]; | 553 | ODeviceButton &b = d-> m_buttons [button]; |
549 | b. setHeldAction ( action ); | 554 | b. setHeldAction ( action ); |
550 | 555 | ||
551 | Config buttonFile ( "ButtonSettings" ); | 556 | Config buttonFile ( "ButtonSettings" ); |
552 | buttonFile. setGroup ( "Button" + QString::number ( button )); | 557 | buttonFile. setGroup ( "Button" + QString::number ( button )); |
553 | buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction ( ). channel ( )); | 558 | buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction ( ). channel ( )); |
diff --git a/libopie/odevicebutton.cpp b/libopie/odevicebutton.cpp index 2270343..4b22358 100644 --- a/libopie/odevicebutton.cpp +++ b/libopie/odevicebutton.cpp | |||
@@ -69,9 +69,9 @@ void OQCopMessage::init ( const QCString &ch, const QCString &m, const QByteArra | |||
69 | } | 69 | } |
70 | 70 | ||
71 | bool OQCopMessage::send ( ) | 71 | bool OQCopMessage::send ( ) |
72 | { | 72 | { |
73 | if ( d-> m_channel. isEmpty ( ) || d-> m_message. isEmpty ( )) | 73 | if ( d-> m_channel. isEmpty ( ) || d-> m_message. isEmpty ( ) ) |
74 | return false; | 74 | return false; |
75 | 75 | ||
76 | QCopEnvelope e ( d-> m_channel, d-> m_message ); | 76 | QCopEnvelope e ( d-> m_channel, d-> m_message ); |
77 | 77 | ||
@@ -217,8 +217,9 @@ void ODeviceButton::setFactoryPresetPressedAction(const OQCopMessage& action) | |||
217 | { | 217 | { |
218 | m_FactoryPresetPressedAction = action; | 218 | m_FactoryPresetPressedAction = action; |
219 | } | 219 | } |
220 | 220 | ||
221 | |||
221 | void ODeviceButton::setPressedAction(const OQCopMessage& action) | 222 | void ODeviceButton::setPressedAction(const OQCopMessage& action) |
222 | { | 223 | { |
223 | m_PressedAction = action; | 224 | m_PressedAction = action; |
224 | } | 225 | } |