author | groucho <groucho> | 2003-03-19 11:36:34 (UTC) |
---|---|---|
committer | groucho <groucho> | 2003-03-19 11:36:34 (UTC) |
commit | 28be0fcc9bda71175c3ee17e79fce2ac24340ff2 (patch) (unidiff) | |
tree | f09c80460e4f0219eb308d612a2e67df57f2c254 /core/settings | |
parent | 18c6c51705de3b1897f671e54b25929e74d11f23 (diff) | |
download | opie-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
-rw-r--r-- | core/settings/button/buttonsettings.cpp | 3 | ||||
-rw-r--r-- | core/settings/button/buttonutils.cpp | 3 | ||||
-rw-r--r-- | core/settings/button/remapdlg.cpp | 24 |
3 files changed, 24 insertions, 6 deletions
diff --git a/core/settings/button/buttonsettings.cpp b/core/settings/button/buttonsettings.cpp index eabb779..942d5e4 100644 --- a/core/settings/button/buttonsettings.cpp +++ b/core/settings/button/buttonsettings.cpp | |||
@@ -205,23 +205,22 @@ void ButtonSettings::keyTimeout ( ) | |||
205 | m_last_button = false; | 205 | m_last_button = false; |
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
209 | void ButtonSettings::edit ( buttoninfo *bi, bool hold ) | 209 | void ButtonSettings::edit ( buttoninfo *bi, bool hold ) |
210 | { | 210 | { |
211 | qDebug ( "remap %s for %s", hold ? "hold" : "press", bi-> m_button-> userText ( ). latin1 ( )); | ||
212 | 211 | ||
213 | if ( m_lock ) | 212 | if ( m_lock ) |
214 | return; | 213 | return; |
215 | m_lock = true; | 214 | m_lock = true; |
216 | 215 | ||
217 | RemapDlg *d = new RemapDlg ( bi-> m_button, hold, this ); | 216 | RemapDlg *d = new RemapDlg ( bi-> m_button, hold, this ); |
218 | 217 | ||
219 | d-> showMaximized ( ); | 218 | d-> showMaximized ( ); |
220 | if ( d-> exec ( ) == QDialog::Accepted ) { | 219 | if ( d-> exec ( ) == QDialog::Accepted ) { |
221 | qDebug ( " -> %s %s", d-> message ( ). channel ( ). data ( ), d-> message ( ). message ( ). data ( )); | 220 | |
222 | 221 | ||
223 | if ( hold ) { | 222 | if ( hold ) { |
224 | bi-> m_hmsg = d-> message ( ); | 223 | bi-> m_hmsg = d-> message ( ); |
225 | bi-> m_hdirty = true; | 224 | bi-> m_hdirty = true; |
226 | } | 225 | } |
227 | else { | 226 | else { |
diff --git a/core/settings/button/buttonutils.cpp b/core/settings/button/buttonutils.cpp index 91d2af3..27a2f38 100644 --- a/core/settings/button/buttonutils.cpp +++ b/core/settings/button/buttonutils.cpp | |||
@@ -62,13 +62,14 @@ ButtonUtils::~ButtonUtils ( ) | |||
62 | 62 | ||
63 | qCopInfo ButtonUtils::messageToInfo ( const OQCopMessage &c ) | 63 | qCopInfo ButtonUtils::messageToInfo ( const OQCopMessage &c ) |
64 | { | 64 | { |
65 | QCString ch = c. channel ( ); | 65 | QCString ch = c. channel ( ); |
66 | QCString f = c. message ( ); | 66 | QCString f = c. message ( ); |
67 | 67 | ||
68 | if ( ch. isNull ( )) | 68 | |
69 | if ( ch == "ignore" ) | ||
69 | return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Ignored</nobr>" )); | 70 | return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Ignored</nobr>" )); |
70 | 71 | ||
71 | for ( const predef_qcop *p = predef; p-> m_text; p++ ) { | 72 | for ( const predef_qcop *p = predef; p-> m_text; p++ ) { |
72 | if (( ch == p-> m_channel ) && ( f == p-> m_function )) | 73 | if (( ch == p-> m_channel ) && ( f == p-> m_function )) |
73 | return qCopInfo ( qApp-> translate ( "ButtonSettings", p-> m_text ), Resource::loadPixmap ( p-> m_pixmap )); | 74 | return qCopInfo ( qApp-> translate ( "ButtonSettings", p-> m_text ), Resource::loadPixmap ( p-> m_pixmap )); |
74 | } | 75 | } |
diff --git a/core/settings/button/remapdlg.cpp b/core/settings/button/remapdlg.cpp index a251bd4..b6ee60b 100644 --- a/core/settings/button/remapdlg.cpp +++ b/core/settings/button/remapdlg.cpp | |||
@@ -56,21 +56,31 @@ RemapDlg::RemapDlg ( const Opie::ODeviceButton *b, bool hold, QWidget *parent, c | |||
56 | m_msg = hold ? b-> heldAction ( ) : b-> pressedAction ( ); | 56 | m_msg = hold ? b-> heldAction ( ) : b-> pressedAction ( ); |
57 | m_msg_preset = hold ? b-> factoryPresetHeldAction ( ) : b-> factoryPresetPressedAction ( ); | 57 | m_msg_preset = hold ? b-> factoryPresetHeldAction ( ) : b-> factoryPresetPressedAction ( ); |
58 | 58 | ||
59 | m_map_none = new NoSortItem ( w_list, 0, tr( "No mapping" )); | 59 | m_map_none = new NoSortItem ( w_list, 0, tr( "No mapping" )); |
60 | m_map_preset = new NoSortItem ( w_list, 1, tr( "Default" ), m_msg_preset. channel ( ), m_msg_preset. message ( )); | 60 | m_map_preset = new NoSortItem ( w_list, 1, tr( "Default" ), m_msg_preset. channel ( ), m_msg_preset. message ( )); |
61 | ((NoSortItem *) m_map_preset )-> setDefault ( true ); | 61 | ((NoSortItem *) m_map_preset )-> setDefault ( true ); |
62 | |||
63 | if (m_msg. channel ( ) == "ignore") | ||
64 | { | ||
65 | m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg_preset. channel ( ), m_msg_preset. message ( )); | ||
66 | |||
67 | m_current = m_map_none; | ||
68 | } | ||
69 | else | ||
70 | { | ||
62 | m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg. channel ( ), m_msg. message ( )); | 71 | m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg. channel ( ), m_msg. message ( )); |
72 | m_current = m_map_custom; | ||
73 | } | ||
63 | 74 | ||
64 | QListViewItem *it = new NoSortItem ( w_list, 3, tr( "Actions" )); | 75 | QListViewItem *it = new NoSortItem ( w_list, 3, tr( "Actions" )); |
65 | ButtonUtils::inst ( )-> insertActions ( it ); | 76 | ButtonUtils::inst ( )-> insertActions ( it ); |
66 | it-> setOpen ( true ); | 77 | it-> setOpen ( true ); |
67 | 78 | ||
68 | m_map_show = new NoSortItem ( w_list, 4, tr( "Show" )); | 79 | m_map_show = new NoSortItem ( w_list, 4, tr( "Show" )); |
69 | 80 | ||
70 | m_current = m_map_custom; | ||
71 | w_list-> setCurrentItem ( m_current ); | 81 | w_list-> setCurrentItem ( m_current ); |
72 | 82 | ||
73 | QTimer::singleShot ( 0, this, SLOT( delayedInit ( ))); | 83 | QTimer::singleShot ( 0, this, SLOT( delayedInit ( ))); |
74 | } | 84 | } |
75 | 85 | ||
76 | RemapDlg::~RemapDlg ( ) | 86 | RemapDlg::~RemapDlg ( ) |
@@ -94,16 +104,24 @@ void RemapDlg::itemChanged ( QListViewItem *it ) | |||
94 | bool enabled = false; | 104 | bool enabled = false; |
95 | OQCopMessage m; | 105 | OQCopMessage m; |
96 | 106 | ||
97 | m_current = it; | 107 | m_current = it; |
98 | 108 | ||
99 | if ( it == m_map_none ) | 109 | if ( it == m_map_none ) |
100 | m_msg = m = OQCopMessage ( 0, 0 ); | 110 | { |
111 | m_msg = m = OQCopMessage ( "ignore", 0 ); | ||
112 | qDebug ("***ignoring"); | ||
113 | } | ||
101 | else if ( it == m_map_preset ) | 114 | else if ( it == m_map_preset ) |
115 | { | ||
102 | m_msg = m = m_msg_preset; | 116 | m_msg = m = m_msg_preset; |
103 | else if ( it && !it-> childCount ( )) { | 117 | qDebug ("***Preset"); |
118 | } | ||
119 | else if ( it && !it-> childCount ( )) | ||
120 | { | ||
121 | qDebug ("***Custom: %s %s ",it-> text ( 1 ). latin1 ( ), it-> text ( 2 ). latin1 ( )); | ||
104 | enabled = ( it == m_map_custom ); | 122 | enabled = ( it == m_map_custom ); |
105 | m_msg = m = OQCopMessage ( it-> text ( 1 ). latin1 ( ), it-> text ( 2 ). latin1 ( )); | 123 | m_msg = m = OQCopMessage ( it-> text ( 1 ). latin1 ( ), it-> text ( 2 ). latin1 ( )); |
106 | } | 124 | } |
107 | 125 | ||
108 | w_channel-> setEnabled ( enabled ); | 126 | w_channel-> setEnabled ( enabled ); |
109 | w_message-> setEnabled ( enabled ); | 127 | w_message-> setEnabled ( enabled ); |