securitydialogs/Autolock/src/AutolockAppUi.cpp
branchRCL_3
changeset 8 ece4bbb094df
parent 5 3b17fc5c9564
child 9 a005fc61b02a
equal deleted inserted replaced
7:6e226572c5f0 8:ece4bbb094df
   137     User::LeaveIfError(iCustomPhone.Open(iPhone));
   137     User::LeaveIfError(iCustomPhone.Open(iPhone));
   138  	#if defined(_DEBUG)
   138  	#if defined(_DEBUG)
   139     RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() phone opened"));
   139     RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() phone opened"));
   140     #endif
   140     #endif
   141 
   141 
   142     TBool systemLocked = EFalse;
   142   TBool systemLocked = EFalse;
   143 	TBool autolockValue = EAutolockStatusUninitialized;
   143 	TBool phoneLocked = EFalse;
   144 
   144 
   145     iWait = NULL;
   145     iWait = NULL;
   146     iWait = CWait::NewL();
   146     iWait = CWait::NewL();
   147 
   147 
   148 	#ifndef __WINS__
   148 	#ifndef __WINS__
   172     #if defined(_DEBUG)
   172     #if defined(_DEBUG)
   173     if(hiddenReset)
   173     if(hiddenReset)
   174         RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() Hidden reset"));
   174         RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() Hidden reset"));
   175     RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() CR get result: %d"), cRresult);
   175     RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() CR get result: %d"), cRresult);
   176     RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() CR lock value: %d"), lockValue);
   176     RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() CR lock value: %d"), lockValue);
   177     #endif
   177     RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() CR lockInfo.iSetting: %d"), lockInfo.iSetting);    
   178 	if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled)
   178     #endif
       
   179 	  if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled)
   179 		{
   180 		{
   180         repository->Set(KSettingsAutoLockTime, 0);
   181         repository->Set(KSettingsAutoLockTime, 0);
   181         if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
   182         if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
   182             {
   183             {
   183             repository->Set(KSettingsLockOnPowerUp, 0);
   184             repository->Set(KSettingsLockOnPowerUp, 0);
   187     else if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) || (hiddenReset && (lockValue == 1)))
   188     else if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) || (hiddenReset && (lockValue == 1)))
   188         {
   189         {
   189         #if defined(_DEBUG)
   190         #if defined(_DEBUG)
   190         RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() Hidden reset when locked"));
   191         RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() Hidden reset when locked"));
   191         #endif
   192         #endif
   192         systemLocked = ETrue;
   193         phoneLocked = systemLocked = ETrue;
   193         }
   194         }
   194 
   195     else if (lockInfo.iSetting == RMobilePhone::ELockSetEnabled && !hiddenReset) {       
   195         
   196         #if defined(_DEBUG)
   196  		if ( lockInfo.iSetting == RMobilePhone::ELockSetEnabled && lockValue != EAutolockOff && !hiddenReset)
   197         RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() Set phone locked"));
   197 		{
       
   198 		    #if defined(_DEBUG)
       
   199         RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() EAutolockStatusUninitialized %d"),EAutolockStatusUninitialized);
       
   200         #endif
   198         #endif
   201         autolockValue = EAutolockStatusUninitialized;					            
   199         phoneLocked = ETrue;
   202     }
   200         }             
   203     else if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled || (hiddenReset && (lockValue == 0)) )
   201  	
   204 		{
       
   205 		    #if defined(_DEBUG)
       
   206         RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() EAutolockOff %d"),EAutolockOff);
       
   207         #endif
       
   208         autolockValue = EAutolockOff;
       
   209     }
       
   210      
   202      
   211     delete repository;
   203     delete repository;
   212 	#endif   //__WINS__
   204 	#endif   //__WINS__
   213 
   205 
   214 	#if defined(_DEBUG)
   206 	#if defined(_DEBUG)
   250     CleanupStack::Pop();	// lockView
   242     CleanupStack::Pop();	// lockView
   251     AddViewL(lockView);    // transfer ownership to CAknViewAppUi
   243     AddViewL(lockView);    // transfer ownership to CAknViewAppUi
   252 	SetDefaultViewL(*lockView);
   244 	SetDefaultViewL(*lockView);
   253 
   245 
   254 	// start autolock timer
   246 	// start autolock timer
   255 	iModel = CAutoLockModel::NewL(this, autolockValue);	
   247 	iModel = CAutoLockModel::NewL(this, phoneLocked);	
   256 
   248 
   257 	// phone event observer
   249 	// phone event observer
   258 	iPhoneObserver = CValueObserver::NewL(this);
   250 	iPhoneObserver = CValueObserver::NewL(this);
   259 	//call bubble
   251 	//call bubble
   260 	iIncallBubble = CAknIncallBubble::NewL();
   252 	iIncallBubble = CAknIncallBubble::NewL();
   494 	if (aForeground )
   486 	if (aForeground )
   495 		{
   487 		{
   496 		if (iLocked)
   488 		if (iLocked)
   497 			{
   489 			{
   498 			// lock voice key 
   490 			// lock voice key 
   499 			LockSideKeyL();			
   491 			LockSideKeyL();	
       
   492 			CAknView* view = View(KAutoLockViewId);
       
   493 			if(view)
       
   494 				{	
       
   495 		  		TRect aCallRect;
       
   496 				STATIC_CAST(CAutolockView*, view)->HandleCall(15, aCallRect);
       
   497 				}
       
   498 		
   500 			}
   499 			}
   501 		else
   500 		else
   502 			{
   501 			{
   503 			// app back to background
   502 			// app back to background
   504 			TApaTask self(iCoeEnv->WsSession());
   503 			TApaTask self(iCoeEnv->WsSession());
   523 			}
   522 			}
   524 		else
   523 		else
   525 			{
   524 			{
   526 			// unlock voice key while there is active call
   525 			// unlock voice key while there is active call
   527 			UnLockSideKey();
   526 			UnLockSideKey();
       
   527 			CAknView* view = View(KAutoLockViewId);
       
   528 			if(view)
       
   529 				{	
       
   530 			  	TRect aCallRect;
       
   531 				STATIC_CAST(CAutolockView*, view)->HandleCall(16, aCallRect);
       
   532 				}
   528 			}
   533 			}
   529 		}
   534 		}
   530 
   535 
   531 	CAknAppUi::HandleForegroundEventL(aForeground);
   536 	CAknAppUi::HandleForegroundEventL(aForeground);
   532 	
   537 	
   933 	self.BringToForeground();
   938 	self.BringToForeground();
   934 	ActivateLocalViewL(KAutoLockViewId);
   939 	ActivateLocalViewL(KAutoLockViewId);
   935 	CAknView* view = View(KAutoLockViewId);
   940 	CAknView* view = View(KAutoLockViewId);
   936 	if(view)
   941 	if(view)
   937 	  {
   942 	  {
       
   943 	  TRect aCallRect;
       
   944       STATIC_CAST(CAutolockView*, view)->HandleCall(17, aCallRect);
   938 	  STATIC_CAST(CAutolockView*, view)->MakeVisible(ETrue);
   945 	  STATIC_CAST(CAutolockView*, view)->MakeVisible(ETrue);
   939 	  }
   946 	  }
   940 	else
   947 	else
   941 	  {
   948 	  {
   942 	  #if defined(_DEBUG)
   949 	  #if defined(_DEBUG)