coreapplicationuis/SysAp/Src/sysapdefaultkeyhandler.cpp
branchRCL_3
changeset 19 924385140d98
parent 18 0818dd463d41
child 20 c2c61fdca848
--- a/coreapplicationuis/SysAp/Src/sysapdefaultkeyhandler.cpp	Thu Aug 19 10:05:08 2010 +0300
+++ b/coreapplicationuis/SysAp/Src/sysapdefaultkeyhandler.cpp	Tue Aug 31 15:24:25 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -19,8 +19,9 @@
 #include <e32property.h>
 #include <eikon.hrh>
 #include <coemain.h>
-#include <aknkeylock.h>
-#include <AknTaskList.h>
+//#include <aknkeylock.h>
+//#include <AknTaskList.h>
+#include "SysApTaskList.h"
 #include <apgtask.h>
 #include <apgcli.h>
 #include <apgwgnam.h>
@@ -33,16 +34,13 @@
 #include <startupdomainpskeys.h>
 #include <hwrmdomainpskeys.h>
 #include <u32hal.h>
-#include <SysAp.rsg>
-#include <centralrepository.h> //for CRepository
-#include <settingsinternalcrkeys.h>
-#include <keylockpolicyapi.h>
-#include <ctsydomainpskeys.h>
-#include <hwrmdomainpskeys.h>
+//#include <SysAp.rsg>
 #include "sysapdefaultkeyhandler.h"
 #include "sysapcallback.h"
 #include "SysAp.hrh"
-#include "AknSgcc.h"
+#include <AknSgcc.h>
+//#include "sysapappui.h"
+#include <w32std.h>
 
 
 const TInt KModifierMask( 0 );
@@ -53,18 +51,18 @@
 // CSysApDefaultKeyHandler::CSysApDefaultKeyHandler
 // ---------------------------------------------------------------------------
 //
-CSysApDefaultKeyHandler::CSysApDefaultKeyHandler( MSysapCallback& aCallback ) :
+CSysApDefaultKeyHandler::CSysApDefaultKeyHandler( MSysapCallback& aCallback ):                                                      
                                                      iCallback(aCallback),
                                                      iCameraSupported(EFalse),
                                                      iCoverDisplaySupported(EFalse),
-                                                     iKeylock(NULL),
+//                                                     iKeylock(NULL),
                                                      iCapturedEKeyCamera(0),
                                                      iCapturedEKeyTwistOpen(0),
                                                      iCapturedEKeyTwistClose(0),
                                                      iCapturedEKeyGripOpen(0),
                                                      iCapturedEKeyGripClose(0),
-                                                     iCapturedEKeyPoC(0),
-                                                     iAknUiServerConnected(EFalse)
+                                                     iCapturedEKeyPoC(0)
+//                                                     iAknUiServerConnected(EFalse)
     {
     }
 
@@ -78,72 +76,23 @@
     
     RWindowGroup groupWin = CCoeEnv::Static()->RootWin();
     User::LeaveIfError ( iCapturedEKeyCamera = groupWin.CaptureKey( EKeyCamera, KModifierMask, KModifierMask ) );
-    User::LeaveIfError ( iCapturedEKeyTwistOpen = groupWin.CaptureKey( EKeyTwistOpen, KModifierMask, KModifierMask ) );
-    User::LeaveIfError ( iCapturedEKeyTwistClose = groupWin.CaptureKey( EKeyTwistClose, KModifierMask, KModifierMask ) );   
-    User::LeaveIfError ( iCapturedEKeyGripOpen = groupWin.CaptureKey( EKeyGripOpen, KModifierMask, KModifierMask ) ); 
-    User::LeaveIfError ( iCapturedEKeyGripClose = groupWin.CaptureKey( EKeyGripClose, KModifierMask, KModifierMask ) ); 
-    User::LeaveIfError ( iCapturedEKeyPoC = groupWin.CaptureKey( EKeyPoC, KModifierMask, KModifierMask ) ); 
-    
-    // flip key events don't need to be captured, because in current setup they are not real events but simulated by SysAp
-    // according to notifications received from P&S key that stores flip information
     
     FeatureManager::InitializeLibL();
     iCameraSupported = FeatureManager::FeatureSupported( KFeatureIdCamera );
     iCoverDisplaySupported = FeatureManager::FeatureSupported( KFeatureIdCoverDisplay );
     FeatureManager::UnInitializeLib();
