securitydialogs/lockapp/inc/lockappkeyguardcontrol.h
branchRCL_3
changeset 22 03674e5abf46
parent 0 164170e6151a
equal deleted inserted replaced
21:09b1ac925e3f 22:03674e5abf46
       
     1 /*
       
     2 * Copyright (c) 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:  Keyguard UI (window-owning compound control)
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __LOCKAPPKEYGUARDCONTROL_H__
       
    20 #define __LOCKAPPKEYGUARDCONTROL_H__
       
    21 
       
    22 // INCLUDES
       
    23 #include "lockappbasecontrol.h"
       
    24 #include "lockappobserverinterface.h"
       
    25 #include <LockDomainCRKeys.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CLockAppPubSubObserver;
       
    29 class CLockAppCenRepObserver;
       
    30 class CUserActivityManager;
       
    31 
       
    32 /**
       
    33  *  CLockAppKeyguardControl class represents the keyguard state in the state machine. 
       
    34  *  Window-owning compound control that provides visible keyguard user interface. 
       
    35  *  Owns all keyguard dialogs and commands received from the child controls like 
       
    36  *  dialogs and cba.
       
    37  *
       
    38  *  @lib    lockapp
       
    39  *  @since  5.0
       
    40  *  @author Joona Petrell
       
    41  *  @author Tamas Koteles
       
    42  *  @see    CLockAppBaseControl
       
    43  *  @see    MLockAppStateControl
       
    44  *  @see    CUserActivityManager
       
    45  *  @see    CLockAppPubSubObserver
       
    46  *  @see    CLockAppCenRepObserver
       
    47  */
       
    48 class CLockAppKeyguardControl : public CLockAppBaseControl, public MEikCommandObserver,
       
    49         public MLockAppObserverInterface
       
    50     {
       
    51     public:
       
    52 
       
    53         /**
       
    54          * Two-phased constructor.
       
    55          *
       
    56          * @param aStateControl reference to the main state control
       
    57          */
       
    58         static CLockAppKeyguardControl* NewL( MLockAppStateControl& aStateControl );
       
    59 
       
    60         /**
       
    61          * Destructor.
       
    62          */
       
    63         ~CLockAppKeyguardControl( );
       
    64 
       
    65         TBool ActivationAllowedL( );
       
    66 
       
    67         TBool DeActivationAllowedL( );
       
    68 
       
    69         virtual void HandleActivateEventL( TUint aEnvMask );
       
    70 
       
    71         virtual void HandleDeActivateEventL( TUint aEnvMask );
       
    72 
       
    73         virtual void HandleEnvironmentChange( TUint aEnvMask, TUint aEventMask );
       
    74 
       
    75     private:
       
    76 
       
    77         /**
       
    78          * C++ default constructor.
       
    79          *
       
    80          * @param aStateControl reference to the main state control
       
    81          */
       
    82         CLockAppKeyguardControl( MLockAppStateControl& aStateControl );
       
    83 
       
    84         /**
       
    85          * Second constructor that can fail (leave).
       
    86          */
       
    87         void ConstructL( );
       
    88 
       
    89     public:
       
    90 
       
    91         void DisplayLockedNote( );
       
    92 
       
    93         void DisplayKeysLockedNote( );
       
    94 
       
    95         void DisplayKeysActiveNote( );
       
    96 
       
    97     public:
       
    98 
       
    99         void HandleResourceChange( TInt aType );
       
   100 
       
   101         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   102 
       
   103     public:
       
   104 
       
   105         /**
       
   106          * Handle Central Repository observer callback.
       
   107          */
       
   108         void HandleCenRepNotify( TUid aCenRepUid, TUint32 aKeyId, TInt aValue );
       
   109 
       
   110         /**
       
   111          * Handle Publish & Subscribe observer callback.
       
   112          */
       
   113         void HandlePubSubNotify( TUid aPubSubUid, TUint aKeyId, TInt aValue );
       
   114 
       
   115     private:
       
   116 
       
   117         TInt CountComponentControls( ) const;
       
   118 
       
   119         CCoeControl* ComponentControl( TInt aIndex ) const;
       
   120 
       
   121     private:
       
   122 
       
   123         /**
       
   124          * UI commands to parent using method ProcessCommandL.
       
   125          *
       
   126          * @param aCommandId Command to be handled
       
   127          */
       
   128         void ProcessCommandL( TInt aCommandId );
       
   129 
       
   130     private:
       
   131 
       
   132         void DisplayConfirmationNote( );
       
   133 
       
   134         // Is allowed to auto lock keys
       
   135         TBool AutoActivationAllowedL( );
       
   136 
       
   137         // Get auto keyguard timeout
       
   138         TInt GetAutoKeyguardTimeout( );
       
   139 
       
   140         // Starts monitoring user activity
       
   141         void StartActivityMonitoringL( );
       
   142 
       
   143         // Gets new autolock period and starts monitoring user activity
       
   144         void ResetInactivityTimeout( );
       
   145 
       
   146         // Stop monitoring user activity.
       
   147         void StopActivityMonitoring( );
       
   148 
       
   149         // Handles Active event. Called by ActivityManager
       
   150         static TInt HandleActiveEventL( TAny* aPtr );
       
   151 
       
   152         // Handles Inactive event. Called by ActivityManager
       
   153         static TInt HandleInactiveEventL( TAny* aPtr );
       
   154 
       
   155     private:
       
   156 
       
   157         /**
       
   158          * "Now press *" confirmation note.
       
   159          */
       
   160         CLockAppLockedNote* iConfirmationNote;
       
   161 
       
   162         /**
       
   163          * "Keys are locked. Press Unlock" note.
       
   164          */
       
   165         CLockAppLockedNote* iLockedNote;
       
   166 
       
   167         /**
       
   168          * "Keys locked" note
       
   169          */
       
   170         CLockAppLockedNote* iKeypadLockedNote;
       
   171 
       
   172         /**
       
   173          * "Keys activated" note
       
   174          */
       
   175         CLockAppLockedNote* iKeypadUnlockedNote;
       
   176 
       
   177         /**
       
   178          * CenRep observers
       
   179          */
       
   180         CLockAppCenRepObserver* iCRAutoKeyguardTime;
       
   181         CLockAppCenRepObserver* iCRPersistentKeyguardStatus;
       
   182 
       
   183         /**
       
   184          * PubSub observers
       
   185          */
       
   186         CLockAppPubSubObserver* iPSStartupObserver;
       
   187 
       
   188         /**
       
   189          * User activity manager
       
   190          */
       
   191         CUserActivityManager* iActivityManager;
       
   192 
       
   193         /**
       
   194          * Hardware support for keyguard
       
   195          */
       
   196         TLockHardware iHardwareSupport;
       
   197 
       
   198         /**
       
   199          * Flags if we had already normal state
       
   200          */
       
   201         TBool iAlreadyNormalState;
       
   202 
       
   203     };
       
   204 
       
   205 #endif // __LOCKAPPKEYGUARDCONTROL_H__
       
   206 
       
   207 // End of File