13 * |
13 * |
14 * Description: IMAP4 attachment fetch operation |
14 * Description: IMAP4 attachment fetch operation |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #ifndef __IPSPLGIMAP4FETCHATTACHMENTOP_H__ |
18 #ifndef IPSPLGIMAP4FETCHATTACHMENTOP_H |
19 #define __IPSPLGIMAP4FETCHATTACHMENTOP_H__ |
19 #define IPSPLGIMAP4FETCHATTACHMENTOP_H |
20 |
|
21 |
20 |
22 class CIpsPlgImap4FetchAttachmentOp; |
21 class CIpsPlgImap4FetchAttachmentOp; |
23 |
22 |
24 /** |
23 /** |
25 * class CIpsPlgImap4FetchAttachmentOp |
24 * CIpsFetchProgReport |
26 * |
25 * helper class for the operation |
|
26 * implements a timer which initiates periodical progress updating |
27 */ |
27 */ |
28 class CIpsFetchProgReport : public CActive |
28 NONSHARABLE_CLASS ( CIpsFetchProgReport ) : public CActive |
29 { |
29 { |
30 public: |
30 public: |
31 /** |
31 /** |
32 * |
32 * @param aAttaOp (callback) reference to fetch operation that created us |
33 */ |
33 */ |
34 static CIpsFetchProgReport* NewL( |
34 static CIpsFetchProgReport* NewL( CIpsPlgImap4FetchAttachmentOp& aAttaOp ); |
35 CIpsPlgImap4FetchAttachmentOp& aAttaOp ); |
|
36 |
35 |
37 /** |
36 // <qmail> destructor made virtual |
38 * |
37 virtual ~CIpsFetchProgReport(); |
39 */ |
|
40 ~CIpsFetchProgReport(); |
|
41 |
38 |
42 /** |
39 protected: // From CActive |
43 * |
|
44 */ |
|
45 virtual void DoCancel(); |
|
46 |
40 |
47 /** |
41 virtual void DoCancel(); |
48 * |
|
49 */ |
|
50 virtual void RunL(); |
|
51 |
42 |
52 private: |
43 virtual void RunL(); |
53 |
44 |
54 /** |
45 private: |
55 * |
46 CIpsFetchProgReport( CIpsPlgImap4FetchAttachmentOp& aAttaOp ); |
56 */ |
47 void ConstructL(); |
57 CIpsFetchProgReport( |
48 void AdjustTimer(); |
58 CIpsPlgImap4FetchAttachmentOp& aAttaOp ); |
|
59 |
|
60 /** |
|
61 * |
|
62 */ |
|
63 void ConstructL(); |
|
64 |
49 |
65 /** |
50 private: // members |
66 * |
51 RTimer iTimer; |
67 */ |
52 // reference to our "parent" op |
68 void AdjustTimer(); |
53 CIpsPlgImap4FetchAttachmentOp& iAttaOp; |
69 |
|
70 private: |
|
71 |
|
72 RTimer iTimer; |
|
73 |
|
74 CIpsPlgImap4FetchAttachmentOp& iAttaOp; |
|
75 |
|
76 }; |
54 }; |
77 |
55 |
78 /** |
56 /** |
79 * class CIpsPlgImap4FetchAttachmentOp |
57 * class CIpsPlgImap4FetchAttachmentOp |
80 * |
58 * fetches messageparts |
81 */ |
59 */ |
82 class CIpsPlgImap4FetchAttachmentOp : |
60 NONSHARABLE_CLASS ( CIpsPlgImap4FetchAttachmentOp ) : |
83 public CIpsPlgOnlineOperation |
61 public CIpsPlgOnlineOperation |
84 { |
62 { |
85 public: |
63 public: |
86 |
64 |
87 /** |
65 /** |
88 * NewL() |
66 * NewL() |
89 * Basic factory function - creates dialog with standard title resource |
67 * @param CMsvSession& client/server session to MsvServer |
90 * @param CMsvSession& |
68 * @param aObserverRequestStatus operation's observer's status |
91 * |
69 * @param aService serviceId of this mailbox |
92 * |
70 * @param aActivityTimer mailbox specific activity timer |
93 * |
71 * @param aSelection selection of message part ids, ownership moves |
94 * |
72 * @param aFSMailBoxId specifies mailbox |
95 * |
73 * @param aFSOperationObserver observes the progress of this operation |
96 * |
74 * @param aFSRequestId identifier for this instance of operation, assigned by the client |
97 * @return CIpsPlgImap4FetchAttachmentOp* self pointer |
75 * @return CIpsPlgImap4FetchAttachmentOp* self pointer |
98 */ |
76 */ |
|
77 // <qmail> CMsvEntrySelection& changed to pointer, aFunctionId removed |
|
78 // <qmail> MFSMailRequestObserver& changed to pointer |
|
79 static CIpsPlgImap4FetchAttachmentOp* NewL( |
|
80 CMsvSession& aMsvSession, |
|
81 TRequestStatus& aObserverRequestStatus, |
|
82 TMsvId aService, |
|
83 CIpsPlgTimerOperation& aActivityTimer, |
|
84 const CMsvEntrySelection* aSelection, |
|
85 TFSMailMsgId aFSMailBoxId, |
|
86 MFSMailRequestObserver* aFSOperationObserver, |
|
87 TInt aFSRequestId ); |
99 |
88 |
100 static CIpsPlgImap4FetchAttachmentOp* NewL( |
89 /** |
101 CMsvSession& aMsvSession, |
90 * ~CIpsPlgImap4FetchAttachmentOp() |
102 TRequestStatus& aObserverRequestStatus, |
91 * destructor |
103 TInt aFunctionId, |
92 */ |
104 TMsvId aService, |
93 virtual ~CIpsPlgImap4FetchAttachmentOp(); |
105 CIpsPlgTimerOperation& aActivityTimer, |
|
106 const TImImap4GetMailInfo& aGetMailInfo, |
|
107 const CMsvEntrySelection& aSel, |
|
108 TFSMailMsgId aFSMailBoxId, |
|
109 MFSMailRequestObserver& aFSOperationObserver, |
|
110 TInt aFSRequestId ); |
|
111 |
94 |
112 /** |
95 /** |
113 * ~CIpsPlgImap4FetchAttachmentOp() |
96 * From MsvOperation |
114 * destructor |
97 * Gets information on the progress of the operation |
115 */ |
98 * (see MsvOperation header) |
|
99 */ |
|
100 const TDesC8& ProgressL(); |
116 |
101 |
117 virtual ~CIpsPlgImap4FetchAttachmentOp(); |
102 /** |
|
103 * From CIpsPlgBaseOperation |
|
104 * For reporting if DoRunL leaves |
|
105 */ |
|
106 const TDesC8& GetErrorProgressL( TInt aError ); |
|
107 |
|
108 TFSProgress GetFSProgressL() const; |
|
109 |
|
110 private: |
|
111 // <qmail> CMsvEntrySelection& changed to pointer, aFunctionId removed |
|
112 // <qmail> MFSMailRequestObserver& changed to pointer |
|
113 CIpsPlgImap4FetchAttachmentOp( |
|
114 CMsvSession& aMsvSession, |
|
115 TRequestStatus& aObserverRequestStatus, |
|
116 TMsvId aService, |
|
117 CIpsPlgTimerOperation& aActivityTimer, |
|
118 const CMsvEntrySelection* aSelection, |
|
119 TFSMailMsgId aFSMailBoxId, |
|
120 MFSMailRequestObserver* aFSOperationObserver, |
|
121 TInt aFSRequestId ); |
118 |
122 |
119 /** |
123 void ConstructL(); |
120 * |
|
121 */ |
|
122 const TDesC8& ProgressL(); |
|
123 |
124 |
|
125 void RunL(); |
|
126 |
|
127 void DoRunL(); |
|
128 |
|
129 //virtual void DoCancel(); |
|
130 |
|
131 void Complete(); |
|
132 |
|
133 void DoConnectL(); |
|
134 |
|
135 /** |
|
136 * Called periodically by CIpsFetchProgReport during active fetching |
|
137 * Leads to sending progress report to plugin's client |
|
138 */ |
|
139 void ReportProgressL(); |
|
140 |
|
141 // <qmail> new func to this op |
|
142 /** |
|
143 * Returns operation type |
|
144 */ |
|
145 TIpsOpType IpsOpType() const; |
|
146 |
|
147 protected: |
|
148 |
|
149 // <qmail> GetEngineProgress removed |
|
150 void DoFetchAttachmentL( ); |
124 |
151 |
125 /** |
152 // <qmail> |
126 * |
153 private: //Data |
127 */ |
154 friend class CIpsFetchProgReport; |
128 const TDesC8& GetErrorProgressL( TInt aError ); |
155 // <qmail> |
|
156 |
|
157 // internal state of this statemachine |
|
158 enum TFetchState { |
|
159 EStateIdle, |
|
160 EStateConnecting, |
|
161 EStateFetching, |
|
162 EStateWaiting, |
|
163 EStateDisconnecting }; |
|
164 TFetchState iState; |
129 |
165 |
130 /** |
166 const CMsvEntrySelection* iSelection; |
131 * |
167 TDesC8* iFetchErrorProgress; |
132 */ |
168 // <qmail> iGetMailInfo, iFunctionId removed |
133 TFSProgress GetFSProgressL() const; |
169 TPckgBuf<TImap4CompoundProgress> iProgress; |
134 |
170 // <qmail> iService, iPopulated removed |
135 |
171 CIpsFetchProgReport* iProgReport; |
136 private: |
172 // Temporary fix for handling KErrServerBusy errors from the |
137 |
173 // messaging service. Remove these once the appropriate observer |
138 |
174 // mechanism has been implemented in the messaging service. |
139 /** |
175 TInt iRetryCount; |
140 * CIpsPlgImap4PopulateOp() |
176 RTimer iRetryTimer; |
141 * @param |
|
142 * |
|
143 * |
|
144 * |
|
145 * |
|
146 * |
|
147 * |
|
148 |
|
149 */ |
|
150 |
|
151 CIpsPlgImap4FetchAttachmentOp( |
|
152 CMsvSession& aMsvSession, |
|
153 TRequestStatus& aObserverRequestStatus, |
|
154 TInt aFunctionId, |
|
155 TMsvId aService, |
|
156 CIpsPlgTimerOperation& aActivityTimer, |
|
157 const TImImap4GetMailInfo& aGetMailInfo, |
|
158 TFSMailMsgId aFSMailBoxId, |
|
159 MFSMailRequestObserver& aFSOperationObserver, |
|
160 TInt aFSRequestId ); |
|
161 |
|
162 /** |
|
163 * ConstructL() |
|
164 */ |
|
165 |
|
166 void ConstructL( const CMsvEntrySelection& aSel ); |
|
167 |
|
168 |
|
169 /** |
|
170 * RunL() |
|
171 */ |
|
172 |
|
173 void RunL(); |
|
174 |
|
175 /** |
|
176 * DoRunL() |
|
177 */ |
|
178 |
|
179 void DoRunL(); |
|
180 |
|
181 /** |
|
182 * DoCancel() |
|
183 */ |
|
184 |
|
185 //virtual void DoCancel(); |
|
186 |
|
187 /** |
|
188 * Complete() |
|
189 */ |
|
190 |
|
191 void Complete(); |
|
192 |
|
193 /** |
|
194 * |
|
195 */ |
|
196 void DoConnectL(); |
|
197 |
|
198 /** |
|
199 * |
|
200 */ |
|
201 void ReportProgressL(); |
|
202 |
|
203 protected: |
|
204 |
|
205 /** |
|
206 * From CIpsPlgOnlineoperation |
|
207 */ |
|
208 TInt GetEngineProgress( const TDesC8& aProgress ); |
|
209 |
|
210 /** |
|
211 * |
|
212 */ |
|
213 void DoFetchAttachmentL( ); |
|
214 |
|
215 enum TFetchState { |
|
216 EStateIdle, |
|
217 EStateConnecting, |
|
218 EStateFetching, |
|
219 EStateWaiting, |
|
220 EStateDisconnecting }; |
|
221 TFetchState iState; |
|
222 |
|
223 private: //Data |
|
224 |
|
225 // because use of ReportProgressL() |
|
226 friend class CIpsFetchProgReport; |
|
227 |
|
228 CMsvEntrySelection* iSelection; |
|
229 TDesC8* iFetchErrorProgress; |
|
230 TImImap4GetMailInfo iGetMailInfo; |
|
231 TInt iFunctionId; |
|
232 TPckgBuf<TImap4CompoundProgress> iProgress; |
|
233 TBool iPopulated; |
|
234 CIpsFetchProgReport* iProgReport; |
|
235 // Temporary fix for handling KErrServerBusy errors from the |
|
236 // messaging service. Remove these once the appropriate observer |
|
237 // mechanism has been implemented in the messaging service. |
|
238 TInt iRetryCount; |
|
239 RTimer iRetryTimer; |
|
240 }; |
177 }; |
241 |
178 |
242 #endif //__IPSPLGIMAP4FETCHATTACHMENTOP_H__ |
179 #endif // IPSPLGIMAP4FETCHATTACHMENTOP_H |