summaryrefslogtreecommitdiff
authorzecke <zecke>2004-05-17 21:21:20 (UTC)
committer zecke <zecke>2004-05-17 21:21:20 (UTC)
commite0d8fdf2bcf61f8b6793ee757de35b985aef1b8d (patch) (unidiff)
treefe4d56b46af10508430eda398ec7d57cc4ab6a9e
parent34f42c17874e84239fc2bff241cecee7ec78d38d (diff)
downloadopie-e0d8fdf2bcf61f8b6793ee757de35b985aef1b8d.zip
opie-e0d8fdf2bcf61f8b6793ee757de35b985aef1b8d.tar.gz
opie-e0d8fdf2bcf61f8b6793ee757de35b985aef1b8d.tar.bz2
use the config group saver right?!
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/okeyconfigmanager.cpp4
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
@@ -484,76 +484,76 @@ OKeyConfigManager::OKeyConfigManager( Opie::Core::OConfig* conf,
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 */
493OKeyConfigManager::~OKeyConfigManager() { 493OKeyConfigManager::~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 */
507void OKeyConfigManager::load() { 507void 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 */
534void OKeyConfigManager::save() { 534void 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