|
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 __CIMAPCOMPOUNDCOPYTOLOCAL_H__ |
|
17 #define __CIMAPCOMPOUNDCOPYTOLOCAL_H__ |
|
18 |
|
19 #include <msvstd.h> |
|
20 #include <imapset.h> // for TImImap4GetPartialMailInfo and TImap4GenericProgress |
|
21 #include "cimapcompoundbase.h" |
|
22 #include "tmessageflaginfo.h" |
|
23 |
|
24 // Forward declarations |
|
25 class CImapOpFetchBody; |
|
26 class CImapFolder; |
|
27 class CImapMailStore; |
|
28 |
|
29 /** |
|
30 The compound object for the copy or move to local operation. The |
|
31 copy to local operation copies or moves a selection of messages |
|
32 from a remote folder to a local folder. |
|
33 |
|
34 @internalTechnology |
|
35 @prototype |
|
36 */ |
|
37 class CImapCompoundCopyToLocal : public CImapCompoundBase |
|
38 { |
|
39 public: |
|
40 ~CImapCompoundCopyToLocal( ); |
|
41 |
|
42 static CImapCompoundCopyToLocal* NewL(CImapSyncManager& aSyncManager, |
|
43 CMsvServerEntry& aServerEntry, |
|
44 CImapSettings& aImapSettings, |
|
45 CImapMailStore& aImapMailStore, |
|
46 TBool aIsMove, |
|
47 const CMsvEntrySelection& aSourceSel, |
|
48 const TMsvId aDestination); |
|
49 |
|
50 static CImapCompoundCopyToLocal* NewL(CImapSyncManager& aSyncManager, |
|
51 CMsvServerEntry& aServerEntry, |
|
52 CImapSettings& aImapSettings, |
|
53 CImapMailStore& aImapMailStore, |
|
54 TBool aIsMove, |
|
55 const CMsvEntrySelection& aSourceSel, |
|
56 const TMsvId aDestination, |
|
57 const TImImap4GetPartialMailInfo& aGetPartialMailInfo); |
|
58 |
|
59 virtual void StartOperation(TRequestStatus& aStatus, CImapSession& aSession); |
|
60 virtual void Progress(TImap4CompoundProgress& aCompoundProgress); |
|
61 |
|
62 // Support for Bearer Mobility |
|
63 virtual void ResumeOperationL(TRequestStatus& aStatus, CImapSession& aSession); |
|
64 virtual void CancelEnableResume(); |
|
65 |
|
66 // allow messages to be removed from the selection of messages to fetch |
|
67 void RemoveFromSelection(CMsvEntrySelection& aDeleteSel); |
|
68 |
|
69 private: |
|
70 CImapCompoundCopyToLocal(CImapSyncManager& aSyncManager, CMsvServerEntry& aServerEntry, CImapSettings& aImapSettings, CImapMailStore& aImapMailStore, TBool aIsMove, const TMsvId aDestination); |
|
71 CImapCompoundCopyToLocal(CImapSyncManager& aSyncManager, CMsvServerEntry& aServerEntry, CImapSettings& aImapSettings, CImapMailStore& aImapMailStore, TBool aIsMove, const TMsvId aDestination, const TImImap4GetPartialMailInfo& aGetPartialMailInfo); |
|
72 void ConstructL(const CMsvEntrySelection& aSourceSel); |
|
73 |
|
74 TBool DoRunLoopL(); |
|
75 void DoCancel(); |
|
76 |
|
77 virtual TInt ProcessNegativeServerResponse(); |
|
78 |
|
79 void UpdatePartialMailInfoToDefaults(TMsvId aDestination); |
|
80 |
|
81 TInt CopyMessage(const TMsvId aSource, const TMsvId aDestinationFolder, const TBool aRemoveOriginal); |
|
82 void CopyMessageL(const TMsvId aSource, const TMsvId aDestinationFolder, const TBool aRemoveOriginal); |
|
83 void CopyCompleteL(); |
|
84 |
|
85 TBool SetSourceFolderL(const TMsvId aMessage); |
|
86 void MarkMessageForDeleteL(const TMsvId& aTarget); |
|
87 private: |
|
88 /** Used to store the message in the local message store */ |
|
89 CImapMailStore& iMailStore; |
|
90 |
|
91 /** Selection of messages to operate on. */ |
|
92 CMsvEntrySelection* iSourceSel; |
|
93 |
|
94 /** ETrue if it is a move operation. The value is set during |
|
95 creation of the compound operation. */ |
|
96 TBool iIsMove; |
|
97 |
|
98 /** The ID of the destination folder were all messages in |
|
99 iSourceSel will be copied/moved to. */ |
|
100 TMsvId iDestinationFolderId; |
|
101 |
|
102 /** Filter used when retrieving the messages */ |
|
103 TImImap4GetPartialMailInfo iGetPartialMailInfo; |
|
104 |
|
105 /** ETrue if a populate operation was requested. */ |
|
106 TBool iPopulateCommand; |
|
107 |
|
108 // Progress Counts |
|
109 TInt iTotalSize; |
|
110 TInt iMessageSelection; |
|
111 TInt iSelectionStillToCopy; |
|
112 |
|
113 /** dedicated CMsvServerEntry for move operations, required |
|
114 because move operations are asynchronous. */ |
|
115 CMsvServerEntry* iMoveEntry; |
|
116 |
|
117 /** The source folder. CImapCompoundCopyFromLocal does not |
|
118 have ownership of this pointer. */ |
|
119 CImapFolder* iSourceFolder; |
|
120 |
|
121 /** The ID of the source folder containing the message currently |
|
122 operating on. */ |
|
123 TMsvId iSourceFolderId; |
|
124 |
|
125 /** The message ID of the message currently operating on. */ |
|
126 TMsvId iCurrentMsgId; |
|
127 |
|
128 /** ETrue if a cancelled fetch should be allowed to be resumed by download rules based fetch */ |
|
129 TBool iResume; |
|
130 |
|
131 /** Dedicated object for fetching message content. */ |
|
132 CImapOpFetchBody* iBodyFetcher; |
|
133 |
|
134 RArrayMessageFlagInfo iOutMessageFlagInfo; |
|
135 }; |
|
136 |
|
137 #endif // __CIMAPCOMPOUNDCOPYFROMLOCAL_H__ |