summaryrefslogtreecommitdiff
path: root/libopie2/opiecore
Unidiff
Diffstat (limited to 'libopie2/opiecore') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/okeyconfigmanager.cpp10
-rw-r--r--libopie2/opiecore/okeyconfigmanager.h7
2 files changed, 14 insertions, 3 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
@@ -617,76 +617,86 @@ void OKeyConfigManager::addKeyConfig( const OKeyConfigItem& item ) {
617 */ 617 */
618void OKeyConfigManager::removeKeyConfig( const OKeyConfigItem& item ) { 618void OKeyConfigManager::removeKeyConfig( const OKeyConfigItem& item ) {
619 m_keys.remove( item ); 619 m_keys.remove( item );
620 delete m_map; m_map = 0; 620 delete m_map; m_map = 0;
621} 621}
622 622
623/** 623/**
624 * Clears the complete list 624 * Clears the complete list
625 */ 625 */
626void OKeyConfigManager::clearKeyConfig() { 626void OKeyConfigManager::clearKeyConfig() {
627 m_keys.clear(); 627 m_keys.clear();
628 delete m_map; m_map = 0; 628 delete m_map; m_map = 0;
629} 629}
630 630
631/** 631/**
632 * 632 *
633 */ 633 */
634Opie::Core::OKeyConfigItem::List OKeyConfigManager::keyConfigList()const{ 634Opie::Core::OKeyConfigItem::List OKeyConfigManager::keyConfigList()const{
635 return m_keys; 635 return m_keys;
636} 636}
637 637
638/** 638/**
639 * Add this OKeyPair to the blackList. 639 * Add this OKeyPair to the blackList.
640 * Internal lists will be destroyed 640 * Internal lists will be destroyed
641 *
642 * @see clearBlackList
643 * @see removeFromBlackList
641 */ 644 */
642void OKeyConfigManager::addToBlackList( const OKeyPair& key) { 645void OKeyConfigManager::addToBlackList( const OKeyPair& key) {
643 m_blackKeys.append( key ); 646 m_blackKeys.append( key );
644 delete m_map; m_map = 0; 647 delete m_map; m_map = 0;
645} 648}
646 649
647 650
648/** 651/**
649 * Remove this OKeyPair from the black List 652 * Remove this OKeyPair from the black List
650 * Internal lists will be destroyed 653 * Internal lists will be destroyed
654 *
655 * @see addToBlackList
656 * @see clearBlackList
651 */ 657 */
652void OKeyConfigManager::removeFromBlackList( const OKeyPair& key ) { 658void OKeyConfigManager::removeFromBlackList( const OKeyPair& key ) {
653 m_blackKeys.remove( key ); 659 m_blackKeys.remove( key );
654 delete m_map; m_map = 0; 660 delete m_map; m_map = 0;
655} 661}
656 662
657 663
658/** 664/**
659 * Clear the blackList 665 * Clear the blackList
660 */ 666 */
661void OKeyConfigManager::clearBlackList() { 667void OKeyConfigManager::clearBlackList() {
662 m_blackKeys.clear(); 668 m_blackKeys.clear();
663 delete m_map; m_map = 0; 669 delete m_map; m_map = 0;
664} 670}
665 671
666 672
667/** 673/**
668 * Return a copy of the blackList 674 * Return a copy of the blackList
675 *
676 * @see addToBlackList
677 * @see clearBlackList
678 * @see removeFromBlackList
669 */ 679 */
670OKeyPair::List OKeyConfigManager::blackList()const { 680OKeyPair::List OKeyConfigManager::blackList()const {
671 return m_blackKeys; 681 return m_blackKeys;
672} 682}
673 683
674 684
675/** 685/**
676 * Ask the Manager to handle KeyEvents for you. 686 * Ask the Manager to handle KeyEvents for you.
677 * All handled keys will emit a QSignal and return true 687 * All handled keys will emit a QSignal and return true
678 * that it handled the keyevent 688 * that it handled the keyevent
679 */ 689 */
680void OKeyConfigManager::handleWidget( QWidget* wid ) { 690void OKeyConfigManager::handleWidget( QWidget* wid ) {
681 wid->installEventFilter( this ); 691 wid->installEventFilter( this );
682} 692}
683 693
684/** 694/**
685 * @internal 695 * @internal
686 */ 696 */
687bool OKeyConfigManager::eventFilter( QObject* obj, QEvent* ev) { 697bool OKeyConfigManager::eventFilter( QObject* obj, QEvent* ev) {
688 if ( !obj->isWidgetType() ) 698 if ( !obj->isWidgetType() )
689 return false; 699 return false;
690 700
691 /* 701 /*
692 * check if we care for the event 702 * check if we care for the event
diff --git a/libopie2/opiecore/okeyconfigmanager.h b/libopie2/opiecore/okeyconfigmanager.h
index d0a6247..12804ee 100644
--- a/libopie2/opiecore/okeyconfigmanager.h
+++ b/libopie2/opiecore/okeyconfigmanager.h
@@ -45,49 +45,49 @@ public:
45 void setKeycode( int ); 45 void setKeycode( int );
46 void setModifier( int ); 46 void setModifier( int );
47 47
48 static OKeyPair returnKey(); 48 static OKeyPair returnKey();
49 static OKeyPair leftArrowKey(); 49 static OKeyPair leftArrowKey();
50 static OKeyPair rightArrowKey(); 50 static OKeyPair rightArrowKey();
51 static OKeyPair upArrowKey(); 51 static OKeyPair upArrowKey();
52 static OKeyPair downArrowKey(); 52 static OKeyPair downArrowKey();
53 static OKeyPair emptyKey(); 53 static OKeyPair emptyKey();
54 static OKeyPair::List hardwareKeys(); 54 static OKeyPair::List hardwareKeys();
55 55
56private: 56private:
57 int m_key; 57 int m_key;
58 int m_mod; 58 int m_mod;
59 class Private; 59 class Private;
60 Private* d; 60 Private* d;
61}; 61};
62 62
63/** 63/**
64 * A class to represent an OKeyPair. 64 * A class to represent an OKeyPair.
65 * It consists out of a Text exposed to the user, Config Key Item, 65 * It consists out of a Text exposed to the user, Config Key Item,
66 * Pixmap, A default OKeyPair and the set OKeyPair. 66 * Pixmap, A default OKeyPair and the set OKeyPair.
67 * You can also pass an id to it 67 * You can also pass an id to it
68 * 68 *
69 * @since 1.1.2 69 * @since 1.2
70 */ 70 */
71class OKeyConfigItem { 71class OKeyConfigItem {
72 friend class OKeyConfigManager; 72 friend class OKeyConfigManager;
73public: 73public:
74 typedef QValueList<OKeyConfigItem> List; 74 typedef QValueList<OKeyConfigItem> List;
75 OKeyConfigItem( const QString& text = QString::null , const QCString& config_key = QCString(), 75 OKeyConfigItem( const QString& text = QString::null , const QCString& config_key = QCString(),
76 const QPixmap& symbol = QPixmap(), 76 const QPixmap& symbol = QPixmap(),
77 int id = -1, 77 int id = -1,
78 const OKeyPair& def = OKeyPair::emptyKey(), 78 const OKeyPair& def = OKeyPair::emptyKey(),
79 QObject *caller = 0, const char* slot = 0); 79 QObject *caller = 0, const char* slot = 0);
80 OKeyConfigItem( const Opie::Core::ODeviceButton& ); 80 OKeyConfigItem( const Opie::Core::ODeviceButton& );
81 ~OKeyConfigItem(); 81 ~OKeyConfigItem();
82 82
83 bool operator==( const OKeyConfigItem& )const; 83 bool operator==( const OKeyConfigItem& )const;
84 bool operator!=( const OKeyConfigItem& )const; 84 bool operator!=( const OKeyConfigItem& )const;
85 85
86 QString text()const; 86 QString text()const;
87 QPixmap pixmap()const; 87 QPixmap pixmap()const;
88 int id()const; 88 int id()const;
89 89
90 90
91 91
92 OKeyPair keyPair()const; 92 OKeyPair keyPair()const;
93 OKeyPair defaultKeyPair()const; 93 OKeyPair defaultKeyPair()const;
@@ -135,65 +135,66 @@ private:
135 * handled by your action and let give you the action. Or you can install 135 * handled by your action and let give you the action. Or you can install
136 * the event filter and get a signal. 136 * the event filter and get a signal.
137 * You need to load and save yourself! 137 * You need to load and save yourself!
138 * 138 *
139 * Again if you want to extend it and I missed a virtual, tell me so I can improve (zecke@handhelds.org) 139 * Again if you want to extend it and I missed a virtual, tell me so I can improve (zecke@handhelds.org)
140 * 140 *
141 * @since 1.1.2 141 * @since 1.1.2
142 */ 142 */
143class OKeyConfigManager : public QObject { 143class OKeyConfigManager : public QObject {
144 Q_OBJECT 144 Q_OBJECT
145 typedef QMap<int, OKeyConfigItem::List> OKeyMapConfigPrivate; 145 typedef QMap<int, OKeyConfigItem::List> OKeyMapConfigPrivate;
146public: 146public:
147 enum EventMask { 147 enum EventMask {
148 MaskPressed = 0x1, 148 MaskPressed = 0x1,
149 MaskReleased = 0x2, 149 MaskReleased = 0x2,
150 }; 150 };
151 151
152 OKeyConfigManager(Opie::Core::OConfig *conf = 0, 152 OKeyConfigManager(Opie::Core::OConfig *conf = 0,
153 const QString& group = QString::null, 153 const QString& group = QString::null,
154 const OKeyPair::List &block = OKeyPair::List(), 154 const OKeyPair::List &block = OKeyPair::List(),
155 bool grabkeyboard = false, QObject * par = 0, 155 bool grabkeyboard = false, QObject * par = 0,
156 const char* name = 0 ); 156 const char* name = 0 );
157 virtual ~OKeyConfigManager(); 157 virtual ~OKeyConfigManager();
158 158
159public slots:
159 virtual void load(); 160 virtual void load();
160 virtual void save(); 161 virtual void save();
162 void handleWidget( QWidget* );
161 163
164public:
162 virtual OKeyConfigItem handleKeyEvent( QKeyEvent* ); 165 virtual OKeyConfigItem handleKeyEvent( QKeyEvent* );
163 int handleKeyEventId( QKeyEvent* ); 166 int handleKeyEventId( QKeyEvent* );
164 167
165 void addKeyConfig( const OKeyConfigItem& ); 168 void addKeyConfig( const OKeyConfigItem& );
166 void removeKeyConfig( const OKeyConfigItem& ); 169 void removeKeyConfig( const OKeyConfigItem& );
167 void clearKeyConfig(); 170 void clearKeyConfig();
168 171
169 void addToBlackList( const OKeyPair& ); 172 void addToBlackList( const OKeyPair& );
170 void removeFromBlackList( const OKeyPair& ); 173 void removeFromBlackList( const OKeyPair& );
171 void clearBlackList(); 174 void clearBlackList();
172 OKeyPair::List blackList()const; 175 OKeyPair::List blackList()const;
173 176
174 void handleWidget( QWidget* );
175
176 bool eventFilter( QObject*, QEvent* ); 177 bool eventFilter( QObject*, QEvent* );
177 178
178 /** 179 /**
179 * Sets the event mask flags aMask. 180 * Sets the event mask flags aMask.
180 * 181 *
181 * aMask is a combination of OKeyConfigManager::EventMask 182 * aMask is a combination of OKeyConfigManager::EventMask
182 * 183 *
183 * @see eventMask(), testEventMask(), addEventMask(), clearEventMask() 184 * @see eventMask(), testEventMask(), addEventMask(), clearEventMask()
184 */ 185 */
185 void setEventMask(uint aMask); 186 void setEventMask(uint aMask);
186 /** 187 /**
187 * Returns the event mask flags set. 188 * Returns the event mask flags set.
188 * 189 *
189 * aMask is a combination of OKeyConfigManager::EventMask 190 * aMask is a combination of OKeyConfigManager::EventMask
190 * 191 *
191 * @see setEventMask(), testEventMask(), addEventMask(), clearEventMask() 192 * @see setEventMask(), testEventMask(), addEventMask(), clearEventMask()
192 */ 193 */
193 uint eventMask()const; 194 uint eventMask()const;
194 /** 195 /**
195 * Test if the event mask flag aMask is set. 196 * Test if the event mask flag aMask is set.
196 * 197 *
197 * @param aMask one of OKeyConfigManager::EventMask 198 * @param aMask one of OKeyConfigManager::EventMask
198 * 199 *
199 * @see eventMask(), setEventMask(), addEventMask(), clearEventMask() 200 * @see eventMask(), setEventMask(), addEventMask(), clearEventMask()