Esempio n. 1
0
void KKeyChooser::readGlobalKeys()
{
	debug("KKeyChooser::readGlobalKeys()");
	
	globalDict->clear();
	
	// QDict<int> *tmpDict = new QDict<int> ( 37, false );
	
	// Insert all global keys into globalDict
	int *keyCode;
	KConfig *pConfig = kapp->getConfig();
	KEntryIterator *gIt = pConfig->entryIterator( "Global Keys" );
	gIt->toFirst();
	while ( gIt->current() ) {
		keyCode = new int;
		*keyCode = stringToKey( gIt->current()->aValue );
		globalDict->insert( gIt->currentKey(), keyCode);
		//debug( " %s, %d", gIt->currentKey(), *keyCode );
		++(*gIt);
	}
	
	
	
	// Only insert global keys which don't appear in the dictionary to be configured
	aIt->toFirst();
	while ( aIt->current() ) {
		if ( globalDict->find( aIt->currentKey() ) ) {
			
			// Tried removing but it didn't work. Hence set them to zero
			// instead
			keyCode = new int;
			*keyCode = 0;
			if ( globalDict->remove( aIt->currentKey() ) )
				debug("remove: %s", aIt->currentKey() );
			//debug("%s, %d", aIt->currentKey(), *globalDict->find(
			//aIt->currentKey() ));
			
		}
		++ ( *aIt );
	}
	
	globalDict->clear();
	
	debug("Global dict contents");
	
	QDictIterator<int> dIt( *globalDict );
	
	dIt.toFirst();
	while ( dIt.current() ) {
		debug("current %s:%d", dIt.currentKey(), *dIt.current());
		
		++dIt;
	}
}