diff -r 2e3d3ce01487 -r 0fdb7f6b0309 coreapplicationuis/SysAp/Src/sysapdefaultkeyhandler.cpp --- a/coreapplicationuis/SysAp/Src/sysapdefaultkeyhandler.cpp Tue Feb 02 10:12:00 2010 +0200 +++ b/coreapplicationuis/SysAp/Src/sysapdefaultkeyhandler.cpp Fri Feb 19 22:58:54 2010 +0200 @@ -20,24 +20,27 @@ #include #include #include -#include +#include #include #include #include #include -#include -#include +#include +#include #include #include -#include +#include #include #include #include -#include +#include +#include //for CRepository +#include +#include #include "sysapdefaultkeyhandler.h" #include "sysapcallback.h" #include "SysAp.hrh" -#include "AknSgcc.h" +#include "aknsgcc.h" const TInt KModifierMask( 0 ); @@ -91,6 +94,8 @@ 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 @@ -119,6 +124,10 @@ } } } + + //Load keylock slide handling CR + TRAP_IGNORE( iSlideRepository = CRepository::NewL( KCRUidSlideSettings ) ); + iKeylockPolicy = CKeyLockPolicyApi::NewL( EPolicyActivateKeyguard ); } // --------------------------------------------------------------------------- @@ -154,7 +163,8 @@ groupWin.CancelCaptureKey( iCapturedEKeyGripOpen ); groupWin.CancelCaptureKey( iCapturedEKeyGripClose ); groupWin.CancelCaptureKey( iCapturedEKeyPoC ); - + delete iSlideRepository; + delete iKeylockPolicy; } @@ -180,6 +190,8 @@ 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 ); @@ -193,11 +205,38 @@ case EKeyGripClose: TRACES( RDebug::Print(_L("CSysApDefaultKeyHandler::HandleKeyEventL: EKeyGripClosed") ) ); RProperty::Set( KPSUidHWRM, KHWRMGripStatus, EPSHWRMGripClosed ); + iKeylockPolicy->EnableKeyguardFeature(); iCallback.ExecCommandL( MSysapCallback::ECancelPowermenu ); - if ( !IsDeviceLocked() && UiReady() ) - { - iKeylock->OfferKeyLock(); - } + if( !iSlideRepository ) + { // default behavior is to always ask for keylock + if ( !IsDeviceLocked() && UiReady() ) + { + iKeylock->OfferKeyLock(); + } + } + else + { // keylock action is defined by user setting + TInt keyGuardSetting; + 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; + } + } // apply default light control iCallback.ExecCommandL( MSysapCallback::EUpdateLights, TUpdateLightsBuf(EKeyGripClose) ); break;