idlefw/plugins/wsplugin/inc/keylockhandler.h
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Keylock handler for Active Idle WS Plug-in.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_AIWSPLUGIN_KEYLOCKHANDLER_H
       
    20 #define C_AIWSPLUGIN_KEYLOCKHANDLER_H
       
    21 
       
    22 #include "eventhandler.h"
       
    23 #include "keylockcontrol.h"
       
    24 #include "keypadsettings.h"
       
    25 #include "keyhandlertimer.h"
       
    26 
       
    27 class CKeyLockPolicyApi;
       
    28 namespace AiWsPlugin {
       
    29 
       
    30 class TKeylockState;
       
    31 
       
    32 /**
       
    33  *  @ingroup group_wsplugin
       
    34  *
       
    35  *  Keylock handler for Active Idle WS Plug-in. 
       
    36  *
       
    37  *  Monitors key presses that activate keyboard lock on the device.
       
    38  *
       
    39  *  @since S60 3.2
       
    40  */
       
    41 class CKeyLockHandler : 
       
    42         public CEventHandler, 
       
    43         public MKeyLockHandlerControl,
       
    44         public MHandlerTimer
       
    45     {
       
    46 public:
       
    47 
       
    48     static CKeyLockHandler* NewLC();
       
    49 
       
    50     ~CKeyLockHandler();
       
    51 
       
    52 // from MHandlerTimer
       
    53 
       
    54     void TimerDone();    
       
    55 
       
    56 private:
       
    57 
       
    58 // from base class CEventHandler
       
    59 
       
    60     void SetUiStateQuery( MUiState& aUiState );
       
    61     
       
    62     void FocusChanged( TBool aState );
       
    63     
       
    64     TBool OfferRawEvent(const TRawEvent& aRawEvent);
       
    65 
       
    66 // from base class MKeyLockHandlerControl
       
    67 
       
    68     const TKeypadSettings& Settings() const;
       
    69     
       
    70     void StartTimeoutTimer( TInt aTimeout );
       
    71     
       
    72     void StopTimeoutTimer();
       
    73     
       
    74     void ActivateKeypadLock();
       
    75     
       
    76     void CancelKeypadLock();
       
    77     
       
    78     void KeypadLockTimeout();
       
    79     
       
    80     void SetNextState( const TKeylockState& aState );
       
    81     
       
    82     void ActivateNextState();
       
    83     
       
    84     void SetLastLockKeyScanCode( TInt aScanCode );
       
    85     
       
    86     TInt LastLockKeyScanCode() const;
       
    87     
       
    88     TBool HasFocus();
       
    89 
       
    90     TBool TimeoutTimerActive();
       
    91     
       
    92 // construction
       
    93 
       
    94     CKeyLockHandler();
       
    95     
       
    96     void ConstructL();
       
    97     
       
    98     static TInt TimerElapsed( TAny* aSelf );
       
    99     
       
   100     TBool IsFirstLockKey( TInt aScanCode );
       
   101     
       
   102     TBool IsSecondLockKey( TInt aScanCode );
       
   103 
       
   104 private: // data
       
   105     /**
       
   106      * Current state of this object.
       
   107      * Not owned.
       
   108      */
       
   109     const TKeylockState* iCurrentState;
       
   110 
       
   111     /**
       
   112      * Next state of this object.
       
   113      * Not owned.
       
   114      */
       
   115     const TKeylockState* iNextState;
       
   116     
       
   117     /**
       
   118      * Timeout timer for keypad lock.
       
   119      * Own.
       
   120      */
       
   121     CPeriodic* iKeypadLockTimer;
       
   122 
       
   123     /**
       
   124      * Key lock settings.
       
   125      */
       
   126     TKeypadSettings iSettings;
       
   127     
       
   128     /**
       
   129      * Last value of SetLastLockKeyScanCode( TInt aScanCode).
       
   130      */
       
   131     TInt iLastLockKeyScanCode;
       
   132     
       
   133     /**
       
   134      * Pointer to ui state.
       
   135      * Not owned.
       
   136      */
       
   137     MUiState* iUiState;
       
   138     
       
   139     /**
       
   140      * For checking keylock buttons
       
   141      * Own
       
   142      */
       
   143     CKeyLockPolicyApi *iKeylockApi;
       
   144     };
       
   145 
       
   146 } // namespace AiWsPlugin
       
   147 
       
   148 
       
   149 #endif // C_AIWSPLUGIN_KEYLOCKHANDLER_H