16 */ |
16 */ |
17 |
17 |
18 #include "emailtrace.h" |
18 #include "emailtrace.h" |
19 #include "ipsplgheaders.h" |
19 #include "ipsplgheaders.h" |
20 |
20 |
|
21 // <qmail> priority const has been removed |
|
22 |
21 // ---------------------------------------------------------------------------- |
23 // ---------------------------------------------------------------------------- |
22 // ---------------------------------------------------------------------------- |
24 // ---------------------------------------------------------------------------- |
23 // <qmail> priority parameter has been removed |
25 // <qmail> priority parameter has been removed |
|
26 // <qmail> MFSMailRequestObserver& changed to pointer |
24 EXPORT_C CIpsPlgImap4PopulateOp* CIpsPlgImap4PopulateOp::NewL( |
27 EXPORT_C CIpsPlgImap4PopulateOp* CIpsPlgImap4PopulateOp::NewL( |
25 CMsvSession& aMsvSession, |
28 CMsvSession& aMsvSession, |
26 TRequestStatus& aObserverRequestStatus, |
29 TRequestStatus& aObserverRequestStatus, |
27 TMsvId aService, |
30 TMsvId aService, |
28 CIpsPlgTimerOperation& aActivityTimer, |
31 CIpsPlgTimerOperation& aActivityTimer, |
88 // ---------------------------------------------------------------------------- |
91 // ---------------------------------------------------------------------------- |
89 CIpsPlgImap4PopulateOp::~CIpsPlgImap4PopulateOp() |
92 CIpsPlgImap4PopulateOp::~CIpsPlgImap4PopulateOp() |
90 { |
93 { |
91 FUNC_LOG; |
94 FUNC_LOG; |
92 delete iSelection; |
95 delete iSelection; |
93 delete iTempSelection; |
96 |
94 } |
97 if ( iTempSelection ) |
95 |
98 { |
96 // ---------------------------------------------------------------------------- |
99 iTempSelection->Reset(); |
97 // ---------------------------------------------------------------------------- |
100 delete iTempSelection; |
98 void CIpsPlgImap4PopulateOp::ConstructL( const CMsvEntrySelection& aSel, TBool aDoFilterSelection ) |
101 } |
|
102 } |
|
103 |
|
104 // ---------------------------------------------------------------------------- |
|
105 // ---------------------------------------------------------------------------- |
|
106 void CIpsPlgImap4PopulateOp::ConstructL( |
|
107 const CMsvEntrySelection& aSel, |
|
108 TBool aDoFilterSelection ) |
99 { |
109 { |
100 FUNC_LOG; |
110 FUNC_LOG; |
101 BaseConstructL( KUidMsgTypeIMAP4 ); |
111 BaseConstructL( KUidMsgTypeIMAP4 ); |
102 |
112 |
103 // <qmail> instantiation moved here |
113 // <qmail> instantiation moved here |
122 DoConnectL(); |
132 DoConnectL(); |
123 } |
133 } |
124 |
134 |
125 // ---------------------------------------------------------------------------- |
135 // ---------------------------------------------------------------------------- |
126 // ---------------------------------------------------------------------------- |
136 // ---------------------------------------------------------------------------- |
127 // <qmail> return type |
137 // <qmail> return type changed: TInt -> TIpsOpType |
128 TIpsOpType CIpsPlgImap4PopulateOp::IpsOpType() const |
138 TIpsOpType CIpsPlgImap4PopulateOp::IpsOpType() const |
129 { |
139 { |
130 FUNC_LOG; |
140 FUNC_LOG; |
131 return EIpsOpTypeImap4PopulateOp; |
141 return EIpsOpTypeImap4PopulateOp; |
132 } |
142 } |
142 // <qmail> priority parameter has been removed |
152 // <qmail> priority parameter has been removed |
143 CIpsPlgImap4ConnectOp* connOp = CIpsPlgImap4ConnectOp::NewL( |
153 CIpsPlgImap4ConnectOp* connOp = CIpsPlgImap4ConnectOp::NewL( |
144 iMsvSession, |
154 iMsvSession, |
145 iStatus, |
155 iStatus, |
146 iService, |
156 iService, |
147 iActivityTimer, |
157 *iActivityTimer, |
148 iFSMailboxId, |
158 iFSMailboxId, |
149 NULL, // no observer for suboperations |
159 NULL, // no observer for suboperations |
150 0, // requestId not needed |
160 0, // requestId not needed |
151 iEventHandler, |
161 iEventHandler, |
152 ETrue ); // Do plain connect |
162 ETrue ); // Do plain connect |
238 return *iFetchErrorProgress; |
248 return *iFetchErrorProgress; |
239 } |
249 } |
240 else |
250 else |
241 { |
251 { |
242 TImap4SyncProgress progg; |
252 TImap4SyncProgress progg; |
|
253 progg.iFoldersNotFound = 0; |
243 progg.iErrorCode = KErrNone; |
254 progg.iErrorCode = KErrNone; |
244 TPckgBuf<TImap4SyncProgress> param(progg); |
255 TPckgBuf<TImap4SyncProgress> param(progg); |
245 iSyncProgress.Copy(param); |
256 iSyncProgress.Copy(param); |
246 return iSyncProgress; |
257 return iSyncProgress; |
247 } |
258 } |
298 void CIpsPlgImap4PopulateOp::FilterSelectionL( const CMsvEntrySelection& aSelection ) |
309 void CIpsPlgImap4PopulateOp::FilterSelectionL( const CMsvEntrySelection& aSelection ) |
299 { |
310 { |
300 FUNC_LOG; |
311 FUNC_LOG; |
301 iSelection->Reset(); |
312 iSelection->Reset(); |
302 TMsvId messageId; |
313 TMsvId messageId; |
303 |
314 // NOTE: this code is taken from symbian os source IMPCMTM.CPP |
304 for ( TInt i = 0; i < aSelection.Count(); i++ ) |
315 // filter selection is in here because messages are |
305 { |
316 // fetched separately then we dont have to make unneccessery imap |
306 messageId = (aSelection)[i]; |
317 // client mtm calls |
|
318 |
|
319 for (TInt i=0; i<aSelection.Count(); i++) |
|
320 { |
|
321 messageId = (aSelection)[i]; |
307 if ( messageId == iService ) |
322 if ( messageId == iService ) |
308 { |
323 { |
309 continue; // ignore serviceId |
324 continue; // ignore serviceId |
310 } |
325 } |
311 TMsvEmailEntry entry; |
326 TMsvEmailEntry entry; |
312 TMsvId service( KMsvNullIndexEntryId ); |
327 TMsvId service = KMsvNullIndexEntryId; |
313 User::LeaveIfError( iMsvSession.GetEntry( messageId, service, entry ) ); |
328 User::LeaveIfError(iMsvSession.GetEntry(messageId, service, entry)); |
314 |
329 |
315 TBool isComplete = !( ( entry.Complete() && entry.PartialDownloaded() ) |
330 TBool isComplete = !( ( entry.Complete() && entry.PartialDownloaded() ) |
316 || ( !entry.Complete() && ( !entry.BodyTextComplete() |
331 || ( !entry.Complete() && ( !entry.BodyTextComplete() |
317 || ( iPartialMailInfo.iGetMailBodyParts == EGetImap4EmailBodyTextAndAttachments ) ) |
332 || ( iPartialMailInfo.iGetMailBodyParts == EGetImap4EmailBodyTextAndAttachments ) ) |
318 && !entry.PartialDownloaded() ) ); |
333 && !entry.PartialDownloaded() ) ); |
319 |
334 |
320 TBool isMsgEntry = entry.iType == KUidMsvMessageEntry; |
335 TBool isMsgEntry = entry.iType == KUidMsvMessageEntry; |
321 TBool isSizeUnderMax = entry.iSize <= iPartialMailInfo.iMaxEmailSize; |
336 TBool isSizeUnderMax = entry.iSize <= iPartialMailInfo.iMaxEmailSize; |
322 TBool isParentComp = entry.Parent() == iPartialMailInfo.iDestinationFolder && isComplete; |
337 TBool isParentComp = entry.Parent() == |
|
338 iPartialMailInfo.iDestinationFolder && isComplete; |
323 |
339 |
324 if( isMsgEntry && IsPartialPopulate() && !isComplete ) |
340 if( IsPartialPopulate( ) |
|
341 && !isComplete |
|
342 && entry.iType == KUidMsvMessageEntry ) |
325 { |
343 { |
326 iSelection->AppendL( messageId ); |
344 iSelection->AppendL( messageId ); |
327 } |
345 } |
328 else if ( isMsgEntry && isSizeUnderMax && !isParentComp ) |
346 else if ( isMsgEntry && isSizeUnderMax && !isParentComp ) |
329 { |
347 { |
336 // ---------------------------------------------------------------------------- |
354 // ---------------------------------------------------------------------------- |
337 TBool CIpsPlgImap4PopulateOp::IsPartialPopulate( ) |
355 TBool CIpsPlgImap4PopulateOp::IsPartialPopulate( ) |
338 { |
356 { |
339 // <qmail> cleaned up code and took one "always true" condition out from the if statement |
357 // <qmail> cleaned up code and took one "always true" condition out from the if statement |
340 FUNC_LOG; |
358 FUNC_LOG; |
|
359 // NOTE: this code is taken from symbian os source IMPCMTM.CPP |
|
360 // code is modified to this class purpose |
341 TBool isPartialPopulate( EFalse ); |
361 TBool isPartialPopulate( EFalse ); |
342 if ( iPartialMailInfo.iPartialMailOptions == ENoSizeLimits && |
362 if ( iPartialMailInfo.iPartialMailOptions == ENoSizeLimits && |
343 iPartialMailInfo.iTotalSizeLimit == KMaxTInt && |
363 iPartialMailInfo.iTotalSizeLimit == KMaxTInt && |
344 iPartialMailInfo.iBodyTextSizeLimit == KMaxTInt && |
364 iPartialMailInfo.iBodyTextSizeLimit == KMaxTInt && |
345 iPartialMailInfo.iAttachmentSizeLimit == KMaxTInt ) |
365 iPartialMailInfo.iAttachmentSizeLimit == KMaxTInt ) |