securitydialogs/lockapp/inc/lockappdevicelockcontrol.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:  Devicelock UI
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef LOCKAPPDEVICELOCKCONTROL_H
       
    20 #define LOCKAPPDEVICELOCKCONTROL_H
       
    21 
       
    22 // INCLUDES
       
    23 #include "lockappbasecontrol.h"
       
    24 #include "lockappobserverinterface.h"
       
    25 #include <etelmm.h>
       
    26 #include <rmmcustomapi.h>
       
    27 #include <LockDomainCRKeys.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CLockAppDevicelockContainer;
       
    31 class CUserActivityManager;
       
    32 class CLockAppPubSubObserver;
       
    33 class CLockAppCenRepObserver;
       
    34 
       
    35 /**
       
    36  *  CLockAppDevicelockControl represents the devicelock state in the state machine.
       
    37  *  Window-owning compound control that provides visible user interface,
       
    38  *  shows the lock bitmap by its child container, handles all events 
       
    39  *  and asks for security code if "unlock" is pressed.
       
    40  *
       
    41  *  @lib    lockapp
       
    42  *  @since  5.0
       
    43  *  @author Joona Petrell
       
    44  *  @author Tamas Koteles
       
    45  *  @see    CLockAppBaseControl
       
    46  *  @see    CLockAppDevicelockContainer
       
    47  *  @see    MLockAppStateControl
       
    48  *  @see    CUserActivityManager
       
    49  *  @see    CLockAppPubSubObserver
       
    50  *  @see    CLockAppCenRepObserver
       
    51  */
       
    52 class CLockAppDevicelockControl : public CLockAppBaseControl, public MEikCommandObserver,
       
    53 		public MLockAppObserverInterface
       
    54 	{
       
    55 	public:
       
    56 
       
    57 		/**
       
    58 		 * Two-phased constructor.
       
    59 		 */
       
    60 		static CLockAppDevicelockControl* NewL( MLockAppStateControl& aStateControl,
       
    61 				RWindowGroup& aWg );
       
    62 
       
    63 		/**
       
    64 		 * Destructor.
       
    65 		 */
       
    66 		~CLockAppDevicelockControl( );
       
    67 		
       
    68 		/**
       
    69 		 * Finalize the construction by connecting to Phone side.
       
    70 		 */
       
    71 		void CLockAppDevicelockControl::ConnectToPhoneL( RWindowGroup& aWg );
       
    72 
       
    73 		/**
       
    74 		 * Is it allowed to activate control.
       
    75 		 */
       
    76 		TBool ActivationAllowedL( TDevicelockReason aReason );
       
    77 
       
    78 		/**
       
    79 		 * is it allowed to deactivate control.
       
    80 		 */
       
    81 		TBool DeActivationAllowedL( );
       
    82 
       
    83 		virtual void HandleActivateEventL( TUint aEnvMask );
       
    84 
       
    85 		virtual void HandleDeActivateEventL( TUint aEnvMask );
       
    86 
       
    87 		virtual void HandleEnvironmentChange( TUint aEnvMask, TUint aEventMask );
       
    88 
       
    89 		/**
       
    90 		 * Set the reason for devicelock.
       
    91 		 */
       
    92 		void SetLockingReason( TDevicelockReason aReason );
       
    93 
       
    94 	private:
       
    95 
       
    96 		/**
       
    97 		 * Constructor for performing 1st stage construction
       
    98 		 */
       
    99 		CLockAppDevicelockControl( MLockAppStateControl& aStateControl );
       
   100 
       
   101 		/**
       
   102 		 * 2nd stage construction
       
   103 		 */
       
   104 		void ConstructL( RWindowGroup& aWg );
       
   105 
       
   106 		void DefinePubSubKeysL( );
       
   107 
       
   108 		void HandleUnlockCommandL( );
       
   109 
       
   110 	public:
       
   111 
       
   112 		/**
       
   113 		 * Handle Central Repository observer callback.
       
   114 		 */
       
   115 		void HandleCenRepNotify( TUid aCenRepUid, TUint32 aKeyId, TInt aValue );
       
   116 
       
   117 		/**
       
   118 		 * Handle Publish & Subscribe observer callback.
       
   119 		 */
       
   120 		void HandlePubSubNotify( TUid aPubSubUid, TUint aKeyId, TInt aValue );
       
   121 
       
   122 	public:
       
   123 
       
   124 		void HandleResourceChange( TInt aType );
       
   125 
       
   126 		TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   127 
       
   128 	private:
       
   129 
       
   130 		TInt CountComponentControls( ) const;
       
   131 
       
   132 		CCoeControl* ComponentControl( TInt aIndex ) const;
       
   133 
       
   134 	private:
       
   135 
       
   136 		/*
       
   137 		 * Checks whether we are booting from a Hidden Reset
       
   138 		 */
       
   139 		TBool IsHiddenReset( );
       
   140 
       
   141 		/*
       
   142 		 * Checks whether the pin is blocked.
       
   143 		 */
       
   144 		TBool IsPinBlocked( );
       
   145 
       
   146 		/*
       
   147 		 * Checks whether TARM admin flag is set (optionally unsets it).
       
   148 		 */
       
   149 		TBool TarmAdminFlag( TBool unSetFlag );
       
   150 
       
   151 		TBool ETelActivationAllowed( );
       
   152 
       
   153 		// Get autolock timeout (in seconds)
       
   154 		TInt GetAutoLockTimeout( );
       
   155 
       
   156 		// Starts monitoring user activity
       
   157 		void StartActivityMonitoringL( );
       
   158 
       
   159 		// Gets new autolock period and starts monitoring user activity
       
   160 		void ResetInactivityTimeout( );
       
   161 
       
   162 		// Stop monitoring user activity.
       
   163 		void StopActivityMonitoring( );
       
   164 
       
   165 		// Handles Active event. Called by ActivityManager
       
   166 		static TInt HandleActiveEventL( TAny* aPtr );
       
   167 
       
   168 		// Handles Inactive event. Called by ActivityManager
       
   169 		static TInt HandleInactiveEventL( TAny* aPtr );
       
   170 
       
   171 		// Set custom status pane visible/invisible
       
   172 		void ShowStatusPane( const TBool aVisible );
       
   173 
       
   174 	private:
       
   175 
       
   176 		/**
       
   177 		 * From @c MEikCommandObserver. Dialogs and CBA send
       
   178 		 * UI commands to parent using method ProcessCommandL.
       
   179 		 *
       
   180 		 * @param aCommandId Command to be handled
       
   181 		 */
       
   182 		void ProcessCommandL( TInt aCommandId );
       
   183 
       
   184 	private:
       
   185 
       
   186 		/*****************************************************
       
   187 		 *    S60 Customer / ETel
       
   188 		 *    S60 ETel API
       
   189 		 *****************************************************/
       
   190 
       
   191 		RTelServer iTelServer;
       
   192 		int iTelServerInitialized;
       
   193 		RMobilePhone iPhone;
       
   194 		int iPhoneInitialized;
       
   195 		RMmCustomAPI iCustomPhone;
       
   196 		int iCustomPhoneInitialized;
       
   197 
       
   198 		/**
       
   199 		 * Devicelock auto-locking timeout observer 
       
   200 		 * (value in minutes)
       
   201 		 */
       
   202 		CLockAppCenRepObserver* iCRAutoLockTime;
       
   203 
       
   204 		/**
       
   205 		 * Devicelock status publisher.
       
   206 		 * (Permamanent setting: On/Off)
       
   207 		 */
       
   208 		CLockAppCenRepObserver* iCRAutoLockStatus;
       
   209 
       
   210 		/**
       
   211 		 * Autolock state PubSub publisher.
       
   212 		 * (Runtime setting)
       
   213 		 */
       
   214 		CLockAppPubSubObserver* iPSAutolockState; 
       
   215 
       
   216 		/**
       
   217 		 * User activity manager/observer
       
   218 		 */
       
   219 		CUserActivityManager* iActivityManager;
       
   220 
       
   221 		/**
       
   222 		 * Background image container control
       
   223 		 */
       
   224 		CLockAppDevicelockContainer* iContainer;
       
   225 
       
   226 		/**
       
   227 		 * Feature manager value for CDMA protocol
       
   228 		 */
       
   229 		TBool iFeatureProtocolCdma;
       
   230 
       
   231 		/**
       
   232 		 * Is security code query shown
       
   233 		 */
       
   234 		TBool iShowingSecCodeQuery;
       
   235 
       
   236 	};
       
   237 
       
   238 #endif // LOCKAPPDEVICELOCKCONTROL_H