phoneapp/phoneui2/tsrc/ut_phoneuikeyeventadapter/cphoneuicontroller_stub.cpp
changeset 22 6bb1b21d2484
parent 21 92ab7f8d0eab
child 51 f39ed5e045e0
equal deleted inserted replaced
21:92ab7f8d0eab 22:6bb1b21d2484
    16 */
    16 */
    17 
    17 
    18 // INCLUDE FILES
    18 // INCLUDE FILES
    19 
    19 
    20 #include "CPhoneUIController_Stub.h"
    20 #include "CPhoneUIController_Stub.h"
       
    21 #include "phoneconstants.h"
    21 
    22 
    22 int m_scan_code;
    23 int m_scan_code;
    23 int m_code;
    24 int m_code;
    24 int m_scan_code_down;
    25 int m_scan_code_down;
    25 int m_code_down;
    26 int m_code_down;
    26 int m_repeats;
    27 int m_repeats;
    27 bool m_leave;
    28 bool m_leave;
       
    29 TEventCode m_eventCode;
    28 
    30 
    29 
    31 
    30 // ================= MEMBER FUNCTIONS =======================
    32 // ================= MEMBER FUNCTIONS =======================
    31 
    33 
    32 // -----------------------------------------------------------
    34 // -----------------------------------------------------------
    34 // C++ default constructor can NOT contain any code, that
    36 // C++ default constructor can NOT contain any code, that
    35 // might leave.
    37 // might leave.
    36 // -----------------------------------------------------------
    38 // -----------------------------------------------------------
    37 //
    39 //
    38 CPhoneUIController_Stub::CPhoneUIController_Stub()  
    40 CPhoneUIController_Stub::CPhoneUIController_Stub()  
    39     {
    41 {
    40     m_leave = false;	
    42     m_leave = false;	
    41     }
    43 }
    42 
    44 
    43 
    45 
    44 
    46 
    45 // -----------------------------------------------------------
    47 // -----------------------------------------------------------
    46 // Destructor
    48 // Destructor
    47 // 
    49 // 
    48 // -----------------------------------------------------------
    50 // -----------------------------------------------------------
    49 
    51 
    50 CPhoneUIController_Stub::~CPhoneUIController_Stub()
    52 CPhoneUIController_Stub::~CPhoneUIController_Stub()
    51     {
    53 {
    52 
    54 }
    53     }
       
    54 
    55 
    55 
    56 
    56 
    57 
    57 // ---------------------------------------------------------
    58 // ---------------------------------------------------------
    58 // CPhoneUIController_Stub::HandleKeyEventL
    59 // CPhoneUIController_Stub::HandleKeyEventL
    59 // ---------------------------------------------------------
    60 // ---------------------------------------------------------
    60 //
    61 //
    61 TKeyResponse CPhoneUIController_Stub::HandleKeyEventL(
    62 TKeyResponse CPhoneUIController_Stub::HandleKeyEventL(
    62     const TKeyEvent& aKeyEvent,
    63     const TKeyEvent& aKeyEvent,
    63     TEventCode aEventCode )
    64     TEventCode aEventCode )
    64     {
    65 {
    65     m_scan_code = 0;
    66     m_scan_code = 0;
    66     m_code = 0;
    67     m_code = 0;
    67     m_scan_code_down = 0;
    68     m_scan_code_down = 0;
    68     m_code_down = 0;
    69     m_code_down = 0;
       
    70     m_eventCode = aEventCode;
    69     
    71     
    70     if (m_leave)
    72     if (m_leave) {
    71         {
       
    72         User::Leave(KErrArgument);
    73         User::Leave(KErrArgument);
    73         }
    74     }
    74         
    75         
    75     m_repeats = aKeyEvent.iRepeats;
    76     m_repeats = aKeyEvent.iRepeats;
    76     
    77     
    77     if ( EEventKeyUp == aEventCode )
    78     if(EEventKeyUp == aEventCode) {
    78         {
       
    79         m_scan_code = aKeyEvent.iScanCode;
    79         m_scan_code = aKeyEvent.iScanCode;
    80         m_code = aKeyEvent.iCode;
    80         m_code = aKeyEvent.iCode;
    81         }
    81     } else if(EEventKey == aEventCode) {
    82     else if ( EEventKey == aEventCode )
       
    83         {
       
    84         m_scan_code_down = aKeyEvent.iScanCode;
    82         m_scan_code_down = aKeyEvent.iScanCode;
    85         m_code_down = aKeyEvent.iCode;       	
    83         m_code_down = aKeyEvent.iCode;       	
    86         }
    84     } else if(EEventLongPress) {
       
    85         m_scan_code = aKeyEvent.iScanCode;
       
    86         m_code = aKeyEvent.iCode;
       
    87     }
    87     
    88     
    88     return EKeyWasNotConsumed;
    89     return EKeyWasNotConsumed;
    89     }
    90 }
    90 
    91 
    91 
    92 
    92 
    93 
    93 //  End of File  
    94 //  End of File