email/pop3andsmtpmtm/imapservermtm/inc/FLDSYNC.H
changeset 25 84d9eb65b26f
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
       
     1 // Copyright (c) 1998-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 // CImImap4FolderSync header
       
    15 // 
       
    16 //
       
    17 
       
    18 #if !defined(__FLDSYNC_H__)
       
    19 #define __FLDSYNC_H__
       
    20 
       
    21 #include <mentact.h>
       
    22 #include <msventry.h>
       
    23 
       
    24 // Forward declarations
       
    25 class CImImap4Session;
       
    26 class CImImap4DirStruct;
       
    27 class TImap4SyncProgress;
       
    28 
       
    29 // Maximum depth of folder tree to sync to
       
    30 const TInt KFolderDepth=8;
       
    31 
       
    32 // States
       
    33 /**
       
    34 @internalComponent
       
    35 @released
       
    36 */
       
    37 enum TFolderSyncState
       
    38 	{
       
    39 	ETreeSync=1,
       
    40 	};
       
    41 
       
    42 class CImImap4FolderSync : public CMsgActive
       
    43 /**
       
    44 @internalComponent
       
    45 @released
       
    46 */
       
    47 	{
       
    48 public:
       
    49 	~CImImap4FolderSync();
       
    50 	static CImImap4FolderSync* NewLC(CImImap4Session *aSession);
       
    51 	static CImImap4FolderSync* NewL(CImImap4Session *aSession);
       
    52 	void ConstructL(CImImap4Session *aSession);
       
    53 
       
    54 	// Mirror folder tree of remote server
       
    55 	void SynchroniseTreeL(TRequestStatus& aStatus, const TMsvId aRoot, const TBool aNewFoldersAreInvisible);
       
    56 
       
    57 	// Set serverentry to use
       
    58 	void SetEntry(CMsvServerEntry* aEntry);
       
    59 
       
    60 	// increment relevant entries in the progress structure
       
    61 	void IncProgress(TImap4SyncProgress& aProgress);
       
    62 	void ResetStats();
       
    63 	
       
    64 private:
       
    65 	CImImap4FolderSync();
       
    66 	void DoRunL();
       
    67 	void DoCancel();
       
    68 	TBool ProcessDirListL();
       
    69 	void BuildLocalL(const TMsvId aFolder, const TBool aDoThisOne);
       
    70 	void OrphanedFolderCheckL();
       
    71 
       
    72 	// Set entry, leave if error (not related to setentry() which sets iEntry)
       
    73 	void SetEntryL(const TMsvId aId);
       
    74 
       
    75 	// Change entry, leave if error
       
    76 	void ChangeEntryL(const TMsvEntry& aEntry);
       
    77 	
       
    78 	// Change entry in bulk mode (i.e. no index file commit), leave if error
       
    79 	void ChangeEntryBulkL(const TMsvEntry& aEntry);
       
    80 
       
    81 	// Get children, leave if error
       
    82 	void GetChildrenL(CMsvEntrySelection& aSelection);
       
    83 
       
    84 private:
       
    85 	// IMAP4 session to use
       
    86 	CImImap4Session*		iSession;
       
    87 
       
    88 	// Tree synchronisation state
       
    89 	TFolderSyncState		iState;
       
    90 	TMsvId					iServiceId;
       
    91 	TMsvId					iFolderId;
       
    92 	TInt					iFolderLevel;
       
    93 	CArrayPtr<CImImap4DirStruct>* iFolderList;
       
    94 	CMsvEntrySelection*		iFolderContents;
       
    95 	CArrayFix<TMsvId>*		iFolderIds[KFolderDepth];
       
    96 	TInt					iFolderPosition[KFolderDepth];
       
    97 	CArrayFix<TMsvId>*		iLocalFolders;
       
    98 	TBool					iNewFoldersAreInvisible;
       
    99 
       
   100 	// Access to message database
       
   101 	CMsvServerEntry*		iEntry;
       
   102 
       
   103 	// Current request status
       
   104 	TRequestStatus*			iRequestStatus;
       
   105 
       
   106 	TInt					iOrphanedFolders;
       
   107 	TInt					iNewFolders;
       
   108 	};
       
   109 
       
   110 #endif