securitydialogs/Autolock/src/AutolockAppUi.cpp
branchRCL_3
changeset 12 a005fc61b02a
parent 10 ece4bbb094df
child 13 bbcfd14ce6a7
equal deleted inserted replaced
10:ece4bbb094df 12:a005fc61b02a
   491 			LockSideKeyL();	
   491 			LockSideKeyL();	
   492 			CAknView* view = View(KAutoLockViewId);
   492 			CAknView* view = View(KAutoLockViewId);
   493 			if(view)
   493 			if(view)
   494 				{	
   494 				{	
   495 		  		TRect aCallRect;
   495 		  		TRect aCallRect;
   496 				STATIC_CAST(CAutolockView*, view)->HandleCall(15, aCallRect);
   496 				STATIC_CAST(CAutolockView*, view)->HandleCall(0x15, aCallRect);
   497 				}
   497 				}
   498 		
   498 		
   499 			}
   499 			}
   500 		else
   500 		else
   501 			{
   501 			{
   514         RProperty::Get(KPSUidStartup, KPSSimStatus, simStatus);
   514         RProperty::Get(KPSUidStartup, KPSSimStatus, simStatus);
   515 
   515 
   516         if (callState == EPSCTsyCallStateNone && simStatus != ESimNotPresent)
   516         if (callState == EPSCTsyCallStateNone && simStatus != ESimNotPresent)
   517 			{	
   517 			{	
   518 			// try put autolock back to foreground
   518 			// try put autolock back to foreground
       
   519 			CAknView* view = View(KAutoLockViewId);
       
   520 			if(view)
       
   521 				{	
       
   522 				TRect aCallRect;
       
   523 				STATIC_CAST(CAutolockView*, view)->HandleCall(0x19, aCallRect);
       
   524 				}
   519 			TApaTask self(iCoeEnv->WsSession());
   525 			TApaTask self(iCoeEnv->WsSession());
   520 			self.SetWgId(iCoeEnv->RootWin().Identifier());
   526 			self.SetWgId(iCoeEnv->RootWin().Identifier());
   521 			self.BringToForeground();		
   527 			self.BringToForeground();		
   522 			}
   528 			}
   523 		else
   529 		else
   526 			UnLockSideKey();
   532 			UnLockSideKey();
   527 			CAknView* view = View(KAutoLockViewId);
   533 			CAknView* view = View(KAutoLockViewId);
   528 			if(view)
   534 			if(view)
   529 				{	
   535 				{	
   530 			  	TRect aCallRect;
   536 			  	TRect aCallRect;
   531 				STATIC_CAST(CAutolockView*, view)->HandleCall(16, aCallRect);
   537 				STATIC_CAST(CAutolockView*, view)->HandleCall(0x16, aCallRect);
   532 				}
   538 				}
   533 			}
   539 			}
   534 		}
   540 		}
   535 
   541 
   536 	CAknAppUi::HandleForegroundEventL(aForeground);
   542 	CAknAppUi::HandleForegroundEventL(aForeground);
   742 	        HideSoftNotification();	// dismiss all the pending notes just before asking the unlocking code
   748 	        HideSoftNotification();	// dismiss all the pending notes just before asking the unlocking code
   743 	        
   749 	        
   744             TRAPD(err,
   750             TRAPD(err,
   745 			{
   751 			{
   746 			iDeviceLockQueryStatus = ETrue;
   752 			iDeviceLockQueryStatus = ETrue;
       
   753 			TBool iAppKeyBelongedToBigClock=EFalse;
       
   754 			if(!iAppKey)
       
   755 				{
       
   756 				RDebug::Printf( "%s %s (%u) stealing EStdKeyApplication0 from BigClock=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
       
   757 				RWindowGroup& groupWin=iCoeEnv->RootWin();
       
   758 				iAppKey = groupWin.CaptureKeyUpAndDowns(EStdKeyApplication0, 0, 0); // Capture app key now, in case that it was given to BigClock
       
   759 				iAppKeyBelongedToBigClock=ETrue;
       
   760 				}
   747 			if(handler->AskSecCodeInAutoLockL())
   761 			if(handler->AskSecCodeInAutoLockL())
   748 				{		
   762 				{		
   749 				iLocked = EFalse;
   763 				iLocked = EFalse;
   750 				DisableWGListChangeEventListening();
   764 				DisableWGListChangeEventListening();
   751 				iDeviceLockQueryStatus = EFalse;
   765 				iDeviceLockQueryStatus = EFalse;
   753 				iModel->SetLockedL(EFalse);
   767 				iModel->SetLockedL(EFalse);
   754 				SwitchToPreviousAppL();
   768 				SwitchToPreviousAppL();
   755 				}
   769 				}
   756             else
   770             else
   757 				{  // make sure that we will be topmost still
   771 				{  // make sure that we will be topmost still
       
   772 					if(iAppKey && iAppKeyBelongedToBigClock)
       
   773 						{
       
   774 						RDebug::Printf( "%s %s (%u) giving EStdKeyApplication0 to BigClock=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
       
   775 						RWindowGroup& groupWin=iCoeEnv->RootWin();
       
   776 						groupWin.CancelCaptureKeyUpAndDowns(iAppKey);	// give S60-Application key back to BigClock
       
   777 						iAppKey = 0;
       
   778 						}
   758 				    iDeviceLockQueryStatus = EFalse;
   779 				    iDeviceLockQueryStatus = EFalse;
   759                     TInt callState;
   780                     TInt callState;
   760                     RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState );
   781                     RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState );
   761                 if ( callState == EPSCTsyCallStateNone &&
   782                 if ( callState == EPSCTsyCallStateNone &&
   762                      !FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
   783                      !FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
   939 	ActivateLocalViewL(KAutoLockViewId);
   960 	ActivateLocalViewL(KAutoLockViewId);
   940 	CAknView* view = View(KAutoLockViewId);
   961 	CAknView* view = View(KAutoLockViewId);
   941 	if(view)
   962 	if(view)
   942 	  {
   963 	  {
   943 	  TRect aCallRect;
   964 	  TRect aCallRect;
   944       STATIC_CAST(CAutolockView*, view)->HandleCall(17, aCallRect);
   965       STATIC_CAST(CAutolockView*, view)->HandleCall(0x17, aCallRect);
   945 	  STATIC_CAST(CAutolockView*, view)->MakeVisible(ETrue);
   966 	  STATIC_CAST(CAutolockView*, view)->MakeVisible(ETrue);
   946 	  }
   967 	  }
   947 	else
   968 	else
   948 	  {
   969 	  {
   949 	  #if defined(_DEBUG)
   970 	  #if defined(_DEBUG)
  1273 	    	          CAknView* view = View(KAutoLockViewId);
  1294 	    	          CAknView* view = View(KAutoLockViewId);
  1274 								  if(view)
  1295 								  if(view)
  1275 								    {	
  1296 								    {	
  1276 								        STATIC_CAST(CAutolockView*, view)->ScreenDeviceChanged();
  1297 								        STATIC_CAST(CAutolockView*, view)->ScreenDeviceChanged();
  1277 								    	TRect aCallRect;
  1298 								    	TRect aCallRect;
  1278 								        STATIC_CAST(CAutolockView*, view)->HandleCall(1, aCallRect);
  1299 								        STATIC_CAST(CAutolockView*, view)->HandleCall(0x1, aCallRect);
  1279    								    	if(aCallButtonRect.iBr.iX==0)
  1300    								    	if(aCallButtonRect.iBr.iX==0)
  1280    								    		aCallButtonRect = TRect (aCallRect);
  1301    								    		aCallButtonRect = TRect (aCallRect);
  1281 								    }
  1302 								    }
  1282 	    	        if(pointer->iType==TPointerEvent::EButton1Up)
  1303 	    	        if(pointer->iType==TPointerEvent::EButton1Up)
  1283 	    	        	{
  1304 	    	        	{
  1355         {
  1376         {
  1356 		            CAknView* view = View(KAutoLockViewId);
  1377 		            CAknView* view = View(KAutoLockViewId);
  1357 								  if(view)
  1378 								  if(view)
  1358 								    {	
  1379 								    {	
  1359 								    	TRect aCallRect;
  1380 								    	TRect aCallRect;
  1360 								        STATIC_CAST(CAutolockView*, view)->HandleCall(10, aCallRect);
  1381 								        STATIC_CAST(CAutolockView*, view)->HandleCall(0x10, aCallRect);
  1361 												if(aCallButtonRect.iBr.iX==0)
  1382 												if(aCallButtonRect.iBr.iX==0)
  1362    								    		aCallButtonRect = TRect (aCallRect);
  1383    								    		aCallButtonRect = TRect (aCallRect);
  1363 								    }
  1384 								    }
  1364         // So now system is locked. When call is not ongoing, autolock should
  1385         // So now system is locked. When call is not ongoing, autolock should
  1365         // be on the foreground.
  1386         // be on the foreground.