diff -r 139d4b7b2938 -r 99bcbff212ad ipsservices/ipssosplugin/src/ipsplgpop3connectop.cpp --- a/ipsservices/ipssosplugin/src/ipsplgpop3connectop.cpp Mon May 24 21:02:02 2010 +0300 +++ b/ipsservices/ipssosplugin/src/ipsplgpop3connectop.cpp Fri May 28 13:56:43 2010 +0300 @@ -30,7 +30,8 @@ // CIpsPlgPop3ConnectOp::NewL() // ---------------------------------------------------------------------------- // MFSMailRequestObserver& changed to pointer -// aSignallingAllowed parameter removed +// aSignallingAllowed parameter added +// aFetchWillFollow parameter added CIpsPlgPop3ConnectOp* CIpsPlgPop3ConnectOp::NewL( CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus, @@ -40,7 +41,9 @@ TFSMailMsgId aFSMailBoxId, MFSMailRequestObserver* aFSOperationObserver, TInt aFSRequestId, - CIpsPlgEventHandler* aEventHandler ) + CIpsPlgEventHandler* aEventHandler, + TBool aSignallingAllowed, + TBool aFetchWillFollow ) { FUNC_LOG; CIpsPlgPop3ConnectOp* op = new(ELeave) CIpsPlgPop3ConnectOp( @@ -52,7 +55,9 @@ aFSMailBoxId, aFSOperationObserver, aFSRequestId, - aEventHandler ); + aEventHandler, + aSignallingAllowed, + aFetchWillFollow ); CleanupStack::PushL( op ); op->ConstructL(); @@ -112,7 +117,7 @@ void CIpsPlgPop3ConnectOp::DoRunL() { FUNC_LOG; - // move TInt err declaration later, and narrow the scope + TInt err( KErrNone ); // remove EQueryingDetails state if ( iState == EStartConnect ) @@ -133,35 +138,46 @@ else if ( iState == EConnected ) { // Connect completed -// Login details checking removed - User::LeaveIfError( iStatus.Int() ); + // Login details checking removed + err = GetOperationErrorCodeL( ); + User::LeaveIfError( err ); + if ( iForcePopulate && Connected() ) { iState = EPopulate; DoPopulateL(); } + // + else if( iFetchWillFollow && Connected() ) + { + // Leave connection open to make fetch + // operation possible + iState = EIdle; + CompleteObserver( KErrNone ); + } + // else { // // start disconnecting iState = EDisconnecting; - DoDisconnect(); + DoDisconnectL(); // } } else if ( iState == EPopulate ) { - // suboperation has completed, the result is in 'this->iStatus' + err = GetOperationErrorCodeL( ); if ( iEventHandler ) { - iEventHandler->SetNewPropertyEvent( iService, KIpsSosEmailSyncCompleted, iStatus.Int() ); + iEventHandler->SetNewPropertyEvent( iService, KIpsSosEmailSyncCompleted, err ); } CIpsPlgSyncStateHandler::SaveSuccessfulSyncTimeL( iMsvSession, iService ); // // start disconnecting iState = EDisconnecting; - DoDisconnect(); + DoDisconnectL(); // } // @@ -240,7 +256,9 @@ // // priority parameter has been removed // MFSMailRequestObserver& changed to pointer -// aSignallingAllowed parameter removed +// aSignallingAllowed parameter added +// aFetchWillFollow parameter added +// iAlreadyConnected removed CIpsPlgPop3ConnectOp::CIpsPlgPop3ConnectOp( CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus, @@ -250,7 +268,9 @@ TFSMailMsgId aFSMailBoxId, MFSMailRequestObserver* aFSOperationObserver, TInt aFSRequestId, - CIpsPlgEventHandler* aEventHandler ) + CIpsPlgEventHandler* aEventHandler, + TBool aSignallingAllowed, + TBool aFetchWillFollow ) : CIpsPlgOnlineOperation( aMsvSession, @@ -258,11 +278,12 @@ aActivityTimer, aFSMailBoxId, aFSOperationObserver, - aFSRequestId ), + aFSRequestId, + aSignallingAllowed ), iState( EIdle ), iForcePopulate( aForcePopulate ), iEventHandler( aEventHandler ), - iAlreadyConnected( EFalse ) + iFetchWillFollow( aFetchWillFollow ) { iService = aServiceId; } @@ -297,7 +318,7 @@ if ( tentry.Connected() ) { iState = EConnected; - iAlreadyConnected = ETrue; + // iAlreadyConnected removed } else { @@ -367,13 +388,35 @@ // removed QueryUsrPassL() from here as unneeded // removed ValidateL() (did nothing) -// removed TInt CIpsPlgPop3ConnectOp::GetOperationErrorCodeL( ) + +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +// +TInt CIpsPlgPop3ConnectOp::GetOperationErrorCodeL( ) + { + FUNC_LOG; + if ( !iSubOperation ) + { + return KErrNotFound; + } + if ( !iSubOperation->IsActive() && iSubOperation->iStatus.Int() != KErrNone ) + { + return iSubOperation->iStatus.Int(); + } + + TPckgBuf paramPack; + paramPack.Copy( iSubOperation->ProgressL() ); + const TPop3Progress& progress = paramPack(); + + return progress.iErrorCode; + } + // removed CIpsPlgImap4ConnectOp::CredientialsSetL // new functions // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- -void CIpsPlgPop3ConnectOp::DoDisconnect() +void CIpsPlgPop3ConnectOp::DoDisconnectL() { FUNC_LOG; // unnecessary: iStatus = KRequestPending; @@ -398,7 +441,7 @@ if ( limit > 0 ) { // basically doing a _very_rough_ conversion from kilobyte value to number-of-rows - limit = ( limit * KPopulateAlgorithmBytesInKilo ) / KPopulateAlgorithmRowLength; + limit = ( limit * KPopulateAlgorithmBytesInKilo ) / KPopulateAlgorithmRowLength; } CleanupStack::PopAndDestroy( 2, settings ); return limit;