qtmobileextensions/src/keycapture/xqkeycapture.cpp
changeset 19 46686fb6258c
parent 15 1f895d8a5b2b
child 27 6bfad47013df
equal deleted inserted replaced
15:1f895d8a5b2b 19:46686fb6258c
    20  */
    20  */
    21 
    21 
    22 #include "xqkeycapture.h"
    22 #include "xqkeycapture.h"
    23 
    23 
    24 #include "keycapture_p.h"
    24 #include "keycapture_p.h"
       
    25 #include "keymapper.h"
    25 #include <qnamespace.h>
    26 #include <qnamespace.h>
    26 #include <qcoreevent.h>
    27 #include <qcoreevent.h>
    27 
    28 
    28 /*!
    29 /*!
    29  Constructor.
    30  Constructor.
    97  \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false.
    98  \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false.
    98  */
    99  */
    99 bool XQKeyCapture::captureKey(Qt::Key aKey,
   100 bool XQKeyCapture::captureKey(Qt::Key aKey,
   100     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   101     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   101 {
   102 {
   102     return d->captureKey(aKey, aModifiersMask, aModifier);
   103     return d->doCapture(d->mMapper->mapQtToS60Key(aKey), aModifiersMask, aModifier,
       
   104         CaptureRequest::CaptureRequestTypeNormal);
   103 }
   105 }
   104 
   106 
   105 /*!
   107 /*!
   106  Selects a given key for capturing key pressing. Requires a S60 key code (TKeyCode).
   108  Selects a given key for capturing key pressing. Requires a S60 key code (TKeyCode).
   107  \param aKey A S60 key code (TKeyCode).
   109  \param aKey A S60 key code (TKeyCode).
   110  \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false.
   112  \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false.
   111  */
   113  */
   112 bool XQKeyCapture::captureKey(TUint aKey,
   114 bool XQKeyCapture::captureKey(TUint aKey,
   113     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   115     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   114 {
   116 {
   115     return d->captureKey(aKey, aModifiersMask, aModifier);
   117     return d->doCapture(aKey, aModifiersMask, aModifier,
       
   118         CaptureRequest::CaptureRequestTypeNormal);
   116 }
   119 }
   117 
   120 
   118 /*!
   121 /*!
   119  Selects a given key for capturing long pressing. Requires a Qt key code.
   122  Selects a given key for capturing long pressing. Requires a Qt key code.
   120  \param aKey A Qt key.
   123  \param aKey A Qt key.
   124  */
   127  */
   125 bool XQKeyCapture::captureLongKey(Qt::Key aKey,
   128 bool XQKeyCapture::captureLongKey(Qt::Key aKey,
   126     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier,
   129     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier,
   127     XQKeyCapture::LongFlags aLongType)
   130     XQKeyCapture::LongFlags aLongType)
   128 {
   131 {
   129     return d->captureLongKey(aKey, aModifiersMask, aModifier, aLongType);
   132     return d->doCapture(d->mMapper->mapQtToS60Key(aKey), aModifiersMask, aModifier,
       
   133         CaptureRequest::CaptureRequestTypeLong, aLongType);
   130 }
   134 }
   131 
   135 
   132 /*!
   136 /*!
   133  Selects a given key for capturing long pressing. Requires a S60 key code (TKeyCode).
   137  Selects a given key for capturing long pressing. Requires a S60 key code (TKeyCode).
   134  \param aKey A S60 key code (TKeyCode).
   138  \param aKey A S60 key code (TKeyCode).
   138  */
   142  */
   139 bool XQKeyCapture::captureLongKey(TUint aKey,
   143 bool XQKeyCapture::captureLongKey(TUint aKey,
   140     Qt::KeyboardModifiers aModifiersMap, Qt::KeyboardModifiers aModifier,
   144     Qt::KeyboardModifiers aModifiersMap, Qt::KeyboardModifiers aModifier,
   141     XQKeyCapture::LongFlags aLongType)
   145     XQKeyCapture::LongFlags aLongType)
   142 {
   146 {
   143     return d->captureLongKey(aKey, aModifiersMap, aModifier, aLongType);
   147     return d->doCapture(aKey, aModifiersMap, aModifier,
       
   148         CaptureRequest::CaptureRequestTypeLong, aLongType);
   144 }
   149 }
   145 
   150 
   146 /*!
   151 /*!
   147  Selects a given key for capturing pressing up and down. Requires a Qt key code.
   152  Selects a given key for capturing pressing up and down. Requires a Qt key code.
   148  \param aKey A Qt key.
   153  \param aKey A Qt key.
   151  \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false.
   156  \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false.
   152  */
   157  */
   153 bool XQKeyCapture::captureKeyUpAndDowns(Qt::Key aKey,
   158 bool XQKeyCapture::captureKeyUpAndDowns(Qt::Key aKey,
   154     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   159     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   155 {
   160 {
   156     return d->captureKeyUpAndDowns(aKey, aModifiersMask, aModifier);
   161     return d->doCapture(d->mMapper->mapQtToS60ScanCodes(aKey), aModifiersMask,
       
   162         aModifier, CaptureRequest::CaptureRequestTypeUpAndDown);
   157 }
   163 }
   158 
   164 
   159 /*!
   165 /*!
   160  Selects a given key for capturing pressing up and down. Requires a S60 key scan code (TStdScanCode).
   166  Selects a given key for capturing pressing up and down. Requires a S60 key scan code (TStdScanCode).
   161  \param aKey A S60 key scan code (TStdScanCode).
   167  \param aKey A S60 key scan code (TStdScanCode).
   164  \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false.
   170  \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false.
   165  */
   171  */
   166 bool XQKeyCapture::captureKeyUpAndDowns(TUint aKey,
   172 bool XQKeyCapture::captureKeyUpAndDowns(TUint aKey,
   167     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   173     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   168 {
   174 {
   169     return d->captureKeyUpAndDowns(aKey, aModifiersMask, aModifier);
   175     return d->doCapture(aKey, aModifiersMask,
       
   176         aModifier, CaptureRequest::CaptureRequestTypeUpAndDown);
   170 }
   177 }
   171 
   178 
   172 /*!
   179 /*!
   173  Deselects a given key from key capturing. Requires a Qt key code.
   180  Deselects a given key from key capturing. Requires a Qt key code.
   174  \param aKey A Qt key.
   181  \param aKey A Qt key.
   177  \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false.
   184  \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false.
   178  */
   185  */
   179 bool XQKeyCapture::cancelCaptureKey(Qt::Key aKey,
   186 bool XQKeyCapture::cancelCaptureKey(Qt::Key aKey,
   180     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   187     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   181 {
   188 {
   182     return d->cancelCaptureKey(aKey, aModifiersMask, aModifier);
   189     return d->doCancelCapture(d->mMapper->mapQtToS60Key(aKey),
       
   190         aModifiersMask, aModifier,
       
   191         CaptureRequest::CaptureRequestTypeNormal);
   183 }
   192 }
   184 
   193 
   185 /*!
   194 /*!
   186  Deselects a given key from key capturing. Requires a S60 key code (TKeyCode).
   195  Deselects a given key from key capturing. Requires a S60 key code (TKeyCode).
   187  \param aKey A S60 key code (TKeyCode).
   196  \param aKey A S60 key code (TKeyCode).
   190  \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false.
   199  \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false.
   191  */
   200  */
   192 bool XQKeyCapture::cancelCaptureKey(TUint aKey,
   201 bool XQKeyCapture::cancelCaptureKey(TUint aKey,
   193     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   202     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   194 {
   203 {
   195     return d->cancelCaptureKey(aKey, aModifiersMask, aModifier);
   204     return d->doCancelCapture(aKey, aModifiersMask, aModifier,
       
   205         CaptureRequest::CaptureRequestTypeNormal);
   196 }
   206 }
   197 
   207 
   198 /*!
   208 /*!
   199  Deselects a given key from capturing long pressing. Requires a Qt key code.
   209  Deselects a given key from capturing long pressing. Requires a Qt key code.
   200  \param aKey A Qt key.
   210  \param aKey A Qt key.
   204  */
   214  */
   205 bool XQKeyCapture::cancelCaptureLongKey(Qt::Key aKey,
   215 bool XQKeyCapture::cancelCaptureLongKey(Qt::Key aKey,
   206     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier,
   216     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier,
   207     XQKeyCapture::LongFlags aLongType)
   217     XQKeyCapture::LongFlags aLongType)
   208 {
   218 {
   209     return d->cancelCaptureLongKey(aKey, aModifiersMask, aModifier,
   219     return d->doCancelCapture(d->mMapper->mapQtToS60Key(aKey), aModifiersMask,
   210         aLongType);
   220         aModifier, CaptureRequest::CaptureRequestTypeLong, aLongType);
   211 }
   221 }
   212 
   222 
   213 /*!
   223 /*!
   214  Deselects a given key from capturing long pressing. Requires a S60 key code (TKeyCode).
   224  Deselects a given key from capturing long pressing. Requires a S60 key code (TKeyCode).
   215  \param aKey A S60 key code (TKeyCode).
   225  \param aKey A S60 key code (TKeyCode).
   219  */
   229  */
   220 bool XQKeyCapture::cancelCaptureLongKey(TUint aKey,
   230 bool XQKeyCapture::cancelCaptureLongKey(TUint aKey,
   221     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier,
   231     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier,
   222     XQKeyCapture::LongFlags aLongType)
   232     XQKeyCapture::LongFlags aLongType)
   223 {
   233 {
   224     return d->cancelCaptureLongKey(aKey, aModifiersMask, aModifier,
   234     return d->doCancelCapture(aKey, aModifiersMask, aModifier,
   225         aLongType);
   235         CaptureRequest::CaptureRequestTypeLong, aLongType);
   226 }
   236 }
   227 
   237 
   228 /*!
   238 /*!
   229  Deselects a given key from capturing pressing up and down. Requires a Qt key code.
   239  Deselects a given key from capturing pressing up and down. Requires a Qt key code.
   230  \param aKey A Qt key.
   240  \param aKey A Qt key.
   233  \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false.
   243  \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false.
   234  */
   244  */
   235 bool XQKeyCapture::cancelCaptureKeyUpAndDowns(Qt::Key aKey,
   245 bool XQKeyCapture::cancelCaptureKeyUpAndDowns(Qt::Key aKey,
   236     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   246     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   237 {
   247 {
   238     return d->cancelCaptureKeyUpAndDowns(aKey, aModifiersMask, aModifier);
   248     return d->doCancelCapture(d->mMapper->mapQtToS60ScanCodes(aKey),
       
   249         aModifiersMask, aModifier,
       
   250         CaptureRequest::CaptureRequestTypeUpAndDown);
   239 }
   251 }
   240 
   252 
   241 /*!
   253 /*!
   242  Deselects a given key from capturing pressing up and down. Requires a S60 key scan code (TStdScanCode).
   254  Deselects a given key from capturing pressing up and down. Requires a S60 key scan code (TStdScanCode).
   243  \param aKey A S60 key scan code (TStdScanCode).
   255  \param aKey A S60 key scan code (TStdScanCode).
   246  \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false.
   258  \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false.
   247  */
   259  */
   248 bool XQKeyCapture::cancelCaptureKeyUpAndDowns(TUint aKey,
   260 bool XQKeyCapture::cancelCaptureKeyUpAndDowns(TUint aKey,
   249     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   261     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   250 {
   262 {
   251     return d->cancelCaptureKeyUpAndDowns(aKey, aModifiersMask, aModifier);
   263     return d->doCancelCapture(aKey, aModifiersMask, aModifier,
       
   264         CaptureRequest::CaptureRequestTypeUpAndDown);
   252 }
   265 }
   253 
   266 
   254 /*!
   267 /*!
   255  Returns latest error string.
   268  Returns latest error string.
   256  \retval Latest error string.
   269  \retval Latest error string.
   281         Qt::KeyboardModifiers aModifier)
   294         Qt::KeyboardModifiers aModifier)
   282 {
   295 {
   283     Qt::Key key;
   296     Qt::Key key;
   284     bool result = true;
   297     bool result = true;
   285     foreach (key, list) {
   298     foreach (key, list) {
   286         bool result = result & d->captureKey(key, aModifiersMask, aModifier);
   299         bool result = result & captureKey(key, aModifiersMask, aModifier);
   287     }
   300     }
   288     return result;
   301     return result;
   289 }
   302 }
   290 
   303 
   291 /*!
   304 /*!
   300         Qt::KeyboardModifiers aModifier)
   313         Qt::KeyboardModifiers aModifier)
   301 {
   314 {
   302     TUint key;
   315     TUint key;
   303     bool result = true;
   316     bool result = true;
   304     foreach (key, list) {
   317     foreach (key, list) {
   305         bool result = result & d->captureKey(key, aModifiersMask, aModifier);
   318         bool result = result & captureKey(key, aModifiersMask, aModifier);
   306     }
   319     }
   307     return result;
   320     return result;
   308 }
   321 }
   309 
   322 
   310 /*!
   323 /*!
   320         XQKeyCapture::LongFlags aLongType)
   333         XQKeyCapture::LongFlags aLongType)
   321 {
   334 {
   322     Qt::Key key;
   335     Qt::Key key;
   323     bool result = true;
   336     bool result = true;
   324     foreach (key, list) {
   337     foreach (key, list) {
   325         bool result = result & d->captureLongKey(key, aModifiersMask, aModifier, aLongType);
   338         bool result = result & captureLongKey(key, aModifiersMask, aModifier, aLongType);
   326     }
   339     }
   327     return result;
   340     return result;
   328 }
   341 }
   329 
   342 
   330 /*!
   343 /*!
   340         XQKeyCapture::LongFlags aLongType)
   353         XQKeyCapture::LongFlags aLongType)
   341 {
   354 {
   342     TUint key;
   355     TUint key;
   343     bool result = true;
   356     bool result = true;
   344     foreach (key, list) {
   357     foreach (key, list) {
   345         bool result = result & d->captureLongKey(key, aModifiersMask, aModifier, aLongType);
   358         bool result = result & captureLongKey(key, aModifiersMask, aModifier, aLongType);
   346     }
   359     }
   347     return result;
   360     return result;
   348 }
   361 }
   349 
   362 
   350 /*!
   363 /*!
   359         Qt::KeyboardModifiers aModifier)
   372         Qt::KeyboardModifiers aModifier)
   360 {
   373 {
   361     Qt::Key key;
   374     Qt::Key key;
   362     bool result = true;
   375     bool result = true;
   363     foreach (key, list) {
   376     foreach (key, list) {
   364         bool result = result & d->captureKeyUpAndDowns(key, aModifiersMask, aModifier);
   377         bool result = result & captureKeyUpAndDowns(key, aModifiersMask, aModifier);
   365     }
   378     }
   366     return result;
   379     return result;
   367 }
   380 }
   368 
   381 
   369 /*!
   382 /*!
   378         Qt::KeyboardModifiers aModifier)
   391         Qt::KeyboardModifiers aModifier)
   379 {
   392 {
   380     TUint key;
   393     TUint key;
   381     bool result = true;
   394     bool result = true;
   382     foreach (key, list) {
   395     foreach (key, list) {
   383         bool result = result & d->captureKeyUpAndDowns(key, aModifiersMask, aModifier);
   396         bool result = result & captureKeyUpAndDowns(key, aModifiersMask, aModifier);
   384     }
   397     }
   385     return result;
   398     return result;
   386 }
   399 }
   387 
   400 
   388 /*!
   401 /*!
   397         Qt::KeyboardModifiers aModifier)
   410         Qt::KeyboardModifiers aModifier)
   398 {
   411 {
   399     Qt::Key key;
   412     Qt::Key key;
   400     bool result = true;
   413     bool result = true;
   401     foreach (key, list) {
   414     foreach (key, list) {
   402         bool result = result & d->cancelCaptureKey(key, aModifiersMask, aModifier);
   415         bool result = result & cancelCaptureKey(key, aModifiersMask, aModifier);
   403     }
   416     }
   404     return result;
   417     return result;
   405 }
   418 }
   406 
   419 
   407 /*!
   420 /*!
   416         Qt::KeyboardModifiers aModifier)
   429         Qt::KeyboardModifiers aModifier)
   417 {
   430 {
   418     TUint key;
   431     TUint key;
   419     bool result = true;
   432     bool result = true;
   420     foreach (key, list) {
   433     foreach (key, list) {
   421         bool result = result & d->cancelCaptureKey(key, aModifiersMask, aModifier);
   434         bool result = result & cancelCaptureKey(key, aModifiersMask, aModifier);
   422     }
   435     }
   423     return result;
   436     return result;
   424 }
   437 }
   425 
   438 
   426 /*!
   439 /*!
   436         XQKeyCapture::LongFlags aLongType)
   449         XQKeyCapture::LongFlags aLongType)
   437 {
   450 {
   438     Qt::Key key;
   451     Qt::Key key;
   439     bool result = true;
   452     bool result = true;
   440     foreach (key, list) {
   453     foreach (key, list) {
   441         bool result = result & d->cancelCaptureLongKey(key, aModifiersMask, aModifier, aLongType);
   454         bool result = result & cancelCaptureLongKey(key, aModifiersMask, aModifier, aLongType);
   442     }
   455     }
   443     return result;
   456     return result;
   444 }
   457 }
   445 
   458 
   446 /*!
   459 /*!
   456         XQKeyCapture::LongFlags aLongType)
   469         XQKeyCapture::LongFlags aLongType)
   457 {
   470 {
   458     TUint key;
   471     TUint key;
   459     bool result = true;
   472     bool result = true;
   460     foreach (key, list) {
   473     foreach (key, list) {
   461         bool result = result & d->cancelCaptureLongKey(key, aModifiersMask, aModifier, aLongType);
   474         bool result = result & cancelCaptureLongKey(key, aModifiersMask, aModifier, aLongType);
   462     }
   475     }
   463     return result;
   476     return result;
   464 }
   477 }
   465 
   478 
   466 /*!
   479 /*!
   475         Qt::KeyboardModifiers aModifier)
   488         Qt::KeyboardModifiers aModifier)
   476 {
   489 {
   477     Qt::Key key;
   490     Qt::Key key;
   478     bool result = true;
   491     bool result = true;
   479     foreach (key, list) {
   492     foreach (key, list) {
   480         bool result = result & d->cancelCaptureKeyUpAndDowns(key, aModifiersMask, aModifier);
   493         bool result = result & cancelCaptureKeyUpAndDowns(key, aModifiersMask, aModifier);
   481     }
   494     }
   482     return result;
   495     return result;
   483 }
   496 }
   484 
   497 
   485 /*!
   498 /*!
   494         Qt::KeyboardModifiers aModifier)
   507         Qt::KeyboardModifiers aModifier)
   495 {
   508 {
   496     TUint key;
   509     TUint key;
   497     bool result = true;
   510     bool result = true;
   498     foreach (key, list) {
   511     foreach (key, list) {
   499         bool result = result & d->cancelCaptureKeyUpAndDowns(key, aModifiersMask, aModifier);
   512         bool result = result & cancelCaptureKeyUpAndDowns(key, aModifiersMask, aModifier);
   500     }
   513     }
   501     return result;
   514     return result;
   502 }
   515 }
   503 
   516 
   504 /*!
   517 /*!
   523  \param aKey A Qt key.
   536  \param aKey A Qt key.
   524  \param aModifiersMask
   537  \param aModifiersMask
   525  \param aModifier 
   538  \param aModifier 
   526  \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false.
   539  \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false.
   527  */
   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  */
   528 bool XqKeyCapture::captureKey(Qt::Key aKey,
   548 bool XqKeyCapture::captureKey(Qt::Key aKey,
   529     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   549     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   530 {
   550 {
   531     return d->captureKey(aKey, aModifiersMask, aModifier);
   551     return d->doCapture(d->mMapper->mapQtToS60Key(aKey), aModifiersMask, aModifier,
       
   552         CaptureRequest::CaptureRequestTypeNormal);
   532 }
   553 }
   533 
   554 
   534 /*!
   555 /*!
   535  Selects a given key for capturing key pressing. Requires a S60 key code (TKeyCode).
   556  Selects a given key for capturing key pressing. Requires a S60 key code (TKeyCode).
   536  \param aKey A S60 key code (TKeyCode).
   557  \param aKey A S60 key code (TKeyCode).
   539  \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false.
   560  \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false.
   540  */
   561  */
   541 bool XqKeyCapture::captureKey(TUint aKey,
   562 bool XqKeyCapture::captureKey(TUint aKey,
   542     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   563     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   543 {
   564 {
   544     return d->captureKey(aKey, aModifiersMask, aModifier);
   565     return d->doCapture(aKey, aModifiersMask, aModifier,
       
   566         CaptureRequest::CaptureRequestTypeNormal);
   545 }
   567 }
   546 
   568 
   547 /*!
   569 /*!
   548  Selects a given key for capturing long pressing. Requires a Qt key code.
   570  Selects a given key for capturing long pressing. Requires a Qt key code.
   549  \param aKey A Qt key.
   571  \param aKey A Qt key.
   553  */
   575  */
   554 bool XqKeyCapture::captureLongKey(Qt::Key aKey,
   576 bool XqKeyCapture::captureLongKey(Qt::Key aKey,
   555     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier,
   577     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier,
   556     XqKeyCapture::LongFlags aLongType)
   578     XqKeyCapture::LongFlags aLongType)
   557 {
   579 {
   558     return d->captureLongKey(aKey, aModifiersMask, aModifier, static_cast<XQKeyCapture::LongFlags>(aLongType));
   580     return d->doCapture(d->mMapper->mapQtToS60Key(aKey), aModifiersMask, aModifier,
       
   581         CaptureRequest::CaptureRequestTypeLong, (XQKeyCapture::LongFlags)aLongType);
   559 }
   582 }
   560 
   583 
   561 /*!
   584 /*!
   562  Selects a given key for capturing long pressing. Requires a S60 key code (TKeyCode).
   585  Selects a given key for capturing long pressing. Requires a S60 key code (TKeyCode).
   563  \param aKey A S60 key code (TKeyCode).
   586  \param aKey A S60 key code (TKeyCode).
   567  */
   590  */
   568 bool XqKeyCapture::captureLongKey(TUint aKey,
   591 bool XqKeyCapture::captureLongKey(TUint aKey,
   569     Qt::KeyboardModifiers aModifiersMap, Qt::KeyboardModifiers aModifier,
   592     Qt::KeyboardModifiers aModifiersMap, Qt::KeyboardModifiers aModifier,
   570     XqKeyCapture::LongFlags aLongType)
   593     XqKeyCapture::LongFlags aLongType)
   571 {
   594 {
   572     return d->captureLongKey(aKey, aModifiersMap, aModifier, static_cast<XQKeyCapture::LongFlags>(aLongType));
   595     return d->doCapture(aKey, aModifiersMap, aModifier,
       
   596         CaptureRequest::CaptureRequestTypeLong, (XQKeyCapture::LongFlags)aLongType);
   573 }
   597 }
   574 
   598 
   575 /*!
   599 /*!
   576  Selects a given key for capturing pressing up and down. Requires a Qt key code.
   600  Selects a given key for capturing pressing up and down. Requires a Qt key code.
   577  \param aKey A Qt key.
   601  \param aKey A Qt key.
   580  \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false.
   604  \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false.
   581  */
   605  */
   582 bool XqKeyCapture::captureKeyUpAndDowns(Qt::Key aKey,
   606 bool XqKeyCapture::captureKeyUpAndDowns(Qt::Key aKey,
   583     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   607     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   584 {
   608 {
   585     return d->captureKeyUpAndDowns(aKey, aModifiersMask, aModifier);
   609     return d->doCapture(d->mMapper->mapQtToS60ScanCodes(aKey), aModifiersMask,
       
   610         aModifier, CaptureRequest::CaptureRequestTypeUpAndDown);
   586 }
   611 }
   587 
   612 
   588 /*!
   613 /*!
   589  Selects a given key for capturing pressing up and down. Requires a S60 key scan code (TStdScanCode).
   614  Selects a given key for capturing pressing up and down. Requires a S60 key scan code (TStdScanCode).
   590  \param aKey A S60 key scan code (TStdScanCode).
   615  \param aKey A S60 key scan code (TStdScanCode).
   593  \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false.
   618  \retval Returns true if aKey was succesfully added to the capturing system, otherwise returns false.
   594  */
   619  */
   595 bool XqKeyCapture::captureKeyUpAndDowns(TUint aKey,
   620 bool XqKeyCapture::captureKeyUpAndDowns(TUint aKey,
   596     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   621     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   597 {
   622 {
   598     return d->captureKeyUpAndDowns(aKey, aModifiersMask, aModifier);
   623     return d->doCapture(aKey, aModifiersMask,
       
   624         aModifier, CaptureRequest::CaptureRequestTypeUpAndDown);
   599 }
   625 }
   600 
   626 
   601 /*!
   627 /*!
   602  Deselects a given key from key capturing. Requires a Qt key code.
   628  Deselects a given key from key capturing. Requires a Qt key code.
   603  \param aKey A Qt key.
   629  \param aKey A Qt key.
   606  \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false.
   632  \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false.
   607  */
   633  */
   608 bool XqKeyCapture::cancelCaptureKey(Qt::Key aKey,
   634 bool XqKeyCapture::cancelCaptureKey(Qt::Key aKey,
   609     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   635     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   610 {
   636 {
   611     return d->cancelCaptureKey(aKey, aModifiersMask, aModifier);
   637     return d->doCancelCapture(d->mMapper->mapQtToS60Key(aKey),
       
   638         aModifiersMask, aModifier,
       
   639         CaptureRequest::CaptureRequestTypeNormal);
   612 }
   640 }
   613 
   641 
   614 /*!
   642 /*!
   615  Deselects a given key from key capturing. Requires a S60 key code (TKeyCode).
   643  Deselects a given key from key capturing. Requires a S60 key code (TKeyCode).
   616  \param aKey A S60 key code (TKeyCode).
   644  \param aKey A S60 key code (TKeyCode).
   619  \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false.
   647  \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false.
   620  */
   648  */
   621 bool XqKeyCapture::cancelCaptureKey(TUint aKey,
   649 bool XqKeyCapture::cancelCaptureKey(TUint aKey,
   622     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   650     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   623 {
   651 {
   624     return d->cancelCaptureKey(aKey, aModifiersMask, aModifier);
   652     return d->doCancelCapture(aKey, aModifiersMask, aModifier,
       
   653         CaptureRequest::CaptureRequestTypeNormal);
   625 }
   654 }
   626 
   655 
   627 /*!
   656 /*!
   628  Deselects a given key from capturing long pressing. Requires a Qt key code.
   657  Deselects a given key from capturing long pressing. Requires a Qt key code.
   629  \param aKey A Qt key.
   658  \param aKey A Qt key.
   633  */
   662  */
   634 bool XqKeyCapture::cancelCaptureLongKey(Qt::Key aKey,
   663 bool XqKeyCapture::cancelCaptureLongKey(Qt::Key aKey,
   635     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier,
   664     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier,
   636     XqKeyCapture::LongFlags aLongType)
   665     XqKeyCapture::LongFlags aLongType)
   637 {
   666 {
   638     return d->cancelCaptureLongKey(aKey, aModifiersMask, aModifier,
   667     return d->doCancelCapture(d->mMapper->mapQtToS60Key(aKey), aModifiersMask,
   639         static_cast<XQKeyCapture::LongFlags>(aLongType));
   668         aModifier, CaptureRequest::CaptureRequestTypeLong, (XQKeyCapture::LongFlags)aLongType);
   640 }
   669 }
   641 
   670 
   642 /*!
   671 /*!
   643  Deselects a given key from capturing long pressing. Requires a S60 key code (TKeyCode).
   672  Deselects a given key from capturing long pressing. Requires a S60 key code (TKeyCode).
   644  \param aKey A S60 key code (TKeyCode).
   673  \param aKey A S60 key code (TKeyCode).
   648  */
   677  */
   649 bool XqKeyCapture::cancelCaptureLongKey(TUint aKey,
   678 bool XqKeyCapture::cancelCaptureLongKey(TUint aKey,
   650     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier,
   679     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier,
   651     XqKeyCapture::LongFlags aLongType)
   680     XqKeyCapture::LongFlags aLongType)
   652 {
   681 {
   653     return d->cancelCaptureLongKey(aKey, aModifiersMask, aModifier,
   682     return d->doCancelCapture(aKey, aModifiersMask, aModifier,
   654         static_cast<XQKeyCapture::LongFlags>(aLongType));
   683         CaptureRequest::CaptureRequestTypeLong, (XQKeyCapture::LongFlags)aLongType);
   655 }
   684 }
   656 
   685 
   657 /*!
   686 /*!
   658  Deselects a given key from capturing pressing up and down. Requires a Qt key code.
   687  Deselects a given key from capturing pressing up and down. Requires a Qt key code.
   659  \param aKey A Qt key.
   688  \param aKey A Qt key.
   662  \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false.
   691  \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false.
   663  */
   692  */
   664 bool XqKeyCapture::cancelCaptureKeyUpAndDowns(Qt::Key aKey,
   693 bool XqKeyCapture::cancelCaptureKeyUpAndDowns(Qt::Key aKey,
   665     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   694     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   666 {
   695 {
   667     return d->cancelCaptureKeyUpAndDowns(aKey, aModifiersMask, aModifier);
   696     return d->doCancelCapture(d->mMapper->mapQtToS60ScanCodes(aKey),
       
   697         aModifiersMask, aModifier,
       
   698         CaptureRequest::CaptureRequestTypeUpAndDown);
   668 }
   699 }
   669 
   700 
   670 /*!
   701 /*!
   671  Deselects a given key from capturing pressing up and down. Requires a S60 key scan code (TStdScanCode).
   702  Deselects a given key from capturing pressing up and down. Requires a S60 key scan code (TStdScanCode).
   672  \param aKey A S60 key scan code (TStdScanCode).
   703  \param aKey A S60 key scan code (TStdScanCode).
   675  \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false.
   706  \retval Returns true if aKey was succesfully removed from the capturing system, otherwise returns false.
   676  */
   707  */
   677 bool XqKeyCapture::cancelCaptureKeyUpAndDowns(TUint aKey,
   708 bool XqKeyCapture::cancelCaptureKeyUpAndDowns(TUint aKey,
   678     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   709     Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier)
   679 {
   710 {
   680     return d->cancelCaptureKeyUpAndDowns(aKey, aModifiersMask, aModifier);
   711     return d->doCancelCapture(aKey, aModifiersMask, aModifier,
       
   712         CaptureRequest::CaptureRequestTypeUpAndDown);
   681 }
   713 }
   682 
   714 
   683 /*!
   715 /*!
   684  Returns latest error string.
   716  Returns latest error string.
   685  \retval Latest error string.
   717  \retval Latest error string.
   710         Qt::KeyboardModifiers aModifier)
   742         Qt::KeyboardModifiers aModifier)
   711 {
   743 {
   712     Qt::Key key;
   744     Qt::Key key;
   713     bool result = true;
   745     bool result = true;
   714     foreach (key, list) {
   746     foreach (key, list) {
   715         bool result = result & d->captureKey(key, aModifiersMask, aModifier);
   747         bool result = result & captureKey(key, aModifiersMask, aModifier);
   716     }
   748     }
   717     return result;
   749     return result;
   718 }
   750 }
   719 
   751 
   720 /*!
   752 /*!
   729         Qt::KeyboardModifiers aModifier)
   761         Qt::KeyboardModifiers aModifier)
   730 {
   762 {
   731     TUint key;
   763     TUint key;
   732     bool result = true;
   764     bool result = true;
   733     foreach (key, list) {
   765     foreach (key, list) {
   734         bool result = result & d->captureKey(key, aModifiersMask, aModifier);
   766         bool result = result & captureKey(key, aModifiersMask, aModifier);
   735     }
   767     }
   736     return result;
   768     return result;
   737 }
   769 }
   738 
   770 
   739 /*!
   771 /*!
   749         XqKeyCapture::LongFlags aLongType)
   781         XqKeyCapture::LongFlags aLongType)
   750 {
   782 {
   751     Qt::Key key;
   783     Qt::Key key;
   752     bool result = true;
   784     bool result = true;
   753     foreach (key, list) {
   785     foreach (key, list) {
   754         bool result = result & d->captureLongKey(key, aModifiersMask, aModifier, static_cast<XQKeyCapture::LongFlags>(aLongType));
   786         bool result = result & captureLongKey(key, aModifiersMask, aModifier, aLongType);
   755     }
   787     }
   756     return result;
   788     return result;
   757 }
   789 }
   758 
   790 
   759 /*!
   791 /*!
   769         XqKeyCapture::LongFlags aLongType)
   801         XqKeyCapture::LongFlags aLongType)
   770 {
   802 {
   771     TUint key;
   803     TUint key;
   772     bool result = true;
   804     bool result = true;
   773     foreach (key, list) {
   805     foreach (key, list) {
   774         bool result = result & d->captureLongKey(key, aModifiersMask, aModifier, static_cast<XQKeyCapture::LongFlags>(aLongType));
   806         bool result = result & captureLongKey(key, aModifiersMask, aModifier, aLongType);
   775     }
   807     }
   776     return result;
   808     return result;
   777 }
   809 }
   778 
   810 
   779 /*!
   811 /*!
   788         Qt::KeyboardModifiers aModifier)
   820         Qt::KeyboardModifiers aModifier)
   789 {
   821 {
   790     Qt::Key key;
   822     Qt::Key key;
   791     bool result = true;
   823     bool result = true;
   792     foreach (key, list) {
   824     foreach (key, list) {
   793         bool result = result & d->captureKeyUpAndDowns(key, aModifiersMask, aModifier);
   825         bool result = result & captureKeyUpAndDowns(key, aModifiersMask, aModifier);
   794     }
   826     }
   795     return result;
   827     return result;
   796 }
   828 }
   797 
   829 
   798 /*!
   830 /*!
   807         Qt::KeyboardModifiers aModifier)
   839         Qt::KeyboardModifiers aModifier)
   808 {
   840 {
   809     TUint key;
   841     TUint key;
   810     bool result = true;
   842     bool result = true;
   811     foreach (key, list) {
   843     foreach (key, list) {
   812         bool result = result & d->captureKeyUpAndDowns(key, aModifiersMask, aModifier);
   844         bool result = result & captureKeyUpAndDowns(key, aModifiersMask, aModifier);
   813     }
   845     }
   814     return result;
   846     return result;
   815 }
   847 }
   816 
   848 
   817 /*!
   849 /*!
   826         Qt::KeyboardModifiers aModifier)
   858         Qt::KeyboardModifiers aModifier)
   827 {
   859 {
   828     Qt::Key key;
   860     Qt::Key key;
   829     bool result = true;
   861     bool result = true;
   830     foreach (key, list) {
   862     foreach (key, list) {
   831         bool result = result & d->cancelCaptureKey(key, aModifiersMask, aModifier);
   863         bool result = result & cancelCaptureKey(key, aModifiersMask, aModifier);
   832     }
   864     }
   833     return result;
   865     return result;
   834 }
   866 }
   835 
   867 
   836 /*!
   868 /*!
   845         Qt::KeyboardModifiers aModifier)
   877         Qt::KeyboardModifiers aModifier)
   846 {
   878 {
   847     TUint key;
   879     TUint key;
   848     bool result = true;
   880     bool result = true;
   849     foreach (key, list) {
   881     foreach (key, list) {
   850         bool result = result & d->cancelCaptureKey(key, aModifiersMask, aModifier);
   882         bool result = result & cancelCaptureKey(key, aModifiersMask, aModifier);
   851     }
   883     }
   852     return result;
   884     return result;
   853 }
   885 }
   854 
   886 
   855 /*!
   887 /*!
   865         XqKeyCapture::LongFlags aLongType)
   897         XqKeyCapture::LongFlags aLongType)
   866 {
   898 {
   867     Qt::Key key;
   899     Qt::Key key;
   868     bool result = true;
   900     bool result = true;
   869     foreach (key, list) {
   901     foreach (key, list) {
   870         bool result = result & d->cancelCaptureLongKey(key, aModifiersMask, aModifier, static_cast<XQKeyCapture::LongFlags>(aLongType));
   902         bool result = result & cancelCaptureLongKey(key, aModifiersMask, aModifier, aLongType);
   871     }
   903     }
   872     return result;
   904     return result;
   873 }
   905 }
   874 
   906 
   875 /*!
   907 /*!
   885         XqKeyCapture::LongFlags aLongType)
   917         XqKeyCapture::LongFlags aLongType)
   886 {
   918 {
   887     TUint key;
   919     TUint key;
   888     bool result = true;
   920     bool result = true;
   889     foreach (key, list) {
   921     foreach (key, list) {
   890         bool result = result & d->cancelCaptureLongKey(key, aModifiersMask, aModifier, static_cast<XQKeyCapture::LongFlags>(aLongType));
   922         bool result = result & cancelCaptureLongKey(key, aModifiersMask, aModifier, aLongType);
   891     }
   923     }
   892     return result;
   924     return result;
   893 }
   925 }
   894 
   926 
   895 /*!
   927 /*!
   904         Qt::KeyboardModifiers aModifier)
   936         Qt::KeyboardModifiers aModifier)
   905 {
   937 {
   906     Qt::Key key;
   938     Qt::Key key;
   907     bool result = true;
   939     bool result = true;
   908     foreach (key, list) {
   940     foreach (key, list) {
   909         bool result = result & d->cancelCaptureKeyUpAndDowns(key, aModifiersMask, aModifier);
   941         bool result = result & cancelCaptureKeyUpAndDowns(key, aModifiersMask, aModifier);
   910     }
   942     }
   911     return result;
   943     return result;
   912 }
   944 }
   913 
   945 
   914 /*!
   946 /*!
   923         Qt::KeyboardModifiers aModifier)
   955         Qt::KeyboardModifiers aModifier)
   924 {
   956 {
   925     TUint key;
   957     TUint key;
   926     bool result = true;
   958     bool result = true;
   927     foreach (key, list) {
   959     foreach (key, list) {
   928         bool result = result & d->cancelCaptureKeyUpAndDowns(key, aModifiersMask, aModifier);
   960         bool result = result & cancelCaptureKeyUpAndDowns(key, aModifiersMask, aModifier);
   929     }
   961     }
   930     return result;
   962     return result;
   931 }
   963 }