ipsservices/ipssosplugin/src/ipsplgpop3connectop.cpp
branchRCL_3
changeset 8 e1b6206813b4
parent 4 e7aa27f58ae1
child 24 d189ee25cf9d
equal deleted inserted replaced
4:e7aa27f58ae1 8:e1b6206813b4
   147             
   147             
   148         if ( ( err == KPop3InvalidUser ) ||
   148         if ( ( err == KPop3InvalidUser ) ||
   149              ( err == KPop3InvalidLogin )  ||
   149              ( err == KPop3InvalidLogin )  ||
   150              ( err == KPop3InvalidApopLogin ) )
   150              ( err == KPop3InvalidApopLogin ) )
   151             {
   151             {
   152             // Login details are wrong.
   152             // Login details are wrong. Trying to ask for password
   153         
   153             if ( !QueryUserPassL() )
   154             iState = EQueryingDetails;
   154                 {
   155             
   155                 CompleteObserver( err );
   156             QueryUsrPassL();
   156                 }
   157             }
   157             }
   158         else if ( err == KErrNone )
   158         else if ( err == KErrNone )
   159             {
   159             {
   160             if ( iForcePopulate && Connected() )
   160             if ( iForcePopulate && Connected() )
   161                 {
   161                 {
   165             else
   165             else
   166                 {
   166                 {
   167                 iState = EIdle;
   167                 iState = EIdle;
   168                 CompleteObserver( KErrNone );
   168                 CompleteObserver( KErrNone );
   169                 }
   169                 }
   170                 
       
   171             }
   170             }
   172         else
   171         else
   173             {
   172             {
   174             // We can't do this before, because 
   173             // We can't do this before, because 
   175             // we want to handle KPop3InvalidUser,
   174             // we want to handle KPop3InvalidUser,
   186                     iService, KIpsSosEmailSyncCompleted, err );
   185                     iService, KIpsSosEmailSyncCompleted, err );
   187             }
   186             }
   188         CIpsPlgSyncStateHandler::SaveSuccessfulSyncTimeL(
   187         CIpsPlgSyncStateHandler::SaveSuccessfulSyncTimeL(
   189                 iMsvSession, iService );
   188                 iMsvSession, iService );
   190         CompleteObserver( err ); 
   189         CompleteObserver( err ); 
   191         }
       
   192     else if ( iState == EErrInvalidDetails )
       
   193         {
       
   194         // proper error code;
       
   195         CompleteObserver( KErrGeneral );
       
   196         }
   190         }
   197     else
   191     else
   198         {
   192         {
   199         User::Panic( KIpsPlgPopConnectPanic ,KErrNotFound);
   193         User::Panic( KIpsPlgPopConnectPanic ,KErrNotFound);
   200         }
   194         }
   236     TFSProgress result = { TFSProgress::EFSStatus_Waiting, 0, 0, KErrNone };
   230     TFSProgress result = { TFSProgress::EFSStatus_Waiting, 0, 0, KErrNone };
   237     result.iError = KErrNone;
   231     result.iError = KErrNone;
   238     switch( iState )
   232     switch( iState )
   239         {
   233         {
   240         case EQueryingDetails:
   234         case EQueryingDetails:
       
   235         case EQueryingDetailsBusy:
   241             result.iProgressStatus = TFSProgress::EFSStatus_Authenticating;
   236             result.iProgressStatus = TFSProgress::EFSStatus_Authenticating;
   242             break;
   237             break;
   243         case EStartConnect:
   238         case EStartConnect:
   244         case EConnected:
   239         case EConnected:
   245             result.iProgressStatus = TFSProgress::EFSStatus_Connecting;
   240             result.iProgressStatus = TFSProgress::EFSStatus_Connecting;
   425     // do proper validation. OR: not needed?
   420     // do proper validation. OR: not needed?
   426     return ETrue;
   421     return ETrue;
   427     }
   422     }
   428 
   423 
   429 // ----------------------------------------------------------------------------
   424 // ----------------------------------------------------------------------------
   430 // CIpsPlgPop3ConnectOp::QueryUsrPassL()
   425 // CIpsPlgPop3ConnectOp::QueryUserPassL()
   431 // ----------------------------------------------------------------------------
   426 // ----------------------------------------------------------------------------
   432 //
   427 //
   433 void CIpsPlgPop3ConnectOp::QueryUsrPassL()
   428 TBool CIpsPlgPop3ConnectOp::QueryUserPassL()
   434     {
   429     {
   435     FUNC_LOG;
   430     FUNC_LOG;
   436 
   431 
   437     if ( iEventHandler )
   432     if ( iEventHandler )
   438         {
   433         {
   439         iEventHandler->QueryUsrPassL( iEntry->EntryId(), this );
   434         // ask for credentials for pop3 account and wait for callback
   440         }
   435         if ( iEventHandler->QueryUsrPassL( iEntry->EntryId(), this ) )
   441     }
   436             {
   442 
   437             iState = EQueryingDetails;
       
   438             }
       
   439         else
       
   440             {
       
   441             // another operation is waiting for password
       
   442             iState = EQueryingDetailsBusy;
       
   443             }
       
   444 
       
   445         return ETrue;
       
   446         }
       
   447 
       
   448     return EFalse;
       
   449     }
   443 
   450 
   444 
   451 
   445 // ----------------------------------------------------------------------------
   452 // ----------------------------------------------------------------------------
   446 // CIpsPlgPop3ConnectOp::GetOperationErrorCodeL()
   453 // CIpsPlgPop3ConnectOp::GetOperationErrorCodeL()
   447 // ----------------------------------------------------------------------------    
   454 // ----------------------------------------------------------------------------    
   474     }
   481     }
   475 
   482 
   476 // ----------------------------------------------------------------------------
   483 // ----------------------------------------------------------------------------
   477 // ----------------------------------------------------------------------------
   484 // ----------------------------------------------------------------------------
   478 void CIpsPlgPop3ConnectOp::CredientialsSetL( TInt aEvent )
   485 void CIpsPlgPop3ConnectOp::CredientialsSetL( TInt aEvent )
   479     {              
   486     {
   480     FUNC_LOG;
   487     FUNC_LOG;
   481     if ( aEvent == EIPSSosCredientialsCancelled ) 
   488 
   482         {
   489     if ( iState == EQueryingDetails )
       
   490         {
       
   491         // response for our operation`s query
       
   492         if ( aEvent == EIPSSosCredientialsCancelled )
       
   493             {
       
   494             // user canceled operation
       
   495             CompleteObserver( KErrCancel );
       
   496             }
       
   497 
       
   498         // password has been set, continue with operation
       
   499         SetActive();
       
   500         CompleteThis();
       
   501         }
       
   502     else if ( iState == EQueryingDetailsBusy )
       
   503         {
       
   504         // response for other operation`s query
       
   505         // we could try to ask for password now,
       
   506         // but decision was made to cancel operation
   483         CompleteObserver( KErrCancel );
   507         CompleteObserver( KErrCancel );
   484         }
   508         SetActive();
   485     //password has been set, continue with operation
   509         CompleteThis();
   486     
   510         }
   487     SetActive();
       
   488     CompleteThis();
       
   489     }
   511     }
   490 //EOF
   512 //EOF
   491 
   513 
   492 
   514