email/imap4mtm/imapprotocolcontroller/inc/cimapcompoundcopywithinservice.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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 __CIMAPCOMPOUNDCOPYWITHINSERVICE_H__
       
    17 #define __CIMAPCOMPOUNDCOPYWITHINSERVICE_H__
       
    18 
       
    19 #include "cimapcompoundbase.h"
       
    20 #include "tmessageflaginfo.h"
       
    21 
       
    22 // forward declarations
       
    23 class CImapFolder;
       
    24 
       
    25 /**
       
    26 The compound object for the copy or move within the service operation. 
       
    27 The copy within service operation copies or moves a selection of 
       
    28 messages from one or more remote folders to another.
       
    29 
       
    30 Stop for migrate policy:
       
    31    The state machine will be stopped when messages from the current
       
    32    source folder have completed the operation of being copied/moved to the
       
    33    destination folder IF there are messages from other source folders to
       
    34    be copied.
       
    35    If there are no more messages from other source folders to be copied,
       
    36    the operation is allowed to complete as normal.
       
    37   
       
    38 
       
    39 @internalTechnology
       
    40 @prototype
       
    41 */
       
    42 class CImapCompoundCopyWithinService : public CImapCompoundBase
       
    43 	{
       
    44 public:
       
    45 	~CImapCompoundCopyWithinService();
       
    46 	
       
    47 	static CImapCompoundCopyWithinService* NewL( CImapSyncManager& aSyncManager, 
       
    48 												 CMsvServerEntry& aServerEntry, 
       
    49 												 CImapSettings& aImapSettings,
       
    50 												 TBool aIsMove, 
       
    51 												 const CMsvEntrySelection& aSourceSel, 
       
    52 												 const TMsvId aDestination );
       
    53 	
       
    54 	virtual void StartOperation(TRequestStatus& aStatus, CImapSession& aSession);
       
    55 	virtual void Progress(TImap4CompoundProgress& aCompoundProgress);
       
    56 	
       
    57 	// Support for Bearer Mobility
       
    58 	virtual void ResumeOperationL(TRequestStatus& aStatus, CImapSession& aSession);
       
    59 	
       
    60 private:
       
    61 	CImapCompoundCopyWithinService( CImapSyncManager& aSyncManager, 
       
    62 									CMsvServerEntry& aServerEntry, 
       
    63 									CImapSettings& aImapSettings,
       
    64 									TBool aIsMove,
       
    65 									const TMsvId aDestination );
       
    66 	void ConstructL(const CMsvEntrySelection& aSourceSel);
       
    67 	
       
    68 	TBool DoRunLoopL();
       
    69 	void DoCancel();
       
    70 
       
    71 	virtual TInt ProcessNegativeServerResponse();
       
    72 
       
    73 	TBool SetSourceFolderL(const TMsvId aMessage);
       
    74 
       
    75 	void CopyMessagesL();	
       
    76 	void MarkMessageForDeletesL();
       
    77 	void DeleteMovedMessagesL();
       
    78 	void IncrementProgress(TInt aNum);
       
    79 	
       
    80 private:
       
    81 	/** ETrue if it is a move operation. The value is set during
       
    82 	creation of the compound operation. */
       
    83 	TBool 	iIsMove;
       
    84 	
       
    85 	/** The ID of the destination folder were all messages in
       
    86 	iSourceSel will be copied/moved to. */
       
    87 	TMsvId  iDestinationId;
       
    88 	
       
    89 	/** The Source folder containing the selection of messages to operate on
       
    90 	Not Owned - can only copy from subscribed folders */
       
    91 	CImapFolder* iSourceFolder;			
       
    92 	
       
    93 	/** The destination folder where the selection of messages will
       
    94 	be copied/moved to.
       
    95 	Owned - can copy to non-subscribed folders */
       
    96 	CImapFolder* iDestinationFolder;
       
    97 	
       
    98 	/** The ID of the source folder containing the message currently
       
    99 	operating on. */
       
   100 	TMsvId	iSourceFolderId;
       
   101 	
       
   102 	/** The message ID of the message currently operating on. */
       
   103 	TMsvId  iCurrentMsgId;
       
   104 	
       
   105 	/** Selection of messages to operate on. */
       
   106 	CMsvEntrySelection* iSourceSel;
       
   107 	
       
   108 	/** UID sequence that will be copied/moved */
       
   109 	HBufC8* iUidSeq;
       
   110 	
       
   111 	// Progress Counts
       
   112 	TInt iTotalSize;
       
   113 
       
   114 	/** Total number of messages to move/copy */
       
   115 	TInt iMsgsToDo;
       
   116 	
       
   117 	/** Number of messages moved/copied */
       
   118 	TInt iMsgsDone;
       
   119 	
       
   120 	/** Number of messages copied in last command to server
       
   121 	this is the number that needs to be deleted from the 
       
   122 	current source when performing a move operation */
       
   123 	TInt iMsgsCopied;	
       
   124 	
       
   125 	/** Array used to copy and delete the messaged */
       
   126 	RArray<TUint> iMessageUids;
       
   127 	
       
   128 	RArrayMessageFlagInfo iOutMessageFlagInfo;
       
   129 	};
       
   130 
       
   131 #endif	// __CIMAPCOMPOUNDCOPYWITHINSERVICE_H__