email/pop3andsmtpmtm/imapservermtm/inc/IMAPOFFL.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 // IMAP4 Offline Operations.
       
    15 // 
       
    16 //
       
    17 
       
    18 #if !defined(__IMAPOFFL_H__)
       
    19 #define __IMAPOFFL_H__
       
    20 
       
    21 
       
    22 class CImImap4Session;
       
    23 class CMsvServerEntry;
       
    24 class CMsvEntrySelection;
       
    25 
       
    26 // enums for use with MtmFunctionId
       
    27 enum
       
    28 	{
       
    29 	EFnOffLineOpMoveDelete,
       
    30 	EFnOffLineOpPopulate
       
    31 	};
       
    32 
       
    33 class CImap4OffLineControl : public CMsgActive
       
    34 /**
       
    35 @internalComponent
       
    36 @released
       
    37 */
       
    38 	{
       
    39 public:
       
    40 	enum TImap4OpType
       
    41 		{
       
    42 		EImap4OpCopyToLocal,
       
    43 		EImap4OpMoveToLocal,
       
    44 		EImap4OpCopyFromLocal,
       
    45 		EImap4OpMoveFromLocal,
       
    46 		EImap4OpCopyWithinService,
       
    47 		EImap4OpMoveWithinService,
       
    48 		EImap4OpPopulate,
       
    49 		EImap4OpDelete,
       
    50 		EImap4OpUndelete,
       
    51 		EImap4OpMoveTypeDelete
       
    52 		};
       
    53 
       
    54 public:
       
    55 	static CImap4OffLineControl* NewL(CMsvServerEntry* aEntry, CImImap4Session *aSession);
       
    56 	static CImap4OffLineControl* NewLC(CMsvServerEntry* aEntry, CImImap4Session *aSession);
       
    57 	~CImap4OffLineControl();
       
    58 	void ConstructL();
       
    59 
       
    60 	// add the given offline operation to the appropriate place
       
    61 	void StoreOfflineCommandL(TImap4OpType aOperation,
       
    62 							  const CMsvEntrySelection& aSelection,
       
    63 							  TMsvId aDestination,
       
    64 							  TRequestStatus& aStatus);
       
    65 
       
    66 	void StoreOfflineCommandL(TImap4OpType aOperation,
       
    67 							  const CMsvEntrySelection& aSelection,
       
    68 							  TMsvId aDestination,
       
    69 							  const TDesC8& aParams,
       
    70 							  TRequestStatus& aStatus);
       
    71 	
       
    72 		// aSelection contains a list of folders and services. Remove any
       
    73 	// offline operations contained within them
       
    74 	void CancelOffLineOperationsL(const CMsvEntrySelection& aSelection);
       
    75 
       
    76 	TMsvId IdIsLocalL(TMsvId aId);
       
    77 	
       
    78 	CImOffLineOperationArray* OffLineOpArrayL(TMsvId aId);
       
    79 	void SetOffLineOpArrayL(TMsvId aId, CImOffLineOperationArray& aArray);
       
    80 	
       
    81 	TBool FindShadowIdsL(const CImOffLineOperation& aOp, CMsvEntrySelection& aSelection);
       
    82 	TMsvId FindShadowIdL(const CImOffLineOperation& aOp);
       
    83 
       
    84 private:
       
    85 	CImap4OffLineControl(CMsvServerEntry* aEntry, CImImap4Session *aSession);
       
    86 
       
    87 	TBool OffLineOpIsCopy(const CImOffLineOperation& aOp);
       
    88 
       
    89 	TImDisconnectedOperationType OffLineOpToDisconnectedOp(const CImOffLineOperation& aOp);
       
    90 
       
    91 	TInt PosVal(const CImOffLineOperation& aOp);
       
    92 
       
    93 	void SaveOperationL(const CImOffLineOperation& aOperation);
       
    94 
       
    95 	TBool FindOffLineOpByIdL(TMsvId aId, TMsvId aDestFolder,
       
    96 							CImOffLineOperation& aOp, TBool aDelete);
       
    97 
       
    98 	void UndeleteOperationL(TMsvId aId, TMsvId aDestId, TBool aConvertMoveToCopy,
       
    99 							TImDisconnectedOperationType aDisconnected =ENoDisconnectedOperations);
       
   100 
       
   101 	void MakeCopyMoveShadowL(const CImOffLineOperation& aOp);
       
   102 	void MakeShadowL(const CImOffLineOperation& aOp);
       
   103 
       
   104 	void UndoOfflineOpL(const CImOffLineOperation& aOp, TBool aClearMultiples);
       
   105 
       
   106 	void SetEntryL(TMsvId aId);
       
   107 	void ChangeEntryL(TMsvEntry& aEntry);
       
   108 	void DeleteEntryL(TMsvId aId);
       
   109 
       
   110 	TMsvId FolderOfL(TMsvId aId);
       
   111 	TMsvId FindOffLineSaveFolderL(TMsvId aId, TMsvId aDestId);
       
   112 	TMsvId MessageOfL(TMsvId aId);
       
   113 	TMsvId ServiceOfL(TMsvId aId);
       
   114 
       
   115 	void PrepareLocalOpL(TMsvId aId);
       
   116 	TBool DoLocalOpL();
       
   117 
       
   118 protected:
       
   119 	void DoCancel();
       
   120 	void DoRunL();
       
   121 	void DoComplete(TInt& aError);
       
   122 
       
   123 private:
       
   124 	CMsvServerEntry* iEntry;			// passed into constructor
       
   125 	CImImap4Session* iSession;			// passed into constructor
       
   126 	
       
   127 	CMsvEntrySelection* iCopyDirect;		// created in constructor and reused as necessary
       
   128 	CMsvEntrySelection* iMoveDirect;		// created in constructor and reused as necessary
       
   129 	CMsvEntrySelection* iMoveToLocalDirect;	// created in constructor and reused as necessary
       
   130 	
       
   131 	TMsvId iDestination;		// store for copy/move destination
       
   132 	TMsvId iServiceId;
       
   133 
       
   134 	//TMsvId iArrayFolder;
       
   135 	//CImOffLineOperationArray* iArray;
       
   136 	};
       
   137 
       
   138 #endif