qtmobileextensions/src/keycapture/capturerequest_s60.h
branchRCL_3
changeset 10 cd2778e5acfe
parent 9 5d007b20cfd0
child 11 19a54be74e5e
equal deleted inserted replaced
9:5d007b20cfd0 10:cd2778e5acfe
     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 #ifndef CAPTUREREQUEST_S60_H
       
    23 #define CAPTUREREQUEST_S60_H
       
    24 
       
    25 #include <qnamespace.h>
       
    26 #include <QMap>
       
    27 
       
    28 #include "xqkeycapture.h"
       
    29 
       
    30 class RWindowGroup;
       
    31 class QKeyMapper;
       
    32 
       
    33 #ifdef _XQKEYCAPTURE_UNITTEST_
       
    34     class MyTestWindowGroup;
       
    35 #endif
       
    36 
       
    37 class CaptureRequest {
       
    38 
       
    39 public:
       
    40     enum CaptureRequestType {
       
    41     CaptureRequestTypeNormal,
       
    42     CaptureRequestTypeLong,
       
    43     CaptureRequestTypeUpAndDown
       
    44     };
       
    45 
       
    46     CaptureRequest(TUint aKey, Qt::KeyboardModifiers aModifiersMask,
       
    47         Qt::KeyboardModifiers aModifier, CaptureRequestType aRequestType, XQKeyCapture::LongFlags aLongKeyFlags,
       
    48 #ifndef _XQKEYCAPTURE_UNITTEST_
       
    49     RWindowGroup* aGroup
       
    50 #else
       
    51     MyTestWindowGroup* aGroup
       
    52 #endif
       
    53     );
       
    54 
       
    55     ~CaptureRequest();
       
    56 
       
    57     int request();
       
    58 
       
    59     int cancel();
       
    60 
       
    61     bool operator==(const CaptureRequest& other) const;
       
    62 
       
    63     bool matches(TUint aKey, Qt::KeyboardModifiers aModifiersMask, Qt::KeyboardModifiers aModifier,
       
    64         CaptureRequestType aRequestType, 
       
    65         XQKeyCapture::LongFlags captureLongFlag = XQKeyCapture::LongWaitNotApplicable) const;
       
    66 
       
    67 private:
       
    68     TUint translatedModifierMask();
       
    69     TUint translatedModifier();
       
    70     TUint translatedModifier(Qt::KeyboardModifiers aModifier);
       
    71     
       
    72 private:
       
    73     const TUint mKey;
       
    74     const Qt::KeyboardModifiers mModifiersMask;
       
    75     const Qt::KeyboardModifiers mModifier;
       
    76     const CaptureRequestType mRequestType;
       
    77     const XQKeyCapture::LongFlags longKeyFlags;
       
    78     
       
    79     long int mRequestHandle;
       
    80     long int mAdditionalRequestHandle;
       
    81     
       
    82 #ifndef _XQKEYCAPTURE_UNITTEST_
       
    83     RWindowGroup* mGroup; //not owned
       
    84 #else
       
    85     MyTestWindowGroup* mGroup;
       
    86 #endif
       
    87     QKeyMapper* mMapper;
       
    88 //    QMap<Qt::Key, TUint> *mQtToS60KeyMap;//not owned
       
    89 //    QMap<Qt::Key, TUint> *mQtToS60StdScanCodeMap;    //not owned
       
    90 };
       
    91 
       
    92 #endif /* CAPTUREREQUEST_S60_H */
       
    93