summaryrefslogtreecommitdiff
authorzecke <zecke>2004-05-01 18:08:46 (UTC)
committer zecke <zecke>2004-05-01 18:08:46 (UTC)
commitec6a887d8abddbab085a0a3aecae5760ff85dbe8 (patch) (unidiff)
tree93f42bc5ebc3a5428dc93af6b7b90392085a551f
parent8dd2d693000c916346f0bb7d94cbc02b8456c65b (diff)
downloadopie-ec6a887d8abddbab085a0a3aecae5760ff85dbe8.zip
opie-ec6a887d8abddbab085a0a3aecae5760ff85dbe8.tar.gz
opie-ec6a887d8abddbab085a0a3aecae5760ff85dbe8.tar.bz2
Make the code more appealing to me
Fix small memory leak for the blacklist QMap
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/okeyconfigmanager.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/libopie2/opiecore/okeyconfigmanager.cpp b/libopie2/opiecore/okeyconfigmanager.cpp
index 18740ef..ad0f7f7 100644
--- a/libopie2/opiecore/okeyconfigmanager.cpp
+++ b/libopie2/opiecore/okeyconfigmanager.cpp
@@ -490,12 +490,13 @@ OKeyConfigManager::OKeyConfigManager( Opie::Core::OConfig* conf,
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} 497}
497 498
498/** 499/**
499 * Load the Configuration from the OConfig 500 * Load the Configuration from the OConfig
500 * 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
501 * make it be the empty key paur 502 * make it be the empty key paur
@@ -508,18 +509,20 @@ void OKeyConfigManager::load() {
508 509
509 /* 510 /*
510 * Read each item 511 * Read each item
511 */ 512 */
512 int key, mod; 513 int key, mod;
513 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 ) {
514 key = m_conf->readNumEntry( (*it).configKey()+"key", (*it).defaultKeyPair().keycode() ); 515 key = m_conf->readNumEntry( (*it).configKey()+"key",
515 mod = m_conf->readNumEntry( (*it).configKey()+"mod", (*it).defaultKeyPair().modifier() ); 516 (*it).defaultKeyPair().keycode() );
517 mod = m_conf->readNumEntry( (*it).configKey()+"mod",
518 (*it).defaultKeyPair().modifier() );
516 OKeyPair okey( key, mod ); 519 OKeyPair okey( key, mod );
517 520
518 if ( !m_blackKeys.contains( okey ) && key != -1 && mod != -1 ) 521 if ( !m_blackKeys.contains( okey ) && key != -1 && mod != -1 )
519 (*it).setKeyPair( OKeyPair(key, mod) ); 522 (*it).setKeyPair( okey );
520 else 523 else
521 (*it).setKeyPair( OKeyPair::emptyKey() ); 524 (*it).setKeyPair( OKeyPair::emptyKey() );
522 } 525 }
523 delete m_map; m_map = 0; 526 delete m_map; m_map = 0;
524} 527}
525 528
@@ -682,12 +685,15 @@ void OKeyConfigManager::handleWidget( QWidget* wid ) {
682 * @internal 685 * @internal
683 */ 686 */
684bool OKeyConfigManager::eventFilter( QObject* obj, QEvent* ev) { 687bool OKeyConfigManager::eventFilter( QObject* obj, QEvent* ev) {
685 if ( !obj->isWidgetType() ) 688 if ( !obj->isWidgetType() )
686 return false; 689 return false;
687 690
691 /*
692 * check if we care for the event
693 */
688 if ( (ev->type() != QEvent::KeyPress||!testEventMask(MaskPressed)) && 694 if ( (ev->type() != QEvent::KeyPress||!testEventMask(MaskPressed)) &&
689 (ev->type() != QEvent::KeyRelease||!testEventMask(MaskReleased)) ) 695 (ev->type() != QEvent::KeyRelease||!testEventMask(MaskReleased)) )
690 return false; 696 return false;
691 697
692 QKeyEvent *key = static_cast<QKeyEvent*>( ev ); 698 QKeyEvent *key = static_cast<QKeyEvent*>( ev );
693 OKeyConfigItem item = handleKeyEvent( key ); 699 OKeyConfigItem item = handleKeyEvent( key );