13 * |
13 * |
14 * Description: IMAP4 populate messages operation |
14 * Description: IMAP4 populate messages operation |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #ifndef __IPSPLGIMAP4POPULATEOP_H__ |
18 #ifndef IPSPLGIMAP4POPULATEOP_H |
19 #define __IPSPLGIMAP4POPULATEOP_H__ |
19 #define IPSPLGIMAP4POPULATEOP_H |
20 |
20 |
21 #include "ipsplgonlineoperation.h" |
21 #include "ipsplgonlineoperation.h" |
22 |
22 |
23 class CIpsPlgEventHandler; |
23 class CIpsPlgEventHandler; |
24 |
24 |
25 /** |
25 /** |
26 * class CIpsPlgImap4PopulateOp |
26 * class CIpsPlgImap4PopulateOp |
27 * |
27 * loads message's actual content/ message parts |
28 */ |
28 */ |
29 |
|
30 NONSHARABLE_CLASS ( CIpsPlgImap4PopulateOp ) : |
29 NONSHARABLE_CLASS ( CIpsPlgImap4PopulateOp ) : |
31 public CIpsPlgOnlineOperation |
30 public CIpsPlgOnlineOperation |
32 { |
31 { |
33 public: |
32 public: |
34 |
33 |
35 /** |
34 /** |
36 * NewL() |
35 * NewL() |
37 * Basic factory function - creates dialog with standard title resource |
36 * Basic factory function - creates dialog with standard title resource |
38 * @param CMsvSession& |
37 * @param aMsvSession client/server session to msvServer |
39 * |
38 * @param aObserverRequestStatus caller's status |
40 * |
39 * @param aService serviceId of the mailbox |
41 * |
40 * @param aActivityTimer mailbox specific activity timer |
42 * |
41 * @param aPartialMailInfo parameter struct for the service request to msvServer |
43 * |
42 * @param aSel selection of messages to populate (first entry contains service entry) |
44 * |
43 * @param aFSMailBoxId mailbox identifier |
45 * @return CIpsPlgImap4PopulateOperation* self pointer |
44 * @param aFSOperationObserver observer for this operation |
46 */ |
45 * @param aFSRequestId client assigned request Id |
|
46 * @param aEventHandler |
|
47 * @param aDoFilterSelection specifies whether a full populate is requested (i.e. refetch already fecthed or not) |
|
48 * @return CIpsPlgImap4PopulateOperation* self pointer |
|
49 */ |
|
50 // <qmail> priority parameter has been removed |
|
51 IMPORT_C static CIpsPlgImap4PopulateOp* NewL( |
|
52 CMsvSession& aMsvSession, |
|
53 TRequestStatus& aObserverRequestStatus, |
|
54 TMsvId aService, |
|
55 CIpsPlgTimerOperation& aActivityTimer, |
|
56 const TImImap4GetPartialMailInfo& aPartialMailInfo, |
|
57 const CMsvEntrySelection& aSel, |
|
58 TFSMailMsgId aFSMailBoxId, |
|
59 MFSMailRequestObserver* aFSOperationObserver, |
|
60 TInt aFSRequestId, |
|
61 CIpsPlgEventHandler* aEventHandler, |
|
62 TBool aDoFilterSelection = ETrue ); |
47 |
63 |
48 IMPORT_C static CIpsPlgImap4PopulateOp* NewL( |
64 virtual ~CIpsPlgImap4PopulateOp(); |
49 CMsvSession& aMsvSession, |
|
50 TRequestStatus& aObserverRequestStatus, |
|
51 TInt aPriority, |
|
52 TMsvId aService, |
|
53 CIpsPlgTimerOperation& aActivityTimer, |
|
54 const TImImap4GetPartialMailInfo& aPartialMailInfo, |
|
55 const CMsvEntrySelection& aSel, |
|
56 TFSMailMsgId aFSMailBoxId, |
|
57 MFSMailRequestObserver& aFSOperationObserver, |
|
58 TInt aFSRequestId, |
|
59 CIpsPlgEventHandler* aEventHandler, |
|
60 TBool aDoFilterSelection = ETrue ); |
|
61 |
65 |
62 /** |
66 /** |
63 * ~CIpsPlgImap4PopulateOp() |
67 * From MsvOperation |
64 * destructor |
68 * Gets information on the progress of the operation |
65 */ |
69 * (see MsvOperation header) |
|
70 */ |
|
71 const TDesC8& ProgressL(); |
|
72 |
|
73 /** |
|
74 * From CIpsPlgBaseOperation |
|
75 * For reporting if DoRunL leaves |
|
76 */ |
|
77 const TDesC8& GetErrorProgressL( TInt aError ); |
|
78 |
|
79 TFSProgress GetFSProgressL() const; |
|
80 |
|
81 // <qmail> change ret val type |
|
82 /** |
|
83 * Returns operation type |
|
84 */ |
|
85 TIpsOpType IpsOpType() const; |
|
86 |
|
87 private: |
|
88 // <qmail> priority parameter has been removed |
|
89 CIpsPlgImap4PopulateOp( |
|
90 CMsvSession& aMsvSession, |
|
91 TRequestStatus& aObserverRequestStatus, |
|
92 TMsvId aService, |
|
93 CIpsPlgTimerOperation& aActivityTimer, |
|
94 const TImImap4GetPartialMailInfo& aGetMailInfo, |
|
95 TFSMailMsgId aFSMailBoxId, |
|
96 MFSMailRequestObserver* aFSOperationObserver, |
|
97 TInt aFSRequestId, |
|
98 CIpsPlgEventHandler* aEventHandler ); |
66 |
99 |
67 virtual ~CIpsPlgImap4PopulateOp(); |
100 void ConstructL( const CMsvEntrySelection& aSel, TBool aDoFilterSelection ); |
68 |
101 |
69 /** |
102 void RunL(); |
70 * |
|
71 */ |
|
72 const TDesC8& ProgressL(); |
|
73 |
103 |
74 |
104 void DoRunL(); |
75 /** |
105 |
76 * |
106 void DoCancel(); |
77 */ |
|
78 const TDesC8& GetErrorProgressL( TInt aError ); |
|
79 |
|
80 /** |
|
81 * |
|
82 */ |
|
83 TFSProgress GetFSProgressL() const; |
|
84 |
|
85 /** |
|
86 * |
|
87 */ |
|
88 virtual TInt IpsOpType() const; |
|
89 |
|
90 private: |
|
91 |
107 |
|
108 /** |
|
109 * completes the status of the observer |
|
110 */ |
|
111 void Complete(); |
|
112 |
|
113 /** |
|
114 * handle connecting state |
|
115 */ |
|
116 void DoConnectL(); |
|
117 |
|
118 /** |
|
119 * Filters given selection of entries |
|
120 * The result is set to internal iSelection member |
|
121 * (filtering is done on basis of what is the current populate status of the particular message) |
|
122 * @param aSelection list of entries to fetch |
|
123 */ |
|
124 void FilterSelectionL( const CMsvEntrySelection& aSelection ); |
|
125 |
|
126 /** |
|
127 * helper for selection filtering |
|
128 */ |
|
129 TBool IsPartialPopulate(); |
92 |
130 |
93 /** |
131 protected: |
94 * CIpsPlgImap4PopulateOp() |
132 |
95 * @param |
133 /** |
96 * |
134 * starts the actual populate command to msvserver |
97 * |
135 */ |
98 * |
136 void DoPopulateL(); |
99 * |
137 |
100 * |
138 // <qmail> remove GetEngineProgress( const TDesC8& aProgress ); |
101 * |
139 |
102 |
140 private: //Data |
103 */ |
141 // <qmail> members changed |
104 |
142 // internal state of the operation |
105 CIpsPlgImap4PopulateOp( |
143 enum TFetchState |
106 CMsvSession& aMsvSession, |
144 { |
107 TRequestStatus& aObserverRequestStatus, |
145 EStateIdle, |
108 TInt aPriority, |
146 EStateConnecting, |
109 TMsvId aService, |
147 EStateFetching, |
110 CIpsPlgTimerOperation& aActivityTimer, |
148 EStateInfoEntryChange |
111 const TImImap4GetPartialMailInfo& aGetMailInfo, |
149 }; |
112 TFSMailMsgId aFSMailBoxId, |
150 TFetchState iState; |
113 MFSMailRequestObserver& aFSOperationObserver, |
151 |
114 TInt aFSRequestId, |
152 // parameter struct for the populate command to msvserver |
115 CIpsPlgEventHandler* aEventHandler ); |
153 TImImap4GetPartialMailInfo iPartialMailInfo; |
116 |
154 // contains full list of messages to fetch |
117 /** |
155 CMsvEntrySelection* iSelection; |
118 * |
156 // contains serviceId and one message entry id from iSelection list |
119 */ |
157 // i.e. populate op loops through iSelection with this iTempSelection |
120 |
158 CMsvEntrySelection* iTempSelection; |
121 void ConstructL( |
159 // not owned |
122 const CMsvEntrySelection& aSel, |
160 CIpsPlgEventHandler* iEventHandler; |
123 TBool aDoFilterSelection ); |
161 TDesC8* iFetchErrorProgress; |
124 |
162 TPckgBuf<TImap4SyncProgress> iSyncProgress; |
125 |
|
126 /** |
|
127 * |
|
128 */ |
|
129 |
|
130 void RunL(); |
|
131 |
|
132 /** |
|
133 * |
|
134 */ |
|
135 void DoRunL(); |
|
136 |
|
137 /** |
|
138 * |
|
139 */ |
|
140 void DoCancel(); |
|
141 |
|
142 /** |
|
143 * |
|
144 */ |
|
145 |
|
146 void Complete(); |
|
147 |
|
148 /** |
|
149 * |
|
150 */ |
|
151 void DoConnectL(); |
|
152 |
|
153 /** |
|
154 * |
|
155 */ |
|
156 void FilterSelectionL( const CMsvEntrySelection& aSelection ); |
|
157 |
|
158 /** |
|
159 * |
|
160 */ |
|
161 TBool IsPartialPopulate( ); |
|
162 |
|
163 protected: |
|
164 |
|
165 /** |
|
166 * |
|
167 */ |
|
168 void DoPopulateL(); |
|
169 |
|
170 /** |
|
171 * From CIpsPlgOnlineoperation |
|
172 */ |
|
173 TInt GetEngineProgress( const TDesC8& aProgress ); |
|
174 |
|
175 protected: |
|
176 |
|
177 enum TFetchState |
|
178 { |
|
179 EStateIdle, |
|
180 EStateConnecting, |
|
181 EStateFetching, |
|
182 EStateInfoEntryChange |
|
183 }; |
|
184 |
|
185 |
|
186 private: //Data |
|
187 |
|
188 TImImap4GetPartialMailInfo iPartialMailInfo; |
|
189 RArray<TMsvId> iSelection; |
|
190 // not owned |
|
191 CIpsPlgEventHandler* iEventHandler; |
|
192 CMsvEntrySelection* iTempSelection; |
|
193 TDesC8* iFetchErrorProgress; |
|
194 TPckgBuf<TImap4SyncProgress> iSyncProgress; |
|
195 TMsvId iParent; |
|
196 TFetchState iState; |
|
197 |
|
198 }; |
163 }; |
199 |
164 |
200 #endif //__IPSPLGIMAP4POPULATEOP_H__ |
165 #endif // IPSPLGIMAP4POPULATEOP_H |