ipsservices/ipssosplugin/src/ipsplgpop3connectop.cpp
branchRCL_3
changeset 8 e1b6206813b4
parent 4 e7aa27f58ae1
child 24 d189ee25cf9d
--- a/ipsservices/ipssosplugin/src/ipsplgpop3connectop.cpp	Tue Feb 02 00:02:40 2010 +0200
+++ b/ipsservices/ipssosplugin/src/ipsplgpop3connectop.cpp	Fri Feb 19 22:37:30 2010 +0200
@@ -149,11 +149,11 @@
              ( err == KPop3InvalidLogin )  ||
              ( err == KPop3InvalidApopLogin ) )
             {
-            // Login details are wrong.
-        
-            iState = EQueryingDetails;
-            
-            QueryUsrPassL();
+            // Login details are wrong. Trying to ask for password
+            if ( !QueryUserPassL() )
+                {
+                CompleteObserver( err );
+                }
             }
         else if ( err == KErrNone )
             {
@@ -167,7 +167,6 @@
                 iState = EIdle;
                 CompleteObserver( KErrNone );
                 }
-                
             }
         else
             {
@@ -189,11 +188,6 @@
                 iMsvSession, iService );
         CompleteObserver( err ); 
         }
-    else if ( iState == EErrInvalidDetails )
-        {
-        // proper error code;
-        CompleteObserver( KErrGeneral );
-        }
     else
         {
         User::Panic( KIpsPlgPopConnectPanic ,KErrNotFound);
@@ -238,6 +232,7 @@
     switch( iState )
         {
         case EQueryingDetails:
+        case EQueryingDetailsBusy:
             result.iProgressStatus = TFSProgress::EFSStatus_Authenticating;
             break;
         case EStartConnect:
@@ -427,21 +422,33 @@
     }
 
 // ----------------------------------------------------------------------------
-// CIpsPlgPop3ConnectOp::QueryUsrPassL()
+// CIpsPlgPop3ConnectOp::QueryUserPassL()
 // ----------------------------------------------------------------------------
 //
-void CIpsPlgPop3ConnectOp::QueryUsrPassL()
+TBool CIpsPlgPop3ConnectOp::QueryUserPassL()
     {
     FUNC_LOG;
 
     if ( iEventHandler )
         {
-        iEventHandler->QueryUsrPassL( iEntry->EntryId(), this );
+        // ask for credentials for pop3 account and wait for callback
+        if ( iEventHandler->QueryUsrPassL( iEntry->EntryId(), this ) )
+            {
+            iState = EQueryingDetails;
+            }
+        else
+            {
+            // another operation is waiting for password
+            iState = EQueryingDetailsBusy;
+            }
+
+        return ETrue;
         }
+
+    return EFalse;
     }
 
 
-
 // ----------------------------------------------------------------------------
 // CIpsPlgPop3ConnectOp::GetOperationErrorCodeL()
 // ----------------------------------------------------------------------------    
@@ -476,16 +483,31 @@
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 void CIpsPlgPop3ConnectOp::CredientialsSetL( TInt aEvent )
-    {              
+    {
     FUNC_LOG;
-    if ( aEvent == EIPSSosCredientialsCancelled ) 
+
+    if ( iState == EQueryingDetails )
         {
+        // response for our operation`s query
+        if ( aEvent == EIPSSosCredientialsCancelled )
+            {
+            // user canceled operation
+            CompleteObserver( KErrCancel );
+            }
+
+        // password has been set, continue with operation
+        SetActive();
+        CompleteThis();
+        }
+    else if ( iState == EQueryingDetailsBusy )
+        {
+        // response for other operation`s query
+        // we could try to ask for password now,
+        // but decision was made to cancel operation
         CompleteObserver( KErrCancel );
+        SetActive();
+        CompleteThis();
         }
-    //password has been set, continue with operation
-    
-    SetActive();
-    CompleteThis();
     }
 //EOF