securitydialogs/lockclient/src/keyguardaccessapi.cpp
branchGCC_SURGE
changeset 40 604cd42065d1
parent 26 aad866c37519
child 53 25dd1e8b2663
equal deleted inserted replaced
29:b63e8c2d8cff 40:604cd42065d1
    29 // ---------------------------------------------------------------------------
    29 // ---------------------------------------------------------------------------
    30 // Standard Symbian OS construction sequence
    30 // Standard Symbian OS construction sequence
    31 // ---------------------------------------------------------------------------
    31 // ---------------------------------------------------------------------------
    32 EXPORT_C CKeyguardAccessApi* CKeyguardAccessApi::NewL( )
    32 EXPORT_C CKeyguardAccessApi* CKeyguardAccessApi::NewL( )
    33     {
    33     {
    34     qDebug() << "============= CKeyguardAccessApi::NewL";
    34     RDEBUG("0", 0);
    35     RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
       
    36 
    35 
    37     CKeyguardAccessApi* self = new (ELeave) CKeyguardAccessApi( );
    36     CKeyguardAccessApi* self = new (ELeave) CKeyguardAccessApi( );
    38     CleanupStack::PushL( self );
    37     CleanupStack::PushL( self );
    39     self->ConstructL( );
    38     self->ConstructL( );
    40     CleanupStack::Pop( self );
    39     CleanupStack::Pop( self );
    44 // ---------------------------------------------------------------------------
    43 // ---------------------------------------------------------------------------
    45 // Constructor.
    44 // Constructor.
    46 // ---------------------------------------------------------------------------
    45 // ---------------------------------------------------------------------------
    47 CKeyguardAccessApi::CKeyguardAccessApi()
    46 CKeyguardAccessApi::CKeyguardAccessApi()
    48     {
    47     {
    49     qDebug() << "============= CKeyguardAccessApi::CKeyguardAccessApi";
    48     RDEBUG("0", 0);
    50     RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
       
    51     }
    49     }
    52 
    50 
    53 // ---------------------------------------------------------------------------
    51 // ---------------------------------------------------------------------------
    54 // Destructor.
    52 // Destructor.
    55 // ---------------------------------------------------------------------------
    53 // ---------------------------------------------------------------------------
    66 // ---------------------------------------------------------------------------
    64 // ---------------------------------------------------------------------------
    67 // Second phase construction
    65 // Second phase construction
    68 // ---------------------------------------------------------------------------
    66 // ---------------------------------------------------------------------------
    69 void CKeyguardAccessApi::ConstructL( )
    67 void CKeyguardAccessApi::ConstructL( )
    70     {
    68     {
    71     qDebug() << "============= CKeyguardAccessApi::ConstructL";
    69     RDEBUG("0", 0);
    72     RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
       
    73     iLockAccessExtension = new (ELeave) RLockAccessExtension;
    70     iLockAccessExtension = new (ELeave) RLockAccessExtension;
    74     }
    71     }
    75 
    72 
    76 // ---------------------------------------------------------------------------
    73 // ---------------------------------------------------------------------------
    77 // 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
    78 // ---------------------------------------------------------------------------
    75 // ---------------------------------------------------------------------------
    79 EXPORT_C TBool CKeyguardAccessApi::IsKeylockEnabled()
    76 EXPORT_C TBool CKeyguardAccessApi::IsKeylockEnabled()
    80     {
    77     {
    81 
    78 
    82 		qDebug() << "============= CKeyguardAccessApi::IsKeylockEnabled";
    79 		RDEBUG("0", 0);
    83     TInt value;
    80     TInt value;
    84     TInt err = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value);
    81     TInt err = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value);
    85     if ( err == KErrNone )
    82     if ( err == KErrNone )
    86         {
    83         {
    87         switch( value )
    84         switch( value )
   103 // ---------------------------------------------------------------------------
   100 // ---------------------------------------------------------------------------
   104 // Checks if the keyguard is enabled or not
   101 // Checks if the keyguard is enabled or not
   105 // ---------------------------------------------------------------------------
   102 // ---------------------------------------------------------------------------
   106 EXPORT_C TBool CKeyguardAccessApi::IsKeyguardEnabled()
   103 EXPORT_C TBool CKeyguardAccessApi::IsKeyguardEnabled()
   107     {
   104     {
   108     qDebug() << "============= CKeyguardAccessApi::IsKeyguardEnabled";
   105     RDEBUG("0", 0);
   109     RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
       
   110 
       
   111     TInt value;
   106     TInt value;
   112     TInt err = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value);
   107     TInt err = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value);
   113     if ( err == KErrNone )
   108     if ( err == KErrNone )
   114         {
   109         {
   115         switch( value )
   110         switch( value )
   146 // ---------------------------------------------------------------------------
   141 // ---------------------------------------------------------------------------
   147 // Requests lockapp server to disable keyguard with or without note.
   142 // Requests lockapp server to disable keyguard with or without note.
   148 // ---------------------------------------------------------------------------
   143 // ---------------------------------------------------------------------------
   149 EXPORT_C TInt CKeyguardAccessApi::DisableKeyguard( TBool aWithNote )
   144 EXPORT_C TInt CKeyguardAccessApi::DisableKeyguard( TBool aWithNote )
   150     {
   145     {
   151 		qDebug() << "============= CKeyguardAccessApi::DisableKeyguard";
   146 		RDEBUG("aWithNote", aWithNote);
   152     if ( iLockAccessExtension )
   147     if ( iLockAccessExtension )
   153         {
   148         {
   154         		qDebug() << "============= CKeyguardAccessApi::DisableKeyguard 1";
   149         RDEBUG("0", 1);
   155         return iLockAccessExtension->SendMessage( ELockAppDisableKeyguard, aWithNote );
   150         return iLockAccessExtension->SendMessage( ELockAppDisableKeyguard, aWithNote );
   156         }
   151         }
   157     else
   152     else
   158         {
   153         {
   159         			qDebug() << "============= CKeyguardAccessApi::DisableKeyguard 0";
   154         RDEBUG("0", 0);
   160 
       
   161         return KErrNotFound;
   155         return KErrNotFound;
   162         }
   156         }
   163     }
   157     }
   164 
   158 
   165 // ---------------------------------------------------------------------------
   159 // ---------------------------------------------------------------------------
   166 // Requests lockapp server to offer keyguard to user.
   160 // Requests lockapp server to offer keyguard to user.
   167 // ---------------------------------------------------------------------------
   161 // ---------------------------------------------------------------------------
   168 EXPORT_C TInt CKeyguardAccessApi::OfferKeyguard()
   162 EXPORT_C TInt CKeyguardAccessApi::OfferKeyguard()
   169     {
   163     {
       
   164    	RDEBUG("0", 0);
   170     if ( iLockAccessExtension )
   165     if ( iLockAccessExtension )
   171         {
   166         {
   172         return iLockAccessExtension->SendMessage( ELockAppOfferKeyguard );
   167         return iLockAccessExtension->SendMessage( ELockAppOfferKeyguard );
   173         }
   168         }
   174     else
   169     else
   180 // ---------------------------------------------------------------------------
   175 // ---------------------------------------------------------------------------
   181 // 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.
   182 // ---------------------------------------------------------------------------
   177 // ---------------------------------------------------------------------------
   183 EXPORT_C TInt CKeyguardAccessApi::ShowKeysLockedNote()
   178 EXPORT_C TInt CKeyguardAccessApi::ShowKeysLockedNote()
   184     {
   179     {
   185     qDebug() << "============= CKeyguardAccessApi::ShowKeysLockedNote";
   180     RDEBUG("0", 0);
   186     if ( iLockAccessExtension )
   181     if ( iLockAccessExtension )
   187         {
   182         {
   188         return iLockAccessExtension->SendMessage( ELockAppShowKeysLockedNote );
   183         return iLockAccessExtension->SendMessage( ELockAppShowKeysLockedNote );
   189         }
   184         }
   190     else
   185     else