-    
-    TKeyLockBuf lockBuf;
-    iCallback.ExecQueryL( MSysapCallback::EGetKeylock, lockBuf );  
-    iKeylock = lockBuf();
-    
-    iKeypadWasLocked = iKeylock->IsKeyLockEnabled();
-    
-    __ASSERT_DEBUG( iKeylock, User::Panic( _L("CSysApDefaultKeyHandler::ConstructL: iKeylock not initialized"), KErrBadHandle ) );
-    
-    if ( iCoverDisplaySupported ) // if flip status is monitored, set the initial flip status now
-        {
-        TInt flipValue;
-        TInt err = RProperty::Get( KPSUidHWRM, KHWRMFlipStatus, flipValue );
-
-        TRACES( RDebug::Print( _L("CSysApDefaultKeyHandler::ConstructL: flipValue=%d, err=%d"), flipValue, err ) );
-        
-        if ( err == KErrNone )
-            {
-            switch ( flipValue )
-                {
-                case EPSHWRMFlipOpen:
-                    SetDisplayState( ETrue );
-                    break;
-                    
-                case EPSHWRMFlipClosed:
-                    SetDisplayState( EFalse );
-                    break;
-                    
-                case EPSHWRMFlipStatusUninitialized:
-                default:
-                    // set display state only if the current flip position is known
-                    break;
-                }
-            }
-        }
-    
-    //Load keylock slide handling CR 
-    TRAP_IGNORE( iSlideRepository = CRepository::NewL( KCRUidSlideSettings ) );
-    iKeylockPolicy = CKeyLockPolicyApi::NewL( EPolicyActivateKeyguard );
-
-    //Load PhoneCallStatus P&S  
-    TInt err = iCallStateProperty.Attach(KPSUidCtsyCallInformation, KCTsyCallState);
+ 
     }
 
 // ---------------------------------------------------------------------------
 // CSysApDefaultKeyHandler::NewL
 // ---------------------------------------------------------------------------
 //
