securitydialogs/lockclient/src/keyguardaccessapi.cpp
branchRCL_3
changeset 22 03674e5abf46
parent 21 09b1ac925e3f
equal deleted inserted replaced
21:09b1ac925e3f 22:03674e5abf46
    22 
    22 
    23 #include <avkondomainpskeys.h>      // KPSUidAvkonDomain, KAknKeyguardStatus, TAknKeyguardStatus
    23 #include <avkondomainpskeys.h>      // KPSUidAvkonDomain, KAknKeyguardStatus, TAknKeyguardStatus
    24 #include <e32property.h> // P&S API
    24 #include <e32property.h> // P&S API
    25 #include <e32debug.h>
    25 #include <e32debug.h>
    26 
    26 
    27 #include <QDebug>
       
    28 
       
    29 // ---------------------------------------------------------------------------
    27 // ---------------------------------------------------------------------------
    30 // Standard Symbian OS construction sequence
    28 // Standard Symbian OS construction sequence
    31 // ---------------------------------------------------------------------------
    29 // ---------------------------------------------------------------------------
    32 EXPORT_C CKeyguardAccessApi* CKeyguardAccessApi::NewL( )
    30 EXPORT_C CKeyguardAccessApi* CKeyguardAccessApi::NewL( )
    33     {
    31     {
    34     RDEBUG("0", 0);
       
    35 
       
    36     CKeyguardAccessApi* self = new (ELeave) CKeyguardAccessApi( );
    32     CKeyguardAccessApi* self = new (ELeave) CKeyguardAccessApi( );
    37     CleanupStack::PushL( self );
    33     CleanupStack::PushL( self );
    38     self->ConstructL( );
    34     self->ConstructL( );
    39     CleanupStack::Pop( self );
    35     CleanupStack::Pop( self );
    40     return self;
    36     return self;
    43 // ---------------------------------------------------------------------------
    39 // ---------------------------------------------------------------------------
    44 // Constructor.
    40 // Constructor.
    45 // ---------------------------------------------------------------------------
    41 // ---------------------------------------------------------------------------
    46 CKeyguardAccessApi::CKeyguardAccessApi()
    42 CKeyguardAccessApi::CKeyguardAccessApi()
    47     {
    43     {
    48     RDEBUG("0", 0);
       
    49     }
    44     }
    50 
    45 
    51 // ---------------------------------------------------------------------------
    46 // ---------------------------------------------------------------------------
    52 // Destructor.
    47 // Destructor.
    53 // ---------------------------------------------------------------------------
    48 // ---------------------------------------------------------------------------
    64 // ---------------------------------------------------------------------------
    59 // ---------------------------------------------------------------------------
    65 // Second phase construction
    60 // Second phase construction
    66 // ---------------------------------------------------------------------------
    61 // ---------------------------------------------------------------------------
    67 void CKeyguardAccessApi::ConstructL( )
    62 void CKeyguardAccessApi::ConstructL( )
    68     {
    63     {
    69     RDEBUG("0", 0);
       
    70     iLockAccessExtension = new (ELeave) RLockAccessExtension;
    64     iLockAccessExtension = new (ELeave) RLockAccessExtension;
    71     }
    65     }
    72 
    66 
    73 // ---------------------------------------------------------------------------
    67 // ---------------------------------------------------------------------------
    74 // Checks if the phone has been locked using P&S key storing lock states
    68 // Checks if the phone has been locked using P&S key storing lock states
    75 // ---------------------------------------------------------------------------
    69 // ---------------------------------------------------------------------------
    76 EXPORT_C TBool CKeyguardAccessApi::IsKeylockEnabled()
    70 EXPORT_C TBool CKeyguardAccessApi::IsKeylockEnabled()
    77     {
    71     {
    78 
       
    79 		RDEBUG("0", 0);
       
    80     TInt value;
    72     TInt value;
    81     TInt err = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value);
    73     TInt err = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value);
    82     if ( err == KErrNone )
    74     if ( err == KErrNone )
    83         {
    75         {
    84         switch( value )
    76         switch( value )
   100 // ---------------------------------------------------------------------------
    92 // ---------------------------------------------------------------------------
   101 // Checks if the keyguard is enabled or not
    93 // Checks if the keyguard is enabled or not
   102 // ---------------------------------------------------------------------------
    94 // ---------------------------------------------------------------------------
   103 EXPORT_C TBool CKeyguardAccessApi::IsKeyguardEnabled()
    95 EXPORT_C TBool CKeyguardAccessApi::IsKeyguardEnabled()
   104     {
    96     {
   105     RDEBUG("0", 0);
       
   106     TInt value;
    97     TInt value;
   107     TInt err = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value);
    98     TInt err = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value);
   108     if ( err == KErrNone )
    99     if ( err == KErrNone )
   109         {
   100         {
   110         switch( value )
   101         switch( value )
   141 // ---------------------------------------------------------------------------
   132 // ---------------------------------------------------------------------------
   142 // Requests lockapp server to disable keyguard with or without note.
   133 // Requests lockapp server to disable keyguard with or without note.
   143 // ---------------------------------------------------------------------------
   134 // ---------------------------------------------------------------------------
   144 EXPORT_C TInt CKeyguardAccessApi::DisableKeyguard( TBool aWithNote )
   135 EXPORT_C TInt CKeyguardAccessApi::DisableKeyguard( TBool aWithNote )
   145     {
   136     {
   146 		RDEBUG("aWithNote", aWithNote);
   137     if ( iLockAccessExtension )
   147     if ( iLockAccessExtension )
   138         {
   148         {
       
   149         RDEBUG("0", 1);
       
   150         return iLockAccessExtension->SendMessage( ELockAppDisableKeyguard, aWithNote );
   139         return iLockAccessExtension->SendMessage( ELockAppDisableKeyguard, aWithNote );
   151         }
   140         }
   152     else
   141     else
   153         {
   142         {
   154         RDEBUG("0", 0);
       
   155         return KErrNotFound;
   143         return KErrNotFound;
   156         }
   144         }
   157     }
   145     }
   158 
   146 
   159 // ---------------------------------------------------------------------------
   147 // ---------------------------------------------------------------------------
   160 // Requests lockapp server to offer keyguard to user.
   148 // Requests lockapp server to offer keyguard to user.
   161 // ---------------------------------------------------------------------------
   149 // ---------------------------------------------------------------------------
   162 EXPORT_C TInt CKeyguardAccessApi::OfferKeyguard()
   150 EXPORT_C TInt CKeyguardAccessApi::OfferKeyguard()
   163     {
   151     {
   164    	RDEBUG("0", 0);
       
   165     if ( iLockAccessExtension )
   152     if ( iLockAccessExtension )
   166         {
   153         {
   167         return iLockAccessExtension->SendMessage( ELockAppOfferKeyguard );
   154         return iLockAccessExtension->SendMessage( ELockAppOfferKeyguard );
   168         }
   155         }
   169     else
   156     else
   175 // ---------------------------------------------------------------------------
   162 // ---------------------------------------------------------------------------
   176 // Shows note informing that keys are locked. Only works if keyguard is already enabled.
   163 // Shows note informing that keys are locked. Only works if keyguard is already enabled.
   177 // ---------------------------------------------------------------------------
   164 // ---------------------------------------------------------------------------
   178 EXPORT_C TInt CKeyguardAccessApi::ShowKeysLockedNote()
   165 EXPORT_C TInt CKeyguardAccessApi::ShowKeysLockedNote()
   179     {
   166     {
   180     RDEBUG("0", 0);
       
   181     if ( iLockAccessExtension )
   167     if ( iLockAccessExtension )
   182         {
   168         {
   183         return iLockAccessExtension->SendMessage( ELockAppShowKeysLockedNote );
   169         return iLockAccessExtension->SendMessage( ELockAppShowKeysLockedNote );
   184         }
   170         }
   185     else
   171     else