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 | |
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 | 25 | ||||
-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 | 26 | ||||
-rw-r--r-- | libopie/odevice.cpp | 15 | ||||
-rw-r--r-- | libopie/odevicebutton.cpp | 3 |
7 files changed, 55 insertions, 22 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 | |||
@@ -297,126 +297,135 @@ void DesktopApplication::reloadPowerWarnSettings ( ) | |||
297 | cfg. setGroup ( "Warnings" ); | 297 | cfg. setGroup ( "Warnings" ); |
298 | 298 | ||
299 | int iv = cfg. readNumEntry ( "checkinterval", 10000 ); | 299 | int iv = cfg. readNumEntry ( "checkinterval", 10000 ); |
300 | 300 | ||
301 | m_apm_timer-> stop ( ); | 301 | m_apm_timer-> stop ( ); |
302 | if ( iv ) | 302 | if ( iv ) |
303 | m_apm_timer-> start ( iv ); | 303 | m_apm_timer-> start ( iv ); |
304 | 304 | ||
305 | m_powerVeryLow = cfg. readNumEntry ( "powerverylow", 10 ); | 305 | m_powerVeryLow = cfg. readNumEntry ( "powerverylow", 10 ); |
306 | m_powerCritical = cfg. readNumEntry ( "powervcritical", 5 ); | 306 | m_powerCritical = cfg. readNumEntry ( "powervcritical", 5 ); |
307 | } | 307 | } |
308 | 308 | ||
309 | 309 | ||
310 | enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; | 310 | enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; |
311 | 311 | ||
312 | 312 | ||
313 | void DesktopApplication::launcherMessage( const QCString & msg, const QByteArray & data ) | 313 | void DesktopApplication::launcherMessage( const QCString & msg, const QByteArray & data ) |
314 | { | 314 | { |
315 | QDataStream stream ( data, IO_ReadOnly ); | 315 | QDataStream stream ( data, IO_ReadOnly ); |
316 | 316 | ||
317 | if ( msg == "deviceButton(int,int,int)" ) { | 317 | if ( msg == "deviceButton(int,int,int)" ) { |
318 | int keycode, press, autoRepeat; | 318 | int keycode, press, autoRepeat; |
319 | stream >> keycode >> press >> autoRepeat; | 319 | stream >> keycode >> press >> autoRepeat; |
320 | 320 | ||
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 | db-> pressedAction ( ). send ( ); | 351 | if (!db-> pressedAction ( ). channel ( ) .isEmpty()) |
352 | { | ||
353 | if ( db-> pressedAction ( ). channel ( )!="ignore") { | ||
354 | db-> pressedAction ( ). send ( ); | ||
355 | } | ||
356 | else return false; | ||
352 | } | 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 ); |
367 | } | ||
368 | else return false; | ||
360 | } | 369 | } |
361 | } | 370 | } |
362 | } | 371 | } |
372 | return true; | ||
363 | } | 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. |
399 | // will not send multiple repeats if user holds key | 408 | // will not send multiple repeats if user holds key |
400 | // i.e. one shot | 409 | // i.e. one shot |
401 | 410 | ||
402 | if ( keycode != 0 && press && !autoRepeat ) { | 411 | if ( keycode != 0 && press && !autoRepeat ) { |
403 | for ( KeyRegisterList::Iterator it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) { | 412 | for ( KeyRegisterList::Iterator it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) { |
404 | if (( *it ). getKeyCode ( ) == keycode ) { | 413 | if (( *it ). getKeyCode ( ) == keycode ) { |
405 | QCopEnvelope (( *it ). getChannel ( ), ( *it ). getMessage ( )); | 414 | QCopEnvelope (( *it ). getChannel ( ), ( *it ). getMessage ( )); |
406 | return true; | 415 | return true; |
407 | } | 416 | } |
408 | } | 417 | } |
409 | } | 418 | } |
410 | } | 419 | } |
411 | 420 | ||
412 | if ( keycode == HardKey_Suspend ) { | 421 | if ( keycode == HardKey_Suspend ) { |
413 | if ( press ) | 422 | if ( press ) |
414 | emit power ( ); | 423 | emit power ( ); |
415 | return true; | 424 | return true; |
416 | } | 425 | } |
417 | else if ( keycode == HardKey_Backlight ) { | 426 | else if ( keycode == HardKey_Backlight ) { |
418 | if ( press ) | 427 | if ( press ) |
419 | emit backlight ( ); | 428 | emit backlight ( ); |
420 | return true; | 429 | return true; |
421 | } | 430 | } |
422 | else if ( keycode == Key_F32 ) { | 431 | else if ( keycode == Key_F32 ) { |
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 | |||
@@ -38,97 +38,97 @@ class QCopBridge; | |||
38 | class TransferServer; | 38 | class TransferServer; |
39 | class DesktopPowerAlerter; | 39 | class DesktopPowerAlerter; |
40 | class PackageSlave; | 40 | class PackageSlave; |
41 | class OpieScreenSaver; | 41 | class OpieScreenSaver; |
42 | 42 | ||
43 | class DesktopApplication : public QPEApplication | 43 | class DesktopApplication : public QPEApplication |
44 | { | 44 | { |
45 | Q_OBJECT | 45 | Q_OBJECT |
46 | public: | 46 | public: |
47 | DesktopApplication( int& argc, char **argv, Type t ); | 47 | DesktopApplication( int& argc, char **argv, Type t ); |
48 | ~DesktopApplication(); | 48 | ~DesktopApplication(); |
49 | 49 | ||
50 | static void switchLCD ( bool on ); // only for togglePower in Desktop | 50 | static void switchLCD ( bool on ); // only for togglePower in Desktop |
51 | 51 | ||
52 | static void soundAlarm(); // only because QCop soundAlarm() is defined in QPE/TaskBar | 52 | static void soundAlarm(); // only because QCop soundAlarm() is defined in QPE/TaskBar |
53 | 53 | ||
54 | signals: | 54 | signals: |
55 | void menu(); | 55 | void menu(); |
56 | void home(); | 56 | void home(); |
57 | void launch(); | 57 | void launch(); |
58 | void backlight(); | 58 | void backlight(); |
59 | void power(); | 59 | void power(); |
60 | void symbol(); | 60 | void symbol(); |
61 | void numLockStateToggle(); | 61 | void numLockStateToggle(); |
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 | ||
111 | 111 | ||
112 | class Desktop : public QWidget | 112 | class Desktop : public QWidget |
113 | { | 113 | { |
114 | Q_OBJECT | 114 | Q_OBJECT |
115 | public: | 115 | public: |
116 | Desktop(); | 116 | Desktop(); |
117 | ~Desktop(); | 117 | ~Desktop(); |
118 | 118 | ||
119 | static bool screenLocked(); | 119 | static bool screenLocked(); |
120 | 120 | ||
121 | void show(); | 121 | void show(); |
122 | void checkMemory(); | 122 | void checkMemory(); |
123 | 123 | ||
124 | public slots: | 124 | public slots: |
125 | void execAutoStart(); | 125 | void execAutoStart(); |
126 | void togglePower(); | 126 | void togglePower(); |
127 | void toggleLight(); | 127 | void toggleLight(); |
128 | void toggleNumLockState(); | 128 | void toggleNumLockState(); |
129 | void toggleCapsLockState(); | 129 | void toggleCapsLockState(); |
130 | void toggleSymbolInput(); | 130 | void toggleSymbolInput(); |
131 | void terminateServers(); | 131 | void terminateServers(); |
132 | 132 | ||
133 | protected: | 133 | protected: |
134 | void executeOrModify( const QString& appLnkFile ); | 134 | void executeOrModify( const QString& appLnkFile ); |
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 | |||
@@ -163,95 +163,94 @@ void ButtonSettings::updateLabels ( ) | |||
163 | (*it)-> m_hlabel-> setText ( cih. m_name ); | 163 | (*it)-> m_hlabel-> setText ( cih. m_name ); |
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
167 | buttoninfo *ButtonSettings::buttonInfoForKeycode ( ushort key ) | 167 | buttoninfo *ButtonSettings::buttonInfoForKeycode ( ushort key ) |
168 | { | 168 | { |
169 | for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { | 169 | for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { |
170 | if ((*it)-> m_button-> keycode ( ) == key ) | 170 | if ((*it)-> m_button-> keycode ( ) == key ) |
171 | return *it; | 171 | return *it; |
172 | } | 172 | } |
173 | return 0; | 173 | return 0; |
174 | } | 174 | } |
175 | 175 | ||
176 | void ButtonSettings::keyPressEvent ( QKeyEvent *e ) | 176 | void ButtonSettings::keyPressEvent ( QKeyEvent *e ) |
177 | { | 177 | { |
178 | buttoninfo *bi = buttonInfoForKeycode ( e-> key ( )); | 178 | buttoninfo *bi = buttonInfoForKeycode ( e-> key ( )); |
179 | 179 | ||
180 | if ( bi && !e-> isAutoRepeat ( )) { | 180 | if ( bi && !e-> isAutoRepeat ( )) { |
181 | m_timer-> stop ( ); | 181 | m_timer-> stop ( ); |
182 | m_last_button = bi; | 182 | m_last_button = bi; |
183 | m_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); | 183 | m_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); |
184 | } | 184 | } |
185 | else | 185 | else |
186 | QDialog::keyPressEvent ( e ); | 186 | QDialog::keyPressEvent ( 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 ) |
246 | ODevice::inst ( )-> remapPressedAction ( bi-> m_index, bi-> m_pmsg ); | 245 | ODevice::inst ( )-> remapPressedAction ( bi-> m_index, bi-> m_pmsg ); |
247 | if ( bi-> m_hdirty ) | 246 | if ( bi-> m_hdirty ) |
248 | ODevice::inst ( )-> remapHeldAction ( bi-> m_index, bi-> m_hmsg ); | 247 | ODevice::inst ( )-> remapHeldAction ( bi-> m_index, bi-> m_hmsg ); |
249 | } | 248 | } |
250 | QDialog::accept ( ); | 249 | QDialog::accept ( ); |
251 | } | 250 | } |
252 | 251 | ||
253 | void ButtonSettings::done ( int r ) | 252 | void ButtonSettings::done ( int r ) |
254 | { | 253 | { |
255 | QDialog::done ( r ); | 254 | QDialog::done ( r ); |
256 | close ( ); | 255 | close ( ); |
257 | } | 256 | } |
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 | |||
@@ -20,97 +20,98 @@ struct predef_qcop { | |||
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 | |
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 | ||
93 | void ButtonUtils::insertActions ( QListViewItem *here ) | 94 | void ButtonUtils::insertActions ( QListViewItem *here ) |
94 | { | 95 | { |
95 | for ( const predef_qcop *p = predef; p-> m_text; p++ ) { | 96 | 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 ); | 97 | 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 )); | 98 | item-> setPixmap ( 0, Resource::loadPixmap ( p-> m_pixmap )); |
98 | } | 99 | } |
99 | } | 100 | } |
100 | 101 | ||
101 | 102 | ||
102 | void ButtonUtils::insertAppLnks ( QListViewItem *here ) | 103 | void ButtonUtils::insertAppLnks ( QListViewItem *here ) |
103 | { | 104 | { |
104 | QStringList types = m_apps-> types ( ); | 105 | QStringList types = m_apps-> types ( ); |
105 | QListViewItem *typeitem [types. count ( )]; | 106 | QListViewItem *typeitem [types. count ( )]; |
106 | 107 | ||
107 | int i = 0; | 108 | int i = 0; |
108 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { | 109 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { |
109 | QListViewItem *item = new QListViewItem ( here, m_apps-> typeName ( *it )); | 110 | QListViewItem *item = new QListViewItem ( here, m_apps-> typeName ( *it )); |
110 | item-> setPixmap ( 0, m_apps-> typePixmap ( *it )); | 111 | item-> setPixmap ( 0, m_apps-> typePixmap ( *it )); |
111 | 112 | ||
112 | typeitem [i++] = item; | 113 | typeitem [i++] = item; |
113 | } | 114 | } |
114 | 115 | ||
115 | for ( QListIterator <AppLnk> appit ( m_apps-> children ( )); *appit; ++appit ) { | 116 | for ( QListIterator <AppLnk> appit ( m_apps-> children ( )); *appit; ++appit ) { |
116 | AppLnk *l = *appit; | 117 | AppLnk *l = *appit; |
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 | |||
@@ -14,119 +14,137 @@ public: | |||
14 | : QListViewItem ( lv, str, s1, s2 ) | 14 | : QListViewItem ( lv, str, s1, s2 ) |
15 | { | 15 | { |
16 | m_key = QString ( QChar ( 'a' + pos )); | 16 | m_key = QString ( QChar ( 'a' + pos )); |
17 | m_def = false; | 17 | m_def = false; |
18 | } | 18 | } |
19 | 19 | ||
20 | void setDefault ( bool b ) | 20 | void setDefault ( bool b ) |
21 | { | 21 | { |
22 | m_def = b; | 22 | m_def = b; |
23 | } | 23 | } |
24 | 24 | ||
25 | virtual QString key ( int /*column*/, bool /*ascending*/ ) const | 25 | virtual QString key ( int /*column*/, bool /*ascending*/ ) const |
26 | { | 26 | { |
27 | return m_key; | 27 | return m_key; |
28 | } | 28 | } |
29 | 29 | ||
30 | 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 ) |
31 | { | 31 | { |
32 | if ( m_def ) { | 32 | if ( m_def ) { |
33 | QFont f ( listView ( )-> font ( )); | 33 | QFont f ( listView ( )-> font ( )); |
34 | f. setBold ( true ); | 34 | f. setBold ( true ); |
35 | p-> setFont ( f ); | 35 | p-> setFont ( f ); |
36 | } | 36 | } |
37 | QListViewItem::paintCell ( p, cg, column, width, align ); | 37 | QListViewItem::paintCell ( p, cg, column, width, align ); |
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 | m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg. channel ( ), m_msg. message ( )); | 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 | { | ||
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 | ||
128 | OQCopMessage RemapDlg::message ( ) | 146 | OQCopMessage RemapDlg::message ( ) |
129 | { | 147 | { |
130 | return m_msg; | 148 | return m_msg; |
131 | } | 149 | } |
132 | 150 | ||
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 9e97c56..d5e3c5c 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -235,97 +235,96 @@ ODevice *ODevice::inst ( ) | |||
235 | * | 235 | * |
236 | * common | 236 | * common |
237 | * | 237 | * |
238 | **************************************************/ | 238 | **************************************************/ |
239 | 239 | ||
240 | 240 | ||
241 | ODevice::ODevice ( ) | 241 | ODevice::ODevice ( ) |
242 | { | 242 | { |
243 | d = new ODeviceData; | 243 | d = new ODeviceData; |
244 | 244 | ||
245 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; | 245 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; |
246 | 246 | ||
247 | d-> m_modelstr = "Unknown"; | 247 | d-> m_modelstr = "Unknown"; |
248 | d-> m_model = Model_Unknown; | 248 | d-> m_model = Model_Unknown; |
249 | d-> m_vendorstr = "Unknown"; | 249 | d-> m_vendorstr = "Unknown"; |
250 | d-> m_vendor = Vendor_Unknown; | 250 | d-> m_vendor = Vendor_Unknown; |
251 | d-> m_systemstr = "Unknown"; | 251 | d-> m_systemstr = "Unknown"; |
252 | d-> m_system = System_Unknown; | 252 | d-> m_system = System_Unknown; |
253 | d-> m_sysverstr = "0.0"; | 253 | d-> m_sysverstr = "0.0"; |
254 | d-> m_rotation = Rot0; | 254 | d-> m_rotation = Rot0; |
255 | 255 | ||
256 | d-> m_holdtime = 1000; // 1000ms | 256 | d-> m_holdtime = 1000; // 1000ms |
257 | 257 | ||
258 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 258 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
259 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 259 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); |
260 | } | 260 | } |
261 | 261 | ||
262 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) | 262 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) |
263 | { | 263 | { |
264 | if ( msg == "deviceButtonMappingChanged()" ) { | 264 | if ( msg == "deviceButtonMappingChanged()" ) { |
265 | reloadButtonMapping ( ); | 265 | reloadButtonMapping ( ); |
266 | } | 266 | } |
267 | } | 267 | } |
268 | 268 | ||
269 | void ODevice::init ( ) | 269 | void ODevice::init ( ) |
270 | { | 270 | { |
271 | // Simulation uses iPAQ 3660 device buttons | 271 | // Simulation uses iPAQ 3660 device buttons |
272 | 272 | ||
273 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 273 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
274 | i_button *ib = ipaq_buttons + i; | 274 | i_button *ib = ipaq_buttons + i; |
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 | ||
290 | ODevice::~ODevice ( ) | 289 | ODevice::~ODevice ( ) |
291 | { | 290 | { |
292 | delete d; | 291 | delete d; |
293 | } | 292 | } |
294 | 293 | ||
295 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) | 294 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) |
296 | { | 295 | { |
297 | return false; | 296 | return false; |
298 | } | 297 | } |
299 | 298 | ||
300 | //#include <linux/apm_bios.h> | 299 | //#include <linux/apm_bios.h> |
301 | 300 | ||
302 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) | 301 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) |
303 | 302 | ||
304 | 303 | ||
305 | bool ODevice::suspend ( ) | 304 | bool ODevice::suspend ( ) |
306 | { | 305 | { |
307 | if ( !d-> m_qwsserver ) // only qwsserver is allowed to suspend | 306 | if ( !d-> m_qwsserver ) // only qwsserver is allowed to suspend |
308 | return false; | 307 | return false; |
309 | 308 | ||
310 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 309 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
311 | return false; | 310 | return false; |
312 | 311 | ||
313 | bool res = false; | 312 | bool res = false; |
314 | 313 | ||
315 | struct timeval tvs, tvn; | 314 | struct timeval tvs, tvn; |
316 | ::gettimeofday ( &tvs, 0 ); | 315 | ::gettimeofday ( &tvs, 0 ); |
317 | 316 | ||
318 | ::sync ( ); // flush fs caches | 317 | ::sync ( ); // flush fs caches |
319 | res = ( ::system ( "apm --suspend" ) == 0 ); | 318 | res = ( ::system ( "apm --suspend" ) == 0 ); |
320 | 319 | ||
321 | // This is needed because the iPAQ apm implementation is asynchronous and we | 320 | // This is needed because the iPAQ apm implementation is asynchronous and we |
322 | // can not be sure when exactly the device is really suspended | 321 | // can not be sure when exactly the device is really suspended |
323 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. | 322 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. |
324 | 323 | ||
325 | if ( res ) { | 324 | if ( res ) { |
326 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | 325 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed |
327 | ::usleep ( 200 * 1000 ); | 326 | ::usleep ( 200 * 1000 ); |
328 | ::gettimeofday ( &tvn, 0 ); | 327 | ::gettimeofday ( &tvn, 0 ); |
329 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); | 328 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); |
330 | } | 329 | } |
331 | 330 | ||
@@ -471,127 +470,133 @@ int ODevice::readLightSensor ( ) | |||
471 | } | 470 | } |
472 | 471 | ||
473 | int ODevice::lightSensorResolution ( ) const | 472 | int ODevice::lightSensorResolution ( ) const |
474 | { | 473 | { |
475 | return 0; | 474 | return 0; |
476 | } | 475 | } |
477 | 476 | ||
478 | const QValueList <ODeviceButton> &ODevice::buttons ( ) const | 477 | const QValueList <ODeviceButton> &ODevice::buttons ( ) const |
479 | { | 478 | { |
480 | return d-> m_buttons; | 479 | return d-> m_buttons; |
481 | } | 480 | } |
482 | 481 | ||
483 | uint ODevice::buttonHoldTime ( ) const | 482 | uint ODevice::buttonHoldTime ( ) const |
484 | { | 483 | { |
485 | return d-> m_holdtime; | 484 | return d-> m_holdtime; |
486 | } | 485 | } |
487 | 486 | ||
488 | const ODeviceButton *ODevice::buttonForKeycode ( ushort code ) | 487 | const ODeviceButton *ODevice::buttonForKeycode ( ushort code ) |
489 | { | 488 | { |
490 | for ( QValueListConstIterator<ODeviceButton> it = d-> m_buttons. begin ( ); it != d-> m_buttons. end ( ); ++it ) { | 489 | for ( QValueListConstIterator<ODeviceButton> it = d-> m_buttons. begin ( ); it != d-> m_buttons. end ( ); ++it ) { |
491 | if ( (*it). keycode ( ) == code ) | 490 | if ( (*it). keycode ( ) == code ) |
492 | return &(*it); | 491 | return &(*it); |
493 | } | 492 | } |
494 | return 0; | 493 | return 0; |
495 | } | 494 | } |
496 | 495 | ||
497 | void ODevice::reloadButtonMapping ( ) | 496 | void ODevice::reloadButtonMapping ( ) |
498 | { | 497 | { |
499 | Config cfg ( "ButtonSettings" ); | 498 | Config cfg ( "ButtonSettings" ); |
500 | 499 | ||
501 | for ( uint i = 0; i < d-> m_buttons. count ( ); i++ ) { | 500 | for ( uint i = 0; i < d-> m_buttons. count ( ); i++ ) { |
502 | ODeviceButton &b = d-> m_buttons [i]; | 501 | ODeviceButton &b = d-> m_buttons [i]; |
503 | QString group = "Button" + QString::number ( i ); | 502 | QString group = "Button" + QString::number ( i ); |
504 | 503 | ||
505 | QCString pch, hch; | 504 | QCString pch, hch; |
506 | QCString pm, hm; | 505 | QCString pm, hm; |
507 | QByteArray pdata, hdata; | 506 | QByteArray pdata, hdata; |
508 | 507 | ||
509 | if ( cfg. hasGroup ( group )) { | 508 | if ( cfg. hasGroup ( group )) { |
510 | cfg. setGroup ( group ); | 509 | cfg. setGroup ( group ); |
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 | ||
525 | void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) | 525 | void 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 | ||
543 | void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) | 548 | void 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 | ||
558 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); | 563 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); |
559 | } | 564 | } |
560 | 565 | ||
561 | 566 | ||
562 | 567 | ||
563 | 568 | ||
564 | /************************************************** | 569 | /************************************************** |
565 | * | 570 | * |
566 | * iPAQ | 571 | * iPAQ |
567 | * | 572 | * |
568 | **************************************************/ | 573 | **************************************************/ |
569 | 574 | ||
570 | void iPAQ::init ( ) | 575 | void iPAQ::init ( ) |
571 | { | 576 | { |
572 | d-> m_vendorstr = "HP"; | 577 | d-> m_vendorstr = "HP"; |
573 | d-> m_vendor = Vendor_HP; | 578 | d-> m_vendor = Vendor_HP; |
574 | 579 | ||
575 | QFile f ( "/proc/hal/model" ); | 580 | QFile f ( "/proc/hal/model" ); |
576 | 581 | ||
577 | if ( f. open ( IO_ReadOnly )) { | 582 | if ( f. open ( IO_ReadOnly )) { |
578 | QTextStream ts ( &f ); | 583 | QTextStream ts ( &f ); |
579 | 584 | ||
580 | d-> m_modelstr = "H" + ts. readLine ( ); | 585 | d-> m_modelstr = "H" + ts. readLine ( ); |
581 | 586 | ||
582 | if ( d-> m_modelstr == "H3100" ) | 587 | if ( d-> m_modelstr == "H3100" ) |
583 | d-> m_model = Model_iPAQ_H31xx; | 588 | d-> m_model = Model_iPAQ_H31xx; |
584 | else if ( d-> m_modelstr == "H3600" ) | 589 | else if ( d-> m_modelstr == "H3600" ) |
585 | d-> m_model = Model_iPAQ_H36xx; | 590 | d-> m_model = Model_iPAQ_H36xx; |
586 | else if ( d-> m_modelstr == "H3700" ) | 591 | else if ( d-> m_modelstr == "H3700" ) |
587 | d-> m_model = Model_iPAQ_H37xx; | 592 | d-> m_model = Model_iPAQ_H37xx; |
588 | else if ( d-> m_modelstr == "H3800" ) | 593 | else if ( d-> m_modelstr == "H3800" ) |
589 | d-> m_model = Model_iPAQ_H38xx; | 594 | d-> m_model = Model_iPAQ_H38xx; |
590 | else if ( d-> m_modelstr == "H3900" ) | 595 | else if ( d-> m_modelstr == "H3900" ) |
591 | d-> m_model = Model_iPAQ_H39xx; | 596 | d-> m_model = Model_iPAQ_H39xx; |
592 | else | 597 | else |
593 | d-> m_model = Model_Unknown; | 598 | d-> m_model = Model_Unknown; |
594 | 599 | ||
595 | f. close ( ); | 600 | f. close ( ); |
596 | } | 601 | } |
597 | 602 | ||
diff --git a/libopie/odevicebutton.cpp b/libopie/odevicebutton.cpp index 2270343..4b22358 100644 --- a/libopie/odevicebutton.cpp +++ b/libopie/odevicebutton.cpp | |||
@@ -25,97 +25,97 @@ | |||
25 | #include <opie/odevicebutton.h> | 25 | #include <opie/odevicebutton.h> |
26 | 26 | ||
27 | using namespace Opie; | 27 | using namespace Opie; |
28 | 28 | ||
29 | 29 | ||
30 | class OQCopMessageData { | 30 | class OQCopMessageData { |
31 | public: | 31 | public: |
32 | QCString m_channel; | 32 | QCString m_channel; |
33 | QCString m_message; | 33 | QCString m_message; |
34 | QByteArray m_data; | 34 | QByteArray m_data; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | 37 | ||
38 | OQCopMessage::OQCopMessage ( ) | 38 | OQCopMessage::OQCopMessage ( ) |
39 | : d ( 0 ) | 39 | : d ( 0 ) |
40 | { | 40 | { |
41 | init ( QCString ( ), QCString ( ), QByteArray ( )); | 41 | init ( QCString ( ), QCString ( ), QByteArray ( )); |
42 | } | 42 | } |
43 | 43 | ||
44 | OQCopMessage::OQCopMessage ( const OQCopMessage © ) | 44 | OQCopMessage::OQCopMessage ( const OQCopMessage © ) |
45 | : d ( 0 ) | 45 | : d ( 0 ) |
46 | { | 46 | { |
47 | init ( copy. channel ( ), copy. message ( ), copy. data ( )); | 47 | init ( copy. channel ( ), copy. message ( ), copy. data ( )); |
48 | } | 48 | } |
49 | 49 | ||
50 | OQCopMessage &OQCopMessage::operator = ( const OQCopMessage &assign ) | 50 | OQCopMessage &OQCopMessage::operator = ( const OQCopMessage &assign ) |
51 | { | 51 | { |
52 | init ( assign. channel ( ), assign. message ( ), assign. data ( )); | 52 | init ( assign. channel ( ), assign. message ( ), assign. data ( )); |
53 | return *this; | 53 | return *this; |
54 | } | 54 | } |
55 | 55 | ||
56 | OQCopMessage::OQCopMessage ( const QCString &ch, const QCString &m, const QByteArray &arg ) | 56 | OQCopMessage::OQCopMessage ( const QCString &ch, const QCString &m, const QByteArray &arg ) |
57 | : d ( 0 ) | 57 | : d ( 0 ) |
58 | { | 58 | { |
59 | init ( ch, m, arg ); | 59 | init ( ch, m, arg ); |
60 | } | 60 | } |
61 | 61 | ||
62 | void OQCopMessage::init ( const QCString &ch, const QCString &m, const QByteArray &arg ) | 62 | void OQCopMessage::init ( const QCString &ch, const QCString &m, const QByteArray &arg ) |
63 | { | 63 | { |
64 | if ( !d ) | 64 | if ( !d ) |
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 | ||
71 | bool OQCopMessage::send ( ) | 71 | bool 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; |
82 | } | 82 | } |
83 | 83 | ||
84 | QCString OQCopMessage::channel ( ) const | 84 | QCString OQCopMessage::channel ( ) const |
85 | { | 85 | { |
86 | return d-> m_channel; | 86 | return d-> m_channel; |
87 | } | 87 | } |
88 | 88 | ||
89 | QCString OQCopMessage::message ( ) const | 89 | QCString OQCopMessage::message ( ) const |
90 | { | 90 | { |
91 | return d-> m_message; | 91 | return d-> m_message; |
92 | } | 92 | } |
93 | 93 | ||
94 | QByteArray OQCopMessage::data ( ) const | 94 | QByteArray OQCopMessage::data ( ) const |
95 | { | 95 | { |
96 | return d-> m_data; | 96 | return d-> m_data; |
97 | } | 97 | } |
98 | 98 | ||
99 | void OQCopMessage::setChannel ( const QCString &ch ) | 99 | void OQCopMessage::setChannel ( const QCString &ch ) |
100 | { | 100 | { |
101 | d-> m_channel = ch; | 101 | d-> m_channel = ch; |
102 | } | 102 | } |
103 | 103 | ||
104 | void OQCopMessage::setMessage ( const QCString &m ) | 104 | void OQCopMessage::setMessage ( const QCString &m ) |
105 | { | 105 | { |
106 | d-> m_message = m; | 106 | d-> m_message = m; |
107 | } | 107 | } |
108 | 108 | ||
109 | void OQCopMessage::setData ( const QByteArray &data ) | 109 | void OQCopMessage::setData ( const QByteArray &data ) |
110 | { | 110 | { |
111 | d-> m_data = data; | 111 | d-> m_data = data; |
112 | } | 112 | } |
113 | 113 | ||
114 | /*! \class ODeviceButton | 114 | /*! \class ODeviceButton |
115 | \brief The ODeviceButton class represents a physical user mappable button on a Qtopia device. | 115 | \brief The ODeviceButton class represents a physical user mappable button on a Qtopia device. |
116 | 116 | ||
117 | This class represents a physical button on a Qtopia device. A | 117 | This class represents a physical button on a Qtopia device. A |
118 | device may have "user programmable" buttons. | 118 | device may have "user programmable" buttons. |
119 | The location and number of buttons will vary from device to | 119 | The location and number of buttons will vary from device to |
120 | device. userText() and pixmap() may be used to describe this button | 120 | device. userText() and pixmap() may be used to describe this button |
121 | to the user in help documentation. | 121 | to the user in help documentation. |
@@ -173,62 +173,63 @@ OQCopMessage ODeviceButton::factoryPresetPressedAction() const | |||
173 | */ | 173 | */ |
174 | OQCopMessage ODeviceButton::pressedAction() const | 174 | OQCopMessage ODeviceButton::pressedAction() const |
175 | { | 175 | { |
176 | if (m_PressedAction.channel().isEmpty()) | 176 | if (m_PressedAction.channel().isEmpty()) |
177 | return factoryPresetPressedAction(); | 177 | return factoryPresetPressedAction(); |
178 | return m_PressedAction; | 178 | return m_PressedAction; |
179 | } | 179 | } |
180 | 180 | ||
181 | /*! | 181 | /*! |
182 | This function returns the factory preset (default) action for when this button | 182 | This function returns the factory preset (default) action for when this button |
183 | is pressed and held. The return value is a legal QCop message. | 183 | is pressed and held. The return value is a legal QCop message. |
184 | */ | 184 | */ |
185 | OQCopMessage ODeviceButton::factoryPresetHeldAction() const | 185 | OQCopMessage ODeviceButton::factoryPresetHeldAction() const |
186 | { | 186 | { |
187 | return m_FactoryPresetHeldAction; | 187 | return m_FactoryPresetHeldAction; |
188 | } | 188 | } |
189 | 189 | ||
190 | /*! | 190 | /*! |
191 | This function returns the user assigned action for when this button is pressed | 191 | This function returns the user assigned action for when this button is pressed |
192 | and held. If no action is assigned, factoryPresetAction() is returned. | 192 | and held. If no action is assigned, factoryPresetAction() is returned. |
193 | */ | 193 | */ |
194 | OQCopMessage ODeviceButton::heldAction() const | 194 | OQCopMessage ODeviceButton::heldAction() const |
195 | { | 195 | { |
196 | if (m_HeldAction.channel().isEmpty()) | 196 | if (m_HeldAction.channel().isEmpty()) |
197 | return factoryPresetHeldAction(); | 197 | return factoryPresetHeldAction(); |
198 | return m_HeldAction; | 198 | return m_HeldAction; |
199 | } | 199 | } |
200 | 200 | ||
201 | void ODeviceButton::setKeycode(ushort keycode) | 201 | void ODeviceButton::setKeycode(ushort keycode) |
202 | { | 202 | { |
203 | m_Keycode = keycode; | 203 | m_Keycode = keycode; |
204 | } | 204 | } |
205 | 205 | ||
206 | void ODeviceButton::setUserText(const QString& text) | 206 | void ODeviceButton::setUserText(const QString& text) |
207 | { | 207 | { |
208 | m_UserText = text; | 208 | m_UserText = text; |
209 | } | 209 | } |
210 | 210 | ||
211 | void ODeviceButton::setPixmap(const QPixmap& picture) | 211 | void ODeviceButton::setPixmap(const QPixmap& picture) |
212 | { | 212 | { |
213 | m_Pixmap = picture; | 213 | m_Pixmap = picture; |
214 | } | 214 | } |
215 | 215 | ||
216 | void ODeviceButton::setFactoryPresetPressedAction(const OQCopMessage& action) | 216 | void ODeviceButton::setFactoryPresetPressedAction(const OQCopMessage& action) |
217 | { | 217 | { |
218 | m_FactoryPresetPressedAction = action; | 218 | m_FactoryPresetPressedAction = action; |
219 | } | 219 | } |
220 | 220 | ||
221 | |||
221 | void ODeviceButton::setPressedAction(const OQCopMessage& action) | 222 | void ODeviceButton::setPressedAction(const OQCopMessage& action) |
222 | { | 223 | { |
223 | m_PressedAction = action; | 224 | m_PressedAction = action; |
224 | } | 225 | } |
225 | 226 | ||
226 | void ODeviceButton::setFactoryPresetHeldAction(const OQCopMessage& action) | 227 | void ODeviceButton::setFactoryPresetHeldAction(const OQCopMessage& action) |
227 | { | 228 | { |
228 | m_FactoryPresetHeldAction = action; | 229 | m_FactoryPresetHeldAction = action; |
229 | } | 230 | } |
230 | 231 | ||
231 | void ODeviceButton::setHeldAction(const OQCopMessage& action) | 232 | void ODeviceButton::setHeldAction(const OQCopMessage& action) |
232 | { | 233 | { |
233 | m_HeldAction = action; | 234 | m_HeldAction = action; |
234 | } | 235 | } |