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 | |
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/launcher/desktop.cpp | 19 | ||||
-rw-r--r-- | core/launcher/desktop.h | 2 | ||||
-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 |
5 files changed, 39 insertions, 12 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index 59f2aea..fbcce7c 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -321,78 +321,87 @@ void DesktopApplication::launcherMessage( const QCString & msg, const QByteArray | |||
321 | const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( keycode ); | 321 | const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( keycode ); |
322 | 322 | ||
323 | if ( db ) | 323 | if ( db ) |
324 | checkButtonAction ( db, keycode, press, autoRepeat ); | 324 | checkButtonAction ( db, keycode, press, autoRepeat ); |
325 | } | 325 | } |
326 | else if ( msg == "keyRegister(int,QCString,QCString)" ) { | 326 | else if ( msg == "keyRegister(int,QCString,QCString)" ) { |
327 | int k; | 327 | int k; |
328 | QCString c, m; | 328 | QCString c, m; |
329 | stream >> k >> c >> m; | 329 | stream >> k >> c >> m; |
330 | 330 | ||
331 | keyRegisterList.append ( QCopKeyRegister ( k, c, m )); | 331 | keyRegisterList.append ( QCopKeyRegister ( k, c, m )); |
332 | } | 332 | } |
333 | } | 333 | } |
334 | 334 | ||
335 | void DesktopApplication::sendHeldAction ( ) | 335 | void DesktopApplication::sendHeldAction ( ) |
336 | { | 336 | { |
337 | if ( m_last_button ) { | 337 | if ( m_last_button ) { |
338 | m_last_button-> heldAction ( ). send ( ); | 338 | m_last_button-> heldAction ( ). send ( ); |
339 | m_last_button = 0; | 339 | m_last_button = 0; |
340 | } | 340 | } |
341 | } | 341 | } |
342 | 342 | ||
343 | 343 | ||
344 | 344 | ||
345 | void DesktopApplication::checkButtonAction ( const ODeviceButton *db, int /*keycode*/, bool press, bool autoRepeat ) | 345 | bool DesktopApplication::checkButtonAction ( const ODeviceButton *db, int /*keycode*/, bool press, bool autoRepeat ) |
346 | { | 346 | { |
347 | if ( db ) { | 347 | if ( db ) { |
348 | if ( !press && !autoRepeat && m_button_timer-> isActive ( )) { | 348 | if ( !press && !autoRepeat && m_button_timer-> isActive ( )) { |
349 | m_button_timer-> stop ( ); | 349 | m_button_timer-> stop ( ); |
350 | if ( !db-> pressedAction ( ). channel ( ). isEmpty ( )) { | 350 | |
351 | if (!db-> pressedAction ( ). channel ( ) .isEmpty()) | ||
352 | { | ||
353 | if ( db-> pressedAction ( ). channel ( )!="ignore") { | ||
351 | db-> pressedAction ( ). send ( ); | 354 | db-> pressedAction ( ). send ( ); |
352 | } | 355 | } |
356 | else return false; | ||
357 | } | ||
353 | } | 358 | } |
354 | else if ( press && !autoRepeat ) { | 359 | else if ( press && !autoRepeat ) { |
355 | m_button_timer-> stop ( ); | 360 | m_button_timer-> stop ( ); |
361 | if (!db-> pressedAction ( ). channel ( ) .isEmpty()) | ||
362 | { | ||
356 | 363 | ||
357 | if ( !db-> heldAction ( ). channel ( ). isEmpty ( )) { | 364 | if ( db-> heldAction ( ). channel ( )!="ignore") { |
358 | m_last_button = db; | 365 | m_last_button = db; |
359 | m_button_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); | 366 | m_button_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); |
360 | } | 367 | } |
368 | else return false; | ||
361 | } | 369 | } |
362 | } | 370 | } |
363 | } | 371 | } |
372 | return true; | ||
373 | } | ||
364 | 374 | ||
365 | bool DesktopApplication::eventFilter ( QObject *o, QEvent *e ) | 375 | bool DesktopApplication::eventFilter ( QObject *o, QEvent *e ) |
366 | { | 376 | { |
367 | if ( e-> type ( ) == QEvent::KeyPress || e-> type ( ) == QEvent::KeyRelease ) { | 377 | if ( e-> type ( ) == QEvent::KeyPress || e-> type ( ) == QEvent::KeyRelease ) { |
368 | QKeyEvent *ke = (QKeyEvent *) e; | 378 | QKeyEvent *ke = (QKeyEvent *) e; |
369 | 379 | ||
370 | const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( ke-> key ( )); | 380 | const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( ke-> key ( )); |
371 | 381 | ||
372 | if ( db ) { | 382 | if ( db ) { |
373 | checkButtonAction ( db, ke-> key ( ), e-> type ( ) == QEvent::KeyPress, ke-> isAutoRepeat ( )); | 383 | return checkButtonAction ( db, ke-> key ( ), e-> type ( ) == QEvent::KeyPress, ke-> isAutoRepeat ( )); |
374 | return true; | ||
375 | } | 384 | } |
376 | } | 385 | } |
377 | return QPEApplication::eventFilter ( o, e ); | 386 | return QPEApplication::eventFilter ( o, e ); |
378 | } | 387 | } |
379 | 388 | ||
380 | #ifdef Q_WS_QWS | 389 | #ifdef Q_WS_QWS |
381 | 390 | ||
382 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | 391 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) |
383 | { | 392 | { |
384 | qpedesktop->checkMemory(); | 393 | qpedesktop->checkMemory(); |
385 | 394 | ||
386 | if ( e->type == QWSEvent::Key ) { | 395 | if ( e->type == QWSEvent::Key ) { |
387 | QWSKeyEvent * ke = (QWSKeyEvent *) e; | 396 | QWSKeyEvent * ke = (QWSKeyEvent *) e; |
388 | ushort keycode = ke-> simpleData. keycode; | 397 | ushort keycode = ke-> simpleData. keycode; |
389 | 398 | ||
390 | if ( !loggedin && keycode != Key_F34 ) | 399 | if ( !loggedin && keycode != Key_F34 ) |
391 | return true; | 400 | return true; |
392 | 401 | ||
393 | bool press = ke-> simpleData. is_press; | 402 | bool press = ke-> simpleData. is_press; |
394 | bool autoRepeat = ke-> simpleData. is_auto_repeat; | 403 | bool autoRepeat = ke-> simpleData. is_auto_repeat; |
395 | 404 | ||
396 | if ( !keyboardGrabbed ( )) { | 405 | if ( !keyboardGrabbed ( )) { |
397 | // app that registers key/message to be sent back to the app, when it doesn't have focus, | 406 | // app that registers key/message to be sent back to the app, when it doesn't have focus, |
398 | // when user presses key, unless keyboard has been requested from app. | 407 | // when user presses key, unless keyboard has been requested from app. |
diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h index db0173e..4024c38 100644 --- a/core/launcher/desktop.h +++ b/core/launcher/desktop.h | |||
@@ -62,49 +62,49 @@ signals: | |||
62 | void capsLockStateToggle(); | 62 | void capsLockStateToggle(); |
63 | void prepareForRestart(); | 63 | void prepareForRestart(); |
64 | 64 | ||
65 | protected: | 65 | protected: |
66 | #ifdef Q_WS_QWS | 66 | #ifdef Q_WS_QWS |
67 | 67 | ||
68 | bool qwsEventFilter( QWSEvent * ); | 68 | bool qwsEventFilter( QWSEvent * ); |
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | void shutdown(); | 71 | void shutdown(); |
72 | void restart(); | 72 | void restart(); |
73 | 73 | ||
74 | public slots: | 74 | public slots: |
75 | virtual void systemMessage ( const QCString &msg, const QByteArray &data ); | 75 | virtual void systemMessage ( const QCString &msg, const QByteArray &data ); |
76 | virtual void launcherMessage ( const QCString &msg, const QByteArray &data ); | 76 | virtual void launcherMessage ( const QCString &msg, const QByteArray &data ); |
77 | void rereadVolumes(); | 77 | void rereadVolumes(); |
78 | 78 | ||
79 | protected slots: | 79 | protected slots: |
80 | void shutdown ( ShutdownImpl::Type ); | 80 | void shutdown ( ShutdownImpl::Type ); |
81 | void apmTimeout ( ); | 81 | void apmTimeout ( ); |
82 | void sendHeldAction ( ); | 82 | void sendHeldAction ( ); |
83 | 83 | ||
84 | protected: | 84 | protected: |
85 | virtual bool eventFilter ( QObject *o, QEvent *e ); | 85 | virtual bool eventFilter ( QObject *o, QEvent *e ); |
86 | void checkButtonAction ( const Opie::ODeviceButton *db, int keycode, bool press, bool autoRepeat ); | 86 | bool checkButtonAction ( const Opie::ODeviceButton *db, int keycode, bool press, bool autoRepeat ); |
87 | 87 | ||
88 | private: | 88 | private: |
89 | static DesktopApplication *me ( ); | 89 | static DesktopApplication *me ( ); |
90 | 90 | ||
91 | private: | 91 | private: |
92 | void reloadPowerWarnSettings(); | 92 | void reloadPowerWarnSettings(); |
93 | DesktopPowerAlerter *pa; | 93 | DesktopPowerAlerter *pa; |
94 | PowerStatus *m_ps, *m_ps_last; | 94 | PowerStatus *m_ps, *m_ps_last; |
95 | QTimer *cardSendTimer; | 95 | QTimer *cardSendTimer; |
96 | QCopChannel *channel; | 96 | QCopChannel *channel; |
97 | OpieScreenSaver *m_screensaver; | 97 | OpieScreenSaver *m_screensaver; |
98 | QTimer * m_apm_timer; | 98 | QTimer * m_apm_timer; |
99 | int m_powerVeryLow; | 99 | int m_powerVeryLow; |
100 | int m_powerCritical; | 100 | int m_powerCritical; |
101 | int m_currentPowerLevel; | 101 | int m_currentPowerLevel; |
102 | 102 | ||
103 | const Opie::ODeviceButton *m_last_button; | 103 | const Opie::ODeviceButton *m_last_button; |
104 | QTimer *m_button_timer; | 104 | QTimer *m_button_timer; |
105 | 105 | ||
106 | bool m_keyclick_sound : 1; | 106 | bool m_keyclick_sound : 1; |
107 | bool m_screentap_sound : 1; | 107 | bool m_screentap_sound : 1; |
108 | bool m_alarm_sound : 1; | 108 | bool m_alarm_sound : 1; |
109 | }; | 109 | }; |
110 | 110 | ||
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 | |||
@@ -187,59 +187,58 @@ void ButtonSettings::keyPressEvent ( QKeyEvent *e ) | |||
187 | } | 187 | } |
188 | 188 | ||
189 | void ButtonSettings::keyReleaseEvent ( QKeyEvent *e ) | 189 | void ButtonSettings::keyReleaseEvent ( QKeyEvent *e ) |
190 | { | 190 | { |
191 | buttoninfo *bi = buttonInfoForKeycode ( e-> key ( )); | 191 | buttoninfo *bi = buttonInfoForKeycode ( e-> key ( )); |
192 | 192 | ||
193 | if ( bi && !e-> isAutoRepeat ( ) && m_timer-> isActive ( )) { | 193 | if ( bi && !e-> isAutoRepeat ( ) && m_timer-> isActive ( )) { |
194 | m_timer-> stop ( ); | 194 | m_timer-> stop ( ); |
195 | edit ( bi, false ); | 195 | edit ( bi, false ); |
196 | } | 196 | } |
197 | else | 197 | else |
198 | QDialog::keyReleaseEvent ( e ); | 198 | QDialog::keyReleaseEvent ( e ); |
199 | } | 199 | } |
200 | 200 | ||
201 | void ButtonSettings::keyTimeout ( ) | 201 | void ButtonSettings::keyTimeout ( ) |
202 | { | 202 | { |
203 | if ( m_last_button ) { | 203 | if ( m_last_button ) { |
204 | edit ( m_last_button, true ); | 204 | edit ( m_last_button, true ); |
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 { |
228 | bi-> m_pmsg = d-> message ( ); | 227 | bi-> m_pmsg = d-> message ( ); |
229 | bi-> m_pdirty = true; | 228 | bi-> m_pdirty = true; |
230 | } | 229 | } |
231 | 230 | ||
232 | updateLabels ( ); | 231 | updateLabels ( ); |
233 | } | 232 | } |
234 | 233 | ||
235 | delete d; | 234 | delete d; |
236 | 235 | ||
237 | m_lock = false; | 236 | m_lock = false; |
238 | } | 237 | } |
239 | 238 | ||
240 | void ButtonSettings::accept ( ) | 239 | void ButtonSettings::accept ( ) |
241 | { | 240 | { |
242 | for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { | 241 | for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { |
243 | buttoninfo *bi = *it; | 242 | buttoninfo *bi = *it; |
244 | 243 | ||
245 | if ( bi-> m_pdirty ) | 244 | if ( bi-> m_pdirty ) |
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 | |||
@@ -44,49 +44,50 @@ ButtonUtils *ButtonUtils::ButtonUtils::inst ( ) | |||
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 | |
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 | } |
75 | 76 | ||
76 | if ( ch. left ( 16 ) == "QPE/Application/" ) { | 77 | if ( ch. left ( 16 ) == "QPE/Application/" ) { |
77 | QString app = ch. mid ( 16 ); | 78 | QString app = ch. mid ( 16 ); |
78 | const AppLnk *applnk = m_apps-> findExec ( app ); | 79 | const AppLnk *applnk = m_apps-> findExec ( app ); |
79 | if ( applnk ) | 80 | if ( applnk ) |
80 | app = applnk-> name ( ); | 81 | app = applnk-> name ( ); |
81 | 82 | ||
82 | if (( f == "raise()" ) || ( f == "nextView()" )) | 83 | if (( f == "raise()" ) || ( f == "nextView()" )) |
83 | return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Show <b>%1</b></nobr>" ). arg ( app ), applnk ? applnk-> pixmap ( ) : QPixmap ( )); | 84 | return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Show <b>%1</b></nobr>" ). arg ( app ), applnk ? applnk-> pixmap ( ) : QPixmap ( )); |
84 | else | 85 | else |
85 | return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Call <b>%1</b>: <i>%2</i></nobr>" ). arg ( app ). arg ( f ), applnk ? applnk-> pixmap ( ) : QPixmap ( )); | 86 | return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Call <b>%1</b>: <i>%2</i></nobr>" ). arg ( app ). arg ( f ), applnk ? applnk-> pixmap ( ) : QPixmap ( )); |
86 | } | 87 | } |
87 | else { | 88 | 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 )); | 89 | 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 | } | 90 | } |
90 | } | 91 | } |
91 | 92 | ||
92 | 93 | ||
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 | |||
@@ -38,90 +38,108 @@ public: | |||
38 | } | 38 | } |
39 | 39 | ||
40 | private: | 40 | private: |
41 | QString m_key; | 41 | QString m_key; |
42 | bool m_def; | 42 | bool m_def; |
43 | }; | 43 | }; |
44 | 44 | ||
45 | 45 | ||
46 | 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 ) |
47 | : RemapDlgBase ( parent, name, true, WStyle_ContextHelp ) | 47 | : RemapDlgBase ( parent, name, true, WStyle_ContextHelp ) |
48 | { | 48 | { |
49 | 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 | 50 | ||
51 | m_current = 0; | 51 | m_current = 0; |
52 | 52 | ||
53 | static const char * const def_channels [] = { "QPE/Application/", "QPE/Launcher", "QPE/System", "QPE/TaskBar", "QPE/", 0 }; | 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 ); | 54 | w_channel-> insertStrList ((const char **) def_channels ); |
55 | 55 | ||
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 ( ) |
77 | { | 87 | { |
78 | } | 88 | } |
79 | 89 | ||
80 | void RemapDlg::delayedInit ( ) | 90 | void RemapDlg::delayedInit ( ) |
81 | { | 91 | { |
82 | bool b = w_list-> viewport ( )-> isUpdatesEnabled ( ); | 92 | bool b = w_list-> viewport ( )-> isUpdatesEnabled ( ); |
83 | w_list-> viewport ( )-> setUpdatesEnabled ( false ); | 93 | w_list-> viewport ( )-> setUpdatesEnabled ( false ); |
84 | 94 | ||
85 | ButtonUtils::inst ( )-> insertAppLnks ( m_map_show ); | 95 | ButtonUtils::inst ( )-> insertAppLnks ( m_map_show ); |
86 | 96 | ||
87 | w_list-> viewport ( )-> setUpdatesEnabled ( b ); | 97 | w_list-> viewport ( )-> setUpdatesEnabled ( b ); |
88 | 98 | ||
89 | m_map_show-> repaint ( ); | 99 | m_map_show-> repaint ( ); |
90 | } | 100 | } |
91 | 101 | ||
92 | void RemapDlg::itemChanged ( QListViewItem *it ) | 102 | void RemapDlg::itemChanged ( QListViewItem *it ) |
93 | { | 103 | { |
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 ); |
110 | 128 | ||
111 | w_channel-> setEditText ( m. channel ( )); | 129 | w_channel-> setEditText ( m. channel ( )); |
112 | w_message-> setEditText ( m. message ( )); | 130 | w_message-> setEditText ( m. message ( )); |
113 | } | 131 | } |
114 | 132 | ||
115 | void RemapDlg::textChanged ( const QString &str ) | 133 | void RemapDlg::textChanged ( const QString &str ) |
116 | { | 134 | { |
117 | if ( !m_current ) | 135 | if ( !m_current ) |
118 | return; | 136 | return; |
119 | 137 | ||
120 | QComboBox *which = (QComboBox *) sender ( ); | 138 | QComboBox *which = (QComboBox *) sender ( ); |
121 | 139 | ||
122 | if ( which == w_channel ) | 140 | if ( which == w_channel ) |
123 | m_current-> setText ( 1, str ); | 141 | m_current-> setText ( 1, str ); |
124 | else if ( which == w_message ) | 142 | else if ( which == w_message ) |
125 | m_current-> setText ( 2, str ); | 143 | m_current-> setText ( 2, str ); |
126 | } | 144 | } |
127 | 145 | ||