email/pop3andsmtpmtm/clientmtms/src/CONSYNC.CPP
changeset 76 60a8a215b0ec
parent 0 72b543305e3a
equal deleted inserted replaced
73:ecf6a73a9186 76:60a8a215b0ec
    37 //	static
    37 //	static
    38 CImapConnectAndSyncOp* CImapConnectAndSyncOp::NewL(	CMsvSession& aSession, const CMsvEntrySelection& aSelection, 
    38 CImapConnectAndSyncOp* CImapConnectAndSyncOp::NewL(	CMsvSession& aSession, const CMsvEntrySelection& aSelection, 
    39 													CBaseMtm& aBaseMtm, TInt aPriority, 
    39 													CBaseMtm& aBaseMtm, TInt aPriority, 
    40 													TRequestStatus& aStatus, 
    40 													TRequestStatus& aStatus, 
    41 													TImapConnectionCompletionState aCompletionState, 
    41 													TImapConnectionCompletionState aCompletionState, 
       
    42                                                     TInt aFunctionId,
    42 													MMsvImapConnectionObserver* aConnectionObserver)
    43 													MMsvImapConnectionObserver* aConnectionObserver)
    43 //
    44 //
    44 //
    45 //
    45 //
    46 //
    46 	{
    47 	{
    47 	CImapConnectAndSyncOp* self=new(ELeave) CImapConnectAndSyncOp(aSession, aSelection, aBaseMtm, aPriority, aStatus, aCompletionState, aConnectionObserver);
    48 	CImapConnectAndSyncOp* self=new(ELeave) CImapConnectAndSyncOp(aSession, aSelection, aBaseMtm, aPriority, aStatus, aCompletionState, aConnectionObserver);
    48 	CleanupStack::PushL(self);
    49 	CleanupStack::PushL(self);
    49 	self->ConstructL(aSelection);
    50 	self->ConstructL(aSelection, aFunctionId);
    50 	CleanupStack::Pop(); //	self
    51 	CleanupStack::Pop(); //	self
    51 	return self;
    52 	return self;
    52 	}
    53 	}
    53 
    54 
    54 CImapConnectAndSyncOp::CImapConnectAndSyncOp(CMsvSession& aSession, const CMsvEntrySelection& aSelection, 
    55 CImapConnectAndSyncOp::CImapConnectAndSyncOp(CMsvSession& aSession, const CMsvEntrySelection& aSelection, 
    66 	{
    67 	{
    67 	iService=aSelection.At(0);
    68 	iService=aSelection.At(0);
    68 	iMtm=KUidMsgTypeIMAP4;
    69 	iMtm=KUidMsgTypeIMAP4;
    69 	}
    70 	}
    70 
    71 
    71 void CImapConnectAndSyncOp::ConstructL(const CMsvEntrySelection& aSelection)
    72 void CImapConnectAndSyncOp::ConstructL(const CMsvEntrySelection& aSelection, TInt aFunctionId)
    72 //
    73 //
    73 //
    74 //
    74 //
    75 //
    75 	{
    76 	{
    76 	iServiceEntry = CMsvEntry::NewL(iMsvSession, iService, TMsvSelectionOrdering());
    77 	iServiceEntry = CMsvEntry::NewL(iMsvSession, iService, TMsvSelectionOrdering());
    95 	CleanupStack::PopAndDestroy(2, settings); // account, settings
    96 	CleanupStack::PopAndDestroy(2, settings); // account, settings
    96 	
    97 	
    97 	// Start the connection operation
    98 	// Start the connection operation
    98 	iSelection = aSelection.CopyL();
    99 	iSelection = aSelection.CopyL();
    99 	TBuf8<4> buf;
   100 	TBuf8<4> buf;
   100 	iOperation = iBaseMtm.InvokeAsyncFunctionL(KIMAP4MTMConnectAndSynchronise, *iSelection, buf, iStatus);
   101 	if(aFunctionId == KIMAP4MTMConnectAndSyncCompleteAfterFullSync)
       
   102 	    {
       
   103         iOperation = iBaseMtm.InvokeAsyncFunctionL(KIMAP4MTMConnectAndSynchronise, *iSelection, buf, iStatus);
       
   104 	    }
       
   105 	else if(aFunctionId == KIMAP4MTMSilentConnectAndSyncCompleteAfterFullSync)
       
   106 	    {
       
   107         iOperation = iBaseMtm.InvokeAsyncFunctionL(KIMAP4MTMSilentConnectAndSynchronise, *iSelection, buf, iStatus);
       
   108 	    }
       
   109 	    
   101 	SetActive();
   110 	SetActive();
   102 	iState = EConnecting;
   111 	iState = EConnecting;
   103 	iObserverRequestStatus=KRequestPending;
   112 	iObserverRequestStatus=KRequestPending;
   104 	iProgress().iSyncProgress.iState=TImap4SyncProgress::EConnecting;
   113 	iProgress().iSyncProgress.iState=TImap4SyncProgress::EConnecting;
   105 	}
   114 	}