-rw-r--r-- | libopie2/opiecore/okeyconfigmanager.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libopie2/opiecore/okeyconfigmanager.cpp b/libopie2/opiecore/okeyconfigmanager.cpp index ad0f7f7..ccb96cc 100644 --- a/libopie2/opiecore/okeyconfigmanager.cpp +++ b/libopie2/opiecore/okeyconfigmanager.cpp | |||
@@ -460,124 +460,124 @@ bool OKeyConfigItem::operator!=( const OKeyConfigItem& conf )const { | |||
460 | * if(!item.isEmpty() ){ | 460 | * if(!item.isEmpty() ){ |
461 | * switch(item.id()){ | 461 | * switch(item.id()){ |
462 | * case My_Delete_Key: | 462 | * case My_Delete_Key: |
463 | * break; | 463 | * break; |
464 | * } | 464 | * } |
465 | * } | 465 | * } |
466 | * } | 466 | * } |
467 | * | 467 | * |
468 | * \endcode | 468 | * \endcode |
469 | * | 469 | * |
470 | * @param conf The Config where the KeySetting should be stored | 470 | * @param conf The Config where the KeySetting should be stored |
471 | * @param group The group where the KeySetting will be stored | 471 | * @param group The group where the KeySetting will be stored |
472 | * @param black Which keys shouldn't be allowed to handle | 472 | * @param black Which keys shouldn't be allowed to handle |
473 | * @param grabkeyboard Calls QPEApplication::grabKeyboard to allow handling of DeviceButtons | 473 | * @param grabkeyboard Calls QPEApplication::grabKeyboard to allow handling of DeviceButtons |
474 | * @param par The parent/owner of this manager | 474 | * @param par The parent/owner of this manager |
475 | * @param name The name of this object | 475 | * @param name The name of this object |
476 | */ | 476 | */ |
477 | OKeyConfigManager::OKeyConfigManager( Opie::Core::OConfig* conf, | 477 | OKeyConfigManager::OKeyConfigManager( Opie::Core::OConfig* conf, |
478 | const QString& group, | 478 | const QString& group, |
479 | const OKeyPair::List& black, | 479 | const OKeyPair::List& black, |
480 | bool grabkeyboard, QObject* par, | 480 | bool grabkeyboard, QObject* par, |
481 | const char* name) | 481 | const char* name) |
482 | : QObject( par, name ), m_conf( conf ), m_group( group ), | 482 | : QObject( par, name ), m_conf( conf ), m_group( group ), |
483 | m_blackKeys( black ), m_grab( grabkeyboard ), m_map( 0 ){ | 483 | m_blackKeys( black ), m_grab( grabkeyboard ), m_map( 0 ){ |
484 | if ( m_grab ) | 484 | if ( m_grab ) |
485 | QPEApplication::grabKeyboard(); | 485 | QPEApplication::grabKeyboard(); |
486 | m_event_mask = OKeyConfigManager::MaskReleased; | 486 | m_event_mask = OKeyConfigManager::MaskReleased; |
487 | } | 487 | } |
488 | 488 | ||
489 | 489 | ||
490 | /** | 490 | /** |
491 | * Destructor | 491 | * Destructor |
492 | */ | 492 | */ |
493 | OKeyConfigManager::~OKeyConfigManager() { | 493 | OKeyConfigManager::~OKeyConfigManager() { |
494 | if ( m_grab ) | 494 | if ( m_grab ) |
495 | QPEApplication::ungrabKeyboard(); | 495 | QPEApplication::ungrabKeyboard(); |
496 | delete m_map; | 496 | delete m_map; |
497 | } | 497 | } |
498 | 498 | ||
499 | /** | 499 | /** |
500 | * Load the Configuration from the OConfig | 500 | * Load the Configuration from the OConfig |
501 | * If a Key is restricted but was in the config we will | 501 | * If a Key is restricted but was in the config we will |
502 | * make it be the empty key paur | 502 | * make it be the empty key paur |
503 | * We will change the group but restore to the previous. | 503 | * We will change the group but restore to the previous. |
504 | * | 504 | * |
505 | * @see OKeyPair::emptyKey | 505 | * @see OKeyPair::emptyKey |
506 | */ | 506 | */ |
507 | void OKeyConfigManager::load() { | 507 | void OKeyConfigManager::load() { |
508 | Opie::Core::OConfigGroupSaver( m_conf, m_group ); | 508 | Opie::Core::OConfigGroupSaver grp( m_conf, m_group ); |
509 | 509 | ||
510 | /* | 510 | /* |
511 | * Read each item | 511 | * Read each item |
512 | */ | 512 | */ |
513 | int key, mod; | 513 | int key, mod; |
514 | for( OKeyConfigItem::List::Iterator it = m_keys.begin(); it != m_keys.end(); ++it ) { | 514 | for( OKeyConfigItem::List::Iterator it = m_keys.begin(); it != m_keys.end(); ++it ) { |
515 | key = m_conf->readNumEntry( (*it).configKey()+"key", | 515 | key = m_conf->readNumEntry( (*it).configKey()+"key", |
516 | (*it).defaultKeyPair().keycode() ); | 516 | (*it).defaultKeyPair().keycode() ); |
517 | mod = m_conf->readNumEntry( (*it).configKey()+"mod", | 517 | mod = m_conf->readNumEntry( (*it).configKey()+"mod", |
518 | (*it).defaultKeyPair().modifier() ); | 518 | (*it).defaultKeyPair().modifier() ); |
519 | OKeyPair okey( key, mod ); | 519 | OKeyPair okey( key, mod ); |
520 | 520 | ||
521 | if ( !m_blackKeys.contains( okey ) && key != -1 && mod != -1 ) | 521 | if ( !m_blackKeys.contains( okey ) && key != -1 && mod != -1 ) |
522 | (*it).setKeyPair( okey ); | 522 | (*it).setKeyPair( okey ); |
523 | else | 523 | else |
524 | (*it).setKeyPair( OKeyPair::emptyKey() ); | 524 | (*it).setKeyPair( OKeyPair::emptyKey() ); |
525 | } | 525 | } |
526 | delete m_map; m_map = 0; | 526 | delete m_map; m_map = 0; |
527 | } | 527 | } |
528 | 528 | ||
529 | /** | 529 | /** |
530 | * We will save the current configuration | 530 | * We will save the current configuration |
531 | * to the OConfig. We will change the group but restore | 531 | * to the OConfig. We will change the group but restore |
532 | * to the previous | 532 | * to the previous |
533 | */ | 533 | */ |
534 | void OKeyConfigManager::save() { | 534 | void OKeyConfigManager::save() { |
535 | Opie::Core::OConfigGroupSaver( m_conf, m_group ); | 535 | Opie::Core::OConfigGroupSaver grp( m_conf, m_group ); |
536 | 536 | ||
537 | /* | 537 | /* |
538 | * Write each item | 538 | * Write each item |
539 | */ | 539 | */ |
540 | for( OKeyConfigItem::List::Iterator it = m_keys.begin();it != m_keys.end(); ++it ) { | 540 | for( OKeyConfigItem::List::Iterator it = m_keys.begin();it != m_keys.end(); ++it ) { |
541 | /* skip empty items */ | 541 | /* skip empty items */ |
542 | if ( (*it).isEmpty() ) | 542 | if ( (*it).isEmpty() ) |
543 | continue; | 543 | continue; |
544 | OKeyPair pair = (*it).keyPair(); | 544 | OKeyPair pair = (*it).keyPair(); |
545 | OKeyPair deft = (*it).defaultKeyPair(); | 545 | OKeyPair deft = (*it).defaultKeyPair(); |
546 | /* | 546 | /* |
547 | * don't write if it is the default setting | 547 | * don't write if it is the default setting |
548 | * FIXME allow to remove Keys from config | 548 | * FIXME allow to remove Keys from config |
549 | if ( (pair.keycode() == deft.keycode()) && | 549 | if ( (pair.keycode() == deft.keycode()) && |
550 | (pair.modifier()== deft.modifier() ) ) | 550 | (pair.modifier()== deft.modifier() ) ) |
551 | return; | 551 | return; |
552 | */ | 552 | */ |
553 | 553 | ||
554 | m_conf->writeEntry((*it).configKey()+"key", pair.keycode() ); | 554 | m_conf->writeEntry((*it).configKey()+"key", pair.keycode() ); |
555 | m_conf->writeEntry((*it).configKey()+"mod", pair.modifier() ); | 555 | m_conf->writeEntry((*it).configKey()+"mod", pair.modifier() ); |
556 | } | 556 | } |
557 | m_conf->write(); | 557 | m_conf->write(); |
558 | } | 558 | } |
559 | 559 | ||
560 | /** | 560 | /** |
561 | * This is function uses a QMap internally but you can have the same keycode | 561 | * This is function uses a QMap internally but you can have the same keycode |
562 | * with different modifier key. The behaviour is undefined if you add a OKeyConfigItem | 562 | * with different modifier key. The behaviour is undefined if you add a OKeyConfigItem |
563 | * with same keycode and modifier key. The GUI takes care that a user can't | 563 | * with same keycode and modifier key. The GUI takes care that a user can't |
564 | * cofigure two keys. | 564 | * cofigure two keys. |
565 | * | 565 | * |
566 | * Make sure you call e->ignore if you don't want to handle this event | 566 | * Make sure you call e->ignore if you don't want to handle this event |
567 | */ | 567 | */ |
568 | OKeyConfigItem OKeyConfigManager::handleKeyEvent( QKeyEvent* e ) { | 568 | OKeyConfigItem OKeyConfigManager::handleKeyEvent( QKeyEvent* e ) { |
569 | /* | 569 | /* |
570 | * Fix Up issues with Qt/E, my keybard, and virtual input | 570 | * Fix Up issues with Qt/E, my keybard, and virtual input |
571 | * methods | 571 | * methods |
572 | * First my Keyboard delivers 256,512,1024 for shift/ctrl/alt instead of the button state | 572 | * First my Keyboard delivers 256,512,1024 for shift/ctrl/alt instead of the button state |
573 | * Also key() on virtual inputmethods are zero and only ascii. We need to fix upper and lower | 573 | * Also key() on virtual inputmethods are zero and only ascii. We need to fix upper and lower |
574 | * case ascii | 574 | * case ascii |
575 | */ | 575 | */ |
576 | int key, mod; | 576 | int key, mod; |
577 | Opie::Core::Internal::fixupKeys( key, mod, e ); | 577 | Opie::Core::Internal::fixupKeys( key, mod, e ); |
578 | 578 | ||
579 | OKeyConfigItem::List _keyList = keyList( key ); | 579 | OKeyConfigItem::List _keyList = keyList( key ); |
580 | if ( _keyList.isEmpty() ) | 580 | if ( _keyList.isEmpty() ) |
581 | return OKeyConfigItem(); | 581 | return OKeyConfigItem(); |
582 | 582 | ||
583 | OKeyConfigItem item; | 583 | OKeyConfigItem item; |