-rw-r--r-- | core/launcher/desktop.cpp | 25 |
1 files changed, 17 insertions, 8 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 | 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. |