ipsservices/ipssosplugin/src/ipsplgimap4connectop.cpp
branchRCL_3
changeset 24 d189ee25cf9d
parent 8 e1b6206813b4
child 25 3533d4323edc
--- a/ipsservices/ipssosplugin/src/ipsplgimap4connectop.cpp	Thu Aug 19 09:38:05 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgimap4connectop.cpp	Tue Aug 31 15:04:17 2010 +0300
@@ -16,34 +16,33 @@
 *
 */
 
-
 #include "emailtrace.h"
 #include "ipsplgheaders.h"
 
+// <qmail> removed
 
-_LIT( KIpsPlgIpsConnPanic, "IpsConn" ); 
+// <qmail> KIpsPlgIpsConnPanic removed
 
 // ----------------------------------------------------------------------------
 // CIpsPlgImap4ConnectOp::NewL()
 // ----------------------------------------------------------------------------
-// 
+// <qmail> priority parameter has been removed
+// <qmail> MFSMailRequestObserver& changed it to pointer
+// <qmail> aSignallingAllowed parameter has been removed
 CIpsPlgImap4ConnectOp* CIpsPlgImap4ConnectOp::NewL(
     CMsvSession& aMsvSession,
-	TInt aPriority,
     TRequestStatus& aObserverRequestStatus,
     TMsvId aService,
     CIpsPlgTimerOperation& aActivityTimer,
     TFSMailMsgId aFSMailBoxId,
-    MFSMailRequestObserver& aFSOperationObserver,
+    MFSMailRequestObserver* aFSOperationObserver,
     TInt aFSRequestId,
     CIpsPlgEventHandler* aEventHandler,
-    TBool aDoPlainConnect,
-    TBool aSignallingAllowed )
+    TBool aDoPlainConnect )
     {
     FUNC_LOG;
     CIpsPlgImap4ConnectOp* self = new (ELeave) CIpsPlgImap4ConnectOp(
         aMsvSession, 
-        aPriority, 
         aObserverRequestStatus,
         aService, 
         aActivityTimer,
@@ -51,7 +50,6 @@
         aFSOperationObserver,
         aFSRequestId,
         aDoPlainConnect,
-        aSignallingAllowed,
         aEventHandler );
         
     CleanupStack::PushL( self );
@@ -63,33 +61,32 @@
 // ----------------------------------------------------------------------------
 // CIpsPlgImap4ConnectOp::CIpsPlgImap4ConnectOp()
 // ----------------------------------------------------------------------------
-// 
+// <qmail> priority parameter has been removed
+// <qmail> MFSMailRequestObserver& changed it to pointer
+// <qmail> aSignallingAllowed parameter has been removed
 CIpsPlgImap4ConnectOp::CIpsPlgImap4ConnectOp(
     CMsvSession& aMsvSession,
-	TInt aPriority,
     TRequestStatus& aObserverRequestStatus,
     TMsvId aService,
     CIpsPlgTimerOperation& aActivityTimer,
     TFSMailMsgId aFSMailBoxId,
-    MFSMailRequestObserver& aFSOperationObserver,
+    MFSMailRequestObserver* aFSOperationObserver,
     TInt aFSRequestId,
     TBool aDoPlainConnect,
-    TBool aSignallingAllowed,
     CIpsPlgEventHandler* aEventHandler)
     :
     CIpsPlgOnlineOperation(
 	    aMsvSession,
-	    aPriority,
 	    aObserverRequestStatus,
 	    aActivityTimer,
 	    aFSMailBoxId,
 	    aFSOperationObserver,
-	    aFSRequestId,
-    	aSignallingAllowed ),
+	    aFSRequestId ),
+    iState( EStateIdle ),
+    iSelection( NULL ),
     iDoPlainConnect( aDoPlainConnect ),
     iEventHandler( aEventHandler ),
-    iIsSyncStartedSignaled( EFalse ),
-    iAlreadyConnected( EFalse )
+    iIsSyncStartedSignaled( EFalse )
     {
     FUNC_LOG;
     iService = aService;
@@ -104,7 +101,7 @@
     FUNC_LOG;
     Cancel();
     delete iSelection;
-    iState = EStateIdle;
+    // <qmail> setting state in destructor makes no sense
     }
 
 // ----------------------------------------------------------------------------
@@ -126,20 +123,20 @@
         User::Panic( KIpsPlgIpsConnPanic, KErrNotSupported );
         }
     
