author | zecke <zecke> | 2004-04-02 06:43:42 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-02 06:43:42 (UTC) |
commit | a31c8ad914e72b874062dcb31e72476aca735bb0 (patch) (unidiff) | |
tree | 2db1bfd49893369c4ab71bec0e546527c01d6bcd | |
parent | fbe21a008888cef12eb863151b4aaee1e75f0f22 (diff) | |
download | opie-a31c8ad914e72b874062dcb31e72476aca735bb0.zip opie-a31c8ad914e72b874062dcb31e72476aca735bb0.tar.gz opie-a31c8ad914e72b874062dcb31e72476aca735bb0.tar.bz2 |
Add OKeyConfigWidget to the .pro file
and also allow single character shortcuts
-rw-r--r-- | libopie2/opieui/okeyconfigwidget.cpp | 7 | ||||
-rw-r--r-- | libopie2/opieui/opieui.pro | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/libopie2/opieui/okeyconfigwidget.cpp b/libopie2/opieui/okeyconfigwidget.cpp index 8967d77..ef6d713 100644 --- a/libopie2/opieui/okeyconfigwidget.cpp +++ b/libopie2/opieui/okeyconfigwidget.cpp | |||
@@ -1,1246 +1,1247 @@ | |||
1 | #include "okeyconfigwidget.h" | 1 | #include "okeyconfigwidget.h" |
2 | #include "okeyconfigwidget_p.h" | 2 | #include "okeyconfigwidget_p.h" |
3 | 3 | ||
4 | 4 | ||
5 | #include <qgroupbox.h> | 5 | #include <qgroupbox.h> |
6 | #include <qradiobutton.h> | 6 | #include <qradiobutton.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qbuttongroup.h> | 8 | #include <qbuttongroup.h> |
9 | #include <qmessagebox.h> | 9 | #include <qmessagebox.h> |
10 | #include <qaccel.h> | 10 | #include <qaccel.h> |
11 | #include <qlayout.h> | 11 | #include <qlayout.h> |
12 | #include <qlabel.h> | 12 | #include <qlabel.h> |
13 | 13 | ||
14 | /* non gui */ | 14 | /* non gui */ |
15 | #include <qtimer.h> | 15 | #include <qtimer.h> |
16 | 16 | ||
17 | 17 | ||
18 | using namespace Opie::Ui; | 18 | using namespace Opie::Ui; |
19 | 19 | ||
20 | 20 | ||
21 | 21 | ||
22 | /** | 22 | /** |
23 | * The default Constructor of a OKeyPair. | 23 | * The default Constructor of a OKeyPair. |
24 | * A Key and a Modifier ( Alt/Shift/Ctrl ) | 24 | * A Key and a Modifier ( Alt/Shift/Ctrl ) |
25 | * needs to be supplied. | 25 | * needs to be supplied. |
26 | * Use Qt::Key for the information. | 26 | * Use Qt::Key for the information. |
27 | * The default arguments create an Empty OKeyPair. If you | 27 | * The default arguments create an Empty OKeyPair. If you |
28 | * want to get an empty OKeyPair use the static method for getting | 28 | * want to get an empty OKeyPair use the static method for getting |
29 | * the emptyKey() | 29 | * the emptyKey() |
30 | * | 30 | * |
31 | * @see OKeyPair OKeyPair::emptyKey() | 31 | * @see OKeyPair OKeyPair::emptyKey() |
32 | */ | 32 | */ |
33 | OKeyPair::OKeyPair( int key, int mod ) | 33 | OKeyPair::OKeyPair( int key, int mod ) |
34 | : m_key( key ), m_mod( mod ) | 34 | : m_key( key ), m_mod( mod ) |
35 | {} | 35 | {} |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * The destructor | 38 | * The destructor |
39 | */ | 39 | */ |
40 | OKeyPair::~OKeyPair() {} | 40 | OKeyPair::~OKeyPair() {} |
41 | 41 | ||
42 | 42 | ||
43 | /** | 43 | /** |
44 | * Is this OKeyPair empty/valid? | 44 | * Is this OKeyPair empty/valid? |
45 | */ | 45 | */ |
46 | bool OKeyPair::isEmpty()const { | 46 | bool OKeyPair::isEmpty()const { |
47 | return ( ( m_key == -1 )&& ( m_mod == -1 ) ); | 47 | return ( ( m_key == -1 )&& ( m_mod == -1 ) ); |
48 | } | 48 | } |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * get the keycode for this OKeyPair. The Key relates to Qt::Key. | 51 | * get the keycode for this OKeyPair. The Key relates to Qt::Key. |
52 | * | 52 | * |
53 | * @see Qt::Key | 53 | * @see Qt::Key |
54 | * @see setKey | 54 | * @see setKey |
55 | */ | 55 | */ |
56 | int OKeyPair::keycode()const { | 56 | int OKeyPair::keycode()const { |
57 | return m_key; | 57 | return m_key; |
58 | } | 58 | } |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * get the modifier key for this OKeyPair. The Modifier State relates | 61 | * get the modifier key for this OKeyPair. The Modifier State relates |
62 | * to the Qt::ButtonState | 62 | * to the Qt::ButtonState |
63 | * | 63 | * |
64 | * @see Qt::ButtonState | 64 | * @see Qt::ButtonState |
65 | * @see setModifier | 65 | * @see setModifier |
66 | */ | 66 | */ |
67 | int OKeyPair::modifier()const { | 67 | int OKeyPair::modifier()const { |
68 | return m_mod; | 68 | return m_mod; |
69 | } | 69 | } |
70 | 70 | ||
71 | 71 | ||
72 | /** | 72 | /** |
73 | * Set the keycode | 73 | * Set the keycode |
74 | * @param key The Keycode to set | 74 | * @param key The Keycode to set |
75 | * | 75 | * |
76 | * @see keycode() | 76 | * @see keycode() |
77 | * @see Qt::Key | 77 | * @see Qt::Key |
78 | */ | 78 | */ |
79 | void OKeyPair::setKeycode( int key ) { | 79 | void OKeyPair::setKeycode( int key ) { |
80 | m_key = key; | 80 | m_key = key; |
81 | } | 81 | } |
82 | 82 | ||
83 | /** | 83 | /** |
84 | * Set the modifier key | 84 | * Set the modifier key |
85 | * | 85 | * |
86 | * @param the Modifier key | 86 | * @param the Modifier key |
87 | * @see Qt::ButtonState | 87 | * @see Qt::ButtonState |
88 | * @see modifier() | 88 | * @see modifier() |
89 | */ | 89 | */ |
90 | void OKeyPair::setModifier( int mod ) { | 90 | void OKeyPair::setModifier( int mod ) { |
91 | m_mod = mod; | 91 | m_mod = mod; |
92 | } | 92 | } |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * Return an OKeyPair for the Return Key without any modifier. | 95 | * Return an OKeyPair for the Return Key without any modifier. |
96 | */ | 96 | */ |
97 | OKeyPair OKeyPair::returnKey() { | 97 | OKeyPair OKeyPair::returnKey() { |
98 | return OKeyPair( Qt::Key_Return, 0 ); | 98 | return OKeyPair( Qt::Key_Return, 0 ); |
99 | } | 99 | } |
100 | 100 | ||
101 | /** | 101 | /** |
102 | * Return an OKeyPair for the Left Arrow Key | 102 | * Return an OKeyPair for the Left Arrow Key |
103 | * without any modifier Key | 103 | * without any modifier Key |
104 | */ | 104 | */ |
105 | OKeyPair OKeyPair::leftArrowKey() { | 105 | OKeyPair OKeyPair::leftArrowKey() { |
106 | return OKeyPair( Qt::Key_Left, 0 ); | 106 | return OKeyPair( Qt::Key_Left, 0 ); |
107 | } | 107 | } |
108 | 108 | ||
109 | /** | 109 | /** |
110 | * Return an OKeyPair for the Right Arrow Key | 110 | * Return an OKeyPair for the Right Arrow Key |
111 | * without any modifier Key | 111 | * without any modifier Key |
112 | */ | 112 | */ |
113 | OKeyPair OKeyPair::rightArrowKey() { | 113 | OKeyPair OKeyPair::rightArrowKey() { |
114 | return OKeyPair( Qt::Key_Right, 0 ); | 114 | return OKeyPair( Qt::Key_Right, 0 ); |
115 | } | 115 | } |
116 | 116 | ||
117 | /** | 117 | /** |
118 | * Return an OKeyPair for the Up Arrow Key | 118 | * Return an OKeyPair for the Up Arrow Key |
119 | * without any modifier Key | 119 | * without any modifier Key |
120 | */ | 120 | */ |
121 | OKeyPair OKeyPair::upArrowKey() { | 121 | OKeyPair OKeyPair::upArrowKey() { |
122 | return OKeyPair( Qt::Key_Up, 0 ); | 122 | return OKeyPair( Qt::Key_Up, 0 ); |
123 | } | 123 | } |
124 | 124 | ||
125 | /** | 125 | /** |
126 | * Return an OKeyPair for the Down Arrow Key | 126 | * Return an OKeyPair for the Down Arrow Key |
127 | * without any modifier Key | 127 | * without any modifier Key |
128 | */ | 128 | */ |
129 | OKeyPair OKeyPair::downArrowKey() { | 129 | OKeyPair OKeyPair::downArrowKey() { |
130 | return OKeyPair( Qt::Key_Down, 0 ); | 130 | return OKeyPair( Qt::Key_Down, 0 ); |
131 | } | 131 | } |
132 | 132 | ||
133 | /** | 133 | /** |
134 | * Return an Empty OKeyPair | 134 | * Return an Empty OKeyPair |
135 | */ | 135 | */ |
136 | OKeyPair OKeyPair::emptyKey() { | 136 | OKeyPair OKeyPair::emptyKey() { |
137 | return OKeyPair(); | 137 | return OKeyPair(); |
138 | } | 138 | } |
139 | 139 | ||
140 | /** | 140 | /** |
141 | * This functions uses the Opie::Core::ODevice::buttons | 141 | * This functions uses the Opie::Core::ODevice::buttons |
142 | * for OKeyPairList | 142 | * for OKeyPairList |
143 | * | 143 | * |
144 | * @see Opie::Core::ODevice | 144 | * @see Opie::Core::ODevice |
145 | * @see Opie::Core::ODeviceButton | 145 | * @see Opie::Core::ODeviceButton |
146 | * @see Opie::Core::ODevice::button | 146 | * @see Opie::Core::ODevice::button |
147 | */ | 147 | */ |
148 | OKeyPair::List OKeyPair::hardwareKeys() { | 148 | OKeyPair::List OKeyPair::hardwareKeys() { |
149 | const QValueList<Opie::Core::ODeviceButton> but = Opie::Core::ODevice::inst()->buttons(); | 149 | const QValueList<Opie::Core::ODeviceButton> but = Opie::Core::ODevice::inst()->buttons(); |
150 | OKeyPair::List lst; | 150 | OKeyPair::List lst; |
151 | 151 | ||
152 | for ( QValueList<Opie::Core::ODeviceButton>::ConstIterator it = but.begin(); | 152 | for ( QValueList<Opie::Core::ODeviceButton>::ConstIterator it = but.begin(); |
153 | it != but.end(); ++it ) | 153 | it != but.end(); ++it ) |
154 | lst.append( OKeyPair( (*it).keycode(), 0 ) ); | 154 | lst.append( OKeyPair( (*it).keycode(), 0 ) ); |
155 | 155 | ||
156 | 156 | ||
157 | return lst; | 157 | return lst; |
158 | } | 158 | } |
159 | 159 | ||
160 | /** | 160 | /** |
161 | * Equals operator. Check if two OKeyPairs have the same key and modifier | 161 | * Equals operator. Check if two OKeyPairs have the same key and modifier |
162 | * @see operator!= | 162 | * @see operator!= |
163 | */ | 163 | */ |
164 | bool OKeyPair::operator==( const OKeyPair& pair)const { | 164 | bool OKeyPair::operator==( const OKeyPair& pair)const { |
165 | if ( m_key != pair.m_key ) return false; | 165 | if ( m_key != pair.m_key ) return false; |
166 | if ( m_mod != pair.m_mod ) return false; | 166 | if ( m_mod != pair.m_mod ) return false; |
167 | 167 | ||
168 | return true; | 168 | return true; |
169 | } | 169 | } |
170 | 170 | ||
171 | /** | 171 | /** |
172 | * Not equal operator. calls the equal operator internally | 172 | * Not equal operator. calls the equal operator internally |
173 | */ | 173 | */ |
174 | bool OKeyPair::operator!=( const OKeyPair& pair)const { | 174 | bool OKeyPair::operator!=( const OKeyPair& pair)const { |
175 | return !(*this == pair); | 175 | return !(*this == pair); |
176 | } | 176 | } |
177 | 177 | ||
178 | 178 | ||
179 | /** | 179 | /** |
180 | * The normal Constructor to create a OKeyConfigItem | 180 | * The normal Constructor to create a OKeyConfigItem |
181 | * | 181 | * |
182 | * You can set the the key paramater of this item but if | 182 | * You can set the the key paramater of this item but if |
183 | * you use this item with the OKeyConfigManager your setting | 183 | * you use this item with the OKeyConfigManager your setting |
184 | * will be overwritten. | 184 | * will be overwritten. |
185 | * You can also specify a QObject and slot which sould get called | 185 | * You can also specify a QObject and slot which sould get called |
186 | * once this item is activated. This slot only works if you | 186 | * once this item is activated. This slot only works if you |
187 | * use the OKeyConfigManager. | 187 | * use the OKeyConfigManager. |
188 | * The actual Key is read by load() | 188 | * The actual Key is read by load() |
189 | * | 189 | * |
190 | * \code | 190 | * \code |
191 | * void MySlot::create(){ | 191 | * void MySlot::create(){ |
192 | * OKeyConfigItem item(tr("Delete"),"delete",Resource::loadPixmap("trash"), | 192 | * OKeyConfigItem item(tr("Delete"),"delete",Resource::loadPixmap("trash"), |
193 | * 123, OKeyPair(Qt::Key_D,Qt::ControlButton), | 193 | * 123, OKeyPair(Qt::Key_D,Qt::ControlButton), |
194 | * this,SLOT(slotDelete(QWidget*,QKeyEvent*))); | 194 | * this,SLOT(slotDelete(QWidget*,QKeyEvent*))); |
195 | * } | 195 | * } |
196 | * \endcode | 196 | * \endcode |
197 | * | 197 | * |
198 | * @param text The text exposed to the user | 198 | * @param text The text exposed to the user |
199 | * @param config_key The key used in the config | 199 | * @param config_key The key used in the config |
200 | * @param pix A Pixmap associated with this Item | 200 | * @param pix A Pixmap associated with this Item |
201 | * @param def The OKeyPair used as default | 201 | * @param def The OKeyPair used as default |
202 | * @param caller The object where the slot exists | 202 | * @param caller The object where the slot exists |
203 | * @param slot The slot which should get called | 203 | * @param slot The slot which should get called |
204 | * | 204 | * |
205 | */ | 205 | */ |
206 | OKeyConfigItem::OKeyConfigItem( const QString& text, const QCString& config_key, | 206 | OKeyConfigItem::OKeyConfigItem( const QString& text, const QCString& config_key, |
207 | const QPixmap& pix, int id, const OKeyPair& def, | 207 | const QPixmap& pix, int id, const OKeyPair& def, |
208 | QObject *caller, | 208 | QObject *caller, |
209 | const char* slot ) | 209 | const char* slot ) |
210 | : m_text( text ), m_config( config_key ), m_pix( pix ), | 210 | : m_text( text ), m_config( config_key ), m_pix( pix ), |
211 | m_id( id ), m_def( def ), | 211 | m_id( id ), m_def( def ), |
212 | m_obj( caller ), m_str( slot ) {} | 212 | m_obj( caller ), m_str( slot ) {} |
213 | 213 | ||
214 | /** | 214 | /** |
215 | * A special Constructor for converting from an Opie::Core::ODeviceButton | 215 | * A special Constructor for converting from an Opie::Core::ODeviceButton |
216 | * delivered by Opie::Core::ODevice::buttons() | 216 | * delivered by Opie::Core::ODevice::buttons() |
217 | * There is no Config Key set and both default key and key are set | 217 | * There is no Config Key set and both default key and key are set |
218 | * to Opie::Core::ODeviceButton::keycode() and 0 to modifier | 218 | * to Opie::Core::ODeviceButton::keycode() and 0 to modifier |
219 | * | 219 | * |
220 | * @see Opie::Core::ODevice | 220 | * @see Opie::Core::ODevice |
221 | * @see Opie::Core::ODeviceButton | 221 | * @see Opie::Core::ODeviceButton |
222 | * @see Opie::Core::ODevice::buttons() | 222 | * @see Opie::Core::ODevice::buttons() |
223 | */ | 223 | */ |
224 | OKeyConfigItem::OKeyConfigItem( const Opie::Core::ODeviceButton& b ) | 224 | OKeyConfigItem::OKeyConfigItem( const Opie::Core::ODeviceButton& b ) |
225 | : m_text( b.userText() ), m_pix( b.pixmap() ), m_id( -1 ), | 225 | : m_text( b.userText() ), m_pix( b.pixmap() ), m_id( -1 ), |
226 | m_key( OKeyPair( b.keycode(), 0 ) ), m_def( OKeyPair( b.keycode(), 0 ) ) | 226 | m_key( OKeyPair( b.keycode(), 0 ) ), m_def( OKeyPair( b.keycode(), 0 ) ) |
227 | {} | 227 | {} |
228 | 228 | ||
229 | 229 | ||
230 | /** | 230 | /** |
231 | * Destructor | 231 | * Destructor |
232 | */ | 232 | */ |
233 | OKeyConfigItem::~OKeyConfigItem() {} | 233 | OKeyConfigItem::~OKeyConfigItem() {} |
234 | 234 | ||
235 | 235 | ||
236 | /** | 236 | /** |
237 | * The text exposed to the user | 237 | * The text exposed to the user |
238 | * | 238 | * |
239 | * @see setText | 239 | * @see setText |
240 | */ | 240 | */ |
241 | QString OKeyConfigItem::text()const { | 241 | QString OKeyConfigItem::text()const { |
242 | return m_text; | 242 | return m_text; |
243 | } | 243 | } |
244 | 244 | ||
245 | /** | 245 | /** |
246 | * The pixmap shown to the user for your action/key | 246 | * The pixmap shown to the user for your action/key |
247 | * | 247 | * |
248 | * @see setPixmap | 248 | * @see setPixmap |
249 | */ | 249 | */ |
250 | QPixmap OKeyConfigItem::pixmap()const { | 250 | QPixmap OKeyConfigItem::pixmap()const { |
251 | return m_pix; | 251 | return m_pix; |
252 | } | 252 | } |
253 | 253 | ||
254 | /** | 254 | /** |
255 | * Return the OKeyPair this OKeyConfigItem is configured for. | 255 | * Return the OKeyPair this OKeyConfigItem is configured for. |
256 | * | 256 | * |
257 | * @see setKeyPair | 257 | * @see setKeyPair |
258 | */ | 258 | */ |
259 | OKeyPair OKeyConfigItem::keyPair()const { | 259 | OKeyPair OKeyConfigItem::keyPair()const { |
260 | return m_key; | 260 | return m_key; |
261 | } | 261 | } |
262 | 262 | ||
263 | /** | 263 | /** |
264 | * Return the default OKeyPair | 264 | * Return the default OKeyPair |
265 | * @see setDefaultKeyPair | 265 | * @see setDefaultKeyPair |
266 | */ | 266 | */ |
267 | OKeyPair OKeyConfigItem::defaultKeyPair()const { | 267 | OKeyPair OKeyConfigItem::defaultKeyPair()const { |
268 | return m_def; | 268 | return m_def; |
269 | } | 269 | } |
270 | 270 | ||
271 | 271 | ||
272 | /** | 272 | /** |
273 | * Return the Id you assigned to this item. | 273 | * Return the Id you assigned to this item. |
274 | * setting is only possible by the constructor | 274 | * setting is only possible by the constructor |
275 | */ | 275 | */ |
276 | int OKeyConfigItem::id()const{ | 276 | int OKeyConfigItem::id()const{ |
277 | return m_id; | 277 | return m_id; |
278 | } | 278 | } |
279 | 279 | ||
280 | /** | 280 | /** |
281 | * reutrn the Config Key. Setting it is only possible | 281 | * reutrn the Config Key. Setting it is only possible |
282 | * by the constructor | 282 | * by the constructor |
283 | */ | 283 | */ |
284 | QCString OKeyConfigItem::configKey()const { | 284 | QCString OKeyConfigItem::configKey()const { |
285 | return m_config; | 285 | return m_config; |
286 | } | 286 | } |
287 | 287 | ||
288 | /** | 288 | /** |
289 | * @internal | 289 | * @internal |
290 | */ | 290 | */ |
291 | QObject* OKeyConfigItem::object()const{ | 291 | QObject* OKeyConfigItem::object()const{ |
292 | return m_obj; | 292 | return m_obj; |
293 | } | 293 | } |
294 | 294 | ||
295 | /** | 295 | /** |
296 | * @internal | 296 | * @internal |
297 | */ | 297 | */ |
298 | QCString OKeyConfigItem::slot()const { | 298 | QCString OKeyConfigItem::slot()const { |
299 | return m_str; | 299 | return m_str; |
300 | } | 300 | } |
301 | 301 | ||
302 | /** | 302 | /** |
303 | * Set the text | 303 | * Set the text |
304 | * | 304 | * |
305 | * @param text Set the Text of this Action to text | 305 | * @param text Set the Text of this Action to text |
306 | * @see text() | 306 | * @see text() |
307 | */ | 307 | */ |
308 | void OKeyConfigItem::setText( const QString& text ) { | 308 | void OKeyConfigItem::setText( const QString& text ) { |
309 | m_text = text; | 309 | m_text = text; |
310 | } | 310 | } |
311 | 311 | ||
312 | /** | 312 | /** |
313 | * Set the pixmap of this action | 313 | * Set the pixmap of this action |
314 | * | 314 | * |
315 | * @param pix The Pixmap to set | 315 | * @param pix The Pixmap to set |
316 | * @see pixmap() | 316 | * @see pixmap() |
317 | */ | 317 | */ |
318 | void OKeyConfigItem::setPixmap( const QPixmap& pix ) { | 318 | void OKeyConfigItem::setPixmap( const QPixmap& pix ) { |
319 | m_pix = pix; | 319 | m_pix = pix; |
320 | } | 320 | } |
321 | 321 | ||
322 | /** | 322 | /** |
323 | * Set the KeyPair the OKeyConfigItem uses. | 323 | * Set the KeyPair the OKeyConfigItem uses. |
324 | * Your set Key could get overwritten if you use | 324 | * Your set Key could get overwritten if you use |
325 | * the manager or GUI to configure the key | 325 | * the manager or GUI to configure the key |
326 | * | 326 | * |
327 | * @param key Set the OKeyPair used | 327 | * @param key Set the OKeyPair used |
328 | * @see keyPair() | 328 | * @see keyPair() |
329 | */ | 329 | */ |
330 | void OKeyConfigItem::setKeyPair( const OKeyPair& key) { | 330 | void OKeyConfigItem::setKeyPair( const OKeyPair& key) { |
331 | m_key = key; | 331 | m_key = key; |
332 | } | 332 | } |
333 | 333 | ||
334 | /** | 334 | /** |
335 | * Set the default KeyPair. | 335 | * Set the default KeyPair. |
336 | * | 336 | * |
337 | * @param key The default keypair | 337 | * @param key The default keypair |
338 | * @see defaultKeyPair() | 338 | * @see defaultKeyPair() |
339 | */ | 339 | */ |
340 | void OKeyConfigItem::setDefaultKeyPair( const OKeyPair& key ) { | 340 | void OKeyConfigItem::setDefaultKeyPair( const OKeyPair& key ) { |
341 | m_def = key; | 341 | m_def = key; |
342 | } | 342 | } |
343 | 343 | ||
344 | /** | 344 | /** |
345 | * @internal | 345 | * @internal |
346 | */ | 346 | */ |
347 | void OKeyConfigItem::setConfigKey( const QCString& str) { | 347 | void OKeyConfigItem::setConfigKey( const QCString& str) { |
348 | m_config = str; | 348 | m_config = str; |
349 | m_config.detach(); | 349 | m_config.detach(); |
350 | } | 350 | } |
351 | 351 | ||
352 | /** | 352 | /** |
353 | * @internal | 353 | * @internal |
354 | */ | 354 | */ |
355 | void OKeyConfigItem::setId( int id ) { | 355 | void OKeyConfigItem::setId( int id ) { |
356 | m_id = id; | 356 | m_id = id; |
357 | } | 357 | } |
358 | 358 | ||
359 | /** | 359 | /** |
360 | * If the item is not configured isEmpty() will return true | 360 | * If the item is not configured isEmpty() will return true |
361 | * It is empty if no text is present and no default | 361 | * It is empty if no text is present and no default |
362 | * and no configured key | 362 | * and no configured key |
363 | */ | 363 | */ |
364 | bool OKeyConfigItem::isEmpty()const { | 364 | bool OKeyConfigItem::isEmpty()const { |
365 | if ( !m_def.isEmpty() ) return false; | 365 | if ( !m_def.isEmpty() ) return false; |
366 | if ( !m_key.isEmpty() ) return false; | 366 | if ( !m_key.isEmpty() ) return false; |
367 | if ( !m_text.isEmpty() ) return false; | 367 | if ( !m_text.isEmpty() ) return false; |
368 | if ( m_id != -1 ) return false; | 368 | if ( m_id != -1 ) return false; |
369 | 369 | ||
370 | return true; | 370 | return true; |
371 | } | 371 | } |
372 | 372 | ||
373 | /** | 373 | /** |
374 | * Check if the KeyPairs are the same | 374 | * Check if the KeyPairs are the same |
375 | */ | 375 | */ |
376 | bool OKeyConfigItem::operator==( const OKeyConfigItem& conf )const { | 376 | bool OKeyConfigItem::operator==( const OKeyConfigItem& conf )const { |
377 | /* if ( isEmpty() == conf.isEmpty() ) return true; | 377 | /* if ( isEmpty() == conf.isEmpty() ) return true; |
378 | else if ( isEmpty() != conf.isEmpty() ) return false; | 378 | else if ( isEmpty() != conf.isEmpty() ) return false; |
379 | else if ( !isEmpty()!= conf.isEmpty() ) return false; | 379 | else if ( !isEmpty()!= conf.isEmpty() ) return false; |
380 | */ | 380 | */ |
381 | 381 | ||
382 | if ( m_id != conf.m_id ) return false; | 382 | if ( m_id != conf.m_id ) return false; |
383 | if ( m_obj != conf.m_obj ) return false; | 383 | if ( m_obj != conf.m_obj ) return false; |
384 | if ( m_text != conf.m_text ) return false; | 384 | if ( m_text != conf.m_text ) return false; |
385 | if ( m_key != conf.m_key ) return false; | 385 | if ( m_key != conf.m_key ) return false; |
386 | if ( m_def != conf.m_def ) return false; | 386 | if ( m_def != conf.m_def ) return false; |
387 | 387 | ||
388 | 388 | ||
389 | 389 | ||
390 | return true; | 390 | return true; |
391 | 391 | ||
392 | } | 392 | } |
393 | 393 | ||
394 | bool OKeyConfigItem::operator!=( const OKeyConfigItem& conf )const { | 394 | bool OKeyConfigItem::operator!=( const OKeyConfigItem& conf )const { |
395 | return !( *this == conf ); | 395 | return !( *this == conf ); |
396 | } | 396 | } |
397 | 397 | ||
398 | /** | 398 | /** |
399 | * \brief c'tor | 399 | * \brief c'tor |
400 | * The Constructor for a OKeyConfigManager | 400 | * The Constructor for a OKeyConfigManager |
401 | * | 401 | * |
402 | * You can use this manager in multiple ways. Either make it handle | 402 | * You can use this manager in multiple ways. Either make it handle |
403 | * QKeyEvents | 403 | * QKeyEvents |
404 | * | 404 | * |
405 | * \code | 405 | * \code |
406 | * Opie::Core::Config conf = oApp->config(); | 406 | * Opie::Core::Config conf = oApp->config(); |
407 | * Opie::Ui::OKeyPairList blackList; | 407 | * Opie::Ui::OKeyPairList blackList; |
408 | * blackList.append(Opie::Ui::OKeyPair::leftArrowKey()); | 408 | * blackList.append(Opie::Ui::OKeyPair::leftArrowKey()); |
409 | * blackList.append(Opie::Ui::OKeyPair::rightArrowKey()); | 409 | * blackList.append(Opie::Ui::OKeyPair::rightArrowKey()); |
410 | * Opie::Ui::OKeyConfigManager *manager = new Opie::Ui::OKeyConfigManager(conf,"key_actions",blackList, | 410 | * Opie::Ui::OKeyConfigManager *manager = new Opie::Ui::OKeyConfigManager(conf,"key_actions",blackList, |
411 | * false); | 411 | * false); |
412 | * QListView *view = new QListView(); | 412 | * QListView *view = new QListView(); |
413 | * manager->handleWidget(view); | 413 | * manager->handleWidget(view); |
414 | * manager->addKeyConfig( Opie::Ui::OKeyPair::returnKey()); | 414 | * manager->addKeyConfig( Opie::Ui::OKeyPair::returnKey()); |
415 | * manager->load(); | 415 | * manager->load(); |
416 | * | 416 | * |
417 | * connect(manager,SIGNAL(actionActivated(QWidget*,QKeyEvent*,const Opie::Ui::OKeyConfigItem&)), | 417 | * connect(manager,SIGNAL(actionActivated(QWidget*,QKeyEvent*,const Opie::Ui::OKeyConfigItem&)), |
418 | * this,SLOT(slotHandleKey(QWidget*,QKeyEvent*,const Opie::Ui::OKeyConfigItem&))); | 418 | * this,SLOT(slotHandleKey(QWidget*,QKeyEvent*,const Opie::Ui::OKeyConfigItem&))); |
419 | * | 419 | * |
420 | * .... | 420 | * .... |
421 | * | 421 | * |
422 | * void update(){ | 422 | * void update(){ |
423 | * QDialog diag(true); | 423 | * QDialog diag(true); |
424 | * QHBoxLayout *lay = new QHBoxLayout(&diag); | 424 | * QHBoxLayout *lay = new QHBoxLayout(&diag); |
425 | * Opie::Ui::OKeyConfigWidget *wid = new Opie::Ui::OKeyConfigWidget(manager,&diag); | 425 | * Opie::Ui::OKeyConfigWidget *wid = new Opie::Ui::OKeyConfigWidget(manager,&diag); |
426 | * wid->setChangeMode(Opie::Ui::OKeyConfigWidget::Queu); | 426 | * wid->setChangeMode(Opie::Ui::OKeyConfigWidget::Queu); |
427 | * lay->addWidget(wid); | 427 | * lay->addWidget(wid); |
428 | * if(QPEApplication::execDialog( &diag)== QDialog::Accepted){ | 428 | * if(QPEApplication::execDialog( &diag)== QDialog::Accepted){ |
429 | * wid->save(); | 429 | * wid->save(); |
430 | * } | 430 | * } |
431 | * } | 431 | * } |
432 | * | 432 | * |
433 | * .... | 433 | * .... |
434 | * MyListView::keyPressEvent( QKeyEvent* e ){ | 434 | * MyListView::keyPressEvent( QKeyEvent* e ){ |
435 | * Opie::Ui::OKeyConfigItem item = manager->handleKeyEvent(e); | 435 | * Opie::Ui::OKeyConfigItem item = manager->handleKeyEvent(e); |
436 | * if(!item.isEmpty() ){ | 436 | * if(!item.isEmpty() ){ |
437 | * switch(item.id()){ | 437 | * switch(item.id()){ |
438 | * case My_Delete_Key: | 438 | * case My_Delete_Key: |
439 | * break; | 439 | * break; |
440 | * } | 440 | * } |
441 | * } | 441 | * } |
442 | * } | 442 | * } |
443 | * | 443 | * |
444 | * \endcode | 444 | * \endcode |
445 | * | 445 | * |
446 | * @param conf The Config where the KeySetting should be stored | 446 | * @param conf The Config where the KeySetting should be stored |
447 | * @param group The group where the KeySetting will be stored | 447 | * @param group The group where the KeySetting will be stored |
448 | * @param black Which keys shouldn't be allowed to handle | 448 | * @param black Which keys shouldn't be allowed to handle |
449 | * @param grabkeyboard Calls QPEApplication::grabKeyboard to allow handling of DeviceButtons | 449 | * @param grabkeyboard Calls QPEApplication::grabKeyboard to allow handling of DeviceButtons |
450 | * @param par The parent/owner of this manager | 450 | * @param par The parent/owner of this manager |
451 | * @param name The name of this object | 451 | * @param name The name of this object |
452 | */ | 452 | */ |
453 | OKeyConfigManager::OKeyConfigManager( Opie::Core::OConfig* conf, | 453 | OKeyConfigManager::OKeyConfigManager( Opie::Core::OConfig* conf, |
454 | const QString& group, | 454 | const QString& group, |
455 | const OKeyPair::List& black, | 455 | const OKeyPair::List& black, |
456 | bool grabkeyboard, QObject* par, | 456 | bool grabkeyboard, QObject* par, |
457 | const char* name) | 457 | const char* name) |
458 | : QObject( par, name ), m_conf( conf ), m_group( group ), | 458 | : QObject( par, name ), m_conf( conf ), m_group( group ), |
459 | m_blackKeys( black ), m_grab( grabkeyboard ), m_map( 0 ){ | 459 | m_blackKeys( black ), m_grab( grabkeyboard ), m_map( 0 ){ |
460 | if ( m_grab ) | 460 | if ( m_grab ) |
461 | QPEApplication::grabKeyboard(); | 461 | QPEApplication::grabKeyboard(); |
462 | } | 462 | } |
463 | 463 | ||
464 | 464 | ||
465 | /** | 465 | /** |
466 | * Destructor | 466 | * Destructor |
467 | */ | 467 | */ |
468 | OKeyConfigManager::~OKeyConfigManager() { | 468 | OKeyConfigManager::~OKeyConfigManager() { |
469 | if ( m_grab ) | 469 | if ( m_grab ) |
470 | QPEApplication::ungrabKeyboard(); | 470 | QPEApplication::ungrabKeyboard(); |
471 | } | 471 | } |
472 | 472 | ||
473 | /** | 473 | /** |
474 | * Load the Configuration from the OConfig | 474 | * Load the Configuration from the OConfig |
475 | * If a Key is restricted but was in the config we will | 475 | * If a Key is restricted but was in the config we will |
476 | * make it be the empty key paur | 476 | * make it be the empty key paur |
477 | * We will change the group of the OConfig Item! | 477 | * We will change the group of the OConfig Item! |
478 | * | 478 | * |
479 | * @see OKeyPair::emptyKey | 479 | * @see OKeyPair::emptyKey |
480 | */ | 480 | */ |
481 | void OKeyConfigManager::load() { | 481 | void OKeyConfigManager::load() { |
482 | m_conf->setGroup( m_group ); | 482 | m_conf->setGroup( m_group ); |
483 | 483 | ||
484 | /* | 484 | /* |
485 | * Read each item | 485 | * Read each item |
486 | */ | 486 | */ |
487 | int key, mod; | 487 | int key, mod; |
488 | for( OKeyConfigItem::List::Iterator it = m_keys.begin(); it != m_keys.end(); ++it ) { | 488 | for( OKeyConfigItem::List::Iterator it = m_keys.begin(); it != m_keys.end(); ++it ) { |
489 | key = m_conf->readNumEntry( (*it).configKey()+"key", (*it).defaultKeyPair().keycode() ); | 489 | key = m_conf->readNumEntry( (*it).configKey()+"key", (*it).defaultKeyPair().keycode() ); |
490 | mod = m_conf->readNumEntry( (*it).configKey()+"mod", (*it).defaultKeyPair().modifier() ); | 490 | mod = m_conf->readNumEntry( (*it).configKey()+"mod", (*it).defaultKeyPair().modifier() ); |
491 | OKeyPair okey( key, mod ); | 491 | OKeyPair okey( key, mod ); |
492 | 492 | ||
493 | if ( !m_blackKeys.contains( okey ) && key != -1 && mod != -1 ) | 493 | if ( !m_blackKeys.contains( okey ) && key != -1 && mod != -1 ) |
494 | (*it).setKeyPair( OKeyPair(key, mod) ); | 494 | (*it).setKeyPair( OKeyPair(key, mod) ); |
495 | else | 495 | else |
496 | (*it).setKeyPair( OKeyPair::emptyKey() ); | 496 | (*it).setKeyPair( OKeyPair::emptyKey() ); |
497 | } | 497 | } |
498 | delete m_map; m_map = 0; | 498 | delete m_map; m_map = 0; |
499 | } | 499 | } |
500 | 500 | ||
501 | /** | 501 | /** |
502 | * We will save the current configuration | 502 | * We will save the current configuration |
503 | * to the OConfig. We will change the group. | 503 | * to the OConfig. We will change the group. |
504 | */ | 504 | */ |
505 | void OKeyConfigManager::save() { | 505 | void OKeyConfigManager::save() { |
506 | m_conf->setGroup( m_group ); | 506 | m_conf->setGroup( m_group ); |
507 | 507 | ||
508 | /* | 508 | /* |
509 | * Write each item | 509 | * Write each item |
510 | */ | 510 | */ |
511 | for( OKeyConfigItem::List::Iterator it = m_keys.begin();it != m_keys.end(); ++it ) { | 511 | for( OKeyConfigItem::List::Iterator it = m_keys.begin();it != m_keys.end(); ++it ) { |
512 | /* skip empty items */ | 512 | /* skip empty items */ |
513 | if ( (*it).isEmpty() ) | 513 | if ( (*it).isEmpty() ) |
514 | continue; | 514 | continue; |
515 | OKeyPair pair = (*it).keyPair(); | 515 | OKeyPair pair = (*it).keyPair(); |
516 | OKeyPair deft = (*it).defaultKeyPair(); | 516 | OKeyPair deft = (*it).defaultKeyPair(); |
517 | /* | 517 | /* |
518 | * don't write if it is the default setting | 518 | * don't write if it is the default setting |
519 | * FIXME allow to remove Keys from config | 519 | * FIXME allow to remove Keys from config |
520 | if ( (pair.keycode() == deft.keycode()) && | 520 | if ( (pair.keycode() == deft.keycode()) && |
521 | (pair.modifier()== deft.modifier() ) ) | 521 | (pair.modifier()== deft.modifier() ) ) |
522 | return; | 522 | return; |
523 | */ | 523 | */ |
524 | 524 | ||
525 | m_conf->writeEntry((*it).configKey()+"key", pair.keycode() ); | 525 | m_conf->writeEntry((*it).configKey()+"key", pair.keycode() ); |
526 | m_conf->writeEntry((*it).configKey()+"mod", pair.modifier() ); | 526 | m_conf->writeEntry((*it).configKey()+"mod", pair.modifier() ); |
527 | } | 527 | } |
528 | } | 528 | } |
529 | 529 | ||
530 | /** | 530 | /** |
531 | * This is function uses a QMap internally but you can have the same keycode | 531 | * This is function uses a QMap internally but you can have the same keycode |
532 | * with different modifier key. The behaviour is undefined if you add a OKeyConfigItem | 532 | * with different modifier key. The behaviour is undefined if you add a OKeyConfigItem |
533 | * with same keycode and modifier key. The GUI takes care that a user can't | 533 | * with same keycode and modifier key. The GUI takes care that a user can't |
534 | * cofigure two keys. | 534 | * cofigure two keys. |
535 | * | 535 | * |
536 | * Make sure you call e->ignore if you don't want to handle this event | 536 | * Make sure you call e->ignore if you don't want to handle this event |
537 | */ | 537 | */ |
538 | OKeyConfigItem OKeyConfigManager::handleKeyEvent( QKeyEvent* e ) { | 538 | OKeyConfigItem OKeyConfigManager::handleKeyEvent( QKeyEvent* e ) { |
539 | /* | 539 | /* |
540 | * Fix Up issues with Qt/E, my keybard, and virtual input | 540 | * Fix Up issues with Qt/E, my keybard, and virtual input |
541 | * methods | 541 | * methods |
542 | * First my Keyboard delivers 256,512,1024 for shift/ctrl/alt instead of the button state | 542 | * First my Keyboard delivers 256,512,1024 for shift/ctrl/alt instead of the button state |
543 | * Also key() on virtual inputmethods are zero and only ascii. We need to fix upper and lower | 543 | * Also key() on virtual inputmethods are zero and only ascii. We need to fix upper and lower |
544 | * case ascii | 544 | * case ascii |
545 | */ | 545 | */ |
546 | int key, mod; | 546 | int key, mod; |
547 | Opie::Ui::Private::fixupKeys( key, mod, e ); | 547 | Opie::Ui::Private::fixupKeys( key, mod, e ); |
548 | 548 | ||
549 | OKeyConfigItem::List _keyList = keyList( key ); | 549 | OKeyConfigItem::List _keyList = keyList( key ); |
550 | if ( _keyList.isEmpty() ) | 550 | if ( _keyList.isEmpty() ) |
551 | return OKeyConfigItem(); | 551 | return OKeyConfigItem(); |
552 | 552 | ||
553 | OKeyConfigItem item; | 553 | OKeyConfigItem item; |
554 | for ( OKeyConfigItem::List::Iterator it = _keyList.begin(); it != _keyList.end(); | 554 | for ( OKeyConfigItem::List::Iterator it = _keyList.begin(); it != _keyList.end(); |
555 | ++it ) { | 555 | ++it ) { |
556 | if ( (*it).keyPair().modifier() == mod ) { | 556 | if ( (*it).keyPair().modifier() == mod ) { |
557 | item = *it; | 557 | item = *it; |
558 | break; | 558 | break; |
559 | } | 559 | } |
560 | 560 | ||
561 | } | 561 | } |
562 | 562 | ||
563 | return item; | 563 | return item; |
564 | } | 564 | } |
565 | 565 | ||
566 | /** | 566 | /** |
567 | * Return the associated id of the item or -1 if no item | 567 | * Return the associated id of the item or -1 if no item |
568 | * matched the key | 568 | * matched the key |
569 | * | 569 | * |
570 | * @see handleKeyEvent | 570 | * @see handleKeyEvent |
571 | */ | 571 | */ |
572 | int OKeyConfigManager::handleKeyEventId( QKeyEvent* ev) { | 572 | int OKeyConfigManager::handleKeyEventId( QKeyEvent* ev) { |
573 | return handleKeyEvent( ev ).id(); | 573 | return handleKeyEvent( ev ).id(); |
574 | } | 574 | } |
575 | 575 | ||
576 | /** | 576 | /** |
577 | * Add Key Config to the List of items | 577 | * Add Key Config to the List of items |
578 | */ | 578 | */ |
579 | void OKeyConfigManager::addKeyConfig( const OKeyConfigItem& item ) { | 579 | void OKeyConfigManager::addKeyConfig( const OKeyConfigItem& item ) { |
580 | m_keys.append( item ); | 580 | m_keys.append( item ); |
581 | delete m_map; m_map = 0; | 581 | delete m_map; m_map = 0; |
582 | } | 582 | } |
583 | 583 | ||
584 | /** | 584 | /** |
585 | * Remove the Key from the Config. Internal lists will be destroyed | 585 | * Remove the Key from the Config. Internal lists will be destroyed |
586 | * and rebuild on demand later | 586 | * and rebuild on demand later |
587 | */ | 587 | */ |
588 | void OKeyConfigManager::removeKeyConfig( const OKeyConfigItem& item ) { | 588 | void OKeyConfigManager::removeKeyConfig( const OKeyConfigItem& item ) { |
589 | m_keys.remove( item ); | 589 | m_keys.remove( item ); |
590 | delete m_map; m_map = 0; | 590 | delete m_map; m_map = 0; |
591 | } | 591 | } |
592 | 592 | ||
593 | /** | 593 | /** |
594 | * Clears the complete list | 594 | * Clears the complete list |
595 | */ | 595 | */ |
596 | void OKeyConfigManager::clearKeyConfig() { | 596 | void OKeyConfigManager::clearKeyConfig() { |
597 | m_keys.clear(); | 597 | m_keys.clear(); |
598 | delete m_map; m_map = 0; | 598 | delete m_map; m_map = 0; |
599 | } | 599 | } |
600 | 600 | ||
601 | /** | 601 | /** |
602 | * | 602 | * |
603 | */ | 603 | */ |
604 | Opie::Ui::OKeyConfigItem::List OKeyConfigManager::keyConfigList()const{ | 604 | Opie::Ui::OKeyConfigItem::List OKeyConfigManager::keyConfigList()const{ |
605 | return m_keys; | 605 | return m_keys; |
606 | } | 606 | } |
607 | 607 | ||
608 | /** | 608 | /** |
609 | * Add this OKeyPair to the blackList. | 609 | * Add this OKeyPair to the blackList. |
610 | * Internal lists will be destroyed | 610 | * Internal lists will be destroyed |
611 | */ | 611 | */ |
612 | void OKeyConfigManager::addToBlackList( const OKeyPair& key) { | 612 | void OKeyConfigManager::addToBlackList( const OKeyPair& key) { |
613 | m_blackKeys.append( key ); | 613 | m_blackKeys.append( key ); |
614 | delete m_map; m_map = 0; | 614 | delete m_map; m_map = 0; |
615 | } | 615 | } |
616 | 616 | ||
617 | 617 | ||
618 | /** | 618 | /** |
619 | * Remove this OKeyPair from the black List | 619 | * Remove this OKeyPair from the black List |
620 | * Internal lists will be destroyed | 620 | * Internal lists will be destroyed |
621 | */ | 621 | */ |
622 | void OKeyConfigManager::removeFromBlackList( const OKeyPair& key ) { | 622 | void OKeyConfigManager::removeFromBlackList( const OKeyPair& key ) { |
623 | m_blackKeys.remove( key ); | 623 | m_blackKeys.remove( key ); |
624 | delete m_map; m_map = 0; | 624 | delete m_map; m_map = 0; |
625 | } | 625 | } |
626 | 626 | ||
627 | 627 | ||
628 | /** | 628 | /** |
629 | * Clear the blackList | 629 | * Clear the blackList |
630 | */ | 630 | */ |
631 | void OKeyConfigManager::clearBlackList() { | 631 | void OKeyConfigManager::clearBlackList() { |
632 | m_blackKeys.clear(); | 632 | m_blackKeys.clear(); |
633 | delete m_map; m_map = 0; | 633 | delete m_map; m_map = 0; |
634 | } | 634 | } |
635 | 635 | ||
636 | 636 | ||
637 | /** | 637 | /** |
638 | * Return a copy of the blackList | 638 | * Return a copy of the blackList |
639 | */ | 639 | */ |
640 | OKeyPair::List OKeyConfigManager::blackList()const { | 640 | OKeyPair::List OKeyConfigManager::blackList()const { |
641 | return m_blackKeys; | 641 | return m_blackKeys; |
642 | } | 642 | } |
643 | 643 | ||
644 | 644 | ||
645 | /** | 645 | /** |
646 | * Ask the Manager to handle KeyEvents for you. | 646 | * Ask the Manager to handle KeyEvents for you. |
647 | * All handled keys will emit a QSignal and return true | 647 | * All handled keys will emit a QSignal and return true |
648 | * that it handled the keyevent | 648 | * that it handled the keyevent |
649 | */ | 649 | */ |
650 | void OKeyConfigManager::handleWidget( QWidget* wid ) { | 650 | void OKeyConfigManager::handleWidget( QWidget* wid ) { |
651 | wid->installEventFilter( this ); | 651 | wid->installEventFilter( this ); |
652 | } | 652 | } |
653 | 653 | ||
654 | /** | 654 | /** |
655 | * @internal | 655 | * @internal |
656 | */ | 656 | */ |
657 | bool OKeyConfigManager::eventFilter( QObject* obj, QEvent* ev) { | 657 | bool OKeyConfigManager::eventFilter( QObject* obj, QEvent* ev) { |
658 | if ( !obj->isWidgetType() ) | 658 | if ( !obj->isWidgetType() ) |
659 | return false; | 659 | return false; |
660 | 660 | ||
661 | if ( ev->type() != QEvent::KeyPress && ev->type() != QEvent::KeyRelease ) | 661 | if ( ev->type() != QEvent::KeyPress && ev->type() != QEvent::KeyRelease ) |
662 | return false; | 662 | return false; |
663 | 663 | ||
664 | QKeyEvent *key = static_cast<QKeyEvent*>( ev ); | 664 | QKeyEvent *key = static_cast<QKeyEvent*>( ev ); |
665 | OKeyConfigItem item = handleKeyEvent( key ); | 665 | OKeyConfigItem item = handleKeyEvent( key ); |
666 | 666 | ||
667 | if ( item.isEmpty() ) | 667 | if ( item.isEmpty() ) |
668 | return false; | 668 | return false; |
669 | 669 | ||
670 | QWidget *wid = static_cast<QWidget*>( obj ); | 670 | QWidget *wid = static_cast<QWidget*>( obj ); |
671 | 671 | ||
672 | if ( item.object() && !item.slot().isEmpty() ) { | 672 | if ( item.object() && !item.slot().isEmpty() ) { |
673 | connect( this, SIGNAL( actionActivated(QWidget*, QKeyEvent*)), | 673 | connect( this, SIGNAL( actionActivated(QWidget*, QKeyEvent*)), |
674 | item.object(), item.slot().data() ); | 674 | item.object(), item.slot().data() ); |
675 | emit actionActivated(wid, key); | 675 | emit actionActivated(wid, key); |
676 | disconnect( this, SIGNAL(actionActivated(QWidget*,QKeyEvent*)), | 676 | disconnect( this, SIGNAL(actionActivated(QWidget*,QKeyEvent*)), |
677 | item.object(), item.slot().data() ); | 677 | item.object(), item.slot().data() ); |
678 | } | 678 | } |
679 | emit actionActivated( wid, key, item ); | 679 | emit actionActivated( wid, key, item ); |
680 | 680 | ||
681 | return true; | 681 | return true; |
682 | } | 682 | } |
683 | 683 | ||
684 | /** | 684 | /** |
685 | * @internal | 685 | * @internal |
686 | */ | 686 | */ |
687 | OKeyConfigItem::List OKeyConfigManager::keyList( int keycode) { | 687 | OKeyConfigItem::List OKeyConfigManager::keyList( int keycode) { |
688 | /* | 688 | /* |
689 | * Create the map if not existing anymore | 689 | * Create the map if not existing anymore |
690 | */ | 690 | */ |
691 | if ( !m_map ) { | 691 | if ( !m_map ) { |
692 | m_map = new OKeyMapConfigPrivate; | 692 | m_map = new OKeyMapConfigPrivate; |
693 | /* for every key */ | 693 | /* for every key */ |
694 | for ( OKeyConfigItem::List::Iterator it = m_keys.begin(); | 694 | for ( OKeyConfigItem::List::Iterator it = m_keys.begin(); |
695 | it!= m_keys.end(); ++it ) { | 695 | it!= m_keys.end(); ++it ) { |
696 | 696 | ||
697 | bool add = true; | 697 | bool add = true; |
698 | /* see if this key is blocked */ | 698 | /* see if this key is blocked */ |
699 | OKeyPair pair = (*it).keyPair(); | 699 | OKeyPair pair = (*it).keyPair(); |
700 | for ( OKeyPair::List::Iterator pairIt = m_blackKeys.begin(); | 700 | for ( OKeyPair::List::Iterator pairIt = m_blackKeys.begin(); |
701 | pairIt != m_blackKeys.end(); ++pairIt ) { | 701 | pairIt != m_blackKeys.end(); ++pairIt ) { |
702 | if ( (*pairIt).keycode() == pair.keycode() && | 702 | if ( (*pairIt).keycode() == pair.keycode() && |
703 | (*pairIt).modifier() == pair.modifier() ) { | 703 | (*pairIt).modifier() == pair.modifier() ) { |
704 | add = false; | 704 | add = false; |
705 | break; | 705 | break; |
706 | } | 706 | } |
707 | } | 707 | } |
708 | /* check if we added it */ | 708 | /* check if we added it */ |
709 | if ( add ) | 709 | if ( add ) |
710 | (*m_map)[pair.keycode()].append( *it ); | 710 | (*m_map)[pair.keycode()].append( *it ); |
711 | } | 711 | } |
712 | } | 712 | } |
713 | return (*m_map)[keycode]; | 713 | return (*m_map)[keycode]; |
714 | } | 714 | } |
715 | 715 | ||
716 | 716 | ||
717 | namespace Opie { | 717 | namespace Opie { |
718 | namespace Ui { | 718 | namespace Ui { |
719 | namespace Private { | 719 | namespace Private { |
720 | 720 | ||
721 | OKeyListViewItem::OKeyListViewItem( const OKeyConfigItem& item, OKeyConfigManager* man, OListViewItem* parent) | 721 | OKeyListViewItem::OKeyListViewItem( const OKeyConfigItem& item, OKeyConfigManager* man, OListViewItem* parent) |
722 | : Opie::Ui::OListViewItem( parent ), m_manager( man ) { | 722 | : Opie::Ui::OListViewItem( parent ), m_manager( man ) { |
723 | m_origItem = item; | 723 | m_origItem = item; |
724 | setItem( item ); | 724 | setItem( item ); |
725 | } | 725 | } |
726 | OKeyListViewItem::~OKeyListViewItem() {} | 726 | OKeyListViewItem::~OKeyListViewItem() {} |
727 | OKeyConfigItem &OKeyListViewItem::item(){ | 727 | OKeyConfigItem &OKeyListViewItem::item(){ |
728 | return m_item; | 728 | return m_item; |
729 | } | 729 | } |
730 | OKeyConfigItem OKeyListViewItem::origItem() const{ | 730 | OKeyConfigItem OKeyListViewItem::origItem() const{ |
731 | return m_origItem; | 731 | return m_origItem; |
732 | } | 732 | } |
733 | OKeyConfigManager* OKeyListViewItem::manager() { | 733 | OKeyConfigManager* OKeyListViewItem::manager() { |
734 | return m_manager; | 734 | return m_manager; |
735 | } | 735 | } |
736 | void OKeyListViewItem::setItem( const OKeyConfigItem& item ) { | 736 | void OKeyListViewItem::setItem( const OKeyConfigItem& item ) { |
737 | m_item = item; | 737 | m_item = item; |
738 | setPixmap( 0, m_item.pixmap() ); | 738 | setPixmap( 0, m_item.pixmap() ); |
739 | setText ( 1, m_item.text() ); | 739 | setText ( 1, m_item.text() ); |
740 | m_item.keyPair().isEmpty() ? setText( 2, QObject::tr( "None" ) ) : | 740 | m_item.keyPair().isEmpty() ? setText( 2, QObject::tr( "None" ) ) : |
741 | setText( 2, keyToString( m_item.keyPair() ) ); | 741 | setText( 2, keyToString( m_item.keyPair() ) ); |
742 | 742 | ||
743 | m_item.defaultKeyPair().isEmpty() ? setText( 3, QObject::tr( "None" ) ) : | 743 | m_item.defaultKeyPair().isEmpty() ? setText( 3, QObject::tr( "None" ) ) : |
744 | setText ( 3, keyToString( m_item.defaultKeyPair() ) ); | 744 | setText ( 3, keyToString( m_item.defaultKeyPair() ) ); |
745 | } | 745 | } |
746 | void OKeyListViewItem::updateText() { | 746 | void OKeyListViewItem::updateText() { |
747 | m_item.keyPair().isEmpty() ? setText( 2, QObject::tr( "None" ) ) : | 747 | m_item.keyPair().isEmpty() ? setText( 2, QObject::tr( "None" ) ) : |
748 | setText( 2, keyToString( m_item.keyPair() ) ); | 748 | setText( 2, keyToString( m_item.keyPair() ) ); |
749 | } | 749 | } |
750 | 750 | ||
751 | QString keyToString( const OKeyPair& pair ) { | 751 | QString keyToString( const OKeyPair& pair ) { |
752 | int mod = 0; | 752 | int mod = 0; |
753 | if ( pair.modifier() & Qt::ShiftButton ) | 753 | if ( pair.modifier() & Qt::ShiftButton ) |
754 | mod |= Qt::SHIFT; | 754 | mod |= Qt::SHIFT; |
755 | if ( pair.modifier() & Qt::ControlButton ) | 755 | if ( pair.modifier() & Qt::ControlButton ) |
756 | mod |= Qt::CTRL; | 756 | mod |= Qt::CTRL; |
757 | if ( pair.modifier() & Qt::AltButton ) | 757 | if ( pair.modifier() & Qt::AltButton ) |
758 | mod |= Qt::ALT; | 758 | mod |= Qt::ALT; |
759 | 759 | ||
760 | return QAccel::keyToString( mod + pair.keycode() ); | 760 | return QAccel::keyToString( mod + pair.keycode() ); |
761 | } | 761 | } |
762 | 762 | ||
763 | /* | 763 | /* |
764 | * the virtual and hardware key events have both issues... | 764 | * the virtual and hardware key events have both issues... |
765 | */ | 765 | */ |
766 | void fixupKeys( int& key, int &mod, QKeyEvent* e ) { | 766 | void fixupKeys( int& key, int &mod, QKeyEvent* e ) { |
767 | key = e->key(); | 767 | key = e->key(); |
768 | mod = e->state(); | 768 | mod = e->state(); |
769 | /* | 769 | /* |
770 | * virtual keyboard | 770 | * virtual keyboard |
771 | * else change the button mod only | 771 | * else change the button mod only |
772 | */ | 772 | */ |
773 | if ( key == 0 ) { | 773 | if ( key == 0 ) { |
774 | key = e->ascii(); | 774 | key = e->ascii(); |
775 | if ( key > 96 && key < 123) | 775 | if ( key > 96 && key < 123) |
776 | key -= 32; | 776 | key -= 32; |
777 | }else{ | 777 | }else{ |
778 | int new_mod = 0; | 778 | int new_mod = 0; |
779 | if ( mod & 256 ) | 779 | if ( mod & 256 ) |
780 | new_mod |= Qt::ShiftButton; | 780 | new_mod |= Qt::ShiftButton; |
781 | else if ( mod & 512 ) | 781 | else if ( mod & 512 ) |
782 | new_mod |= Qt::ControlButton; | 782 | new_mod |= Qt::ControlButton; |
783 | else if ( mod & 1024 ) | 783 | else if ( mod & 1024 ) |
784 | new_mod |= Qt::AltButton; | 784 | new_mod |= Qt::AltButton; |
785 | 785 | ||
786 | mod = new_mod == 0? mod : new_mod; | 786 | mod = new_mod == 0? mod : new_mod; |
787 | } | 787 | } |
788 | } | 788 | } |
789 | 789 | ||
790 | struct OKeyConfigWidgetPrivate{ | 790 | struct OKeyConfigWidgetPrivate{ |
791 | OKeyConfigWidgetPrivate(const QString& = QString::null, | 791 | OKeyConfigWidgetPrivate(const QString& = QString::null, |
792 | OKeyConfigManager* = 0); | 792 | OKeyConfigManager* = 0); |
793 | bool operator==( const OKeyConfigWidgetPrivate& ); | 793 | bool operator==( const OKeyConfigWidgetPrivate& ); |
794 | QString name; | 794 | QString name; |
795 | OKeyConfigManager *manager; | 795 | OKeyConfigManager *manager; |
796 | }; | 796 | }; |
797 | 797 | ||
798 | OKeyConfigWidgetPrivate::OKeyConfigWidgetPrivate( const QString& _name, | 798 | OKeyConfigWidgetPrivate::OKeyConfigWidgetPrivate( const QString& _name, |
799 | OKeyConfigManager* man ) | 799 | OKeyConfigManager* man ) |
800 | : name( _name ), manager( man ){} | 800 | : name( _name ), manager( man ){} |
801 | 801 | ||
802 | bool OKeyConfigWidgetPrivate::operator==( const OKeyConfigWidgetPrivate& item) { | 802 | bool OKeyConfigWidgetPrivate::operator==( const OKeyConfigWidgetPrivate& item) { |
803 | if ( manager != item.manager) return false; | 803 | if ( manager != item.manager) return false; |
804 | if ( name != item.name ) return false; | 804 | if ( name != item.name ) return false; |
805 | 805 | ||
806 | return true; | 806 | return true; |
807 | } | 807 | } |
808 | 808 | ||
809 | } | 809 | } |
810 | } | 810 | } |
811 | } | 811 | } |
812 | 812 | ||
813 | 813 | ||
814 | 814 | ||
815 | //////////////////////// | 815 | //////////////////////// |
816 | //////////////////////// | 816 | //////////////////////// |
817 | //////// Widget Starts Here | 817 | //////// Widget Starts Here |
818 | 818 | ||
819 | 819 | ||
820 | 820 | ||
821 | 821 | ||
822 | /** | 822 | /** |
823 | * | 823 | * |
824 | * This is a c'tor. You still need to pass the OKeyConfigManager | 824 | * This is a c'tor. You still need to pass the OKeyConfigManager |
825 | * and then issue a load. | 825 | * and then issue a load. |
826 | * The default mode is Immediate | 826 | * The default mode is Immediate |
827 | * | 827 | * |
828 | */ | 828 | */ |
829 | OKeyConfigWidget::OKeyConfigWidget( QWidget* parent, const char *name, WFlags fl ) | 829 | OKeyConfigWidget::OKeyConfigWidget( QWidget* parent, const char *name, WFlags fl ) |
830 | : QWidget( parent, name, fl ) { | 830 | : QWidget( parent, name, fl ) { |
831 | initUi(); | 831 | initUi(); |
832 | } | 832 | } |
833 | 833 | ||
834 | 834 | ||
835 | 835 | ||
836 | /** | 836 | /** |
837 | * c'tor | 837 | * c'tor |
838 | */ | 838 | */ |
839 | OKeyConfigWidget::~OKeyConfigWidget() { | 839 | OKeyConfigWidget::~OKeyConfigWidget() { |
840 | } | 840 | } |
841 | 841 | ||
842 | 842 | ||
843 | /** | 843 | /** |
844 | * @internal | 844 | * @internal |
845 | */ | 845 | */ |
846 | void OKeyConfigWidget::initUi() { | 846 | void OKeyConfigWidget::initUi() { |
847 | QBoxLayout *layout = new QVBoxLayout( this ); | 847 | QBoxLayout *layout = new QVBoxLayout( this ); |
848 | QGridLayout *gridLay = new QGridLayout( 2, 2 ); | 848 | QGridLayout *gridLay = new QGridLayout( 2, 2 ); |
849 | layout->addLayout( gridLay, 10 ); | 849 | layout->addLayout( gridLay, 10 ); |
850 | gridLay->setRowStretch( 1, 10 ); // let only the ListView strecth | 850 | gridLay->setRowStretch( 1, 10 ); // let only the ListView strecth |
851 | 851 | ||
852 | /* | 852 | /* |
853 | * LISTVIEW with the Keys | 853 | * LISTVIEW with the Keys |
854 | */ | 854 | */ |
855 | m_view = new Opie::Ui::OListView( this ); | 855 | m_view = new Opie::Ui::OListView( this ); |
856 | m_view->setFocus(); | 856 | m_view->setFocus(); |
857 | m_view->setAllColumnsShowFocus( true ); | 857 | m_view->setAllColumnsShowFocus( true ); |
858 | m_view->addColumn( tr("Pixmap") ); | 858 | m_view->addColumn( tr("Pixmap") ); |
859 | m_view->addColumn( tr("Name","Name of the Action in the ListView Header" ) ); | 859 | m_view->addColumn( tr("Name","Name of the Action in the ListView Header" ) ); |
860 | m_view->addColumn( tr("Key" ) ); | 860 | m_view->addColumn( tr("Key" ) ); |
861 | m_view->addColumn( tr("Default Key" ) ); | 861 | m_view->addColumn( tr("Default Key" ) ); |
862 | m_view->setRootIsDecorated( true ); | 862 | m_view->setRootIsDecorated( true ); |
863 | connect(m_view, SIGNAL(currentChanged(QListViewItem*)), | 863 | connect(m_view, SIGNAL(currentChanged(QListViewItem*)), |
864 | this, SLOT(slotListViewItem(QListViewItem*)) ); | 864 | this, SLOT(slotListViewItem(QListViewItem*)) ); |
865 | 865 | ||
866 | gridLay->addMultiCellWidget( m_view, 1, 1, 0, 1 ); | 866 | gridLay->addMultiCellWidget( m_view, 1, 1, 0, 1 ); |
867 | 867 | ||
868 | /* | 868 | /* |
869 | * GROUP with button info | 869 | * GROUP with button info |
870 | */ | 870 | */ |
871 | 871 | ||
872 | QGroupBox *box = new QGroupBox( this ); | 872 | QGroupBox *box = new QGroupBox( this ); |
873 | box ->setTitle( tr("Shortcut for Selected Action") ); | 873 | box ->setTitle( tr("Shortcut for Selected Action") ); |
874 | box ->setFrameStyle( QFrame::Box | QFrame::Sunken ); | 874 | box ->setFrameStyle( QFrame::Box | QFrame::Sunken ); |
875 | layout->addWidget( box, 1 ); | 875 | layout->addWidget( box, 1 ); |
876 | 876 | ||
877 | gridLay = new QGridLayout( box, 3, 4 ); | 877 | gridLay = new QGridLayout( box, 3, 4 ); |
878 | gridLay->addRowSpacing( 0, fontMetrics().lineSpacing() ); | 878 | gridLay->addRowSpacing( 0, fontMetrics().lineSpacing() ); |
879 | gridLay->setMargin( 4 ); | 879 | gridLay->setMargin( 4 ); |
880 | 880 | ||
881 | QButtonGroup *gr = new QButtonGroup( box ); | 881 | QButtonGroup *gr = new QButtonGroup( box ); |
882 | gr->hide(); | 882 | gr->hide(); |
883 | gr->setExclusive( true ); | 883 | gr->setExclusive( true ); |
884 | 884 | ||
885 | QRadioButton *rad = new QRadioButton( tr( "&None" ), box ); | 885 | QRadioButton *rad = new QRadioButton( tr( "&None" ), box ); |
886 | connect( rad, SIGNAL(clicked()), | 886 | connect( rad, SIGNAL(clicked()), |
887 | this, SLOT(slotNoKey()) ); | 887 | this, SLOT(slotNoKey()) ); |
888 | gr->insert( rad, 10 ); | 888 | gr->insert( rad, 10 ); |
889 | gridLay->addWidget( rad, 1, 0 ); | 889 | gridLay->addWidget( rad, 1, 0 ); |
890 | m_none = rad; | 890 | m_none = rad; |
891 | 891 | ||
892 | rad = new QRadioButton( tr("&Default" ), box ); | 892 | rad = new QRadioButton( tr("&Default" ), box ); |
893 | connect( rad, SIGNAL(clicked()), | 893 | connect( rad, SIGNAL(clicked()), |
894 | this, SLOT(slotDefaultKey()) ); | 894 | this, SLOT(slotDefaultKey()) ); |
895 | gr->insert( rad, 11 ); | 895 | gr->insert( rad, 11 ); |
896 | gridLay->addWidget( rad, 1, 1 ); | 896 | gridLay->addWidget( rad, 1, 1 ); |
897 | m_def = rad; | 897 | m_def = rad; |
898 | 898 | ||
899 | rad = new QRadioButton( tr("C&ustom"), box ); | 899 | rad = new QRadioButton( tr("C&ustom"), box ); |
900 | connect( rad, SIGNAL(clicked()), | 900 | connect( rad, SIGNAL(clicked()), |
901 | this, SLOT(slotCustomKey()) ); | 901 | this, SLOT(slotCustomKey()) ); |
902 | gr->insert( rad, 12 ); | 902 | gr->insert( rad, 12 ); |
903 | gridLay->addWidget( rad, 1, 2 ); | 903 | gridLay->addWidget( rad, 1, 2 ); |
904 | m_cus = rad; | 904 | m_cus = rad; |
905 | 905 | ||
906 | m_btn = new QPushButton( tr("Configure Key"), box ); | 906 | m_btn = new QPushButton( tr("Configure Key"), box ); |
907 | gridLay->addWidget( m_btn, 1, 4 ); | 907 | gridLay->addWidget( m_btn, 1, 4 ); |
908 | 908 | ||
909 | m_lbl= new QLabel( tr( "Default: " ), box ); | 909 | m_lbl= new QLabel( tr( "Default: " ), box ); |
910 | gridLay->addWidget( m_lbl, 2, 0 ); | 910 | gridLay->addWidget( m_lbl, 2, 0 ); |
911 | 911 | ||
912 | connect(m_btn, SIGNAL(clicked()), | 912 | connect(m_btn, SIGNAL(clicked()), |
913 | this, SLOT(slotConfigure())); | 913 | this, SLOT(slotConfigure())); |
914 | 914 | ||
915 | m_box = box; | 915 | m_box = box; |
916 | } | 916 | } |
917 | 917 | ||
918 | /** | 918 | /** |
919 | * Set the ChangeMode. | 919 | * Set the ChangeMode. |
920 | * You need to call this function prior to load | 920 | * You need to call this function prior to load |
921 | * If you call this function past load the behaviour is undefined | 921 | * If you call this function past load the behaviour is undefined |
922 | * But caling load again is safe | 922 | * But caling load again is safe |
923 | */ | 923 | */ |
924 | void OKeyConfigWidget::setChangeMode( enum ChangeMode mode) { | 924 | void OKeyConfigWidget::setChangeMode( enum ChangeMode mode) { |
925 | m_mode = mode; | 925 | m_mode = mode; |
926 | } | 926 | } |
927 | 927 | ||
928 | 928 | ||
929 | /** | 929 | /** |
930 | * return the current mode | 930 | * return the current mode |
931 | */ | 931 | */ |
932 | OKeyConfigWidget::ChangeMode OKeyConfigWidget::changeMode()const { | 932 | OKeyConfigWidget::ChangeMode OKeyConfigWidget::changeMode()const { |
933 | return m_mode; | 933 | return m_mode; |
934 | } | 934 | } |
935 | 935 | ||
936 | 936 | ||
937 | /** | 937 | /** |
938 | * insert these items before calling load | 938 | * insert these items before calling load |
939 | */ | 939 | */ |
940 | void OKeyConfigWidget::insert( const QString& str, OKeyConfigManager* man ) { | 940 | void OKeyConfigWidget::insert( const QString& str, OKeyConfigManager* man ) { |
941 | Opie::Ui::Private::OKeyConfigWidgetPrivate root( str, man ); | 941 | Opie::Ui::Private::OKeyConfigWidgetPrivate root( str, man ); |
942 | m_list.append(root); | 942 | m_list.append(root); |
943 | } | 943 | } |
944 | 944 | ||
945 | 945 | ||
946 | /** | 946 | /** |
947 | * loads the items and allows editing them | 947 | * loads the items and allows editing them |
948 | */ | 948 | */ |
949 | void OKeyConfigWidget::load() { | 949 | void OKeyConfigWidget::load() { |
950 | Opie::Ui::Private::OKeyConfigWidgetPrivateList::Iterator it; | 950 | Opie::Ui::Private::OKeyConfigWidgetPrivateList::Iterator it; |
951 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { | 951 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { |
952 | OListViewItem *item = new OListViewItem( m_view, (*it).name ); | 952 | OListViewItem *item = new OListViewItem( m_view, (*it).name ); |
953 | OKeyConfigItem::List list = (*it).manager->keyConfigList(); | 953 | OKeyConfigItem::List list = (*it).manager->keyConfigList(); |
954 | for (OKeyConfigItem::List::Iterator keyIt = list.begin(); keyIt != list.end();++keyIt ) | 954 | for (OKeyConfigItem::List::Iterator keyIt = list.begin(); keyIt != list.end();++keyIt ) |
955 | (void )new Opie::Ui::Private::OKeyListViewItem(*keyIt, (*it).manager, item ); | 955 | (void )new Opie::Ui::Private::OKeyListViewItem(*keyIt, (*it).manager, item ); |
956 | 956 | ||
957 | } | 957 | } |
958 | } | 958 | } |
959 | 959 | ||
960 | /** | 960 | /** |
961 | * Saves if in Queue Mode. It'll update the supplied | 961 | * Saves if in Queue Mode. It'll update the supplied |
962 | * OKeyConfigManager objects. | 962 | * OKeyConfigManager objects. |
963 | * If in Queue mode it'll just return | 963 | * If in Queue mode it'll just return |
964 | */ | 964 | */ |
965 | void OKeyConfigWidget::save() { | 965 | void OKeyConfigWidget::save() { |
966 | /* | 966 | /* |
967 | * Iterate over all config items | 967 | * Iterate over all config items |
968 | */ | 968 | */ |
969 | QListViewItemIterator it( m_view ); | 969 | QListViewItemIterator it( m_view ); |
970 | while ( it.current() ) { | 970 | while ( it.current() ) { |
971 | if (it.current()->parent() ) { | 971 | if (it.current()->parent() ) { |
972 | Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>( it.current() ); | 972 | Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>( it.current() ); |
973 | OKeyConfigManager *man = item->manager(); | 973 | OKeyConfigManager *man = item->manager(); |
974 | man->removeKeyConfig( item->origItem() ); | 974 | man->removeKeyConfig( item->origItem() ); |
975 | man->addKeyConfig( item->item() ); | 975 | man->addKeyConfig( item->item() ); |
976 | } | 976 | } |
977 | ++it; | 977 | ++it; |
978 | } | 978 | } |
979 | 979 | ||
980 | 980 | ||
981 | } | 981 | } |
982 | 982 | ||
983 | 983 | ||
984 | /** | 984 | /** |
985 | * @internal | 985 | * @internal |
986 | */ | 986 | */ |
987 | void OKeyConfigWidget::slotListViewItem( QListViewItem* _item) { | 987 | void OKeyConfigWidget::slotListViewItem( QListViewItem* _item) { |
988 | if ( !_item || !_item->parent() ) { | 988 | if ( !_item || !_item->parent() ) { |
989 | m_box->setEnabled( false ); | 989 | m_box->setEnabled( false ); |
990 | m_none->setChecked( true ); | 990 | m_none->setChecked( true ); |
991 | m_btn ->setEnabled( false ); | 991 | m_btn ->setEnabled( false ); |
992 | m_def ->setChecked( false ); | 992 | m_def ->setChecked( false ); |
993 | m_cus ->setChecked( false ); | 993 | m_cus ->setChecked( false ); |
994 | }else{ | 994 | }else{ |
995 | m_box->setEnabled( true ); | 995 | m_box->setEnabled( true ); |
996 | Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>( _item ); | 996 | Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>( _item ); |
997 | OKeyConfigItem keyItem= item->item(); | 997 | OKeyConfigItem keyItem= item->item(); |
998 | m_lbl->setText( tr("Default: " )+ item->text( 3 ) ); | 998 | m_lbl->setText( tr("Default: " )+ item->text( 3 ) ); |
999 | if ( keyItem.keyPair().isEmpty() ) { | 999 | if ( keyItem.keyPair().isEmpty() ) { |
1000 | m_none->setChecked( true ); | 1000 | m_none->setChecked( true ); |
1001 | m_btn ->setEnabled( false ); | 1001 | m_btn ->setEnabled( false ); |
1002 | m_def ->setChecked( false ); | 1002 | m_def ->setChecked( false ); |
1003 | m_cus ->setChecked( false ); | 1003 | m_cus ->setChecked( false ); |
1004 | }else { | 1004 | }else { |
1005 | m_none->setChecked( false ); | 1005 | m_none->setChecked( false ); |
1006 | m_cus ->setChecked( true ); | 1006 | m_cus ->setChecked( true ); |
1007 | m_btn ->setEnabled( true ); | 1007 | m_btn ->setEnabled( true ); |
1008 | m_def ->setChecked( false ); | 1008 | m_def ->setChecked( false ); |
1009 | } | 1009 | } |
1010 | } | 1010 | } |
1011 | } | 1011 | } |
1012 | 1012 | ||
1013 | void OKeyConfigWidget::slotNoKey() { | 1013 | void OKeyConfigWidget::slotNoKey() { |
1014 | m_none->setChecked( true ); | 1014 | m_none->setChecked( true ); |
1015 | m_cus ->setChecked( false ); | 1015 | m_cus ->setChecked( false ); |
1016 | m_btn ->setEnabled( false ); | 1016 | m_btn ->setEnabled( false ); |
1017 | m_def ->setChecked( false ); | 1017 | m_def ->setChecked( false ); |
1018 | 1018 | ||
1019 | if ( !m_view->currentItem() || !m_view->currentItem()->parent() ) | 1019 | if ( !m_view->currentItem() || !m_view->currentItem()->parent() ) |
1020 | return; | 1020 | return; |
1021 | 1021 | ||
1022 | 1022 | ||
1023 | 1023 | ||
1024 | /* | 1024 | /* |
1025 | * If immediate we need to remove and readd the key | 1025 | * If immediate we need to remove and readd the key |
1026 | */ | 1026 | */ |
1027 | Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>(m_view->currentItem()); | 1027 | Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>(m_view->currentItem()); |
1028 | updateItem( item, OKeyPair::emptyKey() ); | 1028 | updateItem( item, OKeyPair::emptyKey() ); |
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | void OKeyConfigWidget::slotDefaultKey() { | 1031 | void OKeyConfigWidget::slotDefaultKey() { |
1032 | m_none->setChecked( false ); | 1032 | m_none->setChecked( false ); |
1033 | m_cus ->setChecked( false ); | 1033 | m_cus ->setChecked( false ); |
1034 | m_btn ->setEnabled( false ); | 1034 | m_btn ->setEnabled( false ); |
1035 | m_def ->setChecked( true ); | 1035 | m_def ->setChecked( true ); |
1036 | 1036 | ||
1037 | if ( !m_view->currentItem() || !m_view->currentItem()->parent() ) | 1037 | if ( !m_view->currentItem() || !m_view->currentItem()->parent() ) |
1038 | return; | 1038 | return; |
1039 | 1039 | ||
1040 | Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>(m_view->currentItem()); | 1040 | Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>(m_view->currentItem()); |
1041 | updateItem( item, item->item().defaultKeyPair() ); | 1041 | updateItem( item, item->item().defaultKeyPair() ); |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | void OKeyConfigWidget::slotCustomKey() { | 1044 | void OKeyConfigWidget::slotCustomKey() { |
1045 | m_cus ->setChecked( true ); | 1045 | m_cus ->setChecked( true ); |
1046 | m_btn ->setEnabled( true ); | 1046 | m_btn ->setEnabled( true ); |
1047 | m_def ->setChecked( false ); | 1047 | m_def ->setChecked( false ); |
1048 | m_none->setChecked( false ); | 1048 | m_none->setChecked( false ); |
1049 | 1049 | ||
1050 | if ( !m_view->currentItem() || !m_view->currentItem()->parent() ) | 1050 | if ( !m_view->currentItem() || !m_view->currentItem()->parent() ) |
1051 | return; | 1051 | return; |
1052 | 1052 | ||
1053 | 1053 | ||
1054 | } | 1054 | } |
1055 | 1055 | ||
1056 | void OKeyConfigWidget::slotConfigure() { | 1056 | void OKeyConfigWidget::slotConfigure() { |
1057 | if ( !m_view->currentItem() || !m_view->currentItem()->parent() ) | 1057 | if ( !m_view->currentItem() || !m_view->currentItem()->parent() ) |
1058 | return; | 1058 | return; |
1059 | 1059 | ||
1060 | /* FIXME make use of OModalHelper */ | 1060 | /* FIXME make use of OModalHelper */ |
1061 | OKeyChooserConfigDialog dlg( this, "Dialog Name", true ); | 1061 | OKeyChooserConfigDialog dlg( this, "Dialog Name", true ); |
1062 | dlg.setCaption(tr("Configure Key")); | 1062 | dlg.setCaption(tr("Configure Key")); |
1063 | connect(&dlg, SIGNAL(keyCaptured()), &dlg, SLOT(accept()) ); | 1063 | connect(&dlg, SIGNAL(keyCaptured()), &dlg, SLOT(accept()) ); |
1064 | 1064 | ||
1065 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) { | 1065 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) { |
1066 | Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>(m_view->currentItem()); | 1066 | Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>(m_view->currentItem()); |
1067 | updateItem( item, dlg.keyPair() ); | 1067 | updateItem( item, dlg.keyPair() ); |
1068 | } | 1068 | } |
1069 | 1069 | ||
1070 | 1070 | ||
1071 | } | 1071 | } |
1072 | 1072 | ||
1073 | bool OKeyConfigWidget::sanityCheck( Opie::Ui::Private::OKeyListViewItem* item, | 1073 | bool OKeyConfigWidget::sanityCheck( Opie::Ui::Private::OKeyListViewItem* item, |
1074 | const OKeyPair& newItem ) { | 1074 | const OKeyPair& newItem ) { |
1075 | OKeyPair::List bList = item->manager()->blackList(); | 1075 | OKeyPair::List bList = item->manager()->blackList(); |
1076 | for ( OKeyPair::List::Iterator it = bList.begin(); it != bList.end(); ++it ) { | 1076 | for ( OKeyPair::List::Iterator it = bList.begin(); it != bList.end(); ++it ) { |
1077 | /* black list matched */ | 1077 | /* black list matched */ |
1078 | if ( *it == newItem ) { | 1078 | if ( *it == newItem ) { |
1079 | QMessageBox::warning( 0, tr("Key is on BlackList" ), | 1079 | QMessageBox::warning( 0, tr("Key is on BlackList" ), |
1080 | tr("<qt>The Key you choose is on the black list " | 1080 | tr("<qt>The Key you choose is on the black list " |
1081 | "and may not be used with this manager. Please " | 1081 | "and may not be used with this manager. Please " |
1082 | "use a different key.</qt>" ) ); | 1082 | "use a different key.</qt>" ) ); |
1083 | return false; | 1083 | return false; |
1084 | } | 1084 | } |
1085 | } | 1085 | } |
1086 | /* no we need to check the other items which is dog slow */ | 1086 | /* no we need to check the other items which is dog slow */ |
1087 | QListViewItemIterator it( item->parent() ); | 1087 | QListViewItemIterator it( item->parent() ); |
1088 | while ( it.current() ) { | 1088 | while ( it.current() ) { |
1089 | /* if not our parent and not us */ | 1089 | /* if not our parent and not us */ |
1090 | if (it.current()->parent() && it.current() != item) { | 1090 | if (it.current()->parent() && it.current() != item) { |
1091 | /* damn already given away*/ | 1091 | /* damn already given away*/ |
1092 | if ( newItem == static_cast<Opie::Ui::Private::OKeyListViewItem*>(it.current() )->item().keyPair() ) { | 1092 | if ( newItem == static_cast<Opie::Ui::Private::OKeyListViewItem*>(it.current() )->item().keyPair() ) { |
1093 | QMessageBox::warning( 0, tr("Key is already assigned" ), | 1093 | QMessageBox::warning( 0, tr("Key is already assigned" ), |
1094 | tr("<qt>The Key you choose is already taken by " | 1094 | tr("<qt>The Key you choose is already taken by " |
1095 | "a different Item of your config. Please try" | 1095 | "a different Item of your config. Please try" |
1096 | "using a different key.</qt>" ) ); | 1096 | "using a different key.</qt>" ) ); |
1097 | return false; | 1097 | return false; |
1098 | } | 1098 | } |
1099 | } | 1099 | } |
1100 | ++it; | 1100 | ++it; |
1101 | } | 1101 | } |
1102 | 1102 | ||
1103 | return true; | 1103 | return true; |
1104 | } | 1104 | } |
1105 | 1105 | ||
1106 | void OKeyConfigWidget::updateItem( Opie::Ui::Private::OKeyListViewItem *item, | 1106 | void OKeyConfigWidget::updateItem( Opie::Ui::Private::OKeyListViewItem *item, |
1107 | const OKeyPair& newItem) { | 1107 | const OKeyPair& newItem) { |
1108 | /* sanity check | 1108 | /* sanity check |
1109 | * check against the blacklist of the manager | 1109 | * check against the blacklist of the manager |
1110 | * check if another item uses this key which is o(n) at least | 1110 | * check if another item uses this key which is o(n) at least |
1111 | */ | 1111 | */ |
1112 | if ( !newItem.isEmpty() && !sanityCheck(item, newItem )) | 1112 | if ( !newItem.isEmpty() && !sanityCheck(item, newItem )) |
1113 | return; | 1113 | return; |
1114 | 1114 | ||
1115 | 1115 | ||
1116 | 1116 | ||
1117 | /* | 1117 | /* |
1118 | * If immediate we need to remove and readd the key | 1118 | * If immediate we need to remove and readd the key |
1119 | */ | 1119 | */ |
1120 | if ( m_mode == Imediate ) | 1120 | if ( m_mode == Imediate ) |
1121 | item->manager()->removeKeyConfig( item->item() ); | 1121 | item->manager()->removeKeyConfig( item->item() ); |
1122 | 1122 | ||
1123 | item->item().setKeyPair( newItem ); | 1123 | item->item().setKeyPair( newItem ); |
1124 | item->updateText(); | 1124 | item->updateText(); |
1125 | 1125 | ||
1126 | if ( m_mode == Imediate ) | 1126 | if ( m_mode == Imediate ) |
1127 | item->manager()->addKeyConfig( item->item() ); | 1127 | item->manager()->addKeyConfig( item->item() ); |
1128 | } | 1128 | } |
1129 | 1129 | ||
1130 | 1130 | ||
1131 | 1131 | ||
1132 | ///// | 1132 | ///// |
1133 | OKeyChooserConfigDialog::OKeyChooserConfigDialog( QWidget* par, const char* nam, | 1133 | OKeyChooserConfigDialog::OKeyChooserConfigDialog( QWidget* par, const char* nam, |
1134 | bool mod, WFlags fl ) | 1134 | bool mod, WFlags fl ) |
1135 | : QDialog( par, nam, mod, fl ), m_virtKey( false ), m_keyPair( OKeyPair::emptyKey() ) , | 1135 | : QDialog( par, nam, mod, fl ), m_virtKey( false ), m_keyPair( OKeyPair::emptyKey() ) , |
1136 | m_key( 0 ), m_mod( 0 ) { | 1136 | m_key( 0 ), m_mod( 0 ) { |
1137 | setFocusPolicy( StrongFocus ); | 1137 | setFocusPolicy( StrongFocus ); |
1138 | 1138 | ||
1139 | QHBoxLayout *lay = new QHBoxLayout( this ); | 1139 | QHBoxLayout *lay = new QHBoxLayout( this ); |
1140 | 1140 | ||
1141 | QLabel *lbl = new QLabel( tr("Configure Key" ), this ); | 1141 | QLabel *lbl = new QLabel( tr("Configure Key" ), this ); |
1142 | lay->addWidget( lbl ); | 1142 | lay->addWidget( lbl ); |
1143 | lbl->setFocusPolicy( NoFocus ); | 1143 | lbl->setFocusPolicy( NoFocus ); |
1144 | 1144 | ||
1145 | m_lbl = new QLabel( this ); | 1145 | m_lbl = new QLabel( this ); |
1146 | lay->addWidget( m_lbl ); | 1146 | lay->addWidget( m_lbl ); |
1147 | m_lbl->setFocusPolicy( NoFocus ); | 1147 | m_lbl->setFocusPolicy( NoFocus ); |
1148 | 1148 | ||
1149 | m_timer = new QTimer( this ); | 1149 | m_timer = new QTimer( this ); |
1150 | connect(m_timer, SIGNAL(timeout()), | 1150 | connect(m_timer, SIGNAL(timeout()), |
1151 | this, SLOT(slotTimeUp()) ); | 1151 | this, SLOT(slotTimeUp()) ); |
1152 | } | 1152 | } |
1153 | 1153 | ||
1154 | OKeyChooserConfigDialog::~OKeyChooserConfigDialog() { | 1154 | OKeyChooserConfigDialog::~OKeyChooserConfigDialog() { |
1155 | } | 1155 | } |
1156 | 1156 | ||
1157 | Opie::Ui::OKeyPair OKeyChooserConfigDialog::keyPair()const{ | 1157 | Opie::Ui::OKeyPair OKeyChooserConfigDialog::keyPair()const{ |
1158 | return m_keyPair; | 1158 | return m_keyPair; |
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | void OKeyChooserConfigDialog::keyPressEvent( QKeyEvent* ev ) { | 1161 | void OKeyChooserConfigDialog::keyPressEvent( QKeyEvent* ev ) { |
1162 | QDialog::keyPressEvent( ev ); | 1162 | QDialog::keyPressEvent( ev ); |
1163 | 1163 | ||
1164 | if ( ev->isAutoRepeat() ) | 1164 | if ( ev->isAutoRepeat() ) |
1165 | return; | 1165 | return; |
1166 | 1166 | ||
1167 | int mod, key; | 1167 | int mod, key; |
1168 | Opie::Ui::Private::fixupKeys( key,mod, ev ); | 1168 | Opie::Ui::Private::fixupKeys( key,mod, ev ); |
1169 | 1169 | ||
1170 | /* either we used software keyboard | 1170 | /* either we used software keyboard |
1171 | * or we've true support | 1171 | * or we've true support |
1172 | */ | 1172 | */ |
1173 | if ( !m_virtKey && !ev->key()) { | 1173 | if ( !m_virtKey && !ev->key()) { |
1174 | m_virtKey = true; | 1174 | m_virtKey = true; |
1175 | m_keyPair = OKeyPair( key, mod ); | 1175 | m_keyPair = OKeyPair( key, mod ); |
1176 | }else{ | 1176 | }else{ |
1177 | mod = 0; | 1177 | mod = 0; |
1178 | switch( key ) { | 1178 | switch( key ) { |
1179 | case Qt::Key_Control: | 1179 | case Qt::Key_Control: |
1180 | mod = Qt::ControlButton; | 1180 | mod = Qt::ControlButton; |
1181 | break; | 1181 | break; |
1182 | case Qt::Key_Shift: | 1182 | case Qt::Key_Shift: |
1183 | mod = Qt::ShiftButton; | 1183 | mod = Qt::ShiftButton; |
1184 | break; | 1184 | break; |
1185 | case Qt::Key_Alt: | 1185 | case Qt::Key_Alt: |
1186 | mod = Qt::AltButton; | 1186 | mod = Qt::AltButton; |
1187 | break; | 1187 | break; |
1188 | default: | 1188 | default: |
1189 | break; | 1189 | break; |
1190 | } | 1190 | } |
1191 | if (mod ) | 1191 | if (mod ) { |
1192 | m_mod |= mod; | 1192 | m_mod |= mod; |
1193 | else | 1193 | key = 0; |
1194 | }else | ||
1194 | m_key = key; | 1195 | m_key = key; |
1195 | 1196 | ||
1196 | if ( ( !mod || m_key ) && !m_timer->isActive() ) | 1197 | if ( ( !mod || m_key || key ) && !m_timer->isActive() ) |
1197 | m_timer->start( 150, true ); | 1198 | m_timer->start( 150, true ); |
1198 | 1199 | ||
1199 | m_keyPair = OKeyPair( m_key, m_mod ); | 1200 | m_keyPair = OKeyPair( m_key, m_mod ); |
1200 | } | 1201 | } |
1201 | 1202 | ||
1202 | m_lbl->setText( Opie::Ui::Private::keyToString( m_keyPair ) ); | 1203 | m_lbl->setText( Opie::Ui::Private::keyToString( m_keyPair ) ); |
1203 | 1204 | ||
1204 | } | 1205 | } |
1205 | 1206 | ||
1206 | void OKeyChooserConfigDialog::keyReleaseEvent( QKeyEvent* ev ) { | 1207 | void OKeyChooserConfigDialog::keyReleaseEvent( QKeyEvent* ev ) { |
1207 | m_timer->stop(); | 1208 | m_timer->stop(); |
1208 | QDialog::keyPressEvent( ev ); | 1209 | QDialog::keyPressEvent( ev ); |
1209 | 1210 | ||
1210 | if ( ev->isAutoRepeat() ) | 1211 | if ( ev->isAutoRepeat() ) |
1211 | return; | 1212 | return; |
1212 | 1213 | ||
1213 | 1214 | ||
1214 | if ( m_virtKey && !ev->key()) { | 1215 | if ( m_virtKey && !ev->key()) { |
1215 | m_virtKey = false; | 1216 | m_virtKey = false; |
1216 | slotTimeUp(); | 1217 | slotTimeUp(); |
1217 | }else { | 1218 | }else { |
1218 | int mod = 0; | 1219 | int mod = 0; |
1219 | int key = ev->key(); | 1220 | int key = ev->key(); |
1220 | switch( key ) { | 1221 | switch( key ) { |
1221 | case Qt::Key_Control: | 1222 | case Qt::Key_Control: |
1222 | mod = Qt::ControlButton; | 1223 | mod = Qt::ControlButton; |
1223 | break; | 1224 | break; |
1224 | case Qt::Key_Shift: | 1225 | case Qt::Key_Shift: |
1225 | mod = Qt::ShiftButton; | 1226 | mod = Qt::ShiftButton; |
1226 | break; | 1227 | break; |
1227 | case Qt::Key_Alt: | 1228 | case Qt::Key_Alt: |
1228 | mod = Qt::AltButton; | 1229 | mod = Qt::AltButton; |
1229 | break; | 1230 | break; |
1230 | default: | 1231 | default: |
1231 | break; | 1232 | break; |
1232 | } | 1233 | } |
1233 | if (mod ) | 1234 | if (mod ) |
1234 | m_mod &= ~mod; | 1235 | m_mod &= ~mod; |
1235 | else | 1236 | else |
1236 | m_key = key; | 1237 | m_key = key; |
1237 | m_keyPair = OKeyPair( m_key, m_mod ); | 1238 | m_keyPair = OKeyPair( m_key, m_mod ); |
1238 | m_lbl->setText( Opie::Ui::Private::keyToString( m_keyPair ) ); | 1239 | m_lbl->setText( Opie::Ui::Private::keyToString( m_keyPair ) ); |
1239 | } | 1240 | } |
1240 | } | 1241 | } |
1241 | 1242 | ||
1242 | 1243 | ||
1243 | void OKeyChooserConfigDialog::slotTimeUp() { | 1244 | void OKeyChooserConfigDialog::slotTimeUp() { |
1244 | m_mod = m_key = 0; | 1245 | m_mod = m_key = 0; |
1245 | QTimer::singleShot(0, this, SIGNAL(keyCaptured()) ); | 1246 | QTimer::singleShot(0, this, SIGNAL(keyCaptured()) ); |
1246 | } | 1247 | } |
diff --git a/libopie2/opieui/opieui.pro b/libopie2/opieui/opieui.pro index 0749f7d..e97e82c 100644 --- a/libopie2/opieui/opieui.pro +++ b/libopie2/opieui/opieui.pro | |||
@@ -1,63 +1,65 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | DESTDIR = $(OPIEDIR)/lib | 3 | DESTDIR = $(OPIEDIR)/lib |
4 | HEADERS = oclickablelabel.h \ | 4 | HEADERS = oclickablelabel.h \ |
5 | odialog.h \ | 5 | odialog.h \ |
6 | ofontselector.h \ | 6 | ofontselector.h \ |
7 | oimageeffect.h \ | 7 | oimageeffect.h \ |
8 | okeyconfigwidget.h \ | ||
8 | olistview.h \ | 9 | olistview.h \ |
9 | opixmapeffect.h \ | 10 | opixmapeffect.h \ |
10 | opopupmenu.h \ | 11 | opopupmenu.h \ |
11 | opixmapprovider.h \ | 12 | opixmapprovider.h \ |
12 | oselector.h \ | 13 | oselector.h \ |
13 | oseparator.h \ | 14 | oseparator.h \ |
14 | otabinfo.h \ | 15 | otabinfo.h \ |
15 | otabbar.h \ | 16 | otabbar.h \ |
16 | otabwidget.h \ | 17 | otabwidget.h \ |
17 | otaskbarapplet.h \ | 18 | otaskbarapplet.h \ |
18 | oticker.h \ | 19 | oticker.h \ |
19 | otimepicker.h \ | 20 | otimepicker.h \ |
20 | oversatileview.h \ | 21 | oversatileview.h \ |
21 | oversatileviewitem.h \ | 22 | oversatileviewitem.h \ |
22 | owait.h | 23 | owait.h |
23 | 24 | ||
24 | SOURCES = oclickablelabel.cpp \ | 25 | SOURCES = oclickablelabel.cpp \ |
25 | odialog.cpp \ | 26 | odialog.cpp \ |
26 | ofontselector.cpp \ | 27 | ofontselector.cpp \ |
27 | oimageeffect.cpp \ | 28 | oimageeffect.cpp \ |
29 | okeyconfigwidget.cpp \ | ||
28 | olistview.cpp \ | 30 | olistview.cpp \ |
29 | opixmapeffect.cpp \ | 31 | opixmapeffect.cpp \ |
30 | opopupmenu.cpp \ | 32 | opopupmenu.cpp \ |
31 | opixmapprovider.cpp \ | 33 | opixmapprovider.cpp \ |
32 | oselector.cpp \ | 34 | oselector.cpp \ |
33 | oseparator.cpp \ | 35 | oseparator.cpp \ |
34 | otabbar.cpp \ | 36 | otabbar.cpp \ |
35 | otabwidget.cpp \ | 37 | otabwidget.cpp \ |
36 | otaskbarapplet.cpp \ | 38 | otaskbarapplet.cpp \ |
37 | oticker.cpp \ | 39 | oticker.cpp \ |
38 | otimepicker.cpp \ | 40 | otimepicker.cpp \ |
39 | oversatileview.cpp \ | 41 | oversatileview.cpp \ |
40 | oversatileviewitem.cpp \ | 42 | oversatileviewitem.cpp \ |
41 | owait.cpp | 43 | owait.cpp |
42 | 44 | ||
43 | include ( big-screen/big-screen.pro ) | 45 | include ( big-screen/big-screen.pro ) |
44 | include ( fileselector/fileselector.pro ) | 46 | include ( fileselector/fileselector.pro ) |
45 | 47 | ||
46 | INTERFACES = otimepickerbase.ui | 48 | INTERFACES = otimepickerbase.ui |
47 | 49 | ||
48 | TARGET = opieui2 | 50 | TARGET = opieui2 |
49 | VERSION = 1.8.5 | 51 | VERSION = 1.8.5 |
50 | 52 | ||
51 | INCLUDEPATH += $(OPIEDIR)/include | 53 | INCLUDEPATH += $(OPIEDIR)/include |
52 | DEPENDPATH += $(OPIEDIR)/include | 54 | DEPENDPATH += $(OPIEDIR)/include |
53 | 55 | ||
54 | LIBS += -lopiecore2 | 56 | LIBS += -lopiecore2 |
55 | 57 | ||
56 | !contains( platform, x11 ) { | 58 | !contains( platform, x11 ) { |
57 | include ( $(OPIEDIR)/include.pro ) | 59 | include ( $(OPIEDIR)/include.pro ) |
58 | } | 60 | } |
59 | 61 | ||
60 | contains( platform, x11 ) { | 62 | contains( platform, x11 ) { |
61 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | 63 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib |
62 | } | 64 | } |
63 | 65 | ||