Esempio n. 1
0
void SymbianPhone::lockKeypad()
{
    RAknKeyLock keyLock;

    User::LeaveIfError(keyLock.Connect());

    keyLock.EnableKeyLock();

    keyLock.Close();
}
// =========================== CLASS RAKNKEYLOCK2 ==============================
// -----------------------------------------------------------------------------
// CTestSDKKeyLock::TestKLConnectL
// -----------------------------------------------------------------------------
TInt CTestSDKKeyLock::TestKLConnectL( CStifItemParser& /*aItem*/ )
    {
    RAknKeyLock connect;
    CleanupClosePushL( connect );
    STIF_ASSERT_EQUALS( KErrNone, connect.Connect() );
    
    STIF_ASSERT_NOT_NULL( &connect );
    
    connect.EnableKeyLock();
    STIF_ASSERT_TRUE( connect.IsKeyLockEnabled() );
    connect.DisableKeyLock();
    STIF_ASSERT_FALSE( connect.IsKeyLockEnabled() );
    
    CleanupStack::PopAndDestroy( &connect );
    
    return KErrNone;
    }
// =========================== CLASS RAKNKEYLOCK ===============================
// -----------------------------------------------------------------------------
// CTestSDKKeyLock::TestKLEnableKeyLockL 
// -----------------------------------------------------------------------------
TInt CTestSDKKeyLock::TestKLEnableKeyLockL( CStifItemParser& /*aItem*/ )
    {
    RAknKeyLock enablekeylock;
    CleanupClosePushL( enablekeylock );
    STIF_ASSERT_NOT_LEAVES( enablekeylock.Connect() );
    
    STIF_ASSERT_NOT_NULL( &enablekeylock );
    
    STIF_ASSERT_FALSE( enablekeylock.IsKeyLockEnabled() );
    enablekeylock.EnableKeyLock();
    STIF_ASSERT_TRUE( enablekeylock.IsKeyLockEnabled() );
    enablekeylock.DisableKeyLock();
    STIF_ASSERT_FALSE( enablekeylock.IsKeyLockEnabled() );
    
    CleanupStack::PopAndDestroy( &enablekeylock );
    
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKKeyLock::TestKLIsKeyLockEnabledL
// -----------------------------------------------------------------------------
TInt CTestSDKKeyLock::TestKLIsKeyLockEnabledL( CStifItemParser& /*aItem*/ )
    {
    RAknKeyLock iskeylockenabled;
    CleanupClosePushL( iskeylockenabled );
    STIF_ASSERT_NOT_LEAVES( iskeylockenabled.Connect() );
    
    STIF_ASSERT_NOT_NULL( &iskeylockenabled );
    
    STIF_ASSERT_FALSE( iskeylockenabled.IsKeyLockEnabled() );
    iskeylockenabled.EnableKeyLock();
    STIF_ASSERT_TRUE( iskeylockenabled.IsKeyLockEnabled() );
    iskeylockenabled.DisableKeyLock();
    STIF_ASSERT_FALSE( iskeylockenabled.IsKeyLockEnabled() );
    
    CleanupStack::PopAndDestroy( &iskeylockenabled );
    
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKKeyLock::TestKLEnableSoftNotificationsL
// -----------------------------------------------------------------------------
TInt CTestSDKKeyLock::TestKLEnableSoftNotificationsL( CStifItemParser& /*aItem*/ )
    {
    RAknKeyLock enablesoftnotifications;
    CleanupClosePushL( enablesoftnotifications );
    STIF_ASSERT_NOT_LEAVES( enablesoftnotifications.Connect() );
    
    STIF_ASSERT_NOT_NULL( &enablesoftnotifications );
    
    enablesoftnotifications.EnableKeyLock();
    STIF_ASSERT_TRUE( enablesoftnotifications.IsKeyLockEnabled() );
    
    TBool enable = EFalse;
    enablesoftnotifications.EnableSoftNotifications( enable );
    
    enablesoftnotifications.DisableKeyLock();
    STIF_ASSERT_FALSE( enablesoftnotifications.IsKeyLockEnabled() );
    
    CleanupStack::PopAndDestroy( &enablesoftnotifications );
    
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKKeyLock::TestKLCancelAllNotificationsL
// -----------------------------------------------------------------------------
TInt CTestSDKKeyLock::TestKLCancelAllNotificationsL( CStifItemParser& /*aItem*/ )
    {
    RAknKeyLock cancelallnotifications;
    CleanupClosePushL( cancelallnotifications );
    STIF_ASSERT_NOT_LEAVES( cancelallnotifications.Connect() );
    
    STIF_ASSERT_NOT_NULL( &cancelallnotifications );
    
    cancelallnotifications.EnableKeyLock();
    STIF_ASSERT_TRUE( cancelallnotifications.IsKeyLockEnabled() );
    
    TBool enable = ETrue;
    cancelallnotifications.EnableSoftNotifications( enable );
    
    cancelallnotifications.CancelAllNotifications();
    
    cancelallnotifications.DisableKeyLock();
    STIF_ASSERT_FALSE( cancelallnotifications.IsKeyLockEnabled() );
    
    CleanupStack::PopAndDestroy( &cancelallnotifications );
    
    return KErrNone;
    }