Diffstat (limited to 'core/settings/button/buttonsettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/settings/button/buttonsettings.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/core/settings/button/buttonsettings.cpp b/core/settings/button/buttonsettings.cpp index 523e295..141e0f6 100644 --- a/core/settings/button/buttonsettings.cpp +++ b/core/settings/button/buttonsettings.cpp | |||
@@ -169,87 +169,86 @@ buttoninfo *ButtonSettings::buttonInfoForKeycode ( ushort key ) | |||
169 | if ((*it)-> m_button-> keycode ( ) == key ) | 169 | if ((*it)-> m_button-> keycode ( ) == key ) |
170 | return *it; | 170 | return *it; |
171 | } | 171 | } |
172 | return 0; | 172 | return 0; |
173 | } | 173 | } |
174 | 174 | ||
175 | void ButtonSettings::keyPressEvent ( QKeyEvent *e ) | 175 | void ButtonSettings::keyPressEvent ( QKeyEvent *e ) |
176 | { | 176 | { |
177 | buttoninfo *bi = buttonInfoForKeycode ( e-> key ( )); | 177 | buttoninfo *bi = buttonInfoForKeycode ( e-> key ( )); |
178 | 178 | ||
179 | if ( bi && !e-> isAutoRepeat ( )) { | 179 | if ( bi && !e-> isAutoRepeat ( )) { |
180 | m_timer-> stop ( ); | 180 | m_timer-> stop ( ); |
181 | m_last_button = bi; | 181 | m_last_button = bi; |
182 | m_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); | 182 | m_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); |
183 | } | 183 | } |
184 | else | 184 | else |
185 | QDialog::keyPressEvent ( e ); | 185 | QDialog::keyPressEvent ( e ); |
186 | } | 186 | } |
187 | 187 | ||
188 | void ButtonSettings::keyReleaseEvent ( QKeyEvent *e ) | 188 | void ButtonSettings::keyReleaseEvent ( QKeyEvent *e ) |
189 | { | 189 | { |
190 | buttoninfo *bi = buttonInfoForKeycode ( e-> key ( )); | 190 | buttoninfo *bi = buttonInfoForKeycode ( e-> key ( )); |
191 | 191 | ||
192 | if ( bi && !e-> isAutoRepeat ( ) && m_timer-> isActive ( )) { | 192 | if ( bi && !e-> isAutoRepeat ( ) && m_timer-> isActive ( )) { |
193 | m_timer-> stop ( ); | 193 | m_timer-> stop ( ); |
194 | edit ( bi, false ); | 194 | edit ( bi, false ); |
195 | } | 195 | } |
196 | else | 196 | else |
197 | QDialog::keyReleaseEvent ( e ); | 197 | QDialog::keyReleaseEvent ( e ); |
198 | } | 198 | } |
199 | 199 | ||
200 | void ButtonSettings::keyTimeout ( ) | 200 | void ButtonSettings::keyTimeout ( ) |
201 | { | 201 | { |
202 | if ( m_last_button ) { | 202 | if ( m_last_button ) { |
203 | edit ( m_last_button, true ); | 203 | edit ( m_last_button, true ); |
204 | m_last_button = false; | 204 | m_last_button = false; |
205 | } | 205 | } |
206 | } | 206 | } |
207 | 207 | ||
208 | void ButtonSettings::edit ( buttoninfo *bi, bool hold ) | 208 | void ButtonSettings::edit ( buttoninfo *bi, bool hold ) |
209 | { | 209 | { |
210 | 210 | ||
211 | if ( m_lock ) | 211 | if ( m_lock ) |
212 | return; | 212 | return; |
213 | m_lock = true; | 213 | m_lock = true; |
214 | 214 | ||
215 | RemapDlg *d = new RemapDlg ( bi-> m_button, hold, this ); | 215 | RemapDlg *d = new RemapDlg ( bi-> m_button, hold, this ); |
216 | 216 | ||
217 | d-> showMaximized ( ); | 217 | if ( QPEApplication::execDialog ( d ) == QDialog::Accepted ) { |
218 | if ( d-> exec ( ) == QDialog::Accepted ) { | ||
219 | 218 | ||
220 | 219 | ||
221 | if ( hold ) { | 220 | if ( hold ) { |
222 | bi-> m_hmsg = d-> message ( ); | 221 | bi-> m_hmsg = d-> message ( ); |
223 | bi-> m_hdirty = true; | 222 | bi-> m_hdirty = true; |
224 | } | 223 | } |
225 | else { | 224 | else { |
226 | bi-> m_pmsg = d-> message ( ); | 225 | bi-> m_pmsg = d-> message ( ); |
227 | bi-> m_pdirty = true; | 226 | bi-> m_pdirty = true; |
228 | } | 227 | } |
229 | 228 | ||
230 | updateLabels ( ); | 229 | updateLabels ( ); |
231 | } | 230 | } |
232 | 231 | ||
233 | delete d; | 232 | delete d; |
234 | 233 | ||
235 | m_lock = false; | 234 | m_lock = false; |
236 | } | 235 | } |
237 | 236 | ||
238 | void ButtonSettings::accept ( ) | 237 | void ButtonSettings::accept ( ) |
239 | { | 238 | { |
240 | for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { | 239 | for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { |
241 | buttoninfo *bi = *it; | 240 | buttoninfo *bi = *it; |
242 | 241 | ||
243 | if ( bi-> m_pdirty ) | 242 | if ( bi-> m_pdirty ) |
244 | ODevice::inst ( )-> remapPressedAction ( bi-> m_index, bi-> m_pmsg ); | 243 | ODevice::inst ( )-> remapPressedAction ( bi-> m_index, bi-> m_pmsg ); |
245 | if ( bi-> m_hdirty ) | 244 | if ( bi-> m_hdirty ) |
246 | ODevice::inst ( )-> remapHeldAction ( bi-> m_index, bi-> m_hmsg ); | 245 | ODevice::inst ( )-> remapHeldAction ( bi-> m_index, bi-> m_hmsg ); |
247 | } | 246 | } |
248 | QDialog::accept ( ); | 247 | QDialog::accept ( ); |
249 | } | 248 | } |
250 | 249 | ||
251 | void ButtonSettings::done ( int r ) | 250 | void ButtonSettings::done ( int r ) |
252 | { | 251 | { |
253 | QDialog::done ( r ); | 252 | QDialog::done ( r ); |
254 | close ( ); | 253 | close ( ); |
255 | } | 254 | } |