|
1 /* |
|
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: IMAP4 remote move message operation |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __IPSPLGIMAP4MOVEREMOTEOP_H__ |
|
19 #define __IPSPLGIMAP4MOVEREMOTEOP_H__ |
|
20 |
|
21 |
|
22 #include "ipsplgonlineoperation.h" |
|
23 #include "MFSMailRequestObserver.h" |
|
24 |
|
25 /** |
|
26 * Move a selection of messages that may or may not be complete. |
|
27 * Always fetches entire messages. |
|
28 */ |
|
29 class CIpsPlgImap4MoveRemoteOp : |
|
30 public CIpsPlgOnlineOperation |
|
31 { |
|
32 public: |
|
33 /** |
|
34 * |
|
35 * @param aSession: Server session. |
|
36 * @param aStatus: Observer completion status. |
|
37 * @param aReporter: Progress reporter. |
|
38 * @param aSel: The message ids to get. |
|
39 * @param aTargetId: Where to fetch the messages to. |
|
40 * @param aCopy: Copying or moving. |
|
41 */ |
|
42 static CIpsPlgImap4MoveRemoteOp* NewL( |
|
43 CMsvSession& aMsvSession, |
|
44 TRequestStatus& aObserverRequestStatus, |
|
45 TInt aFunctionId, |
|
46 TMsvId aService, |
|
47 CIpsPlgTimerOperation& aActivityTimer, |
|
48 const TImImap4GetMailInfo& aGetMailInfo, |
|
49 const CMsvEntrySelection& aSel, |
|
50 TFSMailMsgId aFSMailBoxId, |
|
51 MFSMailRequestObserver& aFSOperationObserver, |
|
52 TInt aFSRequestId ); |
|
53 |
|
54 /** |
|
55 * |
|
56 */ |
|
57 virtual ~CIpsPlgImap4MoveRemoteOp(); |
|
58 |
|
59 /** |
|
60 * |
|
61 */ |
|
62 const TDesC8& ProgressL(); |
|
63 |
|
64 /** |
|
65 * |
|
66 */ |
|
67 const TDesC8& GetErrorProgressL( TInt aError ); |
|
68 |
|
69 /** |
|
70 * |
|
71 */ |
|
72 TFSProgress GetFSProgressL() const; |
|
73 |
|
74 private: |
|
75 |
|
76 /** |
|
77 * for explanation of parameters, see NewL |
|
78 */ |
|
79 CIpsPlgImap4MoveRemoteOp( |
|
80 CMsvSession& aMsvSession, |
|
81 TRequestStatus& aObserverRequestStatus, |
|
82 TInt aFunctionId, |
|
83 TMsvId aService, |
|
84 CIpsPlgTimerOperation& aActivityTimer, |
|
85 const TImImap4GetMailInfo& aGetMailInfo, |
|
86 TFSMailMsgId aFSMailBoxId, |
|
87 MFSMailRequestObserver& aFSOperationObserver, |
|
88 TInt aFSRequestId ); |
|
89 |
|
90 /** |
|
91 * |
|
92 */ |
|
93 void ConstructL(const CMsvEntrySelection& aSel); |
|
94 |
|
95 /** |
|
96 * RunL() |
|
97 */ |
|
98 void RunL(); |
|
99 |
|
100 /** |
|
101 * |
|
102 */ |
|
103 void DoRunL(); |
|
104 |
|
105 |
|
106 /** |
|
107 * |
|
108 */ |
|
109 void DoConnectL(); |
|
110 |
|
111 /** |
|
112 * |
|
113 * Sort messages into complete and incomplete. |
|
114 */ |
|
115 void SortMessageSelectionL(const CMsvEntrySelection& aSel); |
|
116 |
|
117 /** |
|
118 * |
|
119 */ |
|
120 |
|
121 void Complete(); |
|
122 |
|
123 /** |
|
124 * |
|
125 */ |
|
126 void DoMoveLocalL(); |
|
127 |
|
128 /** |
|
129 * |
|
130 */ |
|
131 void DoMoveRemoteL(); |
|
132 |
|
133 protected: |
|
134 |
|
135 /** |
|
136 * From CIpsPlgOnlineoperation |
|
137 */ |
|
138 TInt GetEngineProgress( const TDesC8& aProgress ); |
|
139 |
|
140 private: |
|
141 enum TState { EIdle, EConnecting, ELocalMsgs, ERemoteMsgs }; |
|
142 TState iState; |
|
143 TInt iFunctionId; |
|
144 TDesC8* iMoveErrorProgress; |
|
145 TImImap4GetMailInfo iGetMailInfo; |
|
146 CMsvEntrySelection* iSelection; |
|
147 CMsvEntrySelection* iLocalSel; // Complete messages |
|
148 CMsvEntrySelection* iRemoteSel; // Incomplete messages to be fetched. |
|
149 TPckgBuf<TImap4CompoundProgress> iProgressBuf; |
|
150 TPckgBuf<TImap4SyncProgress> iSyncProgress; |
|
151 }; |
|
152 |
|
153 |
|
154 NONSHARABLE_CLASS( CIpsPlgImap4MoveRemoteOpObserver ) : public CBase, |
|
155 public MFSMailRequestObserver |
|
156 { |
|
157 public: |
|
158 |
|
159 static CIpsPlgImap4MoveRemoteOpObserver* NewL( CMsvSession& aSession, |
|
160 CIpsPlgEventHandler& aEventHandler, const TFSMailMsgId& aSourceFolder, |
|
161 const RArray<TFSMailMsgId>& aMessageIds ); |
|
162 ~CIpsPlgImap4MoveRemoteOpObserver(); |
|
163 |
|
164 // From base class MFSMailRequestObserver |
|
165 void RequestResponseL( TFSProgress aEvent, TInt aRequestId ); |
|
166 |
|
167 private: |
|
168 |
|
169 CIpsPlgImap4MoveRemoteOpObserver( CMsvSession& aSession, |
|
170 CIpsPlgEventHandler& aEventHandler, |
|
171 TMsvId aSourceFolderId ); |
|
172 void ConstructL( const RArray<TFSMailMsgId>& aMessageIds ); |
|
173 |
|
174 private: |
|
175 |
|
176 // data |
|
177 CMsvSession& iSession; |
|
178 CIpsPlgEventHandler& iEventHandler; |
|
179 TMsvId iSourceFolderId; |
|
180 CMsvEntrySelection* iSelection; |
|
181 }; |
|
182 |
|
183 #endif //__IPSPLGIMAP4MOVEREMOTEOP_H__ |
|
184 |
|
185 // End of File |