-    if ( tentry.Connected() )
-        {      
-        iState = EStateCompleted; 
-        iAlreadyConnected = ETrue;
-        SetActive();
-        CompleteThis();
+    // <qmail> moved here from StartL which was removed
+    if ( Connected() && iDoPlainConnect )
+        {
+        // trivial case: connect requested, but already connected
+        // (sync is done automatically on background)
+        iState = EStateIdle;
         }
     else
         {
         iState = EStateStartConnect;
-        iStatus = KRequestPending;    
-        SetActive();
-       CompleteThis();
-        }    
+        }
+    iStatus = KRequestPending;    
+    // <qmail> SetActive(); moved inside CompleteThis();
+    CompleteThis();
     }
 
 // ----------------------------------------------------------------------------
@@ -153,9 +150,9 @@
         {
         return GetErrorProgressL( iError );
         }
-    else if(iOperation)
+    else if( iSubOperation )
         {
-        return iOperation->ProgressL();
+        return iSubOperation->ProgressL();
         }
         
     TImap4CompoundProgress& prog = iProgressBuf();
@@ -187,10 +184,7 @@
     result.iError = KErrNone;
     switch( iState )
         {
-        case EStateQueryingDetails:
-        case EStateQueryingDetailsBusy:
-            result.iProgressStatus = TFSProgress::EFSStatus_Authenticating;
-            break;
+        // <qmail> cases EStateQueryingDetails/EStateQueryingDetailsBusy removed
         case EStateStartConnect:
             result.iProgressStatus = TFSProgress::EFSStatus_Started;
             break;
@@ -213,27 +207,14 @@
 // ----------------------------------------------------------------------------
 // CIpsPlgImap4ConnectOp::IpsOpType()
 // ----------------------------------------------------------------------------
-// 
-TInt CIpsPlgImap4ConnectOp::IpsOpType() const
+// <qmail> return type
+TIpsOpType CIpsPlgImap4ConnectOp::IpsOpType() const
     {
     FUNC_LOG;
     return EIpsOpTypeImap4SyncOp;
     }
 
-// ----------------------------------------------------------------------------
-// CIpsPlgImap4ConnectOp::Connected()
-// ----------------------------------------------------------------------------
-// 
-TBool CIpsPlgImap4ConnectOp::Connected() const
-    {
-    FUNC_LOG;
-    TMsvEntry tentry;
-    TMsvId service;
-    iMsvSession.GetEntry(iService, service, tentry );
-    return tentry.Connected();
-    }
-
-
+// <qmail> Connected() moved to baseclass
 // ----------------------------------------------------------------------------
 // CIpsPlgImap4ConnectOp::DoCancel()
 // ----------------------------------------------------------------------------
@@ -241,9 +222,9 @@
 void CIpsPlgImap4ConnectOp::DoCancel()
     {
     FUNC_LOG;
-    if( iOperation )
+    if( iSubOperation )
         {
-        iOperation->Cancel();
+        iSubOperation->Cancel();
         }
     SignalSyncCompleted( KErrCancel );
     CompleteObserver( KErrCancel );
@@ -256,37 +237,34 @@
 void CIpsPlgImap4ConnectOp::DoRunL()
     {
     FUNC_LOG;
-    TInt err = KErrNone;
-    __ASSERT_DEBUG( !(iOperation && iOperation->IsActive()), 
-            User::Panic( KIpsPlgPanicCategory, KErrGeneral ) );
-    if ( iOperation )
+    TInt err( KErrNone );
+    __ASSERT_DEBUG( !(iSubOperation && iSubOperation->IsActive()),
+        User::Panic( KIpsPlgPanicCategory, KErrGeneral ) );
+    if ( iSubOperation )
         {
-        err = iOperation->iStatus.Int();
-        delete iOperation;
-        iOperation = NULL;
+        err = iSubOperation->iStatus.Int();
+        delete iSubOperation;
+        iSubOperation = NULL;
         }
     
     switch( iState )
         {
-        case EStateQueryingDetails:
-            // querying pass finished - try to reconnect
+        // <qmail> removing case EStateQueryingDetails
+        case EStateStartConnect:
+            // <qmail> remove StartL() func and replace it directly with DoConnectOpL
             DoConnectOpL();
             break;
-        case EStateStartConnect:
-        	StartL();
-        	break;
         case EStateConnectAndSync:
             // Connection completed
-
-            if ( err == KErrImapBadLogon )
+                
+            // <qmail> all errors should fail the op
+            if( err )
                 {
-                // Login details are wrong. Trying to ask for password
-                if ( QueryUserPassL() )
-                    {
-                    err = KErrNone;
-                    }
+                iState = EStateIdle;
+                // <qmail> SetActive(); moved inside CompleteThis();
+                CompleteThis();
                 }
-            else if ( err == KErrNone )
+            else
                 {
                 // no errors in connection
                 if( !iDoPlainConnect )
@@ -297,29 +275,28 @@
                     {
                     // Get on with others using this class for connection only
                     iState = EStateIdle;
-                    SetActive();
+                    // <qmail> SetActive(); moved inside CompleteThis();
                     CompleteThis();
                     }
                 }
             break;
         case EStatePopulateAllCompleted:
-            CIpsPlgSyncStateHandler::SaveSuccessfulSyncTimeL(
-                    iMsvSession, iService );
+            CIpsPlgSyncStateHandler::SaveSuccessfulSyncTimeL( iMsvSession, iService );
             // break command is intentially left out
         case EStateCompleted:
             if ( err == KErrNone )
                 {
                 iState = EStateIdle;
-                SetActive();
+                // <qmail> SetActive(); moved inside CompleteThis();
                 CompleteThis();
                 }
             break;
         case EStateIdle:
         default:
-            if ( iOperation )
+            if ( iSubOperation )
                 {
-                delete iOperation;
-                iOperation = NULL;
+                delete iSubOperation;
+                iSubOperation = NULL;
                 }
             CompleteObserver();
             break;
@@ -333,33 +310,7 @@
         }
     }
 
-// ----------------------------------------------------------------------------
-// CIpsPlgImap4ConnectOp::HandleImapConnectionEvent()
-// ----------------------------------------------------------------------------
-// 
-void CIpsPlgImap4ConnectOp::HandleImapConnectionEvent(
-    TImapConnectionEvent aConnectionEvent )
-    {
-    FUNC_LOG;
-    switch ( aConnectionEvent )
-        {
-        case EConnectingToServer:
-            break;
-        case ESynchronisingFolderList:
-        case ESynchronisingInbox:
-		case ESynchronisingFolders:
-		    // send sync started event in any of these sync events
-		    SignalSyncStarted();
-		    break;
-		case ESynchronisationComplete:
-		    break;
-		case EDisconnecting:
-		    break;
-		case EConnectionCompleted:
-	    default:
-	        break;
-        }
-    }
+// <qmail> CIpsPlgImap4ConnectOp::HandleImapConnectionEvent() removed
 
 // ----------------------------------------------------------------------------
 // CIpsPlgImap4ConnectOp::RequestResponseL()
@@ -383,40 +334,38 @@
     iSelection->ResizeL(0);
     iSelection->AppendL(iService);
     
+    // <qmail>
+    iStatus = KRequestPending;
     if ( iDoPlainConnect && !Connected() )
         {
         TBuf8<1> parameter;
-        iStatus = KRequestPending;
+        NM_COMMENT("CIpsPlgImap4ConnectOp: do plain connect");
         // connect and synchronise starts background sync or idle
-        iOperation = iBaseMtm->InvokeAsyncFunctionL(
-                KIMAP4MTMConnect, *iSelection, parameter, iStatus);
-        iState = EStateConnectAndSync;
-        SetActive();
+        iSubOperation = iBaseMtm->InvokeAsyncFunctionL(
+            KIMAP4MTMConnect, *iSelection, parameter, iStatus);
         }
     else if ( Connected() )
         {
         // in this point cant use "connect and do something" commands,
         // use regular sync, when new mails is populated elsewhere.
         TBuf8<1> parameter;
-        iStatus = KRequestPending;
-        iOperation = iBaseMtm->InvokeAsyncFunctionL(
-                KIMAP4MTMFullSync, *iSelection, parameter, iStatus);
-        // also set sync started
-        SignalSyncStarted();
-        iState = EStateConnectAndSync;
-        SetActive();
+        NM_COMMENT("CIpsPlgImap4ConnectOp: full sync starting");
+        iSubOperation = iBaseMtm->InvokeAsyncFunctionL(
+            KIMAP4MTMFullSync, *iSelection, parameter, iStatus);
         }
     else
         {
-        TPckg<MMsvImapConnectionObserver*> parameter(this);
-        // connect and synchronise starts background sync or idle
-        iStatus = KRequestPending;
-        iOperation = iBaseMtm->InvokeAsyncFunctionL(
-                KIMAP4MTMConnectAndSyncCompleteAfterFullSync, 
-                *iSelection, parameter, iStatus);
-        iState = EStateConnectAndSync;
-        SetActive();
+        // the used command requires an observer to be given even though we're not using it
+        NM_COMMENT("CIpsPlgImap4ConnectOp: connect and sync");
+        TPckg<MMsvImapConnectionObserver*> parameter( NULL );
+        iSubOperation = iBaseMtm->InvokeAsyncFunctionL(
+            KIMAP4MTMConnectAndSyncCompleteAfterFullSync, 
+            *iSelection, parameter, iStatus );
         }
+    SignalSyncStarted();
+    iState = EStateConnectAndSync;
+    SetActive();
+    // </qmail>
 	}
 
 // ----------------------------------------------------------------------------
@@ -426,140 +375,55 @@
     {
     FUNC_LOG;
     
+    NM_COMMENT("CIpsPlgImap4ConnectOp: populate all");
     // construct partial fetch info according to imap settings
-    CImImap4Settings* settings = new ( ELeave ) CImImap4Settings();
-    CleanupStack::PushL( settings );
-    CEmailAccounts* accounts = CEmailAccounts::NewLC();
-    TImapAccount imapAcc;
-    accounts->GetImapAccountL(iService, imapAcc );
-    accounts->LoadImapSettingsL( imapAcc, *settings );
+    // <qmail> new function to wrap settings loading
+    CImImap4Settings* settings = GetImapSettingsLC();
     TImImap4GetPartialMailInfo info;
-    CIpsSetDataApi::ConstructImapPartialFetchInfo( info, *settings );
+    ConstructImapPartialFetchInfo( info, *settings );
     TPckgBuf<TImImap4GetPartialMailInfo> package(info);
-    CleanupStack::PopAndDestroy( 2, settings );
+    CleanupStack::PopAndDestroy( settings );
+    settings = NULL;
     
+    // do populate operation unless only headers should be fetched
     if ( info.iTotalSizeLimit != KIpsSetDataHeadersOnly )
         {
-        SignalSyncStarted();
-        CMsvEntry* cEntry = iMsvSession.GetEntryL( iService );
-        CleanupStack::PushL( cEntry );
-        CMsvEntrySelection* childrenSelection = cEntry->ChildrenL();
-        CleanupStack::PushL( childrenSelection );
-        if ( childrenSelection->Count() )
-            {
-            // only inbox is set, do we have to populate other folders also
-            TMsvId id = (*childrenSelection)[0];
-            CMsvEntry* cEntry2 = iMsvSession.GetEntryL( id );
-            CleanupStack::PushL( cEntry2 );
-            delete iSelection;
-            iSelection = NULL;
-            iSelection = cEntry2->ChildrenWithTypeL( KUidMsvMessageEntry );
-            CleanupStack::PopAndDestroy( cEntry2 );
-            
-            }
-        CleanupStack::PopAndDestroy( childrenSelection );
-    
+        // Update iSelection (which will be given to populate op)
+        // <qmail> new function to wrap iSelection populating
+        CreateInboxMessagesSelectionL();
+        
         iStatus = KRequestPending;
-        CIpsPlgTimerOperation* dummy = NULL;
         iBaseMtm->SwitchCurrentEntryL( iService );
-        iOperation = CIpsPlgImap4PopulateOp::NewL(
-                iMsvSession,
-                this->iStatus,
-                CActive::EPriorityLow,
-                iService,
-                *dummy,
-                info,
-                *iSelection,
-                iFSMailboxId,
-                *this,
-                0,
-                iEventHandler );
+        // <qmail> priority parameter has been removed
+        iSubOperation = CIpsPlgImap4PopulateOp::NewL(
+            iMsvSession,
+            iStatus,
+            iService,
+            // <qmail> passing in activity timer; only place where NULL "reference" was used
+            // <qmail> -> can get rid of checking existence of a reference memeber...
+            *iActivityTimer,
+            info,
+            *iSelection,
+            iFSMailboxId,
+            NULL, // no observer for suboperation
+            0, // requestId can be 0
+            iEventHandler );
         
         SetActive();
-        CleanupStack::PopAndDestroy( cEntry );
+        // <qmail> SignalSyncStarted signal moved to happen later in case something goes wrong
+        SignalSyncStarted();
         }
     else
         {
-        SetActive();
+        // <qmail> SetActive(); moved inside CompleteThis();
         CompleteThis();
         }
     iState = EStatePopulateAllCompleted;
     }
 
-// ----------------------------------------------------------------------------
-// CIpsPlgImap4ConnectOp::StartL()
-// ----------------------------------------------------------------------------    
-// 
-void CIpsPlgImap4ConnectOp::StartL()
-    {
-    FUNC_LOG;
-    if ( Connected() && iDoPlainConnect )
-        {
-        // sync is done background, no explicit supported
-        iState = EStateIdle;
-        SetActive();
-        CompleteThis();
-        }
-    else 
-        {
-        DoConnectOpL();
-        }
-    }    
-
-// ----------------------------------------------------------------------------
-// CIpsPlgImap4ConnectOp::QueryUserPwdL()
-// ----------------------------------------------------------------------------
-// 
-TBool CIpsPlgImap4ConnectOp::QueryUserPassL()
-    {
-    if ( iEventHandler )
-        {
-        // ask for credentials for imap account and wait for callback
-        if ( iEventHandler->QueryUsrPassL( iService, this ) )
-            {
-            iState = EStateQueryingDetails;
-            }
-        else
-            {
-            // another operation is waiting for password
-            iState = EStateQueryingDetailsBusy;
-            }
-
-        return ETrue;
-        }
-
-    return EFalse;
-    }
-
-    
-// ----------------------------------------------------------------------------
-// CIpsPlgImap4ConnectOp::GetOperationErrorCodeL()
-// ----------------------------------------------------------------------------    
-//     
-/*TInt CIpsPlgImap4ConnectOp::GetOperationErrorCodeL( )
-    {
-    if ( iAlreadyConnected )
-        {
-        // Connected state was set in CIpsPlgPop3ConnectOp::ConstructL()
-        // so iOperation is null
-        return KErrNone;
-        }
-        
-    if ( !iOperation )
-        {
-        return KErrNotFound;
-        }
-    if ( !iOperation->IsActive() && iOperation->iStatus.Int() != KErrNone )
-        {
-        return iOperation->iStatus.Int();
-        }
-     
-    TPckgBuf<TImap4CompoundProgress> paramPack;
-    paramPack.Copy( iOperation->ProgressL() );
-    const TImap4CompoundProgress& comProgg = paramPack();
-
-    return comProgg.iGenericProgress.iErrorCode;
-    }*/
+// <qmail> removed CIpsPlgImap4ConnectOp::StartL()
+// <qmail> removed CIpsPlgImap4ConnectOp::QueryUserPwdL()
+// <qmail> removed CIpsPlgImap4ConnectOp::GetOperationErrorCodeL()
 
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------       
@@ -571,8 +435,7 @@
         // mark that sync is signaled to prevent 
         // sending necessary event
         iIsSyncStartedSignaled = ETrue;
-        iEventHandler->SetNewPropertyEvent( 
-                iService, KIpsSosEmailSyncStarted, KErrNone );
+        iEventHandler->SetNewPropertyEvent( iService, KIpsSosEmailSyncStarted, KErrNone );
         }
     }
 
