summaryrefslogtreecommitdiff
path: root/libopie
authorgroucho <groucho>2003-03-19 11:36:34 (UTC)
committer groucho <groucho>2003-03-19 11:36:34 (UTC)
commit28be0fcc9bda71175c3ee17e79fce2ac24340ff2 (patch) (unidiff)
treef09c80460e4f0219eb308d612a2e67df57f2c254 /libopie
parent18c6c51705de3b1897f671e54b25929e74d11f23 (diff)
downloadopie-28be0fcc9bda71175c3ee17e79fce2ac24340ff2.zip
opie-28be0fcc9bda71175c3ee17e79fce2ac24340ff2.tar.gz
opie-28be0fcc9bda71175c3ee17e79fce2ac24340ff2.tar.bz2
Fixed bug #744 where non mapped buttons in buttonsettings were not saved by introducing the "
ignore" statement. Also removed unsed debug code
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp15
-rw-r--r--libopie/odevicebutton.cpp3
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
@@ -275,17 +275,16 @@ void ODevice::init ( )
275 ODeviceButton b; 275 ODeviceButton b;
276 276
277 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { 277 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) {
278 b. setKeycode ( ib-> code ); 278 b. setKeycode ( ib-> code );
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 ( );
288} 287}
289 288
290ODevice::~ODevice ( ) 289ODevice::~ODevice ( )
291{ 290{
@@ -511,47 +510,53 @@ void ODevice::reloadButtonMapping ( )
511 pch = cfg. readEntry ( "PressedActionChannel" ). latin1 ( ); 510 pch = cfg. readEntry ( "PressedActionChannel" ). latin1 ( );
512 pm = cfg. readEntry ( "PressedActionMessage" ). latin1 ( ); 511 pm = cfg. readEntry ( "PressedActionMessage" ). latin1 ( );
513 // pdata = decodeBase64 ( buttonFile. readEntry ( "PressedActionArgs" )); 512 // pdata = decodeBase64 ( buttonFile. readEntry ( "PressedActionArgs" ));
514 513
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
525void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) 525void 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
540 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); 545 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
541} 546}
542 547
543void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) 548void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
544{ 549{
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 ( ));
554 buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction ( ). message ( )); 559 buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction ( ). message ( ));
555 560
556 //buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction ( ). data ( ))); 561 //buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction ( ). data ( )));
557 562
diff --git a/libopie/odevicebutton.cpp b/libopie/odevicebutton.cpp
index 2270343..4b22358 100644
--- a/libopie/odevicebutton.cpp
+++ b/libopie/odevicebutton.cpp
@@ -65,17 +65,17 @@ void OQCopMessage::init ( const QCString &ch, const QCString &m, const QByteArra
65 d = new OQCopMessageData ( ); 65 d = new OQCopMessageData ( );
66 d-> m_channel = ch; 66 d-> m_channel = ch;
67 d-> m_message = m; 67 d-> m_message = m;
68 d-> m_data = arg; 68 d-> m_data = arg;
69} 69}
70 70
71bool OQCopMessage::send ( ) 71bool 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
78 if ( d-> m_data. size ( )) 78 if ( d-> m_data. size ( ))
79 e. writeRawBytes ( d-> m_data. data ( ), d-> m_data. size ( )); 79 e. writeRawBytes ( d-> m_data. data ( ), d-> m_data. size ( ));
80 80
81 return true; 81 return true;
@@ -213,16 +213,17 @@ void ODeviceButton::setPixmap(const QPixmap& picture)
213 m_Pixmap = picture; 213 m_Pixmap = picture;
214} 214}
215 215
216void ODeviceButton::setFactoryPresetPressedAction(const OQCopMessage& action) 216void ODeviceButton::setFactoryPresetPressedAction(const OQCopMessage& action)
217{ 217{
218 m_FactoryPresetPressedAction = action; 218 m_FactoryPresetPressedAction = action;
219} 219}
220 220
221
221void ODeviceButton::setPressedAction(const OQCopMessage& action) 222void ODeviceButton::setPressedAction(const OQCopMessage& action)
222{ 223{
223 m_PressedAction = action; 224 m_PressedAction = action;
224} 225}
225 226
226void ODeviceButton::setFactoryPresetHeldAction(const OQCopMessage& action) 227void ODeviceButton::setFactoryPresetHeldAction(const OQCopMessage& action)
227{ 228{
228 m_FactoryPresetHeldAction = action; 229 m_FactoryPresetHeldAction = action;