-CSysApDefaultKeyHandler* CSysApDefaultKeyHandler::NewL( MSysapCallback& aCallback )
+CSysApDefaultKeyHandler* CSysApDefaultKeyHandler::NewL(MSysapCallback& aCallback )
     {
     TRACES( RDebug::Print( _L("CSysApDefaultKeyHandler::NewL()") ) );
     
-    CSysApDefaultKeyHandler* self = new( ELeave ) CSysApDefaultKeyHandler( aCallback) ;
+    CSysApDefaultKeyHandler* self = new( ELeave ) CSysApDefaultKeyHandler(aCallback) ;
     CleanupStack::PushL( self );
     self->ConstructL();
     CleanupStack::Pop( self );
@@ -158,18 +107,8 @@
 CSysApDefaultKeyHandler::~CSysApDefaultKeyHandler()
     {
     TRACES( RDebug::Print( _L("CSysApDefaultKeyHandler::~CSysApDefaultKeyHandler()") ) );
-    
-    iAknUiServer.Close();
-    
     RWindowGroup groupWin = CCoeEnv::Static()->RootWin();
-    groupWin.CancelCaptureKey( iCapturedEKeyCamera );
-    groupWin.CancelCaptureKey( iCapturedEKeyTwistOpen );
-    groupWin.CancelCaptureKey( iCapturedEKeyTwistClose );
-    groupWin.CancelCaptureKey( iCapturedEKeyGripOpen );
-    groupWin.CancelCaptureKey( iCapturedEKeyGripClose );
-    groupWin.CancelCaptureKey( iCapturedEKeyPoC );
-    delete iSlideRepository;
-    delete iKeylockPolicy;
+    groupWin.CancelCaptureKey( iCapturedEKeyCamera );    
     }
     
 
@@ -191,127 +130,18 @@
         response = EKeyWasConsumed; // set again in default case if not consumed
         
         switch ( aKeyEvent.iCode )
-            {
-            case EKeyGripOpen:
-                TRACES( RDebug::Print(_L("CSysApDefaultKeyHandler::HandleKeyEventL: EKeyGripOpen") ) );
-                RProperty::Set( KPSUidHWRM, KHWRMGripStatus, EPSHWRMGripOpen );
-                iKeypadWasLocked = iKeylock->IsKeyLockEnabled();
-                iKeylockPolicy->DisableKeyguardFeature();
-                if (!IsDeviceLocked())
-                    {
-                    iCallback.ExecCommandL( MSysapCallback::EResetKeyguardState );
-                    iKeylock->DisableKeyLock();
-                    iCallback.ExecCommandL( MSysapCallback::ECancelPowermenu );
-                    }
-                // apply default light control
-                iCallback.ExecCommandL( MSysapCallback::EUpdateLights, TUpdateLightsBuf(EKeyGripOpen) );
-                break;
-            
-            case EKeyGripClose:
-                TRACES( RDebug::Print(_L("CSysApDefaultKeyHandler::HandleKeyEventL: EKeyGripClosed") ) );
-                RProperty::Set( KPSUidHWRM, KHWRMGripStatus, EPSHWRMGripClosed );
-                iKeylockPolicy->EnableKeyguardFeature();
-                iCallback.ExecCommandL( MSysapCallback::ECancelPowermenu );
-				if( !iSlideRepository )
-					{ // default behavior is to always ask for keylock
-					if ( !IsDeviceLocked() && UiReady() )
-						{
-						iKeylock->OfferKeyLock();
-						}
-					}
-				else
-					{ // keylock action is defined by user setting
-                    TInt value = 0;
-                    RProperty::Get(KPSUidStartup, KPSStartupUiPhase, value);
-                    TBool startupOver = (value == EStartupUiPhaseAllDone);
-                    if(startupOver)
-                        {
-						TInt status(0);
-						TInt err = iCallStateProperty.Get( status );
-						if (err == KErrNone)
-							{
-							switch ( status )
-								{
-								case EPSCTsyCallStateUninitialized:
-								case EPSCTsyCallStateNone:
-									{
-    
-									TInt keyGuardSetting;
-									User::LeaveIfError(iSlideRepository->Get( KSlideKeyguard, keyGuardSetting ));
-									switch( ( TSlideSettingKeyguard ) keyGuardSetting )
-										{
-										case ESlideSettingsKeyguardActivatingOn: 
-											iKeylock->EnableKeyLock();
-											break;
-										case ESlideSettingsKeyguardActivatingAskMe: 
-											iKeylock->OfferKeyLock();
-											break;
-										case ESlideSettingsKeyguardActivatingOff: 
-											//do nothing
-											break;
-										case ESlideSettingsKeyguardActivatingAutomatic: 
-											if( iKeypadWasLocked )
-												{
-												iKeylock->EnableKeyLock();
-												}
-											break;
-										}
-									}
-                            default: // any other state
-                                break;
-								}
-                            }
-                        }
-					}
-                // apply default light control
-                iCallback.ExecCommandL( MSysapCallback::EUpdateLights, TUpdateLightsBuf(EKeyGripClose) );
-                break;
-            
-            case EKeyFlipOpen: // simulated key event
-                {
-                TRACES( RDebug::Print(_L("CSysApDefaultKeyHandler::HandleKeyEventL: EKeyFlipOpen") ) );
-                SetDisplayState( ETrue );
-                // apply default light control
-                iCallback.ExecCommandL( MSysapCallback::EUpdateLights, TUpdateLightsBuf(EKeyFlipOpen) );
-                }
-                break;
-            
-            case EKeyFlipClose: // simulated key event
-                TRACES( RDebug::Print(_L("CSysApDefaultKeyHandler::HandleKeyEventL: EKeyFlipClose") ) );
-                SetDisplayState( EFalse );
-                // apply default light control
-                iCallback.ExecCommandL( MSysapCallback::EUpdateLights, TUpdateLightsBuf(EKeyFlipClose) );
-                break;
-                
-            case EKeyTwistOpen:
-                TRACES( RDebug::Print(_L("CSysApDefaultKeyHandler::HandleKeyEventL: EKeyTwistOpen") ) );
-                RProperty::Set( KPSUidHWRM, KHWRMTwistStatus, EPSHWRMTwistOpen );
-                break;
-                
-            case EKeyTwistClose:
-                TRACES( RDebug::Print(_L("CSysApDefaultKeyHandler::HandleKeyEventL: EKeyTwistClose") ) );
-                RProperty::Set( KPSUidHWRM, KHWRMTwistStatus, EPSHWRMTwistClose );
-                break;                
-
+            {                              
             case EKeyCamera:
                 TRACES( RDebug::Print(_L("CSysApDefaultKeyHandler::HandleKeyEventL: EKeyCamera") ) );
                 if ( iCameraSupported && !IsDeviceLocked() && !DoShowKeysLockedNote() )
                     {
-					iCallback.ExecCommandL( MSysapCallback::ECancelPowermenu );
                     ActivateApplicationL( KSysApCamcorderUid );
                     }
                 break;
-                
-            case EKeyPoC:
-                TRACES( RDebug::Print(_L("CSysApDefaultKeyHandler::HandleKeyEventL: EKeyPoC") ) );
-                LaunchPocL();
-                break;                
-             
             default:
                 response = EKeyWasNotConsumed;
                 TRACES( RDebug::Print( _L("CSysApDefaultKeyHandler::CSysApDefaultKeyHandler: key was not consumed.") ) ); 
-                break;
-                    
+                break;               
             }
         }
     
@@ -384,15 +214,16 @@
 //
 void CSysApDefaultKeyHandler::ActivateApplicationL( const TUid aUid ) const
     {
+    
     TRACES( RDebug::Print( _L( "CSysApDefaultKeyHandler::ActivateApplicationL") ) );
     
     // Applications must not be activated before reaching normal system operation state
     if ( UiReady() )
         {
-        CAknTaskList* apaTaskList = CAknTaskList::NewL( CCoeEnv::Static()->WsSession() );
+        CSysApTaskList* apaTaskList = CSysApTaskList::NewLC( CCoeEnv::Static()->WsSession() );
         TApaTask apaTask = apaTaskList->FindRootApp( aUid ); // only root application should not be activated
-        delete apaTaskList;
-        
+        CleanupStack::PopAndDestroy( apaTaskList );
+                
         if ( apaTask.Exists() )
             {
             TRACES( RDebug::Print( _L( "CSysApDefaultKeyHandler::ActivateApplicationL: application brought to foreground") ) );
@@ -402,8 +233,8 @@
                 {
                 TRACES( RDebug::Print( _L("e_CAM_PRI_OFF_TO_ON 1") ) );
                 }
-#endif // _DEBUG            
-            CAknSgcClient::MoveApp ( apaTask.WgId(), ESgcMoveAppToForeground );
+#endif // _DEBUG                        
+            apaTask.BringToForeground();
             }
         else
             {
@@ -446,20 +277,8 @@
 void CSysApDefaultKeyHandler::LaunchPocL()
     {
     TRACES( RDebug::Print(_L("CSysApDefaultKeyHandler::LaunchPocL") ) );
-    
-    if ( UiReady() && !IsDeviceLocked() && !DoShowKeysLockedNote() )
-        {
-        CAiwServiceHandler* serviceHandler = CAiwServiceHandler::NewLC();
-        serviceHandler->AttachL( R_POC_AIW_INTEREST );
-            
-        CAiwGenericParamList* inParams = CAiwGenericParamList::NewLC();
-        inParams->AppendL(TAiwGenericParam( EGenericParamPoCLaunchView, TAiwVariant(EAiwPoCMainView)));
-        serviceHandler->ExecuteServiceCmdL( KAiwCmdPoC, *inParams, serviceHandler->OutParamListL());
-        
-        CleanupStack::PopAndDestroy( inParams );
-        CleanupStack::PopAndDestroy( serviceHandler);
-        }
-    }
+    // not supported
+  }
     
 // ----------------------------------------------------------------------------
 // CSysApDefaultKeyHandler::IsDeviceLocked()
@@ -513,29 +332,29 @@
     {
     TRACES( RDebug::Print( _L("CSysApDefaultKeyHandler::DoShowKeysLockedNote: iAknUiServerConnected=%d"), iAknUiServerConnected ) );
     
-    TInt err(KErrNone);
+//    TInt err(KErrNone);
     
     if ( !iAknUiServerConnected )
         {
-        err = iAknUiServer.Connect();
+/*        err = iAknUiServer.Connect();
         
         if ( err != KErrNone )
             {
-            TRACES( RDebug::Print( _L("CSysApDefaultKeyHandler::DoShowKeysLockedNote: RAknUiServer::Connect failed, err=%d"), err ) );
+ //           TRACES( RDebug::Print( _L("CSysApDefaultKeyHandler::DoShowKeysLockedNote: RAknUiServer::Connect failed, err=%d"), err ) );
             return ETrue; // assume that keypad/device is locked
             }
         iAknUiServerConnected = ETrue;            
-        }
+  */      }
     
-    TBool keysLocked;
-    err = iAknUiServer.ShowKeysLockedNote( keysLocked );
+    TBool keysLocked = EFalse;
+/*    err = iAknUiServer.ShowKeysLockedNote( keysLocked );
     
     if ( err != KErrNone )
         {
         TRACES( RDebug::Print( _L("CSysApDefaultKeyHandler::DoShowKeysLockedNote: RAknUiServer::ShowKeysLockedNote failed, err=%d"), err ) );
         keysLocked = ETrue; // assume that keypad/device is locked
         }
-        
+ */       
     return keysLocked;        
     }
 
@@ -566,3 +385,6 @@
     
     return response;        
     }
+
+
+