@@ -581,45 +444,101 @@
 void CIpsPlgImap4ConnectOp::SignalSyncCompleted( TInt aError )
     {
     FUNC_LOG;
-    if ( iEventHandler && aError == KErrImapBadLogon )
+    // <qmail> don't test for aError code; all situations should complete op
+    if ( iEventHandler )
         {
-        /*
-        iEventHandler->SetNewPropertyEvent( 
-                iService, KIpsSosEmailSyncCompleted, aError );
-        */
+        iEventHandler->SetNewPropertyEvent( iService, KIpsSosEmailSyncCompleted, aError );
         iIsSyncStartedSignaled = EFalse;
         }
     }
 
+// <qmail> Removing CIpsPlgImap4ConnectOp::CredientialsSetL 
+
+// <qmail> new functions added
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+void CIpsPlgImap4ConnectOp::ConstructImapPartialFetchInfo( 
+    TImImap4GetPartialMailInfo& aInfo, 
+    const CImImap4Settings& aImap4Settings )
+    {
+    FUNC_LOG;
+    TInt sizeLimit = aImap4Settings.BodyTextSizeLimit();
+    
+    if ( sizeLimit == KIpsSetDataHeadersOnly )
+        {
+        aInfo.iTotalSizeLimit = KIpsSetDataHeadersOnly;
+        }
+    else if ( sizeLimit == KIpsSetDataFullBodyAndAttas )
+        {        
+        aInfo.iTotalSizeLimit = KMaxTInt;
+        aInfo.iAttachmentSizeLimit = KMaxTInt;
+        aInfo.iBodyTextSizeLimit = KMaxTInt;
+        aInfo.iMaxEmailSize = KMaxTInt;
+        aInfo.iPartialMailOptions = ENoSizeLimits;
+        aInfo.iGetMailBodyParts = EGetImap4EmailBodyTextAndAttachments;
+        }
+    else if ( sizeLimit == KIpsSetDataFullBodyOnly )
+        {
+        aInfo.iTotalSizeLimit = KMaxTInt; 
+        aInfo.iAttachmentSizeLimit = 0;
+        aInfo.iBodyTextSizeLimit = KMaxTInt;
+        aInfo.iMaxEmailSize = KMaxTInt;
+        aInfo.iPartialMailOptions = EBodyAlternativeText;
+        aInfo.iGetMailBodyParts = EGetImap4EmailBodyAlternativeText;
+        }
+    else
+        {
+    //<qmail> include html in body
+        aInfo.iTotalSizeLimit = sizeLimit*1024; 
+        aInfo.iAttachmentSizeLimit = 0;
+        aInfo.iMaxEmailSize = sizeLimit*1024;
+        aInfo.iBodyTextSizeLimit = sizeLimit*1024;
+        aInfo.iPartialMailOptions = EBodyAlternativeText;
+        aInfo.iGetMailBodyParts = EGetImap4EmailBodyAlternativeText;
+    // </qmail>    
+        }
+    }
 
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
-void CIpsPlgImap4ConnectOp::CredientialsSetL( TInt aEvent )
+CImImap4Settings* CIpsPlgImap4ConnectOp::GetImapSettingsLC()
+    {
+    FUNC_LOG;
+    CImImap4Settings* settings = new ( ELeave ) CImImap4Settings();
+    CleanupStack::PushL( settings );
+    CEmailAccounts* accounts = CEmailAccounts::NewLC();
+    TImapAccount imapAcc;
+    accounts->GetImapAccountL(iService, imapAcc );
+    accounts->LoadImapSettingsL( imapAcc, *settings );
+    CleanupStack::PopAndDestroy( accounts );
+    return settings;
+    }
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+void CIpsPlgImap4ConnectOp::CreateInboxMessagesSelectionL()
     {
     FUNC_LOG;
-
-    if ( iState == EStateQueryingDetails )
-        {
-        // response for our operation`s query
-        if ( aEvent == EIPSSosCredientialsCancelled )
-            {
-            // user canceled operation
-            CompleteObserver( KErrCancel );
-            }
+    // get children of service entry 
+    CMsvEntry* cEntry = iMsvSession.GetEntryL( iService );
+    CleanupStack::PushL( cEntry );
+    CMsvEntrySelection* childrenSelection = cEntry->ChildrenL();
+    CleanupStack::PopAndDestroy( cEntry );
+    cEntry = NULL;
+    CleanupStack::PushL( childrenSelection );
 
-        // password has been set, continue with operation
-        SetActive();
-        CompleteThis();
-        }
-    else if ( iState == EStateQueryingDetailsBusy )
+    if ( childrenSelection->Count() )
         {
-        // 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();
+        TMsvId id = (*childrenSelection)[0]; // index 0 == inbox
+        cEntry = iMsvSession.GetEntryL( id ); // reusing cEntry pointer for Inbox entry
+        CleanupStack::PushL( cEntry );
+        delete iSelection;
+        iSelection = NULL;
+        // get message-type children of inbox
+        iSelection = cEntry->ChildrenWithTypeL( KUidMsvMessageEntry );
+        CleanupStack::PopAndDestroy( cEntry );
         }
+    CleanupStack::PopAndDestroy( childrenSelection );
     }
-// End of File
 
+// </qmail>