-rw-r--r-- | core/settings/button/buttonsettings.cpp | 8 | ||||
-rw-r--r-- | core/settings/button/buttonsettings.h | 1 | ||||
-rw-r--r-- | core/settings/button/buttonutils.cpp | 22 | ||||
-rw-r--r-- | core/settings/button/remapdlg.cpp | 27 | ||||
-rw-r--r-- | core/settings/button/remapdlg.h | 4 |
5 files changed, 48 insertions, 14 deletions
diff --git a/core/settings/button/buttonsettings.cpp b/core/settings/button/buttonsettings.cpp index c71514c..8b0b0a8 100644 --- a/core/settings/button/buttonsettings.cpp +++ b/core/settings/button/buttonsettings.cpp | |||
@@ -1,249 +1,257 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This file is free software; you can | 5 | _;:, .> :=|. This file is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This file is distributed in the hope that | 12 | .i_,=:_. -<s. This file is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
17 | ..}^=.= = ; Public License for more details. | 17 | ..}^=.= = ; Public License for more details. |
18 | ++= -. .` .: | 18 | ++= -. .` .: |
19 | : = ...= . :.=- You should have received a copy of the GNU | 19 | : = ...= . :.=- You should have received a copy of the GNU |
20 | -. .:....=;==+<; General Public License along with this file; | 20 | -. .:....=;==+<; General Public License along with this file; |
21 | -_. . . )=. = see the file COPYING. If not, write to the | 21 | -_. . . )=. = see the file COPYING. If not, write to the |
22 | -- :-=` Free Software Foundation, Inc., | 22 | -- :-=` Free Software Foundation, Inc., |
23 | 59 Temple Place - Suite 330, | 23 | 59 Temple Place - Suite 330, |
24 | Boston, MA 02111-1307, USA. | 24 | Boston, MA 02111-1307, USA. |
25 | 25 | ||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qtimer.h> | 30 | #include <qtimer.h> |
31 | 31 | ||
32 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
33 | 33 | ||
34 | #include <opie/odevice.h> | 34 | #include <opie/odevice.h> |
35 | 35 | ||
36 | #include "buttonsettings.h" | 36 | #include "buttonsettings.h" |
37 | #include "buttonutils.h" | 37 | #include "buttonutils.h" |
38 | #include "remapdlg.h" | 38 | #include "remapdlg.h" |
39 | 39 | ||
40 | using namespace Opie; | 40 | using namespace Opie; |
41 | 41 | ||
42 | struct buttoninfo { | 42 | struct buttoninfo { |
43 | const ODeviceButton *m_button; | 43 | const ODeviceButton *m_button; |
44 | int m_index; | 44 | int m_index; |
45 | 45 | ||
46 | OQCopMessage m_pmsg; | 46 | OQCopMessage m_pmsg; |
47 | QLabel *m_picon; | 47 | QLabel *m_picon; |
48 | QLabel *m_plabel; | 48 | QLabel *m_plabel; |
49 | 49 | ||
50 | OQCopMessage m_hmsg; | 50 | OQCopMessage m_hmsg; |
51 | QLabel *m_hicon; | 51 | QLabel *m_hicon; |
52 | QLabel *m_hlabel; | 52 | QLabel *m_hlabel; |
53 | 53 | ||
54 | bool m_pdirty : 1; | 54 | bool m_pdirty : 1; |
55 | bool m_hdirty : 1; | 55 | bool m_hdirty : 1; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | 58 | ||
59 | ButtonSettings::ButtonSettings ( ) | 59 | ButtonSettings::ButtonSettings ( ) |
60 | : QDialog ( 0, "ButtonSettings", false, WStyle_ContextHelp ) | 60 | : QDialog ( 0, "ButtonSettings", false, WStyle_ContextHelp ) |
61 | { | 61 | { |
62 | const QValueList <ODeviceButton> &buttons = ODevice::inst ( )-> buttons ( ); | 62 | const QValueList <ODeviceButton> &buttons = ODevice::inst ( )-> buttons ( ); |
63 | (void) ButtonUtils::inst ( ); // initialise | ||
63 | 64 | ||
64 | setCaption ( tr( "Button Settings" )); | 65 | setCaption ( tr( "Button Settings" )); |
65 | 66 | ||
66 | QVBoxLayout *toplay = new QVBoxLayout ( this, 3, 3 ); | 67 | QVBoxLayout *toplay = new QVBoxLayout ( this, 3, 3 ); |
67 | 68 | ||
68 | QLabel *l = new QLabel ( tr( "<center>Press or hold the button you want to remap.</center>" ), this ); | 69 | QLabel *l = new QLabel ( tr( "<center>Press or hold the button you want to remap.</center>" ), this ); |
69 | toplay-> addWidget ( l ); | 70 | toplay-> addWidget ( l ); |
70 | 71 | ||
71 | QGridLayout *lay = new QGridLayout ( toplay ); | 72 | QGridLayout *lay = new QGridLayout ( toplay ); |
72 | lay-> setMargin ( 0 ); | 73 | lay-> setMargin ( 0 ); |
73 | lay-> setColStretch ( 0, 0 ); | 74 | lay-> setColStretch ( 0, 0 ); |
74 | lay-> setColStretch ( 1, 0 ); | 75 | lay-> setColStretch ( 1, 0 ); |
75 | lay-> setColStretch ( 2, 0 ); | 76 | lay-> setColStretch ( 2, 0 ); |
76 | lay-> setColStretch ( 3, 10 ); | 77 | lay-> setColStretch ( 3, 10 ); |
77 | 78 | ||
78 | m_infos. setAutoDelete ( true ); | 79 | m_infos. setAutoDelete ( true ); |
79 | 80 | ||
80 | int i = 1; | 81 | int i = 1; |
81 | int index = 0; | 82 | int index = 0; |
82 | for ( QValueList<ODeviceButton>::ConstIterator it = buttons. begin ( ); it != buttons. end ( ); it++ ) { | 83 | for ( QValueList<ODeviceButton>::ConstIterator it = buttons. begin ( ); it != buttons. end ( ); it++ ) { |
83 | if ( it != buttons. begin ( )) { | 84 | if ( it != buttons. begin ( )) { |
84 | QFrame *f = new QFrame ( this ); | 85 | QFrame *f = new QFrame ( this ); |
85 | f-> setFrameStyle ( QFrame::Sunken | QFrame::VLine ); | 86 | f-> setFrameStyle ( QFrame::Sunken | QFrame::VLine ); |
86 | lay-> addMultiCellWidget ( f, i, i, 0, 2 ); | 87 | lay-> addMultiCellWidget ( f, i, i, 0, 2 ); |
87 | i++; | 88 | i++; |
88 | } | 89 | } |
89 | 90 | ||
90 | buttoninfo *bi = new buttoninfo ( ); | 91 | buttoninfo *bi = new buttoninfo ( ); |
91 | bi-> m_button = &(*it); | 92 | bi-> m_button = &(*it); |
92 | bi-> m_index = index++; | 93 | bi-> m_index = index++; |
93 | bi-> m_pmsg = (*it). pressedAction ( ); | 94 | bi-> m_pmsg = (*it). pressedAction ( ); |
94 | bi-> m_hmsg = (*it). heldAction ( ); | 95 | bi-> m_hmsg = (*it). heldAction ( ); |
95 | bi-> m_pdirty = false; | 96 | bi-> m_pdirty = false; |
96 | bi-> m_hdirty = false; | 97 | bi-> m_hdirty = false; |
97 | 98 | ||
98 | l = new QLabel ( this ); | 99 | l = new QLabel ( this ); |
99 | l-> setPixmap (( *it ). pixmap ( )); | 100 | l-> setPixmap (( *it ). pixmap ( )); |
100 | 101 | ||
101 | lay-> addMultiCellWidget ( l, i, i + 1, 0, 0 ); | 102 | lay-> addMultiCellWidget ( l, i, i + 1, 0, 0 ); |
102 | 103 | ||
103 | l = new QLabel ( tr( "Press:" ), this ); | 104 | l = new QLabel ( tr( "Press:" ), this ); |
104 | lay-> addWidget ( l, i, 1, AlignLeft | AlignBottom ); | 105 | lay-> addWidget ( l, i, 1, AlignLeft | AlignBottom ); |
105 | l = new QLabel ( tr( "Hold:" ), this ); | 106 | l = new QLabel ( tr( "Hold:" ), this ); |
106 | lay-> addWidget ( l, i + 1, 1, AlignLeft | AlignTop ); | 107 | lay-> addWidget ( l, i + 1, 1, AlignLeft | AlignTop ); |
107 | 108 | ||
108 | l = new QLabel ( this ); | 109 | l = new QLabel ( this ); |
109 | l-> setFixedSize ( 16, 16 ); | 110 | l-> setFixedSize ( 16, 16 ); |
110 | lay-> addWidget ( l, i, 2, AlignLeft | AlignBottom ); | 111 | lay-> addWidget ( l, i, 2, AlignLeft | AlignBottom ); |
111 | bi-> m_picon = l; | 112 | bi-> m_picon = l; |
112 | 113 | ||
113 | l = new QLabel ( this ); | 114 | l = new QLabel ( this ); |
114 | l-> setAlignment ( AlignLeft | AlignVCenter | SingleLine ); | 115 | l-> setAlignment ( AlignLeft | AlignVCenter | SingleLine ); |
115 | lay-> addWidget ( l, i, 3, AlignLeft | AlignBottom ); | 116 | lay-> addWidget ( l, i, 3, AlignLeft | AlignBottom ); |
116 | bi-> m_plabel = l; | 117 | bi-> m_plabel = l; |
117 | 118 | ||
118 | l = new QLabel ( this ); | 119 | l = new QLabel ( this ); |
119 | l-> setFixedSize ( 16, 16 ); | 120 | l-> setFixedSize ( 16, 16 ); |
120 | lay-> addWidget ( l, i + 1, 2, AlignLeft | AlignTop ); | 121 | lay-> addWidget ( l, i + 1, 2, AlignLeft | AlignTop ); |
121 | bi-> m_hicon = l; | 122 | bi-> m_hicon = l; |
122 | 123 | ||
123 | l = new QLabel ( this ); | 124 | l = new QLabel ( this ); |
124 | l-> setAlignment ( AlignLeft | AlignVCenter | SingleLine ); | 125 | l-> setAlignment ( AlignLeft | AlignVCenter | SingleLine ); |
125 | lay-> addWidget ( l, i + 1, 3, AlignLeft | AlignTop ); | 126 | lay-> addWidget ( l, i + 1, 3, AlignLeft | AlignTop ); |
126 | bi-> m_hlabel = l; | 127 | bi-> m_hlabel = l; |
127 | 128 | ||
128 | i += 2; | 129 | i += 2; |
129 | 130 | ||
130 | m_infos. append ( bi ); | 131 | m_infos. append ( bi ); |
131 | } | 132 | } |
132 | 133 | ||
133 | toplay-> addStretch ( 10 ); | 134 | toplay-> addStretch ( 10 ); |
134 | 135 | ||
135 | m_last_button = 0; | 136 | m_last_button = 0; |
137 | m_lock = false; | ||
136 | 138 | ||
137 | m_timer = new QTimer ( this ); | 139 | m_timer = new QTimer ( this ); |
138 | connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( keyTimeout ( ))); | 140 | connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( keyTimeout ( ))); |
139 | 141 | ||
140 | updateLabels ( ); | 142 | updateLabels ( ); |
141 | 143 | ||
142 | QPEApplication::grabKeyboard ( ); | 144 | QPEApplication::grabKeyboard ( ); |
143 | } | 145 | } |
144 | 146 | ||
145 | ButtonSettings::~ButtonSettings ( ) | 147 | ButtonSettings::~ButtonSettings ( ) |
146 | { | 148 | { |
147 | QPEApplication::ungrabKeyboard ( ); | 149 | QPEApplication::ungrabKeyboard ( ); |
148 | } | 150 | } |
149 | 151 | ||
150 | void ButtonSettings::updateLabels ( ) | 152 | void ButtonSettings::updateLabels ( ) |
151 | { | 153 | { |
152 | for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { | 154 | for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { |
153 | qCopInfo cip = ButtonUtils::inst ( )-> messageToInfo ((*it)-> m_pmsg ); | 155 | qCopInfo cip = ButtonUtils::inst ( )-> messageToInfo ((*it)-> m_pmsg ); |
154 | 156 | ||
155 | (*it)-> m_picon-> setPixmap ( cip. m_icon ); | 157 | (*it)-> m_picon-> setPixmap ( cip. m_icon ); |
156 | (*it)-> m_plabel-> setText ( cip. m_name ); | 158 | (*it)-> m_plabel-> setText ( cip. m_name ); |
157 | 159 | ||
158 | qCopInfo cih = ButtonUtils::inst ( )-> messageToInfo ((*it)-> m_hmsg ); | 160 | qCopInfo cih = ButtonUtils::inst ( )-> messageToInfo ((*it)-> m_hmsg ); |
159 | 161 | ||
160 | (*it)-> m_hicon-> setPixmap ( cih. m_icon ); | 162 | (*it)-> m_hicon-> setPixmap ( cih. m_icon ); |
161 | (*it)-> m_hlabel-> setText ( cih. m_name ); | 163 | (*it)-> m_hlabel-> setText ( cih. m_name ); |
162 | } | 164 | } |
163 | } | 165 | } |
164 | 166 | ||
165 | buttoninfo *ButtonSettings::buttonInfoForKeycode ( ushort key ) | 167 | buttoninfo *ButtonSettings::buttonInfoForKeycode ( ushort key ) |
166 | { | 168 | { |
167 | for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { | 169 | for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { |
168 | if ((*it)-> m_button-> keycode ( ) == key ) | 170 | if ((*it)-> m_button-> keycode ( ) == key ) |
169 | return *it; | 171 | return *it; |
170 | } | 172 | } |
171 | return 0; | 173 | return 0; |
172 | } | 174 | } |
173 | 175 | ||
174 | void ButtonSettings::keyPressEvent ( QKeyEvent *e ) | 176 | void ButtonSettings::keyPressEvent ( QKeyEvent *e ) |
175 | { | 177 | { |
176 | buttoninfo *bi = buttonInfoForKeycode ( e-> key ( )); | 178 | buttoninfo *bi = buttonInfoForKeycode ( e-> key ( )); |
177 | 179 | ||
178 | if ( bi && !e-> isAutoRepeat ( )) { | 180 | if ( bi && !e-> isAutoRepeat ( )) { |
179 | m_timer-> stop ( ); | 181 | m_timer-> stop ( ); |
180 | m_last_button = bi; | 182 | m_last_button = bi; |
181 | m_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); | 183 | m_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); |
182 | } | 184 | } |
183 | else | 185 | else |
184 | QDialog::keyPressEvent ( e ); | 186 | QDialog::keyPressEvent ( e ); |
185 | } | 187 | } |
186 | 188 | ||
187 | void ButtonSettings::keyReleaseEvent ( QKeyEvent *e ) | 189 | void ButtonSettings::keyReleaseEvent ( QKeyEvent *e ) |
188 | { | 190 | { |
189 | buttoninfo *bi = buttonInfoForKeycode ( e-> key ( )); | 191 | buttoninfo *bi = buttonInfoForKeycode ( e-> key ( )); |
190 | 192 | ||
191 | if ( bi && !e-> isAutoRepeat ( ) && m_timer-> isActive ( )) { | 193 | if ( bi && !e-> isAutoRepeat ( ) && m_timer-> isActive ( )) { |
192 | m_timer-> stop ( ); | 194 | m_timer-> stop ( ); |
193 | edit ( bi, false ); | 195 | edit ( bi, false ); |
194 | } | 196 | } |
195 | else | 197 | else |
196 | QDialog::keyReleaseEvent ( e ); | 198 | QDialog::keyReleaseEvent ( e ); |
197 | } | 199 | } |
198 | 200 | ||
199 | void ButtonSettings::keyTimeout ( ) | 201 | void ButtonSettings::keyTimeout ( ) |
200 | { | 202 | { |
201 | if ( m_last_button ) { | 203 | if ( m_last_button ) { |
202 | edit ( m_last_button, true ); | 204 | edit ( m_last_button, true ); |
203 | m_last_button = false; | 205 | m_last_button = false; |
204 | } | 206 | } |
205 | } | 207 | } |
206 | 208 | ||
207 | void ButtonSettings::edit ( buttoninfo *bi, bool hold ) | 209 | void ButtonSettings::edit ( buttoninfo *bi, bool hold ) |
208 | { | 210 | { |
209 | qDebug ( "remap %s for %s", hold ? "hold" : "press", bi-> m_button-> userText ( ). latin1 ( )); | 211 | qDebug ( "remap %s for %s", hold ? "hold" : "press", bi-> m_button-> userText ( ). latin1 ( )); |
210 | 212 | ||
213 | if ( m_lock ) | ||
214 | return; | ||
215 | m_lock = true; | ||
216 | |||
211 | RemapDlg *d = new RemapDlg ( bi-> m_button, hold, this ); | 217 | RemapDlg *d = new RemapDlg ( bi-> m_button, hold, this ); |
212 | 218 | ||
213 | d-> showMaximized ( ); | 219 | d-> showMaximized ( ); |
214 | if ( d-> exec ( ) == QDialog::Accepted ) { | 220 | if ( d-> exec ( ) == QDialog::Accepted ) { |
215 | qDebug ( " -> %s %s", d-> message ( ). channel ( ). data ( ), d-> message ( ). message ( ). data ( )); | 221 | qDebug ( " -> %s %s", d-> message ( ). channel ( ). data ( ), d-> message ( ). message ( ). data ( )); |
216 | 222 | ||
217 | if ( hold ) { | 223 | if ( hold ) { |
218 | bi-> m_hmsg = d-> message ( ); | 224 | bi-> m_hmsg = d-> message ( ); |
219 | bi-> m_hdirty = true; | 225 | bi-> m_hdirty = true; |
220 | } | 226 | } |
221 | else { | 227 | else { |
222 | bi-> m_pmsg = d-> message ( ); | 228 | bi-> m_pmsg = d-> message ( ); |
223 | bi-> m_pdirty = true; | 229 | bi-> m_pdirty = true; |
224 | } | 230 | } |
225 | 231 | ||
226 | updateLabels ( ); | 232 | updateLabels ( ); |
227 | } | 233 | } |
228 | 234 | ||
229 | delete d; | 235 | delete d; |
236 | |||
237 | m_lock = false; | ||
230 | } | 238 | } |
231 | 239 | ||
232 | void ButtonSettings::accept ( ) | 240 | void ButtonSettings::accept ( ) |
233 | { | 241 | { |
234 | for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { | 242 | for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { |
235 | buttoninfo *bi = *it; | 243 | buttoninfo *bi = *it; |
236 | 244 | ||
237 | if ( bi-> m_pdirty ) | 245 | if ( bi-> m_pdirty ) |
238 | ODevice::inst ( )-> remapPressedAction ( bi-> m_index, bi-> m_pmsg ); | 246 | ODevice::inst ( )-> remapPressedAction ( bi-> m_index, bi-> m_pmsg ); |
239 | if ( bi-> m_hdirty ) | 247 | if ( bi-> m_hdirty ) |
240 | ODevice::inst ( )-> remapHeldAction ( bi-> m_index, bi-> m_hmsg ); | 248 | ODevice::inst ( )-> remapHeldAction ( bi-> m_index, bi-> m_hmsg ); |
241 | } | 249 | } |
242 | QDialog::accept ( ); | 250 | QDialog::accept ( ); |
243 | } | 251 | } |
244 | 252 | ||
245 | void ButtonSettings::done ( int r ) | 253 | void ButtonSettings::done ( int r ) |
246 | { | 254 | { |
247 | QDialog::done ( r ); | 255 | QDialog::done ( r ); |
248 | close ( ); | 256 | close ( ); |
249 | } | 257 | } |
diff --git a/core/settings/button/buttonsettings.h b/core/settings/button/buttonsettings.h index f571825..d41a209 100644 --- a/core/settings/button/buttonsettings.h +++ b/core/settings/button/buttonsettings.h | |||
@@ -1,74 +1,75 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This file is free software; you can | 5 | _;:, .> :=|. This file is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This file is distributed in the hope that | 12 | .i_,=:_. -<s. This file is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
17 | ..}^=.= = ; Public License for more details. | 17 | ..}^=.= = ; Public License for more details. |
18 | ++= -. .` .: | 18 | ++= -. .` .: |
19 | : = ...= . :.=- You should have received a copy of the GNU | 19 | : = ...= . :.=- You should have received a copy of the GNU |
20 | -. .:....=;==+<; General Public License along with this file; | 20 | -. .:....=;==+<; General Public License along with this file; |
21 | -_. . . )=. = see the file COPYING. If not, write to the | 21 | -_. . . )=. = see the file COPYING. If not, write to the |
22 | -- :-=` Free Software Foundation, Inc., | 22 | -- :-=` Free Software Foundation, Inc., |
23 | 59 Temple Place - Suite 330, | 23 | 59 Temple Place - Suite 330, |
24 | Boston, MA 02111-1307, USA. | 24 | Boston, MA 02111-1307, USA. |
25 | 25 | ||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef __BUTTON_SETTINGS_H__ | 28 | #ifndef __BUTTON_SETTINGS_H__ |
29 | #define __BUTTON_SETTINGS_H__ | 29 | #define __BUTTON_SETTINGS_H__ |
30 | 30 | ||
31 | #include <qdialog.h> | 31 | #include <qdialog.h> |
32 | #include <qlist.h> | 32 | #include <qlist.h> |
33 | #include <opie/odevice.h> | 33 | #include <opie/odevice.h> |
34 | 34 | ||
35 | class QTimer; | 35 | class QTimer; |
36 | 36 | ||
37 | using namespace Opie; | 37 | using namespace Opie; |
38 | 38 | ||
39 | class buttoninfo; | 39 | class buttoninfo; |
40 | 40 | ||
41 | class ButtonSettings : public QDialog { | 41 | class ButtonSettings : public QDialog { |
42 | Q_OBJECT | 42 | Q_OBJECT |
43 | 43 | ||
44 | public: | 44 | public: |
45 | ButtonSettings ( ); | 45 | ButtonSettings ( ); |
46 | ~ButtonSettings ( ); | 46 | ~ButtonSettings ( ); |
47 | 47 | ||
48 | virtual void accept ( ); | 48 | virtual void accept ( ); |
49 | virtual void done ( int r ); | 49 | virtual void done ( int r ); |
50 | 50 | ||
51 | private slots: | 51 | private slots: |
52 | void keyTimeout ( ); | 52 | void keyTimeout ( ); |
53 | void updateLabels ( ); | 53 | void updateLabels ( ); |
54 | 54 | ||
55 | protected: | 55 | protected: |
56 | virtual void keyPressEvent ( QKeyEvent *e ); | 56 | virtual void keyPressEvent ( QKeyEvent *e ); |
57 | virtual void keyReleaseEvent ( QKeyEvent *e ); | 57 | virtual void keyReleaseEvent ( QKeyEvent *e ); |
58 | 58 | ||
59 | private: | 59 | private: |
60 | buttoninfo *buttonInfoForKeycode ( ushort key ); | 60 | buttoninfo *buttonInfoForKeycode ( ushort key ); |
61 | 61 | ||
62 | void edit ( buttoninfo *bi, bool hold ); | 62 | void edit ( buttoninfo *bi, bool hold ); |
63 | QString qcopToString ( const OQCopMessage &c ); | 63 | QString qcopToString ( const OQCopMessage &c ); |
64 | 64 | ||
65 | private: | 65 | private: |
66 | QTimer *m_timer; | 66 | QTimer *m_timer; |
67 | buttoninfo *m_last_button; | 67 | buttoninfo *m_last_button; |
68 | 68 | ||
69 | QList <buttoninfo> m_infos; | 69 | QList <buttoninfo> m_infos; |
70 | bool m_lock; | ||
70 | }; | 71 | }; |
71 | 72 | ||
72 | #endif | 73 | #endif |
73 | 74 | ||
74 | 75 | ||
diff --git a/core/settings/button/buttonutils.cpp b/core/settings/button/buttonutils.cpp index bb70047..91d2af3 100644 --- a/core/settings/button/buttonutils.cpp +++ b/core/settings/button/buttonutils.cpp | |||
@@ -8,112 +8,120 @@ | |||
8 | 8 | ||
9 | #include "buttonutils.h" | 9 | #include "buttonutils.h" |
10 | 10 | ||
11 | using namespace Opie; | 11 | using namespace Opie; |
12 | 12 | ||
13 | struct predef_qcop { | 13 | struct predef_qcop { |
14 | const char *m_text; | 14 | const char *m_text; |
15 | const char *m_pixmap; | 15 | const char *m_pixmap; |
16 | const char *m_channel; | 16 | const char *m_channel; |
17 | const char *m_function; | 17 | const char *m_function; |
18 | }; | 18 | }; |
19 | 19 | ||
20 | static const predef_qcop predef [] = { | 20 | static const predef_qcop predef [] = { |
21 | 21 | ||
22 | { QT_TRANSLATE_NOOP( "ButtonSettings", "Beam VCard" ), "beam", "QPE/Application/addressbook", "beamBusinessCard()" }, | 22 | { QT_TRANSLATE_NOOP( "ButtonSettings", "Beam VCard" ), "beam", "QPE/Application/addressbook", "beamBusinessCard()" }, |
23 | { QT_TRANSLATE_NOOP( "ButtonSettings", "Send eMail" ), "buttonsettings/mail", "QPE/Application/mail", "newMail()" }, | 23 | { QT_TRANSLATE_NOOP( "ButtonSettings", "Send eMail" ), "buttonsettings/mail", "QPE/Application/mail", "newMail()" }, |
24 | 24 | ||
25 | 25 | ||
26 | { QT_TRANSLATE_NOOP( "ButtonSettings", "Toggle Menu" ), "buttonsettings/menu", "QPE/TaskBar", "toggleMenu()" }, | 26 | { QT_TRANSLATE_NOOP( "ButtonSettings", "Toggle Menu" ), "buttonsettings/menu", "QPE/TaskBar", "toggleMenu()" }, |
27 | { QT_TRANSLATE_NOOP( "ButtonSettings", "Toggle O-Menu" ), "buttonsettings/omenu", "QPE/TaskBar", "toggleStartMenu()" }, | 27 | { QT_TRANSLATE_NOOP( "ButtonSettings", "Toggle O-Menu" ), "buttonsettings/omenu", "QPE/TaskBar", "toggleStartMenu()" }, |
28 | { QT_TRANSLATE_NOOP( "ButtonSettings", "Show Desktop" ), "home", "QPE/Launcher", "home()" }, | 28 | { QT_TRANSLATE_NOOP( "ButtonSettings", "Show Desktop" ), "home", "QPE/Launcher", "home()" }, |
29 | { QT_TRANSLATE_NOOP( "ButtonSettings", "Toggle Recording" ), "buttonsettings/record", "QPE/VMemo", "toggleRecord()" }, | 29 | { QT_TRANSLATE_NOOP( "ButtonSettings", "Toggle Recording" ), "buttonsettings/record", "QPE/VMemo", "toggleRecord()" }, |
30 | 30 | ||
31 | { 0, 0, 0, 0 } | 31 | { 0, 0, 0, 0 } |
32 | }; | 32 | }; |
33 | 33 | ||
34 | 34 | ||
35 | 35 | ||
36 | 36 | ||
37 | ButtonUtils *ButtonUtils::ButtonUtils::inst ( ) | 37 | ButtonUtils *ButtonUtils::ButtonUtils::inst ( ) |
38 | { | 38 | { |
39 | static ButtonUtils *p = 0; | 39 | static ButtonUtils *p = 0; |
40 | 40 | ||
41 | if ( !p ) { | 41 | if ( !p ) { |
42 | p = new ButtonUtils ( ); | 42 | p = new ButtonUtils ( ); |
43 | ::atexit ( cleanup ); | 43 | ::atexit ( cleanup ); |
44 | } | 44 | } |
45 | return p; | 45 | return p; |
46 | } | 46 | } |
47 | 47 | ||
48 | void ButtonUtils::cleanup ( ) | 48 | void ButtonUtils::cleanup ( ) |
49 | { | 49 | { |
50 | delete inst ( ); | 50 | delete inst ( ); |
51 | } | 51 | } |
52 | 52 | ||
53 | ButtonUtils::ButtonUtils ( ) | 53 | ButtonUtils::ButtonUtils ( ) |
54 | { | 54 | { |
55 | m_apps = new AppLnkSet( MimeType::appsFolderName ( )); | 55 | m_apps = new AppLnkSet( MimeType::appsFolderName ( )); |
56 | } | 56 | } |
57 | 57 | ||
58 | ButtonUtils::~ButtonUtils ( ) | 58 | ButtonUtils::~ButtonUtils ( ) |
59 | { | 59 | { |
60 | delete m_apps; | 60 | delete m_apps; |
61 | } | 61 | } |
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 | if ( ch. isNull ( )) |
69 | return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Ignored</nobr>" )); | 69 | return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Ignored</nobr>" )); |
70 | 70 | ||
71 | for ( const predef_qcop *p = predef; p-> m_text; p++ ) { | 71 | for ( const predef_qcop *p = predef; p-> m_text; p++ ) { |
72 | if (( ch == p-> m_channel ) && ( f == p-> m_function )) | 72 | if (( ch == p-> m_channel ) && ( f == p-> m_function )) |
73 | return qCopInfo ( qApp-> translate ( "ButtonSettings", p-> m_text ), Resource::loadPixmap ( p-> m_pixmap )); | 73 | return qCopInfo ( qApp-> translate ( "ButtonSettings", p-> m_text ), Resource::loadPixmap ( p-> m_pixmap )); |
74 | } | 74 | } |
75 | 75 | ||
76 | if ( ch. left ( 16 ) == "QPE/Application/" ) { | 76 | if ( ch. left ( 16 ) == "QPE/Application/" ) { |
77 | QString app = ch. mid ( 16 ); | 77 | QString app = ch. mid ( 16 ); |
78 | const AppLnk *applnk = m_apps-> findExec ( app ); | 78 | const AppLnk *applnk = m_apps-> findExec ( app ); |
79 | if ( applnk ) | 79 | if ( applnk ) |
80 | app = applnk-> name ( ); | 80 | app = applnk-> name ( ); |
81 | 81 | ||
82 | if (( f == "raise()" ) || ( f == "nextView()" )) | 82 | if (( f == "raise()" ) || ( f == "nextView()" )) |
83 | return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Show <b>%1</b></nobr>" ). arg ( app ), applnk ? applnk-> pixmap ( ) : QPixmap ( )); | 83 | return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Show <b>%1</b></nobr>" ). arg ( app ), applnk ? applnk-> pixmap ( ) : QPixmap ( )); |
84 | else | 84 | else |
85 | return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Call <b>%1</b>: <i>%2</i></nobr>" ). arg ( app ). arg ( f ), applnk ? applnk-> pixmap ( ) : QPixmap ( )); | 85 | return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Call <b>%1</b>: <i>%2</i></nobr>" ). arg ( app ). arg ( f ), applnk ? applnk-> pixmap ( ) : QPixmap ( )); |
86 | } | 86 | } |
87 | else { | 87 | else { |
88 | return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Call <b>%1</b> <i>%2</i></nobr>" ). arg (( ch. left ( 4 ) == "QPE/" ) ? ch. mid ( 4 ) : ch ). arg ( f )); | 88 | return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Call <b>%1</b> <i>%2</i></nobr>" ). arg (( ch. left ( 4 ) == "QPE/" ) ? ch. mid ( 4 ) : ch ). arg ( f )); |
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | 92 | ||
93 | void ButtonUtils::insertActions ( QListViewItem *here ) | 93 | void ButtonUtils::insertActions ( QListViewItem *here ) |
94 | { | 94 | { |
95 | for ( const predef_qcop *p = predef; p-> m_text; p++ ) { | 95 | for ( const predef_qcop *p = predef; p-> m_text; p++ ) { |
96 | QListViewItem *item = new QListViewItem ( here, qApp-> translate ( "ButtonSettings", p-> m_text ), p-> m_channel, p-> m_function ); | 96 | QListViewItem *item = new QListViewItem ( here, qApp-> translate ( "ButtonSettings", p-> m_text ), p-> m_channel, p-> m_function ); |
97 | item-> setPixmap ( 0, Resource::loadPixmap ( p-> m_pixmap )); | 97 | item-> setPixmap ( 0, Resource::loadPixmap ( p-> m_pixmap )); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | 101 | ||
102 | void ButtonUtils::insertAppLnks ( QListViewItem *here ) | 102 | void ButtonUtils::insertAppLnks ( QListViewItem *here ) |
103 | { | 103 | { |
104 | QStringList types = m_apps-> types ( ); | 104 | QStringList types = m_apps-> types ( ); |
105 | QListViewItem *typeitem [types. count ( )]; | ||
105 | 106 | ||
107 | int i = 0; | ||
106 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { | 108 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { |
107 | QListViewItem *item = new QListViewItem ( here, m_apps-> typeName ( *it )); | 109 | QListViewItem *item = new QListViewItem ( here, m_apps-> typeName ( *it )); |
108 | item-> setPixmap ( 0, m_apps-> typePixmap ( *it )); | 110 | item-> setPixmap ( 0, m_apps-> typePixmap ( *it )); |
109 | 111 | ||
110 | for ( QListIterator <AppLnk> appit ( m_apps-> children ( )); *appit; ++appit ) { | 112 | typeitem [i++] = item; |
111 | AppLnk *l = *appit; | 113 | } |
112 | 114 | ||
115 | for ( QListIterator <AppLnk> appit ( m_apps-> children ( )); *appit; ++appit ) { | ||
116 | AppLnk *l = *appit; | ||
117 | |||
118 | int i = 0; | ||
119 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { | ||
113 | if ( l-> type ( ) == *it ) { | 120 | if ( l-> type ( ) == *it ) { |
114 | QListViewItem *sub = new QListViewItem ( item, l-> name ( ), QString ( "QPE/Application/" ) + l-> exec ( ), "raise()" ); | 121 | QListViewItem *sub = new QListViewItem ( typeitem [i], l-> name ( ), QString ( "QPE/Application/" ) + l-> exec ( ), "raise()" ); |
115 | sub-> setPixmap ( 0, l-> pixmap ( )); | 122 | sub-> setPixmap ( 0, l-> pixmap ( )); |
116 | } | 123 | } |
117 | } | 124 | i++; |
125 | } | ||
118 | } | 126 | } |
119 | } | 127 | } |
diff --git a/core/settings/button/remapdlg.cpp b/core/settings/button/remapdlg.cpp index 511d0e7..a251bd4 100644 --- a/core/settings/button/remapdlg.cpp +++ b/core/settings/button/remapdlg.cpp | |||
@@ -1,119 +1,132 @@ | |||
1 | #include <qlistview.h> | 1 | #include <qlistview.h> |
2 | #include <qlabel.h> | 2 | #include <qlabel.h> |
3 | #include <qcombobox.h> | 3 | #include <qcombobox.h> |
4 | #include <qtimer.h> | ||
4 | 5 | ||
5 | #include "remapdlg.h" | 6 | #include "remapdlg.h" |
6 | #include "buttonutils.h" | 7 | #include "buttonutils.h" |
7 | 8 | ||
8 | using namespace Opie; | 9 | using namespace Opie; |
9 | 10 | ||
10 | class NoSortItem : public QListViewItem { | 11 | class NoSortItem : public QListViewItem { |
11 | public: | 12 | public: |
12 | NoSortItem ( QListView *lv, uint pos, const QString &str, const QCString &s1 = 0, const QCString &s2 = 0 ) | 13 | NoSortItem ( QListView *lv, uint pos, const QString &str, const QCString &s1 = 0, const QCString &s2 = 0 ) |
13 | : QListViewItem ( lv, str, s1, s2 ) | 14 | : QListViewItem ( lv, str, s1, s2 ) |
14 | { | 15 | { |
15 | m_key = QString ( QChar ( 'a' + pos )); | 16 | m_key = QString ( QChar ( 'a' + pos )); |
16 | m_def = false; | 17 | m_def = false; |
17 | } | 18 | } |
18 | 19 | ||
19 | void setDefault ( bool b ) | 20 | void setDefault ( bool b ) |
20 | { | 21 | { |
21 | m_def = b; | 22 | m_def = b; |
22 | } | 23 | } |
23 | 24 | ||
24 | virtual QString key ( int /*column*/, bool /*ascending*/ ) const | 25 | virtual QString key ( int /*column*/, bool /*ascending*/ ) const |
25 | { | 26 | { |
26 | return m_key; | 27 | return m_key; |
27 | } | 28 | } |
28 | 29 | ||
29 | virtual void paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align ) | 30 | virtual void paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align ) |
30 | { | 31 | { |
31 | if ( m_def ) { | 32 | if ( m_def ) { |
32 | QFont f ( listView ( )-> font ( )); | 33 | QFont f ( listView ( )-> font ( )); |
33 | f. setBold ( true ); | 34 | f. setBold ( true ); |
34 | p-> setFont ( f ); | 35 | p-> setFont ( f ); |
35 | } | 36 | } |
36 | QListViewItem::paintCell ( p, cg, column, width, align ); | 37 | QListViewItem::paintCell ( p, cg, column, width, align ); |
37 | } | 38 | } |
38 | 39 | ||
39 | private: | 40 | private: |
40 | QString m_key; | 41 | QString m_key; |
41 | bool m_def; | 42 | bool m_def; |
42 | }; | 43 | }; |
43 | 44 | ||
44 | 45 | ||
45 | RemapDlg::RemapDlg ( const Opie::ODeviceButton *b, bool hold, QWidget *parent, const char *name ) | 46 | RemapDlg::RemapDlg ( const Opie::ODeviceButton *b, bool hold, QWidget *parent, const char *name ) |
46 | : RemapDlgBase ( parent, name, true, WStyle_ContextHelp ) | 47 | : RemapDlgBase ( parent, name, true, WStyle_ContextHelp ) |
47 | { | 48 | { |
48 | setCaption ( tr( "%1 %2", "(hold|press) buttoname" ). arg( hold ? tr( "Held" ) : tr( "Pressed" )). arg ( b-> userText ( ))); | 49 | setCaption ( tr( "%1 %2", "(hold|press) buttoname" ). arg( hold ? tr( "Held" ) : tr( "Pressed" )). arg ( b-> userText ( ))); |
50 | |||
51 | m_current = 0; | ||
52 | |||
53 | static const char * const def_channels [] = { "QPE/Application/", "QPE/Launcher", "QPE/System", "QPE/TaskBar", "QPE/", 0 }; | ||
54 | w_channel-> insertStrList ((const char **) def_channels ); | ||
49 | 55 | ||
50 | m_msg = hold ? b-> heldAction ( ) : b-> pressedAction ( ); | 56 | m_msg = hold ? b-> heldAction ( ) : b-> pressedAction ( ); |
51 | m_msg_preset = hold ? b-> factoryPresetHeldAction ( ) : b-> factoryPresetPressedAction ( ); | 57 | m_msg_preset = hold ? b-> factoryPresetHeldAction ( ) : b-> factoryPresetPressedAction ( ); |
52 | 58 | ||
53 | m_map_none = new NoSortItem ( w_list, 0, tr( "No mapping" )); | 59 | m_map_none = new NoSortItem ( w_list, 0, tr( "No mapping" )); |
54 | 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 ( )); |
55 | ((NoSortItem *) m_map_preset )-> setDefault ( true ); | 61 | ((NoSortItem *) m_map_preset )-> setDefault ( true ); |
56 | m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg. channel ( ), m_msg. message ( )); | 62 | m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg. channel ( ), m_msg. message ( )); |
57 | 63 | ||
58 | QListViewItem *it = new NoSortItem ( w_list, 3, tr( "Actions" )); | 64 | QListViewItem *it = new NoSortItem ( w_list, 3, tr( "Actions" )); |
59 | ButtonUtils::inst ( )-> insertActions ( it ); | 65 | ButtonUtils::inst ( )-> insertActions ( it ); |
60 | it-> setOpen ( true ); | 66 | it-> setOpen ( true ); |
61 | 67 | ||
62 | it = new NoSortItem ( w_list, 4, tr( "Show" )); | 68 | m_map_show = new NoSortItem ( w_list, 4, tr( "Show" )); |
63 | ButtonUtils::inst ( )-> insertAppLnks ( it ); | ||
64 | 69 | ||
65 | m_current = m_map_custom; | 70 | m_current = m_map_custom; |
66 | w_list-> setCurrentItem ( m_current ); | 71 | w_list-> setCurrentItem ( m_current ); |
67 | 72 | ||
68 | static const char * const def_channels [] = { | 73 | QTimer::singleShot ( 0, this, SLOT( delayedInit ( ))); |
69 | "QPE/Application/", "QPE/Launcher", "QPE/System", "QPE/TaskBar", "QPE/", 0 | ||
70 | }; | ||
71 | |||
72 | w_channel-> insertStrList ((const char **) def_channels ); | ||
73 | } | 74 | } |
74 | 75 | ||
75 | RemapDlg::~RemapDlg ( ) | 76 | RemapDlg::~RemapDlg ( ) |
76 | { | 77 | { |
77 | } | 78 | } |
78 | 79 | ||
80 | void RemapDlg::delayedInit ( ) | ||
81 | { | ||
82 | bool b = w_list-> viewport ( )-> isUpdatesEnabled ( ); | ||
83 | w_list-> viewport ( )-> setUpdatesEnabled ( false ); | ||
84 | |||
85 | ButtonUtils::inst ( )-> insertAppLnks ( m_map_show ); | ||
86 | |||
87 | w_list-> viewport ( )-> setUpdatesEnabled ( b ); | ||
88 | |||
89 | m_map_show-> repaint ( ); | ||
90 | } | ||
91 | |||
79 | void RemapDlg::itemChanged ( QListViewItem *it ) | 92 | void RemapDlg::itemChanged ( QListViewItem *it ) |
80 | { | 93 | { |
81 | bool enabled = false; | 94 | bool enabled = false; |
82 | OQCopMessage m; | 95 | OQCopMessage m; |
83 | 96 | ||
84 | m_current = it; | 97 | m_current = it; |
85 | 98 | ||
86 | if ( it == m_map_none ) | 99 | if ( it == m_map_none ) |
87 | m_msg = m = OQCopMessage ( 0, 0 ); | 100 | m_msg = m = OQCopMessage ( 0, 0 ); |
88 | else if ( it == m_map_preset ) | 101 | else if ( it == m_map_preset ) |
89 | m_msg = m = m_msg_preset; | 102 | m_msg = m = m_msg_preset; |
90 | else if ( it && !it-> childCount ( )) { | 103 | else if ( it && !it-> childCount ( )) { |
91 | enabled = ( it == m_map_custom ); | 104 | enabled = ( it == m_map_custom ); |
92 | m_msg = m = OQCopMessage ( it-> text ( 1 ). latin1 ( ), it-> text ( 2 ). latin1 ( )); | 105 | m_msg = m = OQCopMessage ( it-> text ( 1 ). latin1 ( ), it-> text ( 2 ). latin1 ( )); |
93 | } | 106 | } |
94 | 107 | ||
95 | w_channel-> setEnabled ( enabled ); | 108 | w_channel-> setEnabled ( enabled ); |
96 | w_message-> setEnabled ( enabled ); | 109 | w_message-> setEnabled ( enabled ); |
97 | 110 | ||
98 | w_channel-> setEditText ( m. channel ( )); | 111 | w_channel-> setEditText ( m. channel ( )); |
99 | w_message-> setEditText ( m. message ( )); | 112 | w_message-> setEditText ( m. message ( )); |
100 | } | 113 | } |
101 | 114 | ||
102 | void RemapDlg::textChanged ( const QString &str ) | 115 | void RemapDlg::textChanged ( const QString &str ) |
103 | { | 116 | { |
104 | if ( !m_current ) | 117 | if ( !m_current ) |
105 | return; | 118 | return; |
106 | 119 | ||
107 | QComboBox *which = (QComboBox *) sender ( ); | 120 | QComboBox *which = (QComboBox *) sender ( ); |
108 | 121 | ||
109 | if ( which == w_channel ) | 122 | if ( which == w_channel ) |
110 | m_current-> setText ( 1, str ); | 123 | m_current-> setText ( 1, str ); |
111 | else if ( which == w_message ) | 124 | else if ( which == w_message ) |
112 | m_current-> setText ( 2, str ); | 125 | m_current-> setText ( 2, str ); |
113 | } | 126 | } |
114 | 127 | ||
115 | OQCopMessage RemapDlg::message ( ) | 128 | OQCopMessage RemapDlg::message ( ) |
116 | { | 129 | { |
117 | return m_msg; | 130 | return m_msg; |
118 | } | 131 | } |
119 | 132 | ||
diff --git a/core/settings/button/remapdlg.h b/core/settings/button/remapdlg.h index 8c9cc02..046a22f 100644 --- a/core/settings/button/remapdlg.h +++ b/core/settings/button/remapdlg.h | |||
@@ -1,35 +1,39 @@ | |||
1 | #ifndef __REMAPDLG_H__ | 1 | #ifndef __REMAPDLG_H__ |
2 | #define __REMAPDLG_H__ | 2 | #define __REMAPDLG_H__ |
3 | 3 | ||
4 | #include <opie/odevicebutton.h> | 4 | #include <opie/odevicebutton.h> |
5 | 5 | ||
6 | #include "remapdlgbase.h" | 6 | #include "remapdlgbase.h" |
7 | 7 | ||
8 | class QListViewItem; | 8 | class QListViewItem; |
9 | 9 | ||
10 | 10 | ||
11 | class RemapDlg : public RemapDlgBase { | 11 | class RemapDlg : public RemapDlgBase { |
12 | Q_OBJECT | 12 | Q_OBJECT |
13 | 13 | ||
14 | public: | 14 | public: |
15 | RemapDlg ( const Opie::ODeviceButton *b, bool hold, QWidget* parent = 0, const char* name = 0 ); | 15 | RemapDlg ( const Opie::ODeviceButton *b, bool hold, QWidget* parent = 0, const char* name = 0 ); |
16 | ~RemapDlg ( ); | 16 | ~RemapDlg ( ); |
17 | 17 | ||
18 | Opie::OQCopMessage message ( ); | 18 | Opie::OQCopMessage message ( ); |
19 | 19 | ||
20 | public slots: | 20 | public slots: |
21 | virtual void itemChanged ( QListViewItem * ); | 21 | virtual void itemChanged ( QListViewItem * ); |
22 | virtual void textChanged ( const QString & ); | 22 | virtual void textChanged ( const QString & ); |
23 | |||
24 | private slots: | ||
25 | void delayedInit ( ); | ||
23 | 26 | ||
24 | private: | 27 | private: |
25 | Opie::OQCopMessage m_msg; | 28 | Opie::OQCopMessage m_msg; |
26 | Opie::OQCopMessage m_msg_preset; | 29 | Opie::OQCopMessage m_msg_preset; |
27 | 30 | ||
28 | QListViewItem *m_current; | 31 | QListViewItem *m_current; |
29 | 32 | ||
30 | QListViewItem *m_map_none; | 33 | QListViewItem *m_map_none; |
31 | QListViewItem *m_map_preset; | 34 | QListViewItem *m_map_preset; |
32 | QListViewItem *m_map_custom; | 35 | QListViewItem *m_map_custom; |
36 | QListViewItem *m_map_show; | ||
33 | }; | 37 | }; |
34 | 38 | ||
35 | #endif | 39 | #endif |