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