securitydialogs/Autolock/src/AutolockAppUi.cpp
branchRCL_3
changeset 21 33ad376816a8
parent 20 53af9c3d61e4
child 36 2ca12c9f635b
equal deleted inserted replaced
20:53af9c3d61e4 21:33ad376816a8
   765 	        HideSoftNotification();	// dismiss all the pending notes just before asking the unlocking code
   765 	        HideSoftNotification();	// dismiss all the pending notes just before asking the unlocking code
   766 	        
   766 	        
   767             TRAPD(err,
   767             TRAPD(err,
   768 			{
   768 			{
   769 			iDeviceLockQueryStatus = ETrue;
   769 			iDeviceLockQueryStatus = ETrue;
   770 			TBool iAppKeyBelongedToBigClock=EFalse;
       
   771 			if(!iAppKey)
       
   772 				{
       
   773 				// RDebug::Printf( "%s %s (%u) stealing EStdKeyApplication0 from BigClock=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
       
   774 				RWindowGroup& groupWin=iCoeEnv->RootWin();
       
   775 				iAppKey = groupWin.CaptureKeyUpAndDowns(EStdKeyApplication0, 0, 0); // Capture app key now, in case that it was given to BigClock
       
   776 				iAppKeyBelongedToBigClock=ETrue;
       
   777 				}
       
   778 			if(handler->AskSecCodeInAutoLockL())
   770 			if(handler->AskSecCodeInAutoLockL())
   779 				{		
   771 				{		
   780 				iLocked = EFalse;
   772 				iLocked = EFalse;
   781 				DisableWGListChangeEventListening();
   773 				DisableWGListChangeEventListening();
   782 				iDeviceLockQueryStatus = EFalse;
   774 				iDeviceLockQueryStatus = EFalse;
   784 				iModel->SetLockedL(EFalse);
   776 				iModel->SetLockedL(EFalse);
   785 				SwitchToPreviousAppL();
   777 				SwitchToPreviousAppL();
   786 				}
   778 				}
   787             else
   779             else
   788 				{  // make sure that we will be topmost still
   780 				{  // make sure that we will be topmost still
   789 					if(iAppKey && iAppKeyBelongedToBigClock)
       
   790 						{
       
   791 						// RDebug::Printf( "%s %s (%u) giving EStdKeyApplication0 to BigClock=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
       
   792 						RWindowGroup& groupWin=iCoeEnv->RootWin();
       
   793 						groupWin.CancelCaptureKeyUpAndDowns(iAppKey);	// give S60-Application key back to BigClock
       
   794 						iAppKey = 0;
       
   795 						}
       
   796 				    iDeviceLockQueryStatus = EFalse;
   781 				    iDeviceLockQueryStatus = EFalse;
   797                     TInt callState;
   782                     TInt callState;
   798                     RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState );
   783                     RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState );
   799                 if ( callState == EPSCTsyCallStateNone &&
   784                 if ( callState == EPSCTsyCallStateNone &&
   800                      !FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
   785                      !FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
  1001 	#endif
   986 	#endif
  1002 	// capture appkey & volume key
   987 	// capture appkey & volume key
  1003 	if (!iAppKey)
   988 	if (!iAppKey)
  1004 		{
   989 		{
  1005 		RWindowGroup& groupWin=iCoeEnv->RootWin();
   990 		RWindowGroup& groupWin=iCoeEnv->RootWin();
  1006 		#if defined(_DEBUG)
   991 		iAppKey = groupWin.CaptureKeyUpAndDowns(EStdKeyApplication0, 0, 0); // Capture app key
  1007 		RDebug::Printf( "%s %s (%u) searching for popupclock.exe =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x0 );
       
  1008 		#endif
       
  1009 		TApaTaskList taskList( CCoeEnv::Static()->WsSession() );
       
  1010 		const TUid KBigClockUid = { 0x2000FDC3 };
       
  1011 		TApaTask task( taskList.FindApp( KBigClockUid ) );
       
  1012 		if ( task.Exists() )
       
  1013 			{
       
  1014 			#if defined(_DEBUG)
       
  1015 			RDebug::Printf( "%s %s (%u) popupclock.exe is running. Not capturing EStdKeyApplication0=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EStdKeyApplication0 );
       
  1016 			#endif
       
  1017 			}
       
  1018 		else
       
  1019 			{
       
  1020 			#if defined(_DEBUG)
       
  1021 			RDebug::Printf( "%s %s (%u) popupclock.exe not running. Not capturing EStdKeyApplication0=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EStdKeyApplication0 );
       
  1022 			#endif
       
  1023 			iAppKey = groupWin.CaptureKeyUpAndDowns(EStdKeyApplication0, 0, 0); // Capture app key
       
  1024 			}
       
  1025 		}
   992 		}
  1026 	LockSideKeyL();
   993 	LockSideKeyL();
  1027 	}
   994 	}
  1028 // ----------------------------------------------------
   995 // ----------------------------------------------------
  1029 // CAutolockAppUi::UnLockKeys()
   996 // CAutolockAppUi::UnLockKeys()