|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU Lesser General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: |
|
19 * |
|
20 */ |
|
21 |
|
22 #include "xqkeycapture.h" |
|
23 |
|
24 #include "keycapture_p.h" |
|
25 #include "keymapper.h" |
|
26 #include <qnamespace.h> |
|
27 #include <qcoreevent.h> |
|
28 |
|
29 /*! |
|
30 Constructor. |
|
31 */ |
|
32 XQKeyCapture::XQKeyCapture() : |
|
33 d(new KeyCapturePrivate()) |
|
34 { |
|
35 |
|
36 } |
|
37 |
|
38 /*! |
|
39 Destructor. |
|
40 */ |
|
41 XQKeyCapture::~XQKeyCapture() |
|
42 { |
|
43 delete d; |
|
44 } |
|
45 |
|
46 /*! |
|
47 Initializes remote key handler(s) given by parameter. |
|
48 \param flags Flag representing supported remote handler. Flags can be ORed for simulteanous initializations. |
|
49 CaptureEnableRemoteExtEvents flag adds posibility to receive native events from remote device. |
|
50 QKeyEvent::nativeVirtualKey() function returns native remote key code. |
|
51 Important: Extended remote events have different custome type. Static functions |
|
52 XQKeyCapture::remoteKeyPress() and XQKeyCapture::remoteKeyRelease() return custom |
|
53 event types. |
|
54 */ |
|
55 bool XQKeyCapture::captureRemoteKeys(CapturingFlags flags) |
|
56 { |
|
57 return d->initRemote(flags); |
|
58 } |
|
59 |
|
60 /*! |
|
61 Cancels remote key handler(s) given by parameter. |
|
62 \param flags Flag representing supported remote interfaces. Flags can be ORed for simulteanous cancellations. |
|
63 */ |
|
64 bool XQKeyCapture::cancelCaptureRemoteKeys(CapturingFlags flags) |
|
65 { |
|
66 return d->closeRemote(flags); |
|
67 } |
|
68 |
|
69 /*! |
|
70 Returns type of remote key press event. Event type is assigned dynamically. |
|
71 \retval returns type of remote key press event. |
|
72 */ |
|
73 QEvent::Type XQKeyCapture::remoteEventType_KeyPress() |
|
74 { |
|
75 if (KeyCapturePrivate::mRemoteEventType_KeyPress == 0) |
|
76 KeyCapturePrivate::mRemoteEventType_KeyPress = QEvent::registerEventType(); |
|
77 |
|
78 return (QEvent::Type)KeyCapturePrivate::mRemoteEventType_KeyPress; |
|
79 } |
|
80 |
|
81 /*! |
|
82 Returns type of remote key release event. Event type is assigned dynamically. |
|
83 \retval returns type of remote key release event. |
|
84 */ |
|
85 QEvent::Type XQKeyCapture::remoteEventType_KeyRelease() |
|
86 { |
|
87 if (KeyCapturePrivate::mRemoteEventType_KeyRelease == 0) |
|
88 KeyCapturePrivate::mRemoteEventType_KeyRelease = QEvent::registerEventType(); |
|
89 |
|
90 return (QEvent::Type)KeyCapturePrivate::mRemoteEventType_KeyRelease; |
|
91 } |
|
92 |
|
93 /*! |
|
94 Selects a given key for capturing key pressing. Requires a Qt key code. |
|
95 \param aKey A Qt key. |
|
96 \param aModifiersMask |
|
97 \param aModifier |
|
98 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
99 */ |
|
100 bool XQKeyCapture::captureKey(Qt::Key aKey, |
|
101 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier) |
|
102 { |
|
103 return d->doCapture(d->mMapper->mapQtToS60Key(aKey), aModifiersMask, aModifier, |
|
104 CaptureRequest::CaptureRequestTypeNormal); |
|
105 } |
|
106 |
|
107 /*! |
|
108 Selects a given key for capturing key pressing. Requires a S60 key code (TKeyCode). |
|
109 \param aKey A S60 key code (TKeyCode). |
|
110 \param aModifiersMask |
|
111 \param aModifier |
|
112 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
113 */ |
|
114 bool XQKeyCapture::captureKey(TUint aKey, |
|
115 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier) |
|
116 { |
|
117 return d->doCapture(aKey, aModifiersMask, aModifier, |
|
118 CaptureRequest::CaptureRequestTypeNormal); |
|
119 } |
|
120 |
|
121 /*! |
|
122 Selects a given key for capturing long pressing. Requires a Qt key code. |
|
123 \param aKey A Qt key. |
|
124 \param aModifiersMask |
|
125 \param aModifier |
|
126 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
127 */ |
|
128 bool XQKeyCapture::captureLongKey(Qt::Key aKey, |
|
129 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier, |
|
130 XQKeyCapture::LongFlags aLongType) |
|
131 { |
|
132 return d->doCapture(d->mMapper->mapQtToS60Key(aKey), aModifiersMask, aModifier, |
|
133 CaptureRequest::CaptureRequestTypeLong, aLongType); |
|
134 } |
|
135 |
|
136 /*! |
|
137 Selects a given key for capturing long pressing. Requires a S60 key code (TKeyCode). |
|
138 \param aKey A S60 key code (TKeyCode). |
|
139 \param aModifiersMap |
|
140 \param aModifier |
|
141 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
142 */ |
|
143 bool XQKeyCapture::captureLongKey(TUint aKey, |
|
144 Qt::KeyboardModifiers aModifiersMap, Qt::KeyboardModifiers aModifier, |
|
145 XQKeyCapture::LongFlags aLongType) |
|
146 { |
|
147 return d->doCapture(aKey, aModifiersMap, aModifier, |
|
148 CaptureRequest::CaptureRequestTypeLong, aLongType); |
|
149 } |
|
150 |
|
151 /*! |
|
152 Selects a given key for capturing pressing up and down. Requires a Qt key code. |
|
153 \param aKey A Qt key. |
|
154 \param aModifiersMask |
|
155 \param aModifier |
|
156 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
157 */ |
|
158 bool XQKeyCapture::captureKeyUpAndDowns(Qt::Key aKey, |
|
159 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier) |
|
160 { |
|
161 return d->doCapture(d->mMapper->mapQtToS60ScanCodes(aKey), aModifiersMask, |
|
162 aModifier, CaptureRequest::CaptureRequestTypeUpAndDown); |
|
163 } |
|
164 |
|
165 /*! |
|
166 Selects a given key for capturing pressing up and down. Requires a S60 key scan code (TStdScanCode). |
|
167 \param aKey A S60 key scan code (TStdScanCode). |
|
168 \param aModifiersMask |
|
169 \param aModifier |
|
170 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
171 */ |
|
172 bool XQKeyCapture::captureKeyUpAndDowns(TUint aKey, |
|
173 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier) |
|
174 { |
|
175 return d->doCapture(aKey, aModifiersMask, |
|
176 aModifier, CaptureRequest::CaptureRequestTypeUpAndDown); |
|
177 } |
|
178 |
|
179 /*! |
|
180 Deselects a given key from key capturing. Requires a Qt key code. |
|
181 \param aKey A Qt key. |
|
182 \param aModifiersMask |
|
183 \param aModifier |
|
184 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
185 */ |
|
186 bool XQKeyCapture::cancelCaptureKey(Qt::Key aKey, |
|
187 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier) |
|
188 { |
|
189 return d->doCancelCapture(d->mMapper->mapQtToS60Key(aKey), |
|
190 aModifiersMask, aModifier, |
|
191 CaptureRequest::CaptureRequestTypeNormal); |
|
192 } |
|
193 |
|
194 /*! |
|
195 Deselects a given key from key capturing. Requires a S60 key code (TKeyCode). |
|
196 \param aKey A S60 key code (TKeyCode). |
|
197 \param aModifiersMask |
|
198 \param aModifier |
|
199 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
200 */ |
|
201 bool XQKeyCapture::cancelCaptureKey(TUint aKey, |
|
202 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier) |
|
203 { |
|
204 return d->doCancelCapture(aKey, aModifiersMask, aModifier, |
|
205 CaptureRequest::CaptureRequestTypeNormal); |
|
206 } |
|
207 |
|
208 /*! |
|
209 Deselects a given key from capturing long pressing. Requires a Qt key code. |
|
210 \param aKey A Qt key. |
|
211 \param aModifiersMask |
|
212 \param aModifier |
|
213 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
214 */ |
|
215 bool XQKeyCapture::cancelCaptureLongKey(Qt::Key aKey, |
|
216 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier, |
|
217 XQKeyCapture::LongFlags aLongType) |
|
218 { |
|
219 return d->doCancelCapture(d->mMapper->mapQtToS60Key(aKey), aModifiersMask, |
|
220 aModifier, CaptureRequest::CaptureRequestTypeLong, aLongType); |
|
221 } |
|
222 |
|
223 /*! |
|
224 Deselects a given key from capturing long pressing. Requires a S60 key code (TKeyCode). |
|
225 \param aKey A S60 key code (TKeyCode). |
|
226 \param aModifiersMask |
|
227 \param aModifier |
|
228 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
229 */ |
|
230 bool XQKeyCapture::cancelCaptureLongKey(TUint aKey, |
|
231 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier, |
|
232 XQKeyCapture::LongFlags aLongType) |
|
233 { |
|
234 return d->doCancelCapture(aKey, aModifiersMask, aModifier, |
|
235 CaptureRequest::CaptureRequestTypeLong, aLongType); |
|
236 } |
|
237 |
|
238 /*! |
|
239 Deselects a given key from capturing pressing up and down. Requires a Qt key code. |
|
240 \param aKey A Qt key. |
|
241 \param aModifiersMask |
|
242 \param aModifier |
|
243 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
244 */ |
|
245 bool XQKeyCapture::cancelCaptureKeyUpAndDowns(Qt::Key aKey, |
|
246 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier) |
|
247 { |
|
248 return d->doCancelCapture(d->mMapper->mapQtToS60ScanCodes(aKey), |
|
249 aModifiersMask, aModifier, |
|
250 CaptureRequest::CaptureRequestTypeUpAndDown); |
|
251 } |
|
252 |
|
253 /*! |
|
254 Deselects a given key from capturing pressing up and down. Requires a S60 key scan code (TStdScanCode). |
|
255 \param aKey A S60 key scan code (TStdScanCode). |
|
256 \param aModifiersMask |
|
257 \param aModifier |
|
258 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
259 */ |
|
260 bool XQKeyCapture::cancelCaptureKeyUpAndDowns(TUint aKey, |
|
261 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier) |
|
262 { |
|
263 return d->doCancelCapture(aKey, aModifiersMask, aModifier, |
|
264 CaptureRequest::CaptureRequestTypeUpAndDown); |
|
265 } |
|
266 |
|
267 /*! |
|
268 Returns latest error string. |
|
269 \retval Latest error string. |
|
270 */ |
|
271 QString XQKeyCapture::errorString() const |
|
272 { |
|
273 return d->errorString(); |
|
274 } |
|
275 |
|
276 /*! |
|
277 Returns latest error id. |
|
278 \retval Latest error id. |
|
279 */ |
|
280 int XQKeyCapture::errorId() const |
|
281 { |
|
282 return d->errorId(); |
|
283 } |
|
284 |
|
285 /*! |
|
286 Selects a given keys for capturing key pressing. Requires a Qt key code. |
|
287 \param list A Qt keys list. |
|
288 \param aModifiersMask |
|
289 \param aModifier |
|
290 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
291 */ |
|
292 bool XQKeyCapture::captureKey(XQKeyCaptureKeyList list, |
|
293 Qt::KeyboardModifiers aModifiersMask, |
|
294 Qt::KeyboardModifiers aModifier) |
|
295 { |
|
296 Qt::Key key; |
|
297 bool result = true; |
|
298 foreach (key, list) { |
|
299 bool result = result & captureKey(key, aModifiersMask, aModifier); |
|
300 } |
|
301 return result; |
|
302 } |
|
303 |
|
304 /*! |
|
305 Selects a given keys for capturing key pressing. Requires a S60 key code (TKeyCode). |
|
306 \param list A S60 list of keys (TKeyCode codes). |
|
307 \param aModifiersMask |
|
308 \param aModifier |
|
309 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
310 */ |
|
311 bool XQKeyCapture::captureKey(XQKeyCaptureNativeKeyList list, |
|
312 Qt::KeyboardModifiers aModifiersMask, |
|
313 Qt::KeyboardModifiers aModifier) |
|
314 { |
|
315 TUint key; |
|
316 bool result = true; |
|
317 foreach (key, list) { |
|
318 bool result = result & captureKey(key, aModifiersMask, aModifier); |
|
319 } |
|
320 return result; |
|
321 } |
|
322 |
|
323 /*! |
|
324 Selects a given keys for capturing long pressing. Requires a Qt key code. |
|
325 \param aKey A Qt list of keys. |
|
326 \param aModifiersMask |
|
327 \param aModifier |
|
328 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
329 */ |
|
330 bool XQKeyCapture::captureLongKey(XQKeyCaptureKeyList list, |
|
331 Qt::KeyboardModifiers aModifiersMask, |
|
332 Qt::KeyboardModifiers aModifier, |
|
333 XQKeyCapture::LongFlags aLongType) |
|
334 { |
|
335 Qt::Key key; |
|
336 bool result = true; |
|
337 foreach (key, list) { |
|
338 bool result = result & captureLongKey(key, aModifiersMask, aModifier, aLongType); |
|
339 } |
|
340 return result; |
|
341 } |
|
342 |
|
343 /*! |
|
344 Selects a given keys for capturing long pressing. Requires a S60 key code (TKeyCode). |
|
345 \param list A S60 list of keys (TKeyCode codes). |
|
346 \param aModifiersMap |
|
347 \param aModifier |
|
348 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
349 */ |
|
350 bool XQKeyCapture::captureLongKey(XQKeyCaptureNativeKeyList list, |
|
351 Qt::KeyboardModifiers aModifiersMask, |
|
352 Qt::KeyboardModifiers aModifier, |
|
353 XQKeyCapture::LongFlags aLongType) |
|
354 { |
|
355 TUint key; |
|
356 bool result = true; |
|
357 foreach (key, list) { |
|
358 bool result = result & captureLongKey(key, aModifiersMask, aModifier, aLongType); |
|
359 } |
|
360 return result; |
|
361 } |
|
362 |
|
363 /*! |
|
364 Selects a given keys for capturing pressing up and down. Requires a Qt key code. |
|
365 \param list A Qt list of keys. |
|
366 \param aModifiersMask |
|
367 \param aModifier |
|
368 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
369 */ |
|
370 bool XQKeyCapture::captureKeyUpAndDowns(XQKeyCaptureKeyList list, |
|
371 Qt::KeyboardModifiers aModifiersMask, |
|
372 Qt::KeyboardModifiers aModifier) |
|
373 { |
|
374 Qt::Key key; |
|
375 bool result = true; |
|
376 foreach (key, list) { |
|
377 bool result = result & captureKeyUpAndDowns(key, aModifiersMask, aModifier); |
|
378 } |
|
379 return result; |
|
380 } |
|
381 |
|
382 /*! |
|
383 Selects a given keys for capturing pressing up and down. Requires a S60 key scan code (TStdScanCode). |
|
384 \param list A list of S60 key scan codes (TStdScanCode). |
|
385 \param aModifiersMask |
|
386 \param aModifier |
|
387 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
388 */ |
|
389 bool XQKeyCapture::captureKeyUpAndDowns(XQKeyCaptureNativeKeyList list, |
|
390 Qt::KeyboardModifiers aModifiersMask, |
|
391 Qt::KeyboardModifiers aModifier) |
|
392 { |
|
393 TUint key; |
|
394 bool result = true; |
|
395 foreach (key, list) { |
|
396 bool result = result & captureKeyUpAndDowns(key, aModifiersMask, aModifier); |
|
397 } |
|
398 return result; |
|
399 } |
|
400 |
|
401 /*! |
|
402 Deselects a given list of keys from key capturing. Requires a Qt key code. |
|
403 \param list A Qt list of keys. |
|
404 \param aModifiersMask |
|
405 \param aModifier |
|
406 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
407 */ |
|
408 bool XQKeyCapture::cancelCaptureKey(XQKeyCaptureKeyList list, |
|
409 Qt::KeyboardModifiers aModifiersMask, |
|
410 Qt::KeyboardModifiers aModifier) |
|
411 { |
|
412 Qt::Key key; |
|
413 bool result = true; |
|
414 foreach (key, list) { |
|
415 bool result = result & cancelCaptureKey(key, aModifiersMask, aModifier); |
|
416 } |
|
417 return result; |
|
418 } |
|
419 |
|
420 /*! |
|
421 Deselects a given list of keys from key capturing. Requires a S60 key code (TKeyCode). |
|
422 \param list A S60 list of key codes (TKeyCode). |
|
423 \param aModifiersMask |
|
424 \param aModifier |
|
425 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
426 */ |
|
427 bool XQKeyCapture::cancelCaptureKey(XQKeyCaptureNativeKeyList list, |
|
428 Qt::KeyboardModifiers aModifiersMask, |
|
429 Qt::KeyboardModifiers aModifier) |
|
430 { |
|
431 TUint key; |
|
432 bool result = true; |
|
433 foreach (key, list) { |
|
434 bool result = result & cancelCaptureKey(key, aModifiersMask, aModifier); |
|
435 } |
|
436 return result; |
|
437 } |
|
438 |
|
439 /*! |
|
440 Deselects a given list of keys from capturing long pressing. Requires a Qt key code. |
|
441 \param list A list of Qt keys. |
|
442 \param aModifiersMask |
|
443 \param aModifier |
|
444 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
445 */ |
|
446 bool XQKeyCapture::cancelCaptureLongKey(XQKeyCaptureKeyList list, |
|
447 Qt::KeyboardModifiers aModifiersMask, |
|
448 Qt::KeyboardModifiers aModifier, |
|
449 XQKeyCapture::LongFlags aLongType) |
|
450 { |
|
451 Qt::Key key; |
|
452 bool result = true; |
|
453 foreach (key, list) { |
|
454 bool result = result & cancelCaptureLongKey(key, aModifiersMask, aModifier, aLongType); |
|
455 } |
|
456 return result; |
|
457 } |
|
458 |
|
459 /*! |
|
460 Deselects a given key from capturing long pressing. Requires a S60 key code (TKeyCode). |
|
461 \paramlist A list of S60 key codes (TKeyCode). |
|
462 \param aModifiersMask |
|
463 \param aModifier |
|
464 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
465 */ |
|
466 bool XQKeyCapture::cancelCaptureLongKey(XQKeyCaptureNativeKeyList list, |
|
467 Qt::KeyboardModifiers aModifiersMask, |
|
468 Qt::KeyboardModifiers aModifier, |
|
469 XQKeyCapture::LongFlags aLongType) |
|
470 { |
|
471 TUint key; |
|
472 bool result = true; |
|
473 foreach (key, list) { |
|
474 bool result = result & cancelCaptureLongKey(key, aModifiersMask, aModifier, aLongType); |
|
475 } |
|
476 return result; |
|
477 } |
|
478 |
|
479 /*! |
|
480 Deselects a list of given keys from capturing pressing up and down. Requires a Qt key codes. |
|
481 \param list A list of Qt keys. |
|
482 \param aModifiersMask |
|
483 \param aModifier |
|
484 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
485 */ |
|
486 bool XQKeyCapture::cancelCaptureKeyUpAndDowns(XQKeyCaptureKeyList list, |
|
487 Qt::KeyboardModifiers aModifiersMask, |
|
488 Qt::KeyboardModifiers aModifier) |
|
489 { |
|
490 Qt::Key key; |
|
491 bool result = true; |
|
492 foreach (key, list) { |
|
493 bool result = result & cancelCaptureKeyUpAndDowns(key, aModifiersMask, aModifier); |
|
494 } |
|
495 return result; |
|
496 } |
|
497 |
|
498 /*! |
|
499 Deselects a given list of keys from capturing pressing up and down. Requires a S60 key scan code (TStdScanCode). |
|
500 \param aKey A S60 key scan code (TStdScanCode). |
|
501 \param aModifiersMask |
|
502 \param aModifier |
|
503 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
504 */ |
|
505 bool XQKeyCapture::cancelCaptureKeyUpAndDowns(XQKeyCaptureNativeKeyList list, |
|
506 Qt::KeyboardModifiers aModifiersMask, |
|
507 Qt::KeyboardModifiers aModifier) |
|
508 { |
|
509 TUint key; |
|
510 bool result = true; |
|
511 foreach (key, list) { |
|
512 bool result = result & cancelCaptureKeyUpAndDowns(key, aModifiersMask, aModifier); |
|
513 } |
|
514 return result; |
|
515 } |
|
516 |
|
517 /*! |
|
518 Constructor. |
|
519 */ |
|
520 XqKeyCapture::XqKeyCapture() : |
|
521 d(new KeyCapturePrivate()) |
|
522 { |
|
523 |
|
524 } |
|
525 |
|
526 /*! |
|
527 Destructor. |
|
528 */ |
|
529 XqKeyCapture::~XqKeyCapture() |
|
530 { |
|
531 delete d; |
|
532 } |
|
533 |
|
534 /*! |
|
535 Selects a given key for capturing key pressing. Requires a Qt key code. |
|
536 \param aKey A Qt key. |
|
537 \param aModifiersMask |
|
538 \param aModifier |
|
539 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
540 */ |
|
541 /*! |
|
542 Selects a given key for capturing key pressing. Requires a Qt key code. |
|
543 \param aKey A Qt key. |
|
544 \param aModifiersMask |
|
545 \param aModifier |
|
546 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
547 */ |
|
548 bool XqKeyCapture::captureKey(Qt::Key aKey, |
|
549 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier) |
|
550 { |
|
551 return d->doCapture(d->mMapper->mapQtToS60Key(aKey), aModifiersMask, aModifier, |
|
552 CaptureRequest::CaptureRequestTypeNormal); |
|
553 } |
|
554 |
|
555 /*! |
|
556 Selects a given key for capturing key pressing. Requires a S60 key code (TKeyCode). |
|
557 \param aKey A S60 key code (TKeyCode). |
|
558 \param aModifiersMask |
|
559 \param aModifier |
|
560 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
561 */ |
|
562 bool XqKeyCapture::captureKey(TUint aKey, |
|
563 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier) |
|
564 { |
|
565 return d->doCapture(aKey, aModifiersMask, aModifier, |
|
566 CaptureRequest::CaptureRequestTypeNormal); |
|
567 } |
|
568 |
|
569 /*! |
|
570 Selects a given key for capturing long pressing. Requires a Qt key code. |
|
571 \param aKey A Qt key. |
|
572 \param aModifiersMask |
|
573 \param aModifier |
|
574 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
575 */ |
|
576 bool XqKeyCapture::captureLongKey(Qt::Key aKey, |
|
577 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier, |
|
578 XqKeyCapture::LongFlags aLongType) |
|
579 { |
|
580 return d->doCapture(d->mMapper->mapQtToS60Key(aKey), aModifiersMask, aModifier, |
|
581 CaptureRequest::CaptureRequestTypeLong, (XQKeyCapture::LongFlags)aLongType); |
|
582 } |
|
583 |
|
584 /*! |
|
585 Selects a given key for capturing long pressing. Requires a S60 key code (TKeyCode). |
|
586 \param aKey A S60 key code (TKeyCode). |
|
587 \param aModifiersMap |
|
588 \param aModifier |
|
589 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
590 */ |
|
591 bool XqKeyCapture::captureLongKey(TUint aKey, |
|
592 Qt::KeyboardModifiers aModifiersMap, Qt::KeyboardModifiers aModifier, |
|
593 XqKeyCapture::LongFlags aLongType) |
|
594 { |
|
595 return d->doCapture(aKey, aModifiersMap, aModifier, |
|
596 CaptureRequest::CaptureRequestTypeLong, (XQKeyCapture::LongFlags)aLongType); |
|
597 } |
|
598 |
|
599 /*! |
|
600 Selects a given key for capturing pressing up and down. Requires a Qt key code. |
|
601 \param aKey A Qt key. |
|
602 \param aModifiersMask |
|
603 \param aModifier |
|
604 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
605 */ |
|
606 bool XqKeyCapture::captureKeyUpAndDowns(Qt::Key aKey, |
|
607 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier) |
|
608 { |
|
609 return d->doCapture(d->mMapper->mapQtToS60ScanCodes(aKey), aModifiersMask, |
|
610 aModifier, CaptureRequest::CaptureRequestTypeUpAndDown); |
|
611 } |
|
612 |
|
613 /*! |
|
614 Selects a given key for capturing pressing up and down. Requires a S60 key scan code (TStdScanCode). |
|
615 \param aKey A S60 key scan code (TStdScanCode). |
|
616 \param aModifiersMask |
|
617 \param aModifier |
|
618 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
619 */ |
|
620 bool XqKeyCapture::captureKeyUpAndDowns(TUint aKey, |
|
621 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier) |
|
622 { |
|
623 return d->doCapture(aKey, aModifiersMask, |
|
624 aModifier, CaptureRequest::CaptureRequestTypeUpAndDown); |
|
625 } |
|
626 |
|
627 /*! |
|
628 Deselects a given key from key capturing. Requires a Qt key code. |
|
629 \param aKey A Qt key. |
|
630 \param aModifiersMask |
|
631 \param aModifier |
|
632 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
633 */ |
|
634 bool XqKeyCapture::cancelCaptureKey(Qt::Key aKey, |
|
635 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier) |
|
636 { |
|
637 return d->doCancelCapture(d->mMapper->mapQtToS60Key(aKey), |
|
638 aModifiersMask, aModifier, |
|
639 CaptureRequest::CaptureRequestTypeNormal); |
|
640 } |
|
641 |
|
642 /*! |
|
643 Deselects a given key from key capturing. Requires a S60 key code (TKeyCode). |
|
644 \param aKey A S60 key code (TKeyCode). |
|
645 \param aModifiersMask |
|
646 \param aModifier |
|
647 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
648 */ |
|
649 bool XqKeyCapture::cancelCaptureKey(TUint aKey, |
|
650 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier) |
|
651 { |
|
652 return d->doCancelCapture(aKey, aModifiersMask, aModifier, |
|
653 CaptureRequest::CaptureRequestTypeNormal); |
|
654 } |
|
655 |
|
656 /*! |
|
657 Deselects a given key from capturing long pressing. Requires a Qt key code. |
|
658 \param aKey A Qt key. |
|
659 \param aModifiersMask |
|
660 \param aModifier |
|
661 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
662 */ |
|
663 bool XqKeyCapture::cancelCaptureLongKey(Qt::Key aKey, |
|
664 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier, |
|
665 XqKeyCapture::LongFlags aLongType) |
|
666 { |
|
667 return d->doCancelCapture(d->mMapper->mapQtToS60Key(aKey), aModifiersMask, |
|
668 aModifier, CaptureRequest::CaptureRequestTypeLong, (XQKeyCapture::LongFlags)aLongType); |
|
669 } |
|
670 |
|
671 /*! |
|
672 Deselects a given key from capturing long pressing. Requires a S60 key code (TKeyCode). |
|
673 \param aKey A S60 key code (TKeyCode). |
|
674 \param aModifiersMask |
|
675 \param aModifier |
|
676 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
677 */ |
|
678 bool XqKeyCapture::cancelCaptureLongKey(TUint aKey, |
|
679 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier, |
|
680 XqKeyCapture::LongFlags aLongType) |
|
681 { |
|
682 return d->doCancelCapture(aKey, aModifiersMask, aModifier, |
|
683 CaptureRequest::CaptureRequestTypeLong, (XQKeyCapture::LongFlags)aLongType); |
|
684 } |
|
685 |
|
686 /*! |
|
687 Deselects a given key from capturing pressing up and down. Requires a Qt key code. |
|
688 \param aKey A Qt key. |
|
689 \param aModifiersMask |
|
690 \param aModifier |
|
691 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
692 */ |
|
693 bool XqKeyCapture::cancelCaptureKeyUpAndDowns(Qt::Key aKey, |
|
694 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier) |
|
695 { |
|
696 return d->doCancelCapture(d->mMapper->mapQtToS60ScanCodes(aKey), |
|
697 aModifiersMask, aModifier, |
|
698 CaptureRequest::CaptureRequestTypeUpAndDown); |
|
699 } |
|
700 |
|
701 /*! |
|
702 Deselects a given key from capturing pressing up and down. Requires a S60 key scan code (TStdScanCode). |
|
703 \param aKey A S60 key scan code (TStdScanCode). |
|
704 \param aModifiersMask |
|
705 \param aModifier |
|
706 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
707 */ |
|
708 bool XqKeyCapture::cancelCaptureKeyUpAndDowns(TUint aKey, |
|
709 Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier) |
|
710 { |
|
711 return d->doCancelCapture(aKey, aModifiersMask, aModifier, |
|
712 CaptureRequest::CaptureRequestTypeUpAndDown); |
|
713 } |
|
714 |
|
715 /*! |
|
716 Returns latest error string. |
|
717 \retval Latest error string. |
|
718 */ |
|
719 QString XqKeyCapture::errorString() const |
|
720 { |
|
721 return d->errorString(); |
|
722 } |
|
723 |
|
724 /*! |
|
725 Returns latest error id. |
|
726 \retval Latest error id. |
|
727 */ |
|
728 int XqKeyCapture::errorId() const |
|
729 { |
|
730 return d->errorId(); |
|
731 } |
|
732 |
|
733 /*! |
|
734 Selects a given keys for capturing key pressing. Requires a Qt key code. |
|
735 \param list A Qt keys list. |
|
736 \param aModifiersMask |
|
737 \param aModifier |
|
738 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
739 */ |
|
740 bool XqKeyCapture::captureKey(XQKeyCaptureKeyList list, |
|
741 Qt::KeyboardModifiers aModifiersMask, |
|
742 Qt::KeyboardModifiers aModifier) |
|
743 { |
|
744 Qt::Key key; |
|
745 bool result = true; |
|
746 foreach (key, list) { |
|
747 bool result = result & captureKey(key, aModifiersMask, aModifier); |
|
748 } |
|
749 return result; |
|
750 } |
|
751 |
|
752 /*! |
|
753 Selects a given keys for capturing key pressing. Requires a S60 key code (TKeyCode). |
|
754 \param list A S60 list of keys (TKeyCode codes). |
|
755 \param aModifiersMask |
|
756 \param aModifier |
|
757 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
758 */ |
|
759 bool XqKeyCapture::captureKey(XQKeyCaptureNativeKeyList list, |
|
760 Qt::KeyboardModifiers aModifiersMask, |
|
761 Qt::KeyboardModifiers aModifier) |
|
762 { |
|
763 TUint key; |
|
764 bool result = true; |
|
765 foreach (key, list) { |
|
766 bool result = result & captureKey(key, aModifiersMask, aModifier); |
|
767 } |
|
768 return result; |
|
769 } |
|
770 |
|
771 /*! |
|
772 Selects a given keys for capturing long pressing. Requires a Qt key code. |
|
773 \param aKey A Qt list of keys. |
|
774 \param aModifiersMask |
|
775 \param aModifier |
|
776 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
777 */ |
|
778 bool XqKeyCapture::captureLongKey(XQKeyCaptureKeyList list, |
|
779 Qt::KeyboardModifiers aModifiersMask, |
|
780 Qt::KeyboardModifiers aModifier, |
|
781 XqKeyCapture::LongFlags aLongType) |
|
782 { |
|
783 Qt::Key key; |
|
784 bool result = true; |
|
785 foreach (key, list) { |
|
786 bool result = result & captureLongKey(key, aModifiersMask, aModifier, aLongType); |
|
787 } |
|
788 return result; |
|
789 } |
|
790 |
|
791 /*! |
|
792 Selects a given keys for capturing long pressing. Requires a S60 key code (TKeyCode). |
|
793 \param list A S60 list of keys (TKeyCode codes). |
|
794 \param aModifiersMap |
|
795 \param aModifier |
|
796 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
797 */ |
|
798 bool XqKeyCapture::captureLongKey(XQKeyCaptureNativeKeyList list, |
|
799 Qt::KeyboardModifiers aModifiersMask, |
|
800 Qt::KeyboardModifiers aModifier, |
|
801 XqKeyCapture::LongFlags aLongType) |
|
802 { |
|
803 TUint key; |
|
804 bool result = true; |
|
805 foreach (key, list) { |
|
806 bool result = result & captureLongKey(key, aModifiersMask, aModifier, aLongType); |
|
807 } |
|
808 return result; |
|
809 } |
|
810 |
|
811 /*! |
|
812 Selects a given keys for capturing pressing up and down. Requires a Qt key code. |
|
813 \param list A Qt list of keys. |
|
814 \param aModifiersMask |
|
815 \param aModifier |
|
816 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
817 */ |
|
818 bool XqKeyCapture::captureKeyUpAndDowns(XQKeyCaptureKeyList list, |
|
819 Qt::KeyboardModifiers aModifiersMask, |
|
820 Qt::KeyboardModifiers aModifier) |
|
821 { |
|
822 Qt::Key key; |
|
823 bool result = true; |
|
824 foreach (key, list) { |
|
825 bool result = result & captureKeyUpAndDowns(key, aModifiersMask, aModifier); |
|
826 } |
|
827 return result; |
|
828 } |
|
829 |
|
830 /*! |
|
831 Selects a given keys for capturing pressing up and down. Requires a S60 key scan code (TStdScanCode). |
|
832 \param list A list of S60 key scan codes (TStdScanCode). |
|
833 \param aModifiersMask |
|
834 \param aModifier |
|
835 \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false. |
|
836 */ |
|
837 bool XqKeyCapture::captureKeyUpAndDowns(XQKeyCaptureNativeKeyList list, |
|
838 Qt::KeyboardModifiers aModifiersMask, |
|
839 Qt::KeyboardModifiers aModifier) |
|
840 { |
|
841 TUint key; |
|
842 bool result = true; |
|
843 foreach (key, list) { |
|
844 bool result = result & captureKeyUpAndDowns(key, aModifiersMask, aModifier); |
|
845 } |
|
846 return result; |
|
847 } |
|
848 |
|
849 /*! |
|
850 Deselects a given list of keys from key capturing. Requires a Qt key code. |
|
851 \param list A Qt list of keys. |
|
852 \param aModifiersMask |
|
853 \param aModifier |
|
854 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
855 */ |
|
856 bool XqKeyCapture::cancelCaptureKey(XQKeyCaptureKeyList list, |
|
857 Qt::KeyboardModifiers aModifiersMask, |
|
858 Qt::KeyboardModifiers aModifier) |
|
859 { |
|
860 Qt::Key key; |
|
861 bool result = true; |
|
862 foreach (key, list) { |
|
863 bool result = result & cancelCaptureKey(key, aModifiersMask, aModifier); |
|
864 } |
|
865 return result; |
|
866 } |
|
867 |
|
868 /*! |
|
869 Deselects a given list of keys from key capturing. Requires a S60 key code (TKeyCode). |
|
870 \param list A S60 list of key codes (TKeyCode). |
|
871 \param aModifiersMask |
|
872 \param aModifier |
|
873 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
874 */ |
|
875 bool XqKeyCapture::cancelCaptureKey(XQKeyCaptureNativeKeyList list, |
|
876 Qt::KeyboardModifiers aModifiersMask, |
|
877 Qt::KeyboardModifiers aModifier) |
|
878 { |
|
879 TUint key; |
|
880 bool result = true; |
|
881 foreach (key, list) { |
|
882 bool result = result & cancelCaptureKey(key, aModifiersMask, aModifier); |
|
883 } |
|
884 return result; |
|
885 } |
|
886 |
|
887 /*! |
|
888 Deselects a given list of keys from capturing long pressing. Requires a Qt key code. |
|
889 \param list A list of Qt keys. |
|
890 \param aModifiersMask |
|
891 \param aModifier |
|
892 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
893 */ |
|
894 bool XqKeyCapture::cancelCaptureLongKey(XQKeyCaptureKeyList list, |
|
895 Qt::KeyboardModifiers aModifiersMask, |
|
896 Qt::KeyboardModifiers aModifier, |
|
897 XqKeyCapture::LongFlags aLongType) |
|
898 { |
|
899 Qt::Key key; |
|
900 bool result = true; |
|
901 foreach (key, list) { |
|
902 bool result = result & cancelCaptureLongKey(key, aModifiersMask, aModifier, aLongType); |
|
903 } |
|
904 return result; |
|
905 } |
|
906 |
|
907 /*! |
|
908 Deselects a given key from capturing long pressing. Requires a S60 key code (TKeyCode). |
|
909 \paramlist A list of S60 key codes (TKeyCode). |
|
910 \param aModifiersMask |
|
911 \param aModifier |
|
912 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
913 */ |
|
914 bool XqKeyCapture::cancelCaptureLongKey(XQKeyCaptureNativeKeyList list, |
|
915 Qt::KeyboardModifiers aModifiersMask, |
|
916 Qt::KeyboardModifiers aModifier, |
|
917 XqKeyCapture::LongFlags aLongType) |
|
918 { |
|
919 TUint key; |
|
920 bool result = true; |
|
921 foreach (key, list) { |
|
922 bool result = result & cancelCaptureLongKey(key, aModifiersMask, aModifier, aLongType); |
|
923 } |
|
924 return result; |
|
925 } |
|
926 |
|
927 /*! |
|
928 Deselects a list of given keys from capturing pressing up and down. Requires a Qt key codes. |
|
929 \param list A list of Qt keys. |
|
930 \param aModifiersMask |
|
931 \param aModifier |
|
932 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
933 */ |
|
934 bool XqKeyCapture::cancelCaptureKeyUpAndDowns(XQKeyCaptureKeyList list, |
|
935 Qt::KeyboardModifiers aModifiersMask, |
|
936 Qt::KeyboardModifiers aModifier) |
|
937 { |
|
938 Qt::Key key; |
|
939 bool result = true; |
|
940 foreach (key, list) { |
|
941 bool result = result & cancelCaptureKeyUpAndDowns(key, aModifiersMask, aModifier); |
|
942 } |
|
943 return result; |
|
944 } |
|
945 |
|
946 /*! |
|
947 Deselects a given list of keys from capturing pressing up and down. Requires a S60 key scan code (TStdScanCode). |
|
948 \param aKey A S60 key scan code (TStdScanCode). |
|
949 \param aModifiersMask |
|
950 \param aModifier |
|
951 \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false. |
|
952 */ |
|
953 bool XqKeyCapture::cancelCaptureKeyUpAndDowns(XQKeyCaptureNativeKeyList list, |
|
954 Qt::KeyboardModifiers aModifiersMask, |
|
955 Qt::KeyboardModifiers aModifier) |
|
956 { |
|
957 TUint key; |
|
958 bool result = true; |
|
959 foreach (key, list) { |
|
960 bool result = result & cancelCaptureKeyUpAndDowns(key, aModifiersMask, aModifier); |
|
961 } |
|
962 return result; |
|
963 } |