email/imap4mtm/imapprotocolcontroller/inc/cimapcompoundsyncservice.h
changeset 31 ebfee66fde93
parent 0 72b543305e3a
equal deleted inserted replaced
30:6a20128ce557 31:ebfee66fde93
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __CIMAPCOMPOUNDSYNCSERVICE_H__
       
    17 #define __CIMAPCOMPOUNDSYNCSERVICE_H__
       
    18 
       
    19 #include "cimapcompoundbase.h"
       
    20 #include "cimapofflinecontrol.h"
       
    21 
       
    22 // Forward declarations
       
    23 class CImapFolder;
       
    24 class CImapSession;
       
    25 class CImapMailStore;
       
    26 class CImOffLineOperation;
       
    27 
       
    28 
       
    29 /**
       
    30 Compound operation object for performing the necessary sequence of commands
       
    31 to synchronise the local mirror of the remote mailbox tree and the contents
       
    32 of mailboxes that are subscribed according to settings.
       
    33 
       
    34 @internalTechnology
       
    35 @prototype
       
    36 */
       
    37 class CImapCompoundSyncService : public CImapCompoundBase
       
    38 	{
       
    39 public:
       
    40 	~CImapCompoundSyncService();
       
    41 	
       
    42 	static CImapCompoundSyncService* NewL(CImapSyncManager& aSyncManager, CMsvServerEntry& aServerEntry, CImapSettings& aImapSettings, CImapMailStore& aImapMailStore, CImapOfflineControl& aImapOfflineControl, TBool aDoLateDeletes);
       
    43 	virtual void StartOperation(TRequestStatus& aStatus, CImapSession& aSession);
       
    44 	virtual void Progress(TImap4CompoundProgress& aCompoundProgress);
       
    45 	
       
    46 	// Support for Bearer Mobility
       
    47 	virtual void ResumeOperationL(TRequestStatus& aStatus, CImapSession& aSession);
       
    48 	virtual void StopForMigrate();
       
    49 	
       
    50 	// remove messages from the download rules based fetch
       
    51 	void RemoveFromSelectionL(CMsvEntrySelection& aDeleteSel);
       
    52 
       
    53 private:
       
    54 	CImapCompoundSyncService(CImapSyncManager& aSyncManager, CMsvServerEntry& aServerEntry, CImapSettings& aImapSettings,CImapMailStore& aImapMailStore, CImapOfflineControl& aImapOfflineControl ,TBool aDoLateDeletes);
       
    55 	void ConstructL();
       
    56 
       
    57 	TBool DoRunLoopL();
       
    58 	void DoCancel();
       
    59 
       
    60 	virtual TInt ProcessNegativeServerResponse();
       
    61 
       
    62 	// get the offlineOpArray from the id and set up iOutstandingOps and Folder
       
    63 	TBool RefreshOutstandingOpsL(TMsvId aId);
       
    64 
       
    65 	// do the appropriate offline operation
       
    66 	void DoOpL(const CImOffLineOperation& aOp);
       
    67 
       
    68 	// finish up the op just done (send log message, append delete
       
    69 	// etc.)
       
    70 	void DonePendingOpL();
       
    71 
       
    72 	// process the next one in the outstanding ops list. Returns ETrue
       
    73 	// if finished
       
    74 	TBool NextPendingOpL();
       
    75 	
       
    76 	// process pending deletes of the type given in the given
       
    77 	// folder. Returns ETrue if any items were deleted
       
    78 	TBool MatchDeleteOp(const CImOffLineOperation& aOp, TBool aMoveDeletesOnly);
       
    79 	TBool ProcessPendingDeleteOpsL(TMsvId aFolder, TBool aMoveDeletesOnly);
       
    80 	TBool ProcessPendingDeleteOpsListL(TBool aMoveDeletesOnly);
       
    81 
       
    82 	// make aId and its parents visible
       
    83 	void ChangeEntryL(const TMsvEntry& aEntry);
       
    84 	void DoComplete(TInt& aErr);
       
    85 
       
    86 private:
       
    87 	// Sync subscriptions folders progess
       
    88 	TMsvId					iNextFolderSync;
       
    89 	
       
    90 	// List of outstanding operations on inbox/other folder
       
    91 	CImOffLineOperationArray* iOutstandingOps;
       
    92 
       
    93 	// current folder being processed
       
    94 	TMsvId				    iOutstandingOpsFolder;
       
    95 
       
    96 	// list of ids that need to be deleted because they were the
       
    97 	// source of a move
       
    98 	CArrayFix<TMsvId>*		iOutstandingMoveTypeDeletes;
       
    99 	CArrayFix<TMsvId>*		iOutstandingLocalDeletes;
       
   100 
       
   101 	// source id of current operation if it was a move and so should
       
   102 	// be deleted afterwards
       
   103 	TMsvId					iMovedId;
       
   104 
       
   105 	// shadow id of current operation - to be deleted when op finishes
       
   106 	TMsvId					iShadowId;
       
   107 
       
   108 	// pointer to offline control object held by MTM
       
   109 	CImapOfflineControl&	iImapOfflineControl;
       
   110 	
       
   111 	CImapCompoundBase* 		iImapCompound;
       
   112 	TInt					iFoldersNotFound;
       
   113 	TInt					iMsgsToDo;
       
   114 	TInt					iMsgsDone;
       
   115 	CImapMailStore& 		iImapMailStore;
       
   116 	TBool					iPerformDeletes;
       
   117 	TBool 					iDoLateDeletes;
       
   118 	
       
   119 	// download rules
       
   120 	TImImap4GetPartialMailInfo iMailInfo;
       
   121 	TInt32 iFolderSyncCount;
       
   122 	CMsvEntrySelection* iDoNotFetchSel;
       
   123 	
       
   124 	// Folder that we are currently performing an operation on.
       
   125 	// The class does not take ownership of the folder, so it should not
       
   126 	// be deleted.
       
   127 	CImapFolder* iFolder;
       
   128 	};
       
   129 
       
   130 #endif	// __CIMAPCOMPOUNDSYNCSERVICE_H__