email/imap4mtm/imapofflinecontrol/inc/cimapofflinecontrol.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 // cimapofflinecontrol.cpp.h
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __CIMAPOFFLINECONTROL_H__
       
    19 #define __CIMAPOFFLINECONTROL_H__
       
    20 
       
    21 #include <mentact.h>
       
    22 #include <offop.h>
       
    23 
       
    24 class CMsvServerEntry;
       
    25 class CMsvEntrySelection;
       
    26 class TImap4CompoundProgress;
       
    27 
       
    28 // enums for use with MtmFunctionId
       
    29 enum
       
    30 	{
       
    31 	EFnOffLineOpMoveDelete,
       
    32 	EFnOffLineOpPopulate
       
    33 	};
       
    34 
       
    35 class CImapOfflineControl : public CMsgActive
       
    36 /**
       
    37 @internalComponent
       
    38 @released
       
    39 */
       
    40 	{
       
    41 public:
       
    42 	enum TImap4OpType
       
    43 		{
       
    44 		EImap4OpCopyToLocal,
       
    45 		EImap4OpMoveToLocal,
       
    46 		EImap4OpCopyFromLocal,
       
    47 		EImap4OpMoveFromLocal,
       
    48 		EImap4OpCopyWithinService,
       
    49 		EImap4OpMoveWithinService,
       
    50 		EImap4OpPopulate,
       
    51 		EImap4OpDelete,
       
    52 		EImap4OpUndelete,
       
    53 		EImap4OpMoveTypeDelete
       
    54 		};
       
    55 
       
    56 public:	
       
    57 	~CImapOfflineControl();
       
    58 	IMPORT_C static CImapOfflineControl* NewL(CMsvServerEntry& aEntry);
       
    59 
       
    60 	// add the given offline operation to the appropriate place
       
    61 	IMPORT_C void StoreOfflineCommandL(TImap4OpType aOperation,
       
    62 							  const CMsvEntrySelection& aSelection,
       
    63 							  TMsvId aDestination,
       
    64 							  TRequestStatus& aStatus);
       
    65 
       
    66 	IMPORT_C 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 	IMPORT_C void CancelOffLineOperationsL(const CMsvEntrySelection& aSelection);
       
    75 	IMPORT_C TMsvId IdIsLocalL(TMsvId aId);
       
    76 	IMPORT_C CImOffLineOperationArray* OffLineOpArrayL(TMsvId aId);
       
    77 	IMPORT_C void SetOffLineOpArrayL(TMsvId aId, CImOffLineOperationArray& aArray);
       
    78 	IMPORT_C TMsvId FindShadowIdL(const CImOffLineOperation& aOp);
       
    79 	IMPORT_C TImap4CompoundProgress Progress();
       
    80 
       
    81 private:
       
    82 	void ConstructL();
       
    83 	CImapOfflineControl(CMsvServerEntry& aEntry);
       
    84 	TBool FindShadowIdsL(const CImOffLineOperation& aOp, CMsvEntrySelection& aSelection);
       
    85 	TBool OffLineOpIsCopy(const CImOffLineOperation& aOp);
       
    86 	TImDisconnectedOperationType OffLineOpToDisconnectedOp(const CImOffLineOperation& aOp);
       
    87 	TInt PosVal(const CImOffLineOperation& aOp);
       
    88 	void SaveOperationL(const CImOffLineOperation& aOperation);
       
    89 	TBool FindOffLineOpByIdL(TMsvId aId, TMsvId aDestFolder,
       
    90 							CImOffLineOperation& aOp, TBool aDelete);
       
    91 	void UndeleteOperationL(TMsvId aId, TMsvId aDestId, TBool aConvertMoveToCopy,
       
    92 							TImDisconnectedOperationType aDisconnected =ENoDisconnectedOperations);
       
    93 	void MakeCopyMoveShadowL(const CImOffLineOperation& aOp);
       
    94 	void MakeShadowL(const CImOffLineOperation& aOp);
       
    95 
       
    96 	void UndoOfflineOpL(const CImOffLineOperation& aOp, TBool aClearMultiples);
       
    97 
       
    98 	void SetEntryL(TMsvId aId);
       
    99 	void ChangeEntryL(TMsvEntry& aEntry);
       
   100 	void DeleteEntryL(TMsvId aId);
       
   101 
       
   102 	TMsvId FolderOfL(TMsvId aId);
       
   103 	TMsvId FindOffLineSaveFolderL(TMsvId aId, TMsvId aDestId);
       
   104 	TMsvId MessageOfL(TMsvId aId);
       
   105 	TMsvId ServiceOfL(TMsvId aId);
       
   106 
       
   107 	void PrepareLocalOpL(TMsvId aId);
       
   108 	TBool DoLocalOpL();
       
   109 
       
   110 protected:
       
   111 	void DoCancel();
       
   112 	void DoRunL();
       
   113 	void DoComplete(TInt& aError);
       
   114 
       
   115 private:
       
   116 	CMsvServerEntry& iEntry;				// passed into constructor	
       
   117 	CMsvEntrySelection* iCopyDirect;		// created in constructor and reused as necessary
       
   118 	CMsvEntrySelection* iMoveDirect;		// created in constructor and reused as necessary
       
   119 	CMsvEntrySelection* iMoveToLocalDirect;	// created in constructor and reused as necessary
       
   120 	TMsvId iDestination;		// store for copy/move destination
       
   121 	TMsvId iServiceId;
       
   122 	TInt iProgressMsgsToDo;
       
   123 	TInt iProgressMsgsDone;
       
   124 	TImap4GenericProgress::TImap4GenericProgressOp iRequestedOperation;
       
   125 	TImap4CompoundProgress iProgress;
       
   126 	};
       
   127 
       
   128 #endif  // __CIMAPOFFLINECONTROL_H__