email/imap4mtm/imapsyncmanager/inc/cimapopsyncfoldertree.h
changeset 80 8b14b30db193
parent 0 72b543305e3a
equal deleted inserted replaced
79:2981cb3aa489 80:8b14b30db193
       
     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 // CImapOpSyncFolderTree header
       
    15 // 
       
    16 //
       
    17 
       
    18 #if !defined(__IMAPOPSYNCFOLDERTREE_H__)
       
    19 #define __IMAPOPSYNCFOLDERTREE_H__
       
    20 
       
    21 #include "cimapsyncoperation.h"
       
    22 #include "cimaplistfolderinfo.h"
       
    23 
       
    24 // Forward declarations
       
    25 class CMsvEntrySelection;
       
    26 class CImapFolder;
       
    27 
       
    28 class CImapOpSyncFolderTree : public CImapSyncOperation
       
    29 /**
       
    30 Class to perform the synchronise folder tree operation. This object will call the IMAP LIST command to get the
       
    31 complete list of folders on the server. For each folder listed, it will then call the syncmanager to add the folder
       
    32 to the local message server.
       
    33 @internalComponent
       
    34 @prototype
       
    35 */
       
    36 	{
       
    37 public:
       
    38 	static CImapOpSyncFolderTree* NewL(CMsvServerEntry& aEntry, CImapSession& aSession, CImapSyncManager& aSyncMan, CImapSettings& aImapSettings);
       
    39 	static CImapOpSyncFolderTree* NewLC(CMsvServerEntry& aEntry, CImapSession& aSession,CImapSyncManager& aSyncMan, CImapSettings& aImapSettings);
       
    40 	void SynchroniseTreeL(TRequestStatus& aStatus);
       
    41 	~CImapOpSyncFolderTree();	
       
    42 	
       
    43 private:
       
    44 	CImapOpSyncFolderTree(CMsvServerEntry& aEntry, CImapSession& aSession, CImapSyncManager& aSyncMan, CImapSettings& aImapSettings);
       
    45 	
       
    46 	void ConstructL();
       
    47 	void DoRunL();
       
    48 	void DoCancel();
       
    49 	void DoComplete(TInt& aStatus);
       
    50 
       
    51 	void StartBuildingLocalFolderListL();
       
    52 	void ProcessNextFolderInLocalFolderListL();
       
    53 	void SendListRequestL();
       
    54 	void StartProcessingReceivedFolderListL();
       
    55 	void ProcessNextFolderInReceivedFolderListL();
       
    56 	void AddReceivedFolderL(CImapListFolderInfo* aCurrentFolderInfo, const TDesC& aCurrentFolderFullPath);
       
    57 	void RemoveMissingFolders();
       
    58 
       
    59 private:
       
    60 	enum TState
       
    61 		{
       
    62 		EStateIdle,
       
    63 		EStateBuildingLocalFolderList,
       
    64 		EStateFetchingFolderList,
       
    65 		EStateProcessingReceivedFolders
       
    66 		};
       
    67 
       
    68 	TState iState;
       
    69 	RArrayImapListFolderInfo iImapListFolderInfo;
       
    70 	RPointerArray<CImapFolder> iFolderList;
       
    71 	TInt iCurrentFolder;	
       
    72 	CMsvEntrySelection* iSelection;
       
    73 	TPtrC iCurrentPath;
       
    74 	CImapFolder* iSearchFolder;
       
    75 	HBufC* iInboxPathWithSeparator;
       
    76 	HBufC* iFolderPathWithSeparator;
       
    77 	TPtrC iFolderPath;
       
    78 	};
       
    79 
       
    80 #endif // __IMAPOPSYNCFOLDERTREE_H__