eapol/eapol_framework/eapol_symbian/am/eap_notifier/src/eap_auth_observer.cpp
changeset 52 c23bdf5a328a
parent 42 53085837e73a
--- a/eapol/eapol_framework/eapol_symbian/am/eap_notifier/src/eap_auth_observer.cpp	Fri Sep 17 08:30:11 2010 +0300
+++ b/eapol/eapol_framework/eapol_symbian/am/eap_notifier/src/eap_auth_observer.cpp	Mon Oct 04 00:19:54 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 15 %
+* %version: 12 %
 */
 
 // System include files
@@ -88,71 +88,84 @@
 void CEapAuthObserver::DataReceived( CHbSymbianVariantMap& aData )
 {
     RDebug::Print(_L("CEapAuthObserver::DataReceived") );
+        
+    TInt status = KErrNone;    
     
     if ( iType == CEapAuthNotifier::EEapNotifierTypeLEapUsernamePasswordDialog )
         {
         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeLEapUsernamePasswordDialog") );
         UsernamePasswordDlgDataReceived(aData);
+        TRAP_IGNORE( iNotifier->CompleteL( status ));
         }
     else if ( iType == CEapAuthNotifier::EEapNotifierTypeGTCUsernamePasswordDialog )
         {
         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeGTCUsernamePasswordDialog") );
         UsernamePasswordDlgDataReceived(aData);
+        TRAP_IGNORE( iNotifier->CompleteL( status ));
         }
     else if ( iType == CEapAuthNotifier::EEapNotifierTypePapUsernamePasswordDialog )
         {
         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypePapUsernamePasswordDialog") );
         UsernamePasswordDlgDataReceived(aData);
+        TRAP_IGNORE( iNotifier->CompleteL( status ));
         }
     else if ( iType == CEapAuthNotifier::EEapNotifierTypeEapMsChapV2UsernamePasswordDialog )
         {
         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeEapMsChapV2UsernamePasswordDialog") );
         UsernamePasswordDlgDataReceived(aData);
+        TRAP_IGNORE( iNotifier->CompleteL( status ));
         }
     else if ( iType == CEapAuthNotifier::EEapNotifierTypeMsChapV2UsernamePasswordDialog )
         {
         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeMsChapV2UsernamePasswordDialog") );
         UsernamePasswordDlgDataReceived(aData);
+        TRAP_IGNORE( iNotifier->CompleteL( status ));
         }
     else if ( iType == CEapAuthNotifier::EEapNotifierTypeGTCQueryDialog )
         {
         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeGTCQueryDialog") ); 
         PwdQueryDataReceived(aData);
+        TRAP_IGNORE( iNotifier->CompleteL( status ));
         }
     else if ( iType == CEapAuthNotifier::EEapNotifierTypePapAuthQueryDialog )
         {
         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypePapAuthQueryDialog") ); 
         PwdQueryDataReceived(aData);
+        TRAP_IGNORE( iNotifier->CompleteL( status ));
         }
     else if ( iType == CEapAuthNotifier::EEapNotifierTypeFastPacStorePwQueryDialog )
         {
         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeFastPacStorePwQueryDialog") ); 
-        PwdQueryDataReceived(aData);
+        PacStorePwdQueryDataReceived(aData);
         }
     else if ( iType == CEapAuthNotifier::EEapNotifierTypeFastCreateMasterkeyQueryDialog )
         {
         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeFastCreateMasterkeyQueryDialog") ); 
         PwdQueryDataReceived(aData);
+        TRAP_IGNORE( iNotifier->CompleteL( status ));
         }
     else if ( iType == CEapAuthNotifier::EEapNotifierTypeFastPacFilePwQueryDialog )
         {
         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeFastPacFilePwQueryDialog") ); 
         PwdQueryDataReceived(aData);
+        TRAP_IGNORE( iNotifier->CompleteL( status ));
         }
     else if ( iType == CEapAuthNotifier::EEapNotifierTypeMsChapV2OldPasswordDialog )
         {
         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeMsChapV2OldPasswordDialog") ); 
         OldPwdQueryDataReceived(aData);
+        TRAP_IGNORE( iNotifier->CompleteL( status ));
         }
     else if ( iType == CEapAuthNotifier::EEapNotifierTypeMsChapV2NewPasswordDialog )
         {
         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeMsChapV2NewPasswordDialog") ); 
         PwdQueryDataReceived(aData);
+        TRAP_IGNORE( iNotifier->CompleteL( status ));
         }
     
-    TInt status = KErrNone;
+    
     
-    TRAP_IGNORE( iNotifier->CompleteL( status ));
+    //TRAP_IGNORE( iNotifier->CompleteL( status ));
 }
 
 // ---------------------------------------------------------------------------
@@ -251,6 +264,51 @@
     iNotifier->SetSelectedPassword( PasswordInfo );   
 }
 
+// ---------------------------------------------------------------------------
+// Handles the PAC Store password query user input received from the dialog
+// ---------------------------------------------------------------------------
+//
+void CEapAuthObserver::PacStorePwdQueryDataReceived( CHbSymbianVariantMap& aData )
+{
+    RDebug::Print(_L("CEapAuthObserver::PacStorePwdQueryDataReceived") ); 
+        
+    TBool Match = EFalse;   
+    TInt  status = KErrNone;    
+    
+    _LIT(KPassword, "password");
+    
+    CEapAuthNotifier::TEapDialogInfo PasswordInfo;
+    TDesC* Data = NULL;
+           
+    const CHbSymbianVariant *my_variant = aData.Get(KPassword); 
+    if ( my_variant != NULL )
+        {
+        ASSERT( my_variant->Type() == CHbSymbianVariant::EDes  );
+    
+        Data = reinterpret_cast<TDesC*>(my_variant->Data());     
+        PasswordInfo.iPassword.Copy( Data->Ptr(), Data->Length() );
+
+        RDebug::Print(_L("CEapAuthObserver::PwdQueryDataReceived: PasswordInfo.iPassword = %S\n"), &PasswordInfo.iPassword );
+        }
+             
+     // Check if given password can be used to open the PAC store.
+     Match = iNotifier->CheckPasswordMatchingL(PasswordInfo);
+
+     if ( Match != EFalse )
+        {
+        RDebug::Print(_L("CEapAuthObserver::PacStorePwdQueryDataReceived: Match == TRUE") );     
+        iNotifier->SetSelectedPassword( PasswordInfo );   
+        //update(true); 
+        TRAP_IGNORE( iNotifier->CompleteL( status ));    
+        } 
+     else
+        {
+        RDebug::Print(_L("CEapAuthObserver::PacStorePwdQueryDataReceived: Match == FALSE") );       
+        //update(false);       
+        }
+     iNotifier->UpdateDialogL(Match);       
+}
+
 // Derived function:
 // ---------------------------------------------------------------------------
 // From class MHbDeviceDialogObserver.