summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/okeyconfigmanager.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiecore/okeyconfigmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/okeyconfigmanager.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/libopie2/opiecore/okeyconfigmanager.cpp b/libopie2/opiecore/okeyconfigmanager.cpp
index ccb96cc..891cda7 100644
--- a/libopie2/opiecore/okeyconfigmanager.cpp
+++ b/libopie2/opiecore/okeyconfigmanager.cpp
@@ -593,124 +593,134 @@ OKeyConfigItem OKeyConfigManager::handleKeyEvent( QKeyEvent* e ) {
return item;
}
/**
* Return the associated id of the item or -1 if no item
* matched the key
*
* @see handleKeyEvent
*/
int OKeyConfigManager::handleKeyEventId( QKeyEvent* ev) {
return handleKeyEvent( ev ).id();
}
/**
* Add Key Config to the List of items
*/
void OKeyConfigManager::addKeyConfig( const OKeyConfigItem& item ) {
m_keys.append( item );
delete m_map; m_map = 0;
}
/**
* Remove the Key from the Config. Internal lists will be destroyed
* and rebuild on demand later
*/
void OKeyConfigManager::removeKeyConfig( const OKeyConfigItem& item ) {
m_keys.remove( item );
delete m_map; m_map = 0;
}
/**
* Clears the complete list
*/
void OKeyConfigManager::clearKeyConfig() {
m_keys.clear();
delete m_map; m_map = 0;
}
/**
*
*/
Opie::Core::OKeyConfigItem::List OKeyConfigManager::keyConfigList()const{
return m_keys;
}
/**
* Add this OKeyPair to the blackList.
* Internal lists will be destroyed
+ *
+ * @see clearBlackList
+ * @see removeFromBlackList
*/
void OKeyConfigManager::addToBlackList( const OKeyPair& key) {
m_blackKeys.append( key );
delete m_map; m_map = 0;
}
/**
* Remove this OKeyPair from the black List
* Internal lists will be destroyed
+ *
+ * @see addToBlackList
+ * @see clearBlackList
*/
void OKeyConfigManager::removeFromBlackList( const OKeyPair& key ) {
m_blackKeys.remove( key );
delete m_map; m_map = 0;
}
/**
* Clear the blackList
*/
void OKeyConfigManager::clearBlackList() {
m_blackKeys.clear();
delete m_map; m_map = 0;
}
/**
* Return a copy of the blackList
+ *
+ * @see addToBlackList
+ * @see clearBlackList
+ * @see removeFromBlackList
*/
OKeyPair::List OKeyConfigManager::blackList()const {
return m_blackKeys;
}
/**
* Ask the Manager to handle KeyEvents for you.
* All handled keys will emit a QSignal and return true
* that it handled the keyevent
*/
void OKeyConfigManager::handleWidget( QWidget* wid ) {
wid->installEventFilter( this );
}
/**
* @internal
*/
bool OKeyConfigManager::eventFilter( QObject* obj, QEvent* ev) {
if ( !obj->isWidgetType() )
return false;
/*
* check if we care for the event
*/
if ( (ev->type() != QEvent::KeyPress||!testEventMask(MaskPressed)) &&
(ev->type() != QEvent::KeyRelease||!testEventMask(MaskReleased)) )
return false;
QKeyEvent *key = static_cast<QKeyEvent*>( ev );
OKeyConfigItem item = handleKeyEvent( key );
if ( item.isEmpty() )
return false;
QWidget *wid = static_cast<QWidget*>( obj );
if ( item.object() && !item.slot().isEmpty() ) {
connect( this, SIGNAL( actionActivated(QWidget*, QKeyEvent*)),
item.object(), item.slot().data() );
emit actionActivated(wid, key);
disconnect( this, SIGNAL(actionActivated(QWidget*,QKeyEvent*)),
item.object(), item.slot().data() );
}
emit actionActivated( wid, key, item );
return true;
}