86 delete iSearch; |
90 delete iSearch; |
87 delete iSyncStateHandler; |
91 delete iSyncStateHandler; |
88 delete iSession; |
92 delete iSession; |
89 delete iBrandingId; |
93 delete iBrandingId; |
90 } |
94 } |
91 |
95 |
92 // ---------------------------------------------------------------------------- |
96 // ---------------------------------------------------------------------------- |
93 // ---------------------------------------------------------------------------- |
97 // ---------------------------------------------------------------------------- |
94 void CIpsPlgSosBasePlugin::BaseConstructL() |
98 void CIpsPlgSosBasePlugin::BaseConstructL() |
95 { |
99 { |
96 FUNC_LOG; |
100 FUNC_LOG; |
97 iEventHandler = CIpsPlgEventHandler::NewL( *this ); |
101 iEventHandler = CIpsPlgEventHandler::NewL( *this ); |
98 iSession = CMsvSession::OpenAsyncL( *iEventHandler ); |
102 iSession = CMsvSession::OpenAsyncL( *iEventHandler ); |
99 iMsgMapper = CIpsPlgMsgMapper::NewL( *iSession, *this ); |
103 iMsgMapper = CIpsPlgMsgMapper::NewL( *iSession, *this ); |
100 iSmtpService = CIpsPlgSmtpService::NewL( *iSession, *this ); |
104 iSmtpService = CIpsPlgSmtpService::NewL( *iSession, *this ); |
101 iMruList = CIpsPlgMruList::NewL( ); |
105 iMruList = CIpsPlgMruList::NewL( ); |
102 iSearch = CIpsPlgSearch::NewL( *iSession, *this ); |
106 iSearch = CIpsPlgSearch::NewL( *iSession, *this ); |
103 iSyncStateHandler = CIpsPlgSyncStateHandler::NewL( |
107 // <qmail> iSettingsApi removed |
|
108 iSyncStateHandler = CIpsPlgSyncStateHandler::NewL( |
104 *iSession, *this, iOperations ); |
109 *iSession, *this, iOperations ); |
105 iEventHandler->RegisterPropertyObserverL( iSyncStateHandler ); |
110 iEventHandler->RegisterPropertyObserverL( iSyncStateHandler ); |
106 |
111 |
107 RProcess process; |
112 RProcess process; |
108 if ( process.SecureId() == FREESTYLE_EMAIL_UI_SID ) |
113 if ( process.SecureId() == FREESTYLE_EMAIL_UI_SID ) |
113 { |
118 { |
114 iIsUnderUiProcess = EFalse; |
119 iIsUnderUiProcess = EFalse; |
115 } |
120 } |
116 |
121 |
117 #ifndef RD_101_EMAIL |
122 #ifndef RD_101_EMAIL |
118 RAlwaysOnlineClientSession aosession; |
123 RAlwaysOnlineClientSession aosession; |
119 TInt err = aosession.Connect(); |
124 TInt err = aosession.Connect(); |
120 if ( err == KErrNone ) |
125 if ( err == KErrNone ) |
121 { |
126 { |
122 TBuf8<1> dummyBuf; |
127 TBuf8<1> dummyBuf; |
123 TRAP( err, aosession.RelayCommandL( |
128 TRAP( err, aosession.RelayCommandL( |
124 EServerAPIEmailDisableAOEmailPlugin, |
129 EServerAPIEmailDisableAOEmailPlugin, |
125 dummyBuf ) ); |
130 dummyBuf ) ); |
126 } |
131 } |
127 aosession.Close(); |
132 aosession.Close(); |
128 #endif |
133 #endif |
129 } |
134 } |
130 |
135 |
131 // ---------------------------------------------------------------------------- |
136 // ---------------------------------------------------------------------------- |
132 // ---------------------------------------------------------------------------- |
137 // ---------------------------------------------------------------------------- |
133 void CIpsPlgSosBasePlugin::CompleteConstructL() |
138 void CIpsPlgSosBasePlugin::CompleteConstructL() |
134 { |
139 { |
135 FUNC_LOG; |
140 FUNC_LOG; |
136 iSessionOk = ETrue; |
141 iSessionOk = ETrue; |
137 iEventHandler->CompleteConstructL( iSession ); |
142 iEventHandler->CompleteConstructL( iSession ); |
138 } |
143 } |
139 |
144 |
140 // ---------------------------------------------------------------------------- |
145 // ---------------------------------------------------------------------------- |
141 // ---------------------------------------------------------------------------- |
146 // ---------------------------------------------------------------------------- |
142 void CIpsPlgSosBasePlugin::SessionTerminated() |
147 void CIpsPlgSosBasePlugin::SessionTerminated() |
143 { |
148 { |
144 FUNC_LOG; |
149 FUNC_LOG; |
145 iSessionOk = EFalse; |
150 iSessionOk = EFalse; |
146 } |
151 } |
147 |
152 |
148 // ---------------------------------------------------------------------------- |
153 // ---------------------------------------------------------------------------- |
149 // ---------------------------------------------------------------------------- |
154 // ---------------------------------------------------------------------------- |
150 void CIpsPlgSosBasePlugin::OpCompleted( |
155 void CIpsPlgSosBasePlugin::OpCompleted( |
151 CIpsPlgSingleOpWatcher& aOpWatcher, |
156 CIpsPlgSingleOpWatcher& aOpWatcher, |
152 TInt aCompletionCode ) |
157 TInt aCompletionCode ) |
153 { |
158 { |
154 FUNC_LOG; |
159 FUNC_LOG; |
155 // Get valid operation count in each, some operations could have been |
160 // Get valid operation count in each, some operations could have been |
156 // deleted in array |
161 // deleted in array |
157 TInt opId = aOpWatcher.Operation().Id(); |
162 TInt opId = aOpWatcher.Operation().Id(); |
158 for ( TInt i = iOperations.Count()-1; i >= 0; i-- ) |
163 for ( TInt i = iOperations.Count()-1; i >= 0; i-- ) |
159 { |
164 { |
160 CMsvOperation& oper = iOperations[i]->Operation(); |
165 CMsvOperation& oper = iOperations[i]->Operation(); |
161 |
166 |
162 if ( oper.Id() == opId ) |
167 if ( oper.Id() == opId ) |
163 { |
168 { |
164 DeleteAndRemoveOperation( i, aCompletionCode ); |
169 DeleteAndRemoveOperation( i, aCompletionCode ); |
165 } |
170 } |
166 } |
171 |
167 } |
172 // <qmail> iWait removed |
168 |
173 } |
169 // ---------------------------------------------------------------------------- |
174 } |
170 // ---------------------------------------------------------------------------- |
175 |
171 TFSMailBoxStatus CIpsPlgSosBasePlugin::GetMailBoxStatus( |
176 // ---------------------------------------------------------------------------- |
|
177 // ---------------------------------------------------------------------------- |
|
178 TFSMailBoxStatus CIpsPlgSosBasePlugin::GetMailBoxStatus( |
172 const TFSMailMsgId& aMailBoxId ) |
179 const TFSMailMsgId& aMailBoxId ) |
173 { |
180 { |
174 FUNC_LOG; |
181 FUNC_LOG; |
175 TMsvEntry tEntry; |
182 TMsvEntry tEntry; |
176 TMsvId service; |
183 TMsvId service; |
177 TFSMailBoxStatus status; |
184 TFSMailBoxStatus status; |
178 if( iSessionOk ) |
185 if( iSessionOk ) |
179 { |
186 { |
180 iSession->GetEntry( aMailBoxId.Id(), service, tEntry ); |
187 iSession->GetEntry( aMailBoxId.Id(), service, tEntry ); |
181 |
188 |
182 if ( tEntry.Connected() ) |
189 if ( tEntry.Connected() ) |
183 { |
190 { |
184 status = EFSMailBoxOnline; |
191 status = EFSMailBoxOnline; |
185 } |
192 } |
186 else if ( ConnOpRunning( aMailBoxId ) ) |
193 else if ( ConnOpRunning( aMailBoxId ) ) |
187 { |
194 { |
188 status = EFSMailBoxOnline; |
195 status = EFSMailBoxOnline; |
189 } |
196 } |
190 else |
197 else |
191 { |
198 { |
192 status = EFSMailBoxOffline; |
199 status = EFSMailBoxOffline; |
193 } |
200 } |
194 } |
201 } |
195 else |
202 else |
200 } |
207 } |
201 |
208 |
202 // ---------------------------------------------------------------------------- |
209 // ---------------------------------------------------------------------------- |
203 // CIpsPlgSosBasePlugin::SpecifiedSendingMailbox |
210 // CIpsPlgSosBasePlugin::SpecifiedSendingMailbox |
204 // Returns 'null' ID, because the method is not relevant with IPS protocols |
211 // Returns 'null' ID, because the method is not relevant with IPS protocols |
205 // ---------------------------------------------------------------------------- |
212 // ---------------------------------------------------------------------------- |
206 TFSMailMsgId CIpsPlgSosBasePlugin::SpecifiedSendingMailbox() |
213 TFSMailMsgId CIpsPlgSosBasePlugin::SpecifiedSendingMailbox() |
207 { |
214 { |
208 FUNC_LOG; |
215 FUNC_LOG; |
209 return TFSMailMsgId(); |
216 return TFSMailMsgId(); |
210 } |
217 } |
211 |
218 |
212 // ---------------------------------------------------------------------------- |
219 // ---------------------------------------------------------------------------- |
213 // ---------------------------------------------------------------------------- |
220 // ---------------------------------------------------------------------------- |
214 void CIpsPlgSosBasePlugin::ListMailBoxesL( RArray<TFSMailMsgId>& aMailboxes ) |
221 void CIpsPlgSosBasePlugin::ListMailBoxesL( RArray<TFSMailMsgId>& aMailboxes ) |
215 { |
222 { |
216 FUNC_LOG; |
223 FUNC_LOG; |
217 |
224 |
218 if( !iSessionOk ) |
225 if( !iSessionOk ) |
219 { |
226 { |
220 User::Leave( KErrNotReady ); |
227 User::Leave( KErrNotReady ); |
221 } |
228 } |
222 CMsvEntry* cEntry = iSession->GetEntryL( KMsvRootIndexEntryId ); |
229 CMsvEntry* cEntry = iSession->GetEntryL( KMsvRootIndexEntryId ); |
223 CleanupStack::PushL( cEntry ); |
230 CleanupStack::PushL( cEntry ); |
224 |
231 |
225 CMsvEntrySelection* childEntries = cEntry->ChildrenWithMtmL( MtmId() ); |
232 CMsvEntrySelection* childEntries = cEntry->ChildrenWithMtmL( MtmId() ); |
226 CleanupStack::PushL( childEntries ); |
233 CleanupStack::PushL( childEntries ); |
227 |
234 |
228 TInt count( childEntries->Count() ); |
235 TInt count( childEntries->Count() ); |
229 for ( TInt i(0); i < count; i++) |
236 for ( TInt i(0); i < count; i++) |
230 { |
237 { |
231 TFSMailMsgId mailboxId; |
238 TFSMailMsgId mailboxId; |
232 TMsvEntry tEntry; |
239 TMsvEntry tEntry; |
233 TMsvId serviceId; |
240 TMsvId serviceId; |
234 TDriveUnit driveUnit = EDriveC; |
241 TDriveUnit driveUnit = EDriveC; |
235 |
242 |
236 iSession->GetEntry( childEntries->At(i), serviceId, tEntry ); |
243 iSession->GetEntry( childEntries->At(i), serviceId, tEntry ); |
237 |
244 |
238 if( iIMEI.Compare( tEntry.iDescription ) == 0 ) |
245 if( iIMEI.Compare( tEntry.iDescription ) == 0 ) |
239 { |
246 { |
240 mailboxId.SetPluginId( TUid::Uid( PluginId() ) ); |
247 mailboxId.SetPluginId( TUid::Uid( PluginId() ) ); |
241 mailboxId.SetId( childEntries->At(i) ); |
248 mailboxId.SetId( childEntries->At(i) ); |
242 aMailboxes.AppendL( mailboxId ); |
249 aMailboxes.AppendL( mailboxId ); |
255 } |
262 } |
256 } |
263 } |
257 } |
264 } |
258 CleanupStack::PopAndDestroy( 2, cEntry ); // childEntries |
265 CleanupStack::PopAndDestroy( 2, cEntry ); // childEntries |
259 } |
266 } |
260 |
267 |
261 // ---------------------------------------------------------------------------- |
268 // ---------------------------------------------------------------------------- |
262 // ---------------------------------------------------------------------------- |
269 // ---------------------------------------------------------------------------- |
263 CFSMailBox* CIpsPlgSosBasePlugin::GetMailBoxByUidL( |
270 CFSMailBox* CIpsPlgSosBasePlugin::GetMailBoxByUidL( |
264 const TFSMailMsgId& aMailBoxId) |
271 const TFSMailMsgId& aMailBoxId) |
265 { |
272 { |
266 FUNC_LOG; |
273 FUNC_LOG; |
267 CFSMailBox* result( NULL ); |
274 CFSMailBox* result( NULL ); |
268 TMsvEntry tEntry; |
275 TMsvEntry tEntry; |
269 TMsvId serviceId; |
276 TMsvId serviceId; |
270 TInt status; |
277 TInt status; |
271 HBufC* address( NULL ); |
278 HBufC* address( NULL ); |
272 |
279 |
273 if( !iSessionOk ) |
280 if( !iSessionOk ) |
274 { |
281 { |
275 User::Leave( KErrNotReady ); |
282 User::Leave( KErrNotReady ); |
276 } |
283 } |
277 status = iSession->GetEntry( aMailBoxId.Id(), serviceId, tEntry ); |
284 status = iSession->GetEntry( aMailBoxId.Id(), serviceId, tEntry ); |
278 |
285 |
279 if ( status == KErrNone ) |
286 if ( status == KErrNone ) |
280 { |
287 { |
281 result = CFSMailBox::NewL( aMailBoxId ); |
288 result = CFSMailBox::NewL( aMailBoxId ); |
282 CleanupStack::PushL( result ); // << result |
289 CleanupStack::PushL( result ); // << result |
283 result->SetName( tEntry.iDetails ); |
290 result->SetName( tEntry.iDetails ); |
284 result->SetSettingsUid( TUid::Uid( IPS_SET_ECOM_IMPLEMENTATION_UID ) ); |
291 result->SetSettingsUid( TUid::Uid( IPS_SET_ECOM_IMPLEMENTATION_UID ) ); |
285 |
292 |
|
293 // <qmail> |
286 CEmailAccounts* acc = CEmailAccounts::NewLC(); |
294 CEmailAccounts* acc = CEmailAccounts::NewLC(); |
287 TSmtpAccount smtpAcc; |
295 TSmtpAccount smtpAcc; |
288 acc->GetSmtpAccountL( tEntry.iRelatedId , smtpAcc ); |
296 acc->GetSmtpAccountL( tEntry.iRelatedId , smtpAcc ); |
289 CImSmtpSettings* smtpSet = new (ELeave) CImSmtpSettings(); |
297 CImSmtpSettings* smtpSet = new (ELeave) CImSmtpSettings(); |
290 CleanupStack::PushL( smtpSet ); |
298 CleanupStack::PushL( smtpSet ); |
291 acc->LoadSmtpSettingsL( smtpAcc, *smtpSet ); |
299 acc->LoadSmtpSettingsL( smtpAcc, *smtpSet ); |
292 address = smtpSet->EmailAddress().AllocL(); |
300 address = smtpSet->EmailAddress().AllocL(); |
293 CleanupStack::PopAndDestroy( 2, acc ); |
301 CleanupStack::PopAndDestroy( 2, acc ); |
|
302 // </qmail> |
294 |
303 |
295 CleanupStack::PushL( address ); // << address |
304 CleanupStack::PushL( address ); // << address |
296 CFSMailAddress* fsAddress = CFSMailAddress::NewLC(); // << fsAddress |
305 CFSMailAddress* fsAddress = CFSMailAddress::NewLC(); // << fsAddress |
297 fsAddress->SetEmailAddress( *address ); |
306 fsAddress->SetEmailAddress( *address ); |
298 result->SetOwnMailAddressL( fsAddress ); |
307 result->SetOwnMailAddressL( fsAddress ); |
299 CleanupStack::Pop( fsAddress ); // >> fsAddress |
308 CleanupStack::Pop( fsAddress ); // >> fsAddress |
300 CleanupStack::PopAndDestroy( address ); // >>> address |
309 CleanupStack::PopAndDestroy( address ); // >>> address |
301 CleanupStack::Pop( result ); // >> result |
310 CleanupStack::Pop( result ); // >> result |
302 } |
311 } |
303 |
312 |
304 return result; |
313 return result; |
305 } |
314 } |
306 |
315 |
307 // ---------------------------------------------------------------------------- |
316 // ---------------------------------------------------------------------------- |
308 // ---------------------------------------------------------------------------- |
317 // ---------------------------------------------------------------------------- |
309 void CIpsPlgSosBasePlugin::DeleteMailBoxByUidL( |
318 void CIpsPlgSosBasePlugin::DeleteMailBoxByUidL( |
310 const TFSMailMsgId& aMailBoxId, |
319 const TFSMailMsgId& aMailBoxId, |
311 MFSMailRequestObserver& aOperationObserver, |
320 MFSMailRequestObserver& aOperationObserver, |
312 const TInt aRequestId ) |
321 const TInt aRequestId ) |
313 { |
322 { |
317 if( !iSessionOk ) |
326 if( !iSessionOk ) |
318 { |
327 { |
319 User::Leave( KErrNotReady ); |
328 User::Leave( KErrNotReady ); |
320 } |
329 } |
321 |
330 |
|
331 // <qmail> RAlwaysOnlineClientSession - related code removed |
322 // Prepare the parameters to be forwarded to AO-server |
332 // Prepare the parameters to be forwarded to AO-server |
323 TPckg<TMsvId> param = aMailBoxId.Id(); |
333 TPckg<TMsvId> param = aMailBoxId.Id(); |
324 |
334 |
325 // delete MRU list from cen rep |
335 // delete MRU list from cen rep |
326 iMruList->ClearDataL( aMailBoxId ); |
336 iMruList->ClearDataL( aMailBoxId ); |
327 |
337 |
328 iSyncStateHandler->NotifyMailboxRemove( aMailBoxId.Id() ); |
338 iSyncStateHandler->NotifyMailboxRemove( aMailBoxId.Id() ); |
329 |
339 |
|
340 // <qmail> CancelAllOnlineOperations function call removed |
330 iSession->GetEntry( aMailBoxId.Id(), service, tEntry ); |
341 iSession->GetEntry( aMailBoxId.Id(), service, tEntry ); |
331 if ( tEntry.Connected() ) |
342 if ( tEntry.Connected() ) |
332 { |
343 { |
333 DisconnectL( aMailBoxId, aOperationObserver, aRequestId, ETrue ); |
344 DisconnectL( aMailBoxId, aOperationObserver, aRequestId, ETrue ); |
|
345 |
|
346 // remove activity timer from array here but leave the actual delete |
|
347 // to the disconnect operation. This is because the disconnect op |
|
348 // sometimes tries to use the timer after it was deleted here. |
|
349 TInt timerCount = iActivitytimers.Count(); |
|
350 for ( TInt j = 0; j < timerCount; j++ ) |
|
351 { |
|
352 if ( iActivitytimers[j]->FSMailboxId() == aMailBoxId ) |
|
353 { |
|
354 iActivitytimers.Remove( j ); |
|
355 timerCount--; |
|
356 j--; |
|
357 } |
|
358 } |
334 } |
359 } |
335 else |
360 else |
336 { |
361 { |
|
362 // <qmail> iSettingsApi removed |
337 TFSProgress progress = { TFSProgress::EFSStatus_Waiting, 0, 0, KErrNone }; |
363 TFSProgress progress = { TFSProgress::EFSStatus_Waiting, 0, 0, KErrNone }; |
338 progress.iProgressStatus = TFSProgress::EFSStatus_RequestComplete; |
364 progress.iProgressStatus = TFSProgress::EFSStatus_RequestComplete; |
339 progress.iError = KErrNone; |
365 progress.iError = KErrNone; |
340 TInt requestId = aRequestId; |
366 TInt requestId = aRequestId; |
341 aOperationObserver.RequestResponseL( progress, requestId ); |
367 aOperationObserver.RequestResponseL( progress, requestId ); |
342 } |
368 |
343 DeleteActivityTimer( aMailBoxId ); |
369 DeleteActivityTimer( aMailBoxId ); |
344 } |
370 } |
345 |
371 } |
346 // ---------------------------------------------------------------------------- |
372 |
347 // ---------------------------------------------------------------------------- |
373 // ---------------------------------------------------------------------------- |
348 TDesC& CIpsPlgSosBasePlugin::GetBrandingIdL( const TFSMailMsgId& aMailBoxId ) |
374 // ---------------------------------------------------------------------------- |
349 { |
375 TDesC& CIpsPlgSosBasePlugin::GetBrandingIdL( const TFSMailMsgId& aMailBoxId ) |
|
376 { |
350 FUNC_LOG; |
377 FUNC_LOG; |
351 if( !iSessionOk ) |
378 if( !iSessionOk ) |
352 { |
379 { |
353 User::Leave( KErrNotReady ); |
380 User::Leave( KErrNotReady ); |
354 } |
381 } |
355 CMsvEntry* mboxEntry = iSession->GetEntryL( aMailBoxId.Id() ); |
382 CMsvEntry* mboxEntry = iSession->GetEntryL( aMailBoxId.Id() ); |
356 CleanupStack::PushL( mboxEntry ); |
383 CleanupStack::PushL( mboxEntry ); |
357 |
384 |
|
385 // <qmail> iSettingsApi removed, iBrandingId removed |
358 CleanupStack::PopAndDestroy( mboxEntry ); |
386 CleanupStack::PopAndDestroy( mboxEntry ); |
359 |
387 |
360 return *iBrandingId; |
388 return *iBrandingId; |
361 } |
389 } |
362 |
390 |
363 // ---------------------------------------------------------------------------- |
391 // ---------------------------------------------------------------------------- |
364 // ---------------------------------------------------------------------------- |
392 // Pop3 has no implementation for this virtual |
365 void CIpsPlgSosBasePlugin::MoveMessagesL( |
393 // ---------------------------------------------------------------------------- |
|
394 void CIpsPlgSosBasePlugin::MoveMessagesL( |
366 const TFSMailMsgId& aMailBoxId, |
395 const TFSMailMsgId& aMailBoxId, |
367 const RArray<TFSMailMsgId>& aMessageIds, |
396 const RArray<TFSMailMsgId>& aMessageIds, |
368 const TFSMailMsgId& aSourceFolderId, |
397 const TFSMailMsgId& aSourceFolderId, |
369 const TFSMailMsgId& aDestinationFolderId ) |
398 const TFSMailMsgId& aDestinationFolderId ) |
370 { |
399 { |
371 FUNC_LOG; |
400 FUNC_LOG; |
372 // Pop3 has no implementation for this virtual |
401 // Pop3 has no implementation for this virtual |
373 if( aDestinationFolderId.Id() == KMsvDraftEntryId ) |
402 if( aDestinationFolderId.Id() == KMsvDraftEntryId ) |
374 { |
403 { |
375 MoveMessagesToDraftL( |
404 MoveMessagesToDraftL( |
376 aMailBoxId, |
405 aMailBoxId, |
377 aMessageIds, |
406 aMessageIds, |
378 aSourceFolderId, |
407 aSourceFolderId, |
379 aDestinationFolderId ); |
408 aDestinationFolderId ); |
380 } |
409 } |
381 } |
410 } |
382 |
411 |
383 // ---------------------------------------------------------------------------- |
412 // ---------------------------------------------------------------------------- |
384 // ---------------------------------------------------------------------------- |
413 // asynchronic version from move messages function, pop3 plugin not implent |
|
414 // this virtual fucntion. |
|
415 // ---------------------------------------------------------------------------- |
|
416 TInt CIpsPlgSosBasePlugin::MoveMessagesL( |
|
417 const TFSMailMsgId& aMailBoxId, |
|
418 const RArray<TFSMailMsgId>& aMessageIds, |
|
419 const TFSMailMsgId& aSourceFolderId, |
|
420 const TFSMailMsgId& aDestinationFolderId, |
|
421 MFSMailRequestObserver& aOperationObserver, |
|
422 TInt aRequestId ) |
|
423 { |
|
424 FUNC_LOG; |
|
425 TInt ret = KErrNotSupported; |
|
426 if( aDestinationFolderId.Id() == KMsvDraftEntryId ) |
|
427 { |
|
428 MoveMessagesToDraftL( |
|
429 aMailBoxId, |
|
430 aMessageIds, |
|
431 aSourceFolderId, |
|
432 aDestinationFolderId ); |
|
433 ret = KErrNone; |
|
434 } |
|
435 ret = KErrNotSupported; |
|
436 TFSProgress progress = { |
|
437 TFSProgress::EFSStatus_RequestComplete, 0, 0, ret }; |
|
438 aOperationObserver.RequestResponseL( |
|
439 progress, aRequestId ); |
|
440 return ret; |
|
441 } |
|
442 |
|
443 // ---------------------------------------------------------------------------- |
|
444 // ---------------------------------------------------------------------------- |
385 void CIpsPlgSosBasePlugin::MoveMessagesToDraftL( |
445 void CIpsPlgSosBasePlugin::MoveMessagesToDraftL( |
386 const TFSMailMsgId& /*aMailBoxId*/, |
446 const TFSMailMsgId& /*aMailBoxId*/, |
387 const RArray<TFSMailMsgId>& aMessageIds, |
447 const RArray<TFSMailMsgId>& aMessageIds, |
388 const TFSMailMsgId& aSourceFolderId, |
448 const TFSMailMsgId& aSourceFolderId, |
389 const TFSMailMsgId& aDestinationFolderId ) |
449 const TFSMailMsgId& aDestinationFolderId ) |
390 { |
450 { |
391 FUNC_LOG; |
451 FUNC_LOG; |
392 |
452 |
393 TInt count( aMessageIds.Count() ); |
453 TInt count( aMessageIds.Count() ); |
394 if ( !count ) |
454 if ( !count ) |
395 { |
455 { |
396 User::Leave( KErrArgument ); |
456 User::Leave( KErrArgument ); |
397 } |
457 } |
398 |
458 |
399 if( !iSessionOk ) |
459 if( !iSessionOk ) |
400 { |
460 { |
401 User::Leave( KErrNotReady ); |
461 User::Leave( KErrNotReady ); |
402 } |
462 } |
403 |
463 |
404 TMsvId msgService; |
464 TMsvId msgService; |
405 TMsvEntry tEntry; |
465 TMsvEntry tEntry; |
406 |
466 |
407 CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection; |
467 CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection; |
408 CleanupStack::PushL(sel); |
468 CleanupStack::PushL(sel); |
409 |
469 |
410 CMsvEntry* msgEntry = iSession->GetEntryL( aMessageIds[0].Id() ); |
470 CMsvEntry* msgEntry = iSession->GetEntryL( aMessageIds[0].Id() ); |
411 CleanupStack::PushL( msgEntry ); |
471 CleanupStack::PushL( msgEntry ); |
412 |
472 |
413 for( TInt i(0); i < count; i++ ) |
473 for( TInt i(0); i < count; i++ ) |
414 { |
474 { |
415 iSession->GetEntry( aMessageIds[i].Id(), msgService, tEntry ); |
475 iSession->GetEntry( aMessageIds[i].Id(), msgService, tEntry ); |
416 |
476 |
417 if( aSourceFolderId.Id() == KMsvGlobalOutBoxIndexEntryIdValue ) |
477 if( aSourceFolderId.Id() == KMsvGlobalOutBoxIndexEntryIdValue ) |
418 { |
478 { |
419 if( tEntry.SendingState() != KMsvSendStateSending ) |
479 if( tEntry.SendingState() != KMsvSendStateSending ) |
420 { |
480 { |
421 // Set all states in outbox to suspended |
481 // Set all states in outbox to suspended |
431 } |
491 } |
432 } |
492 } |
433 else |
493 else |
434 { |
494 { |
435 sel->AppendL( tEntry.Id() ); |
495 sel->AppendL( tEntry.Id() ); |
436 } |
496 } |
437 } |
497 } |
438 if( sel->Count() ) |
498 if( sel->Count() ) |
439 { |
499 { |
440 CIpsPlgOperationWait* wait = CIpsPlgOperationWait::NewLC(); |
500 CIpsPlgOperationWait* wait = CIpsPlgOperationWait::NewLC(); |
441 if( !aSourceFolderId.IsNullId() ) |
501 if( !aSourceFolderId.IsNullId() ) |
442 { |
502 { |
443 CMsvEntry* cEntry = iSession->GetEntryL( aSourceFolderId.Id() ); |
503 CMsvEntry* cEntry = iSession->GetEntryL( aSourceFolderId.Id() ); |
444 CleanupStack::PushL( cEntry ); |
504 CleanupStack::PushL( cEntry ); |
445 cEntry->MoveL( |
505 cEntry->MoveL( |
446 *sel, |
506 *sel, |
447 aDestinationFolderId.Id(),//KMsvDraftEntryIdValue |
507 aDestinationFolderId.Id(),//KMsvDraftEntryIdValue |
448 wait->iStatus ); |
508 wait->iStatus ); |
449 |
509 |
450 CleanupStack::PopAndDestroy( cEntry ); |
510 CleanupStack::PopAndDestroy( cEntry ); |
451 } |
511 } |
452 else |
512 else |
453 { |
513 { |
454 // Message is in editing state, we can't use parent as entry |
514 // Message is in editing state, we can't use parent as entry |
455 // because it's equal to destination. |
515 // because it's equal to destination. |
456 TMsvId parent = msgEntry->Entry().Parent(); |
516 TMsvId parent = msgEntry->Entry().Parent(); |
457 msgEntry->SetEntryL( parent ); |
517 msgEntry->SetEntryL( parent ); |
458 msgEntry->CopyL( |
518 msgEntry->CopyL( |
459 *sel, |
519 *sel, |
460 aDestinationFolderId.Id(),//KMsvDraftEntryIdValue |
520 aDestinationFolderId.Id(),//KMsvDraftEntryIdValue |
461 wait->iStatus ); |
521 wait->iStatus ); |
462 } |
522 } |
463 wait->Start(); |
523 wait->Start(); |
464 CleanupStack::PopAndDestroy( wait ); // wait |
524 CleanupStack::PopAndDestroy( wait ); // wait |
465 } |
525 } |
466 CleanupStack::PopAndDestroy( 2, sel ); // msgEntry, sel |
526 CleanupStack::PopAndDestroy( 2, sel ); // msgEntry, sel |
467 } |
527 } |
468 |
528 |
469 // ---------------------------------------------------------------------------- |
529 // ---------------------------------------------------------------------------- |
474 RArray<TFSMailMsgId>& /*aNewMessages*/, |
534 RArray<TFSMailMsgId>& /*aNewMessages*/, |
475 const TFSMailMsgId& /*aSourceFolderId*/, |
535 const TFSMailMsgId& /*aSourceFolderId*/, |
476 const TFSMailMsgId& /*aDestinationFolderId*/ ) |
536 const TFSMailMsgId& /*aDestinationFolderId*/ ) |
477 { |
537 { |
478 } |
538 } |
479 |
539 |
480 // ---------------------------------------------------------------------------- |
540 // ---------------------------------------------------------------------------- |
481 // ---------------------------------------------------------------------------- |
541 // ---------------------------------------------------------------------------- |
482 MDesCArray* CIpsPlgSosBasePlugin::GetMrusL( |
542 MDesCArray* CIpsPlgSosBasePlugin::GetMrusL( |
483 const TFSMailMsgId& aMailBoxId) |
543 const TFSMailMsgId& aMailBoxId) |
484 { |
544 { |
485 return iMruList->GetMruListL( aMailBoxId ); |
545 return iMruList->GetMruListL( aMailBoxId ); |
486 } |
546 } |
487 |
547 |
488 // ---------------------------------------------------------------------------- |
548 // ---------------------------------------------------------------------------- |
489 // ---------------------------------------------------------------------------- |
549 // ---------------------------------------------------------------------------- |
490 void CIpsPlgSosBasePlugin::SetMrusL( |
550 void CIpsPlgSosBasePlugin::SetMrusL( |
491 const TFSMailMsgId& aMailBoxId, |
551 const TFSMailMsgId& aMailBoxId, |
492 MDesCArray* aNewMruList ) |
552 MDesCArray* aNewMruList ) |
493 { |
553 { |
494 iMruList->SetMruListL( aMailBoxId, aNewMruList ); |
554 iMruList->SetMruListL( aMailBoxId, aNewMruList ); |
495 } |
555 } |
496 |
556 |
497 // --------------------------------------------------------------------------- |
557 // --------------------------------------------------------------------------- |
498 // --------------------------------------------------------------------------- |
558 // --------------------------------------------------------------------------- |
499 void CIpsPlgSosBasePlugin::GoOnlineL( const TFSMailMsgId& aMailBoxId ) |
559 void CIpsPlgSosBasePlugin::GoOnlineL( const TFSMailMsgId& aMailBoxId ) |
500 { |
560 { |
501 if ( !ConnOpRunning( aMailBoxId) ) |
561 if ( !ConnOpRunning( aMailBoxId) ) |
502 { |
562 { |
503 // append mailbox id go online mailbox array |
563 // append mailbox id go online mailbox array |
504 RefreshNowL( aMailBoxId, *this, 0 ); |
564 RefreshNowL( aMailBoxId, *this, 0 ); |
505 } |
565 } |
506 } |
566 } |
507 |
567 |
508 // --------------------------------------------------------------------------- |
568 // --------------------------------------------------------------------------- |
509 // --------------------------------------------------------------------------- |
569 // --------------------------------------------------------------------------- |
510 void CIpsPlgSosBasePlugin::GoOfflineL( const TFSMailMsgId& aMailBoxId ) |
570 void CIpsPlgSosBasePlugin::GoOfflineL( const TFSMailMsgId& aMailBoxId ) |
511 { |
571 { |
512 FUNC_LOG; |
572 FUNC_LOG; |
513 CancelAllOnlineOperations( aMailBoxId ); |
573 CancelAllOnlineOperations( aMailBoxId ); |
514 // use 0 for request id |
574 // use 0 for request id |
515 DisconnectL( aMailBoxId, *this, 0 ); |
575 DisconnectL( aMailBoxId, *this, 0 ); |
516 } |
576 } |
517 |
577 |
518 // ---------------------------------------------------------------------------- |
578 // ---------------------------------------------------------------------------- |
519 // ---------------------------------------------------------------------------- |
579 // ---------------------------------------------------------------------------- |
520 const TFSProgress CIpsPlgSosBasePlugin::GetLastSyncStatusL( |
580 const TFSProgress CIpsPlgSosBasePlugin::GetLastSyncStatusL( |
521 const TFSMailMsgId& aMailBoxId ) |
581 const TFSMailMsgId& aMailBoxId ) |
522 { |
582 { |
523 FUNC_LOG; |
583 FUNC_LOG; |
524 TMsvEntry tEntry; |
584 TMsvEntry tEntry; |
525 TMsvId service; |
585 TMsvId service; |
621 for ( TInt i(0); i < msgCount; i++ ) |
681 for ( TInt i(0); i < msgCount; i++ ) |
622 { |
682 { |
623 TMsvEmailEntry emlEntry; |
683 TMsvEmailEntry emlEntry; |
624 TMsvId dummy; |
684 TMsvId dummy; |
625 TBool isRead = ETrue; |
685 TBool isRead = ETrue; |
626 if ( iSession->GetEntry( |
686 if ( iSession->GetEntry( |
627 msgChilds->At(i), dummy, emlEntry ) == KErrNone ) |
687 msgChilds->At(i), dummy, emlEntry ) == KErrNone ) |
628 { |
688 { |
629 if ( ( PluginId() == KIpsPlgImap4PluginUid.iUid || |
689 if ( ( PluginId() == KIpsPlgImap4PluginUid.iUid || |
630 PluginId() == KIpsPlgPop3PluginUid.iUid ) && |
690 PluginId() == KIpsPlgPop3PluginUid.iUid ) && |
631 emlEntry.Unread() ) |
691 emlEntry.Unread() ) |
632 { |
692 { |
633 isRead = EFalse; |
693 isRead = EFalse; |
634 } |
694 } |
635 } |
695 } |
636 if ( !isRead && !emlEntry.LocallyDeleted() ) |
696 if ( !isRead && !emlEntry.LocallyDeleted() ) |
637 { |
697 { |
638 unreadCount++; |
698 unreadCount++; |
639 } |
699 } |
640 } |
700 } |
641 |
701 |
642 CleanupStack::PopAndDestroy( msgChilds ); |
702 CleanupStack::PopAndDestroy( msgChilds ); |
643 result->SetUnreadCount( unreadCount ); |
703 result->SetUnreadCount( unreadCount ); |
644 result->SetFolderName( folderEntry->Entry().iDetails ); |
704 result->SetFolderName( folderEntry->Entry().iDetails ); |
645 result->SetFolderType( GetFolderType( folderEntry, aFolderId ) ); |
705 result->SetFolderType( GetFolderType( folderEntry, aFolderId ) ); |
646 TMsvEntry parentEntry; |
706 TMsvEntry parentEntry; |
647 TInt status = iSession->GetEntry( folderEntry->Entry().Parent( ), serviceId, |
707 TInt status = iSession->GetEntry( folderEntry->Entry().Parent( ), serviceId, |
648 parentEntry ); |
708 parentEntry ); |
649 TUint parent( 0 ); |
709 TUint parent( 0 ); |
650 if( status == KErrNone ) |
710 if( status == KErrNone ) |
651 { |
711 { |
652 if( parentEntry.iType == KUidMsvFolderEntry ) |
712 if( parentEntry.iType == KUidMsvFolderEntry ) |
656 else |
716 else |
657 { |
717 { |
658 parent = 0; |
718 parent = 0; |
659 } |
719 } |
660 } |
720 } |
661 |
721 |
662 TFSMailMsgId parentId( PluginId(), parent ); |
722 TFSMailMsgId parentId( PluginId(), parent ); |
663 result->SetParentFolderId( parentId ); |
723 result->SetParentFolderId( parentId ); |
664 |
724 |
665 // Set subfolder count here for ListFolderL |
725 // Set subfolder count here for ListFolderL |
666 CMsvEntrySelection* fldChildren = |
726 CMsvEntrySelection* fldChildren = |
667 folderEntry->ChildrenWithTypeL( KUidMsvFolderEntry ); |
727 folderEntry->ChildrenWithTypeL( KUidMsvFolderEntry ); |
668 CleanupStack::PushL( fldChildren ); // << children |
728 CleanupStack::PushL( fldChildren ); // << children |
669 result->SetSubFolderCount( fldChildren->Count() ); |
729 result->SetSubFolderCount( fldChildren->Count() ); |
670 CleanupStack::PopAndDestroy( fldChildren ); // >>> children |
730 CleanupStack::PopAndDestroy( fldChildren ); // >>> children |
671 |
731 |
672 // Set blocklist for FW |
732 // Set blocklist for FW |
673 BlockCopyMoveFromFoldersL( folderEntry, aFolderId, *result ); |
733 BlockCopyMoveFromFoldersL( folderEntry, aFolderId, *result ); |
674 |
734 |
675 CleanupStack::Pop( result ); // >> result |
735 CleanupStack::Pop( result ); // >> result |
676 } |
736 } |
677 CleanupStack::PopAndDestroy( folderEntry ); // >>> folderEntry |
737 CleanupStack::PopAndDestroy( folderEntry ); // >>> folderEntry |
678 |
738 |
679 return result; |
739 return result; |
680 } |
740 } |
681 |
741 |
682 // ---------------------------------------------------------------------------- |
742 // ---------------------------------------------------------------------------- |
683 // ---------------------------------------------------------------------------- |
743 // ---------------------------------------------------------------------------- |
684 CFSMailFolder* CIpsPlgSosBasePlugin::CreateFolderL( |
744 CFSMailFolder* CIpsPlgSosBasePlugin::CreateFolderL( |
685 const TFSMailMsgId& /* aMailBoxId */, |
745 const TFSMailMsgId& /* aMailBoxId */, |
686 const TFSMailMsgId& /* aFolderId */, |
746 const TFSMailMsgId& /* aFolderId */, |
687 const TDesC& /* aFolderName */, |
747 const TDesC& /* aFolderName */, |
688 const TBool /* aSync */) |
748 const TBool /* aSync */) |
689 { |
749 { |
690 return NULL; |
750 return NULL; |
691 } |
751 } |
692 |
752 |
693 // ---------------------------------------------------------------------------- |
753 // ---------------------------------------------------------------------------- |
694 // ---------------------------------------------------------------------------- |
754 // ---------------------------------------------------------------------------- |
695 void CIpsPlgSosBasePlugin::DeleteFolderByUidL( |
755 void CIpsPlgSosBasePlugin::DeleteFolderByUidL( |
696 const TFSMailMsgId& /* aMailBoxId */, |
756 const TFSMailMsgId& /* aMailBoxId */, |
697 const TFSMailMsgId& /* aFolderId */) |
757 const TFSMailMsgId& /* aFolderId */) |
698 { |
758 { |
699 } |
759 } |
700 |
760 |
701 // ---------------------------------------------------------------------------- |
761 // ---------------------------------------------------------------------------- |
702 // ---------------------------------------------------------------------------- |
762 // ---------------------------------------------------------------------------- |
703 MFSMailIterator* CIpsPlgSosBasePlugin::ListMessagesL( |
763 MFSMailIterator* CIpsPlgSosBasePlugin::ListMessagesL( |
704 const TFSMailMsgId& aMailBoxId, |
764 const TFSMailMsgId& aMailBoxId, |
705 const TFSMailMsgId& aFolderId, |
765 const TFSMailMsgId& aFolderId, |
706 const TFSMailDetails aDetails, |
766 const TFSMailDetails aDetails, |
707 const RArray<TFSMailSortCriteria>& aSorting ) |
767 const RArray<TFSMailSortCriteria>& aSorting ) |
708 { |
768 { |
709 FUNC_LOG; |
769 FUNC_LOG; |
710 CIpsPlgMsgIterator* iterator = CIpsPlgMsgIterator::NewL( |
770 CIpsPlgMsgIterator* iterator = CIpsPlgMsgIterator::NewL( |
711 *this, *iSession, aMailBoxId, aFolderId, aDetails, aSorting ); |
771 *this, *iSession, aMailBoxId, aFolderId, aDetails, aSorting ); |
712 |
772 |
713 return iterator; |
773 return iterator; |
714 } |
774 } |
715 |
775 |
716 // ---------------------------------------------------------------------------- |
776 // ---------------------------------------------------------------------------- |
717 // ---------------------------------------------------------------------------- |
777 // ---------------------------------------------------------------------------- |
718 // |
778 // |
719 CFSMailMessage* CIpsPlgSosBasePlugin::GetMessageByUidL( |
779 CFSMailMessage* CIpsPlgSosBasePlugin::GetMessageByUidL( |
720 const TFSMailMsgId& aMailBoxId, |
780 const TFSMailMsgId& aMailBoxId, |
721 const TFSMailMsgId& /* aFolderId */, |
781 const TFSMailMsgId& /* aFolderId */, |
722 const TFSMailMsgId& aMessageId, |
782 const TFSMailMsgId& aMessageId, |
723 const TFSMailDetails aDetails) |
783 const TFSMailDetails aDetails) |
724 { |
784 { |
725 FUNC_LOG; |
785 FUNC_LOG; |
726 CFSMailMessage* result( NULL ); |
786 CFSMailMessage* result( NULL ); |
727 TMsvId serviceId; |
787 TMsvId serviceId; |
728 TMsvEntry tEntry; |
788 TMsvEntry tEntry; |
729 TInt status( KErrNone ); |
789 TInt status( KErrNone ); |
730 |
790 |
731 if( !iSessionOk ) |
791 if( !iSessionOk ) |
732 { |
792 { |
733 User::Leave( KErrNotReady ); |
793 User::Leave( KErrNotReady ); |
734 } |
794 } |
735 |
795 |
736 status = iSession->GetEntry( aMessageId.Id(), serviceId, tEntry); |
796 status = iSession->GetEntry( aMessageId.Id(), serviceId, tEntry); |
737 |
797 |
738 const TMsvEmailEntry& emlEntry(tEntry); |
798 const TMsvEmailEntry& emlEntry(tEntry); |
739 // do not give deleted marked messages |
799 // do not give deleted marked messages |
740 if ( status == KErrNone && |
800 if ( status == KErrNone && |
741 EDisconnectedDeleteOperation != emlEntry.DisconnectedOperation() |
801 EDisconnectedDeleteOperation != emlEntry.DisconnectedOperation() |
742 && !emlEntry.DeletedIMAP4Flag() ) |
802 && !emlEntry.DeletedIMAP4Flag() ) |
743 { |
803 { |
744 result = iMsgMapper->GetMailMessageL( aMailBoxId, tEntry, aDetails ); |
804 result = iMsgMapper->GetMailMessageL( aMailBoxId, tEntry, aDetails ); |
745 } |
805 } |
746 |
806 |
747 return result; |
807 return result; |
748 } |
808 } |
749 |
809 |
750 // ---------------------------------------------------------------------------- |
810 // ---------------------------------------------------------------------------- |
751 // ---------------------------------------------------------------------------- |
811 // ---------------------------------------------------------------------------- |
752 CFSMailMessage* CIpsPlgSosBasePlugin::CreateMessageToSendL( |
812 CFSMailMessage* CIpsPlgSosBasePlugin::CreateMessageToSendL( |
753 const TFSMailMsgId& aMailBoxId ) |
813 const TFSMailMsgId& aMailBoxId ) |
754 { |
814 { |
755 FUNC_LOG; |
815 FUNC_LOG; |
756 CFSMailMessage* msg = iSmtpService->CreateNewSmtpMessageL( aMailBoxId ); |
816 CFSMailMessage* msg = iSmtpService->CreateNewSmtpMessageL( aMailBoxId ); |
757 return msg; |
817 return msg; |
767 FUNC_LOG; |
827 FUNC_LOG; |
768 // asynchronous message creation is started here to enable canceling of the operation |
828 // asynchronous message creation is started here to enable canceling of the operation |
769 TMsvPartList partList( KMsvMessagePartBody ); |
829 TMsvPartList partList( KMsvMessagePartBody ); |
770 |
830 |
771 CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewLC(*this); |
831 CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewLC(*this); |
|
832 |
|
833 //<qmail> removed mboxEntry from parameters + changed iSmtpService to pointer |
772 |
834 |
773 TMsvEntry mboxEntry; |
|
774 TMsvId service; |
|
775 User::LeaveIfError( |
|
776 iSession->GetEntry( aMailBoxId.Id(), service, mboxEntry ) ); |
|
777 |
|
778 CIpsPlgCreateMessageOperation* op = CIpsPlgCreateMessageOperation::NewL( |
835 CIpsPlgCreateMessageOperation* op = CIpsPlgCreateMessageOperation::NewL( |
779 iSmtpService, |
836 *iSmtpService, |
780 *iSession, |
837 *iSession, |
781 watcher->iStatus, |
838 watcher->iStatus, |
782 mboxEntry.iRelatedId, |
|
783 partList, |
839 partList, |
784 aMailBoxId, |
840 aMailBoxId, |
785 aOperationObserver, |
841 aOperationObserver, |
786 aRequestId ); |
842 aRequestId ); |
|
843 //</qmail> |
787 watcher->SetOperation( op ); |
844 watcher->SetOperation( op ); |
788 |
845 |
789 iOperations.AppendL( watcher ); |
846 iOperations.AppendL( watcher ); |
790 CleanupStack::Pop( watcher ); |
847 CleanupStack::Pop( watcher ); |
791 } |
848 } |
792 // </qmail> |
849 // </qmail> |
793 |
850 |
794 // ---------------------------------------------------------------------------- |
851 // ---------------------------------------------------------------------------- |
795 // ---------------------------------------------------------------------------- |
852 // ---------------------------------------------------------------------------- |
796 CFSMailMessage* CIpsPlgSosBasePlugin::CreateForwardMessageL( |
853 CFSMailMessage* CIpsPlgSosBasePlugin::CreateForwardMessageL( |
797 const TFSMailMsgId& aMailBoxId, |
854 const TFSMailMsgId& aMailBoxId, |
798 const TFSMailMsgId& aOriginalMessageId, |
855 const TFSMailMsgId& aOriginalMessageId, |
799 const TDesC& /* aHeaderDescriptor */) |
856 const TDesC& aHeaderDescriptor ) |
800 { |
857 { |
801 FUNC_LOG; |
858 FUNC_LOG; |
802 CFSMailMessage* msg = iSmtpService->CreateForwardSmtpMessageL( |
859 CFSMailMessage* msg = iSmtpService->CreateForwardSmtpMessageL( |
803 aMailBoxId, aOriginalMessageId ); |
860 aMailBoxId, aOriginalMessageId ); |
|
861 |
|
862 if ( aHeaderDescriptor != KNullDesC ) |
|
863 { |
|
864 // Ignoring trap as it is better to provide something in case of the |
|
865 // below fix method fails than nothing. |
|
866 TRAP_IGNORE( FixReplyForwardHeaderL( |
|
867 msg, |
|
868 aMailBoxId, |
|
869 aOriginalMessageId, |
|
870 aHeaderDescriptor ) ); |
|
871 } |
|
872 |
804 return msg; |
873 return msg; |
805 } |
874 } |
806 |
875 |
807 // <qmail> |
876 // <qmail> |
808 // ---------------------------------------------------------------------------- |
877 // ---------------------------------------------------------------------------- |
1006 } |
1093 } |
1007 // </qmail> |
1094 // </qmail> |
1008 |
1095 |
1009 // ---------------------------------------------------------------------------- |
1096 // ---------------------------------------------------------------------------- |
1010 // CIpsPlgSosBasePlugin::GetMessagesL() |
1097 // CIpsPlgSosBasePlugin::GetMessagesL() |
1011 // ---------------------------------------------------------------------------- |
1098 // ---------------------------------------------------------------------------- |
1012 // |
1099 // |
1013 void CIpsPlgSosBasePlugin::GetMessagesL( |
1100 void CIpsPlgSosBasePlugin::GetMessagesL( |
1014 const TFSMailMsgId& aMailBoxId, |
1101 const TFSMailMsgId& aMailBoxId, |
1015 const TFSMailMsgId& aFolderId, |
1102 const TFSMailMsgId& aFolderId, |
1016 const RArray<TFSMailMsgId>& aMessageIds, |
1103 const RArray<TFSMailMsgId>& aMessageIds, |
1017 RPointerArray<CFSMailMessage>& aMessageList, |
1104 RPointerArray<CFSMailMessage>& aMessageList, |
1018 const TFSMailDetails aDetails ) |
1105 const TFSMailDetails aDetails ) |
1019 { |
1106 { |
1020 FUNC_LOG; |
1107 FUNC_LOG; |
1021 TInt i; |
1108 TInt i; |
1022 CFSMailMessage* msg; |
1109 CFSMailMessage* msg; |
1023 |
1110 |
1024 for (i = 0; i < aMessageIds.Count(); i++ ) |
1111 for (i = 0; i < aMessageIds.Count(); i++ ) |
1025 { |
1112 { |
1026 msg = GetMessageByUidL( |
1113 msg = GetMessageByUidL( |
1027 aMailBoxId, aFolderId, aMessageIds[i], aDetails ); |
1114 aMailBoxId, aFolderId, aMessageIds[i], aDetails ); |
1028 CleanupStack::PushL( msg ); |
1115 CleanupStack::PushL( msg ); |
1029 aMessageList.AppendL( msg ); |
1116 aMessageList.AppendL( msg ); |
1030 CleanupStack::Pop( msg ); |
1117 CleanupStack::Pop( msg ); |
1031 } |
1118 } |
1032 } |
1119 } |
1033 |
1120 |
1034 // ---------------------------------------------------------------------------- |
1121 // ---------------------------------------------------------------------------- |
1035 // ---------------------------------------------------------------------------- |
1122 // ---------------------------------------------------------------------------- |
1036 void CIpsPlgSosBasePlugin::ChildPartsL( |
1123 void CIpsPlgSosBasePlugin::ChildPartsL( |
1037 const TFSMailMsgId& aMailBoxId, |
1124 const TFSMailMsgId& aMailBoxId, |
1038 const TFSMailMsgId& /* aParentFolderId */, |
1125 const TFSMailMsgId& /* aParentFolderId */, |
1039 const TFSMailMsgId& aMessageId, |
1126 const TFSMailMsgId& aMessageId, |
1040 const TFSMailMsgId& aParentId, |
1127 const TFSMailMsgId& aParentId, |
1076 CMsvEntry* cEntry( NULL ); |
1163 CMsvEntry* cEntry( NULL ); |
1077 CImEmailMessage* message( NULL ); |
1164 CImEmailMessage* message( NULL ); |
1078 RFile file; |
1165 RFile file; |
1079 TInt fileSize( 0 ); |
1166 TInt fileSize( 0 ); |
1080 TBool parentToMultipartAlternative( EFalse ); |
1167 TBool parentToMultipartAlternative( EFalse ); |
1081 |
1168 |
1082 // Read attachment size |
1169 // Read attachment size |
1083 User::LeaveIfError( file.Open( iSession->FileSession(), aFilePath, EFileShareReadersOnly ) ); |
1170 User::LeaveIfError( file.Open( iSession->FileSession(), aFilePath, EFileShareReadersOnly ) ); |
1084 |
1171 |
1085 //in rare case that file has disappeared while sending |
1172 //in rare case that file has disappeared while sending |
1086 //we just won't get the size for it |
1173 //we just won't get the size for it |
1087 file.Size( fileSize ); |
1174 file.Size( fileSize ); |
1088 file.Close(); |
1175 file.Close(); |
1089 |
1176 |
1090 // Initialize CMsvAttachment instance for the attachment creation |
1177 // Take ownership of message entry objects since thanks to |
1091 CMsvAttachment* info = CMsvAttachment::NewL( CMsvAttachment::EMsvFile ); |
1178 // "clever" use of active scheduler waits we can re-enter |
1092 CleanupStack::PushL( info ); |
1179 // this function leading to crashes if somebody clears the cache |
1093 |
1180 // while this iteration still needs them |
1094 info->SetAttachmentNameL( aFilePath ); |
1181 TakeMessageEntryLC( aMessageId.Id(), cEntry, message ); |
1095 info->SetSize( fileSize ); |
1182 |
1096 |
|
1097 // Create/acquire Symbian message entry objects |
|
1098 GetMessageEntryL( aMessageId.Id(), cEntry, message ); |
|
1099 |
|
1100 // Operation waiter needed to implement synchronous operation |
1183 // Operation waiter needed to implement synchronous operation |
1101 // on the top of async API |
1184 // on the top of async API |
1102 CIpsPlgOperationWait* waiter = CIpsPlgOperationWait::NewL(); |
1185 CIpsPlgOperationWait* waiter = CIpsPlgOperationWait::NewL(); |
1103 CleanupStack::PushL( waiter ); |
1186 CleanupStack::PushL( waiter ); |
1104 |
1187 |
|
1188 // Initialize CMsvAttachment instance for the attachment creation |
|
1189 CMsvAttachment* info = CMsvAttachment::NewL( CMsvAttachment::EMsvFile ); |
|
1190 CleanupStack::PushL( info ); |
|
1191 info->SetAttachmentNameL( aFilePath ); |
|
1192 info->SetSize( fileSize ); |
|
1193 |
1105 // Start attachment creation |
1194 // Start attachment creation |
1106 message->AttachmentManager().AddAttachmentL( |
1195 message->AttachmentManager().AddAttachmentL( |
1107 aFilePath, info, waiter->iStatus ); |
1196 aFilePath, info, waiter->iStatus ); |
|
1197 CleanupStack::Pop( info ); // attachment manager takes ownership |
1108 |
1198 |
1109 waiter->Start(); |
1199 waiter->Start(); |
1110 CleanupStack::PopAndDestroy( waiter ); |
1200 CleanupStack::PopAndDestroy( waiter ); |
1111 CleanupStack::Pop( info ); // attachment manager takes ownership |
1201 |
|
1202 // Return message entry objects back to cache |
|
1203 CleanupStack::Pop( 2 ); // cEntry, message |
|
1204 ReturnMessageEntry( cEntry, message ); |
1112 |
1205 |
1113 // Dig out the entry ID of the new attachment (unbelievable that |
1206 // Dig out the entry ID of the new attachment (unbelievable that |
1114 // there seems to be no better way to do this) |
1207 // there seems to be no better way to do this) |
1115 message->GetAttachmentsListL( cEntry->Entry().Id( ), |
1208 message->GetAttachmentsListL( cEntry->Entry().Id( ), |
1116 CImEmailMessage::EAllAttachments, CImEmailMessage::EThisMessageOnly ); |
1209 CImEmailMessage::EAllAttachments, CImEmailMessage::EThisMessageOnly ); |
1117 TKeyArrayFix key( 0, ECmpTInt32 ); |
1210 TKeyArrayFix key( 0, ECmpTInt32 ); |
1118 CMsvEntrySelection* attachmentIds = message->Selection().CopyLC(); |
1211 CMsvEntrySelection* attachmentIds = message->Selection().CopyLC(); |
1119 attachmentIds->Sort( key ); |
1212 attachmentIds->Sort( key ); |
1120 if ( !attachmentIds->Count() ) |
1213 if ( !attachmentIds->Count() ) |
1121 { |
1214 { |
1122 User::Leave( KErrGeneral ); |
1215 User::Leave( KErrGeneral ); |
1123 } |
1216 } |
1124 TMsvId newAttachmentId = (*attachmentIds)[ attachmentIds->Count()-1 ]; |
1217 TMsvId newAttachmentId = (*attachmentIds)[ attachmentIds->Count()-1 ]; |
1125 CleanupStack::PopAndDestroy( attachmentIds ); |
1218 CleanupStack::PopAndDestroy( attachmentIds ); |
1126 |
1219 |
1127 CMsvEntry* cAtta = iSession->GetEntryL( newAttachmentId ); |
1220 CMsvEntry* cAtta = iSession->GetEntryL( newAttachmentId ); |
1128 CleanupStack::PushL( cAtta ); |
1221 CleanupStack::PushL( cAtta ); |
1129 |
1222 |
1130 // Set filename to iDetails |
1223 // Set filename to iDetails |
1131 TMsvEntry tEntry = cAtta->Entry(); |
1224 TMsvEntry tEntry = cAtta->Entry(); |
1132 tEntry.iDetails.Set( aFilePath ); |
1225 tEntry.iDetails.Set( aFilePath ); |
1133 cAtta->ChangeL( tEntry ); |
1226 cAtta->ChangeL( tEntry ); |
1134 |
1227 |
1135 if( cAtta->HasStoreL() ) |
1228 if( cAtta->HasStoreL() ) |
1136 { |
1229 { |
1137 CMsvStore* store = cAtta->EditStoreL(); |
1230 CMsvStore* store = cAtta->EditStoreL(); |
1138 CleanupStack::PushL( store ); |
1231 CleanupStack::PushL( store ); |
1139 CImMimeHeader* mimeHeader = CImMimeHeader::NewLC(); |
1232 CImMimeHeader* mimeHeader = CImMimeHeader::NewLC(); |
1140 |
1233 |
1141 if( store->IsPresentL( KUidMsgFileMimeHeader ) ) |
1234 if( store->IsPresentL( KUidMsgFileMimeHeader ) ) |
1142 { |
1235 { |
1143 mimeHeader->RestoreL( *store ); |
1236 mimeHeader->RestoreL( *store ); |
1144 CDesC8Array& array = mimeHeader->ContentTypeParams(); |
1237 CDesC8Array& array = mimeHeader->ContentTypeParams(); |
1145 array.AppendL( KMethod ); |
1238 array.AppendL( KMethod ); |
1146 parentToMultipartAlternative = ETrue; |
1239 parentToMultipartAlternative = ETrue; |
1147 |
1240 |
1148 if( aContentType.Find( KMimeTextCalRequest ) != KErrNotFound ) |
1241 if( aContentType.Find( KMimeTextCalRequest ) != KErrNotFound ) |
1149 { |
1242 { |
1150 array.AppendL( KRequest ); |
1243 array.AppendL( KRequest ); |
1151 } |
1244 } |
1152 else if( aContentType.Find( KMimeTextCalResponse ) != KErrNotFound ) |
1245 else if( aContentType.Find( KMimeTextCalResponse ) != KErrNotFound ) |
1153 { |
1246 { |
1154 array.AppendL( KResponse ); |
1247 array.AppendL( KResponse ); |
1155 } |
1248 } |
1156 else if( aContentType.Find( KMimeTextCalCancel ) != KErrNotFound ) |
1249 else if( aContentType.Find( KMimeTextCalCancel ) != KErrNotFound ) |
1157 { |
1250 { |
1158 array.AppendL( KCancel ); |
1251 array.AppendL( KCancel ); |
1159 } |
1252 } |
1160 else |
1253 else |
1161 { |
1254 { |
1162 parentToMultipartAlternative = EFalse; |
1255 parentToMultipartAlternative = EFalse; |
1163 } |
1256 } |
1164 mimeHeader->StoreWithoutCommitL( *store ); |
1257 mimeHeader->StoreWithoutCommitL( *store ); |
1165 store->CommitL(); |
1258 store->CommitL(); |
1166 } |
1259 } |
1167 |
1260 |
1168 CleanupStack::PopAndDestroy( 2, store ); |
1261 CleanupStack::PopAndDestroy( 2, store ); |
1169 } |
1262 } |
1170 |
1263 |
1171 if( parentToMultipartAlternative && |
1264 if( parentToMultipartAlternative && |
1172 aFilePath.Find( _L(".ics")) != KErrNotFound ) |
1265 aFilePath.Find( _L(".ics")) != KErrNotFound ) |
1173 { |
1266 { |
1174 TMsvEntry tAttaEntry = cAtta->Entry(); |
1267 TMsvEntry tAttaEntry = cAtta->Entry(); |
1175 TMsvId id = tAttaEntry.Parent(); |
1268 TMsvId id = tAttaEntry.Parent(); |
1176 CMsvEntry* cParent = iSession->GetEntryL( id ); |
1269 CMsvEntry* cParent = iSession->GetEntryL( id ); |
1177 CleanupStack::PushL( cParent ); |
1270 CleanupStack::PushL( cParent ); |
1178 |
1271 |
1179 TMsvEmailEntry tEntry = cParent->Entry(); |
1272 TMsvEmailEntry tEntry = cParent->Entry(); |
1180 tEntry.SetMessageFolderType( EFolderTypeAlternative ); |
1273 tEntry.SetMessageFolderType( EFolderTypeAlternative ); |
1181 cParent->ChangeL( tEntry ); |
1274 cParent->ChangeL( tEntry ); |
1182 |
1275 |
1183 CleanupStack::PopAndDestroy( cParent ); |
1276 CleanupStack::PopAndDestroy( cParent ); |
1184 } |
1277 } |
1185 CleanupStack::PopAndDestroy( cAtta ); |
1278 CleanupStack::PopAndDestroy( cAtta ); |
1186 |
1279 |
1187 // Delete the message entries to get all the changes to disk and |
1280 // Delete the message entries to get all the changes to disk and |
1188 // possible store locks released |
1281 // possible store locks released |
1189 CleanCachedMessageEntries(); |
1282 CleanCachedMessageEntries(); |
1190 |
1283 |
1191 // Create the FS message part object |
1284 // Create the FS message part object |
1192 result = iMsgMapper->GetMessagePartL( newAttachmentId, aMailBoxId, |
1285 result = iMsgMapper->GetMessagePartL( newAttachmentId, aMailBoxId, |
1193 aMessageId ); |
1286 aMessageId ); |
1194 |
1287 |
1195 return result; |
1288 return result; |
1196 } |
1289 } |
1197 |
1290 |
1240 const TFSMailMsgId& /* aParentPartId */, |
1333 const TFSMailMsgId& /* aParentPartId */, |
1241 const TDesC& aContentType, |
1334 const TDesC& aContentType, |
1242 RFile& aFile ) |
1335 RFile& aFile ) |
1243 { |
1336 { |
1244 FUNC_LOG; |
1337 FUNC_LOG; |
1245 |
1338 |
1246 // Initialize helper variables |
1339 // Initialize helper variables |
1247 CFSMailMessagePart* result ( NULL ); |
1340 CFSMailMessagePart* result ( NULL ); |
1248 CMsvEntry* cEntry( NULL ); |
1341 CMsvEntry* cEntry( NULL ); |
1249 CImEmailMessage* message( NULL ); |
1342 CImEmailMessage* message( NULL ); |
1250 TInt fileSize( 0 ); |
1343 TInt fileSize( 0 ); |
1251 TBuf<KMaxFileName> fileName; |
1344 TBuf<KMaxFileName> fileName; |
1252 |
1345 |
1253 // Create/acquire Symbian message entry objects |
1346 // Take ownership of message entry objects since thanks to |
1254 CleanCachedMessageEntries(); |
1347 // "clever" use of active scheduler waits we can re-enter |
1255 GetMessageEntryL( aMessageId.Id(), cEntry, message ); |
1348 // this function leading to crashes if somebody clears the cache |
1256 |
1349 // while this iteration still needs them |
1257 // Initialize CMsvAttachment instance for the attachment creation |
1350 TakeMessageEntryLC( aMessageId.Id(), cEntry, message ); |
1258 CMsvAttachment* info = CMsvAttachment::NewL( CMsvAttachment::EMsvFile ); |
1351 |
1259 CleanupStack::PushL( info ); |
|
1260 |
|
1261 // Read attachment size |
|
1262 User::LeaveIfError( aFile.Size( fileSize ) ); |
|
1263 info->SetSize( fileSize ); |
|
1264 |
|
1265 // Read attachment filename |
|
1266 User::LeaveIfError( aFile.FullName( fileName ) ); |
|
1267 info->SetAttachmentNameL( fileName ); |
|
1268 |
|
1269 // Operation waiter needed to implement synchronous operation |
1352 // Operation waiter needed to implement synchronous operation |
1270 // on the top of async API |
1353 // on the top of async API |
1271 CIpsPlgOperationWait* waiter = CIpsPlgOperationWait::NewL(); |
1354 CIpsPlgOperationWait* waiter = CIpsPlgOperationWait::NewL(); |
1272 CleanupStack::PushL( waiter ); |
1355 CleanupStack::PushL( waiter ); |
|
1356 |
|
1357 // Initialize CMsvAttachment instance for the attachment creation |
|
1358 CMsvAttachment* info = CMsvAttachment::NewL( CMsvAttachment::EMsvFile ); |
|
1359 CleanupStack::PushL( info ); |
|
1360 |
|
1361 // Read attachment size |
|
1362 User::LeaveIfError( aFile.Size( fileSize ) ); |
|
1363 info->SetSize( fileSize ); |
|
1364 |
|
1365 // Read attachment filename |
|
1366 User::LeaveIfError( aFile.FullName( fileName ) ); |
|
1367 info->SetAttachmentNameL( fileName ); |
|
1368 |
1273 message->AttachmentManager().AddAttachmentL( aFile, info, waiter->iStatus ); |
1369 message->AttachmentManager().AddAttachmentL( aFile, info, waiter->iStatus ); |
|
1370 CleanupStack::Pop( info ); // attachment manager takes ownership |
|
1371 |
1274 waiter->Start(); |
1372 waiter->Start(); |
1275 CleanupStack::PopAndDestroy( waiter ); |
1373 CleanupStack::PopAndDestroy( waiter ); |
1276 CleanupStack::Pop( info ); // attachment manager takes ownership |
1374 |
|
1375 // Return message entry objects back to cache |
|
1376 CleanupStack::Pop( 2 ); // cEntry, message |
|
1377 ReturnMessageEntry( cEntry, message ); |
1277 |
1378 |
1278 // Dig out the entry ID of the new attachment |
1379 // Dig out the entry ID of the new attachment |
1279 message->GetAttachmentsListL( cEntry->Entry().Id( ), |
1380 message->GetAttachmentsListL( cEntry->Entry().Id( ), |
1280 CImEmailMessage::EAllAttachments, CImEmailMessage::EThisMessageOnly ); |
1381 CImEmailMessage::EAllAttachments, CImEmailMessage::EThisMessageOnly ); |
1281 TKeyArrayFix key( 0, ECmpTInt32 ); |
1382 TKeyArrayFix key( 0, ECmpTInt32 ); |
1282 CMsvEntrySelection* attachmentIds = message->Selection().CopyLC(); |
1383 CMsvEntrySelection* attachmentIds = message->Selection().CopyLC(); |
1283 attachmentIds->Sort( key ); |
1384 attachmentIds->Sort( key ); |
1284 if ( !attachmentIds->Count() ) |
1385 if ( !attachmentIds->Count() ) |
1285 { |
1386 { |
1286 User::Leave( KErrGeneral ); |
1387 User::Leave( KErrGeneral ); |
1287 } |
1388 } |
1288 TMsvId newAttachmentId = (*attachmentIds)[ attachmentIds->Count()-1 ]; |
1389 TMsvId newAttachmentId = (*attachmentIds)[ attachmentIds->Count()-1 ]; |
1289 CleanupStack::PopAndDestroy( attachmentIds ); |
1390 CleanupStack::PopAndDestroy( attachmentIds ); |
1290 |
1391 |
1291 // Meeting request related handling |
1392 // Meeting request related handling |
1292 TBool parentToMultipartAlternative( EFalse ); |
1393 TBool parentToMultipartAlternative( EFalse ); |
1293 CMsvEntry* cAtta = iSession->GetEntryL( newAttachmentId ); |
1394 CMsvEntry* cAtta = iSession->GetEntryL( newAttachmentId ); |
1294 CleanupStack::PushL( cAtta ); |
1395 CleanupStack::PushL( cAtta ); |
1295 |
1396 |
1296 // Set filename to iDetails |
1397 // Set filename to iDetails |
1297 TMsvEntry tEntry = cAtta->Entry(); |
1398 TMsvEntry tEntry = cAtta->Entry(); |
1298 tEntry.iDetails.Set( fileName ); |
1399 tEntry.iDetails.Set( fileName ); |
1299 cAtta->ChangeL( tEntry ); |
1400 cAtta->ChangeL( tEntry ); |
1300 |
1401 |
1301 if( cAtta->HasStoreL() ) |
1402 if( cAtta->HasStoreL() ) |
1302 { |
1403 { |
1303 CMsvStore* store = cAtta->EditStoreL(); |
1404 CMsvStore* store = cAtta->EditStoreL(); |
1304 CleanupStack::PushL( store ); |
1405 CleanupStack::PushL( store ); |
1305 CImMimeHeader* mimeHeader = CImMimeHeader::NewLC(); |
1406 CImMimeHeader* mimeHeader = CImMimeHeader::NewLC(); |
1306 |
1407 |
1307 if( store->IsPresentL( KUidMsgFileMimeHeader ) ) |
1408 if( store->IsPresentL( KUidMsgFileMimeHeader ) ) |
1308 { |
1409 { |
1309 mimeHeader->RestoreL( *store ); |
1410 mimeHeader->RestoreL( *store ); |
1310 CDesC8Array& array = mimeHeader->ContentTypeParams(); |
1411 CDesC8Array& array = mimeHeader->ContentTypeParams(); |
1311 array.AppendL( KMethod ); |
1412 array.AppendL( KMethod ); |
1312 parentToMultipartAlternative = ETrue; |
1413 parentToMultipartAlternative = ETrue; |
1313 |
1414 |
1314 if( aContentType.Find( KMimeTextCalRequest ) != KErrNotFound ) |
1415 if( aContentType.Find( KMimeTextCalRequest ) != KErrNotFound ) |
1315 { |
1416 { |
1316 array.AppendL( KRequest ); |
1417 array.AppendL( KRequest ); |
1317 } |
1418 } |
1318 else if( aContentType.Find( KMimeTextCalResponse ) != KErrNotFound ) |
1419 else if( aContentType.Find( KMimeTextCalResponse ) != KErrNotFound ) |
1319 { |
1420 { |
1320 array.AppendL( KResponse ); |
1421 array.AppendL( KResponse ); |
1321 } |
1422 } |
1322 else if( aContentType.Find( KMimeTextCalCancel ) != KErrNotFound ) |
1423 else if( aContentType.Find( KMimeTextCalCancel ) != KErrNotFound ) |
1323 { |
1424 { |
1324 array.AppendL( KCancel ); |
1425 array.AppendL( KCancel ); |
1325 } |
1426 } |
1326 else |
1427 else |
1327 { |
1428 { |
1331 store->CommitL(); |
1432 store->CommitL(); |
1332 } |
1433 } |
1333 CleanupStack::PopAndDestroy( 2, store ); |
1434 CleanupStack::PopAndDestroy( 2, store ); |
1334 } |
1435 } |
1335 if( parentToMultipartAlternative && fileName.Find( _L(".ics")) != KErrNotFound ) |
1436 if( parentToMultipartAlternative && fileName.Find( _L(".ics")) != KErrNotFound ) |
1336 { |
1437 { |
1337 TMsvEntry tAttaEntry = cAtta->Entry(); |
1438 TMsvEntry tAttaEntry = cAtta->Entry(); |
1338 TMsvId id = tAttaEntry.Parent(); |
1439 TMsvId id = tAttaEntry.Parent(); |
1339 CMsvEntry* cParent = iSession->GetEntryL( id ); |
1440 CMsvEntry* cParent = iSession->GetEntryL( id ); |
1340 CleanupStack::PushL( cParent ); |
1441 CleanupStack::PushL( cParent ); |
1341 |
1442 |
1342 TMsvEmailEntry tEntry = cParent->Entry(); |
1443 TMsvEmailEntry tEntry = cParent->Entry(); |
1343 tEntry.SetMessageFolderType( EFolderTypeAlternative ); |
1444 tEntry.SetMessageFolderType( EFolderTypeAlternative ); |
1344 cParent->ChangeL( tEntry ); |
1445 cParent->ChangeL( tEntry ); |
1345 |
1446 |
1346 CleanupStack::PopAndDestroy( cParent ); |
1447 CleanupStack::PopAndDestroy( cParent ); |
1347 } |
1448 } |
1348 CleanupStack::PopAndDestroy( cAtta ); |
1449 CleanupStack::PopAndDestroy( cAtta ); |
1349 |
1450 |
1350 // Delete the message entries to get all the changes to disk and |
1451 // Delete the message entries to get all the changes to disk and |
1351 // possible store locks released |
1452 // possible store locks released |
1352 CleanCachedMessageEntries(); |
1453 CleanCachedMessageEntries(); |
1353 |
1454 |
1354 // Create the FS message part object and return it |
1455 // Create the FS message part object and return it |
1355 result = iMsgMapper->GetMessagePartL( newAttachmentId, aMailBoxId, |
1456 result = iMsgMapper->GetMessagePartL( newAttachmentId, aMailBoxId, |
1356 aMessageId ); |
1457 aMessageId ); |
1357 return result; |
1458 return result; |
1358 } |
1459 } |
1359 |
1460 |
1360 // ---------------------------------------------------------------------------- |
1461 // ---------------------------------------------------------------------------- |
1361 // ---------------------------------------------------------------------------- |
1462 // ---------------------------------------------------------------------------- |
1362 CFSMailMessagePart* CIpsPlgSosBasePlugin::CopyMessageAsChildPartL( |
1463 CFSMailMessagePart* CIpsPlgSosBasePlugin::CopyMessageAsChildPartL( |
1363 const TFSMailMsgId& /* aMailBoxId */, |
1464 const TFSMailMsgId& /* aMailBoxId */, |
1364 const TFSMailMsgId& /* aParentFolderId */, |
1465 const TFSMailMsgId& /* aParentFolderId */, |
1365 const TFSMailMsgId& /* aMessageId */, |
1466 const TFSMailMsgId& /* aMessageId */, |
1366 const TFSMailMsgId& /* aParentPartId */, |
1467 const TFSMailMsgId& /* aParentPartId */, |
1386 TInt status( KErrNone ); |
1487 TInt status( KErrNone ); |
1387 CMsvEntry* cEntry( NULL ); |
1488 CMsvEntry* cEntry( NULL ); |
1388 TMsvEntry tEntry; |
1489 TMsvEntry tEntry; |
1389 TMsvId serviceId; |
1490 TMsvId serviceId; |
1390 status = iSession->GetEntry( aPartId.Id(), serviceId, tEntry ); |
1491 status = iSession->GetEntry( aPartId.Id(), serviceId, tEntry ); |
1391 |
1492 |
1392 if ( ( status == KErrNone ) && |
1493 if ( ( status == KErrNone ) && |
1393 ( tEntry.iType == KUidMsvAttachmentEntry ) ) |
1494 ( tEntry.iType == KUidMsvAttachmentEntry ) ) |
1394 { |
1495 { |
1395 CImEmailMessage* message( NULL ); |
1496 CImEmailMessage* message( NULL ); |
|
1497 |
1396 // We trust that the message ID really refers to a message |
1498 // We trust that the message ID really refers to a message |
1397 GetMessageEntryL( aMessageId.Id(), cEntry, message ); |
1499 |
1398 |
1500 // Take ownership of message entry objects since thanks to |
1399 MMsvAttachmentManager& attachmentMgr( message->AttachmentManager() ); |
1501 // "clever" use of active scheduler waits we can re-enter |
1400 |
1502 // this function leading to crashes if somebody clears the cache |
|
1503 // while this iteration still needs them |
|
1504 TakeMessageEntryLC( aMessageId.Id(), cEntry, message ); |
|
1505 |
|
1506 MMsvAttachmentManager& attachmentMgr( message->AttachmentManager() ); |
|
1507 |
1401 CIpsPlgOperationWait* waiter = CIpsPlgOperationWait::NewL(); |
1508 CIpsPlgOperationWait* waiter = CIpsPlgOperationWait::NewL(); |
1402 CleanupStack::PushL( waiter ); |
1509 CleanupStack::PushL( waiter ); |
1403 |
1510 |
1404 attachmentMgr.RemoveAttachmentL( |
1511 attachmentMgr.RemoveAttachmentL( |
1405 (TMsvAttachmentId) aPartId.Id(), waiter->iStatus ); |
1512 (TMsvAttachmentId) aPartId.Id(), waiter->iStatus ); |
1406 |
1513 |
1407 waiter->Start(); |
1514 waiter->Start(); |
1408 CleanupStack::PopAndDestroy( waiter ); |
1515 CleanupStack::PopAndDestroy( waiter ); |
1409 } |
1516 |
1410 else if ( ( status == KErrNone ) && |
1517 // Return message entry objects to cache |
|
1518 CleanupStack::Pop( 2 ); // cEntry, message |
|
1519 ReturnMessageEntry( cEntry, message ); |
|
1520 } |
|
1521 else if ( ( status == KErrNone ) && |
1411 ( tEntry.iType == KUidMsvFolderEntry ) ) |
1522 ( tEntry.iType == KUidMsvFolderEntry ) ) |
1412 { |
1523 { |
1413 cEntry = iSession->GetEntryL( tEntry.Parent() ); |
1524 cEntry = iSession->GetEntryL( tEntry.Parent() ); |
1414 CleanupStack::PushL( cEntry ); |
1525 CleanupStack::PushL( cEntry ); |
1415 cEntry->DeleteL( tEntry.Id() ); |
1526 cEntry->DeleteL( tEntry.Id() ); |
1476 TInt CIpsPlgSosBasePlugin::GetMessagePartFileL( |
1587 TInt CIpsPlgSosBasePlugin::GetMessagePartFileL( |
1477 const TFSMailMsgId& /* aMailBoxId */, |
1588 const TFSMailMsgId& /* aMailBoxId */, |
1478 const TFSMailMsgId& /* aParentFolderId */, |
1589 const TFSMailMsgId& /* aParentFolderId */, |
1479 const TFSMailMsgId& /* aMessageId */, |
1590 const TFSMailMsgId& /* aMessageId */, |
1480 const TFSMailMsgId& aMessagePartId, |
1591 const TFSMailMsgId& aMessagePartId, |
1481 RFile& aFileHandle) |
1592 RFile& aFileHandle) |
1482 { |
1593 { |
1483 FUNC_LOG; |
1594 FUNC_LOG; |
1484 TInt status( KErrNone ); |
1595 TInt status( KErrNone ); |
1485 CMsvEntry* cEntry = iSession->GetEntryL( aMessagePartId.Id() ); |
1596 CMsvEntry* cEntry = iSession->GetEntryL( aMessagePartId.Id() ); |
1486 CleanupStack::PushL( cEntry ); |
1597 CleanupStack::PushL( cEntry ); |
1487 CMsvStore* store = NULL; |
1598 CMsvStore* store = NULL; |
1488 TBool hasStore = cEntry->HasStoreL(); |
1599 TBool hasStore = cEntry->HasStoreL(); |
1489 if ( hasStore ) |
1600 if ( hasStore ) |
1490 { |
1601 { |
1491 //<qmail> |
1602 //<qmail> |
1492 // We need to open store for edit to support multipart/alternative |
1603 // We need to open store for edit to support multipart/alternative |
1493 // structure: we must have a possibility to modify text/html message part |
1604 // structure: we must have a possibility to modify text/html message part |
1494 //store = cEntry->ReadStoreL(); |
1605 //store = cEntry->ReadStoreL(); |
1495 store = cEntry->EditStoreL(); |
1606 store = cEntry->EditStoreL(); |
1496 //</qmail> |
1607 //</qmail> |
1497 } |
1608 } |
1498 |
1609 |
1499 if ( !store || !hasStore ) |
1610 if ( !store || !hasStore ) |
1500 { |
1611 { |
1501 User::Leave( KErrNotFound ); |
1612 User::Leave( KErrNotFound ); |
1502 } |
1613 } |
1503 CleanupStack::PushL( store ); |
1614 CleanupStack::PushL( store ); |
1504 MMsvAttachmentManager& attachmentMgr = store->AttachmentManagerL(); |
1615 MMsvAttachmentManager& attachmentMgr = store->AttachmentManagerL(); |
1505 |
1616 |
1506 // It is assumed that the attachment file is always in the index 0 |
1617 // It is assumed that the attachment file is always in the index 0 |
1507 if ( attachmentMgr.AttachmentCount() ) |
1618 if ( attachmentMgr.AttachmentCount() ) |
1508 { |
1619 { |
1509 //<qmail> |
1620 //<qmail> |
1510 // We need to open store for edit to support multipart/alternative |
1621 // We need to open store for edit to support multipart/alternative |
1511 // structure: we must have a possibility to modify text/html message part |
1622 // structure: we must have a possibility to modify text/html message part |
1512 //aFileHandle = attachmentMgr.GetAttachmentFileL( 0 ); |
1623 //aFileHandle = attachmentMgr.GetAttachmentFileL( 0 ); |
1513 aFileHandle = attachmentMgr.GetAttachmentFileForWriteL( 0 ); |
1624 aFileHandle = attachmentMgr.GetAttachmentFileForWriteL( 0 ); |
1514 //</qmail> |
1625 //</qmail> |
1515 } |
1626 } |
1516 else |
1627 else |
1517 { |
1628 { |
1518 User::Leave( KErrNotFound ); |
1629 User::Leave( KErrNotFound ); |
1519 } |
1630 } |
1588 GetMessageEntryL( aMessageId.Id(), cEntry, message ); |
1699 GetMessageEntryL( aMessageId.Id(), cEntry, message ); |
1589 if ( message ) |
1700 if ( message ) |
1590 { |
1701 { |
1591 message->GetBodyTextEntryIdL( |
1702 message->GetBodyTextEntryIdL( |
1592 cEntry->Entry().Id(), CImEmailMessage::EThisMessageOnly ); |
1703 cEntry->Entry().Id(), CImEmailMessage::EThisMessageOnly ); |
1593 |
1704 |
1594 if ( message->Selection().Count() > 0 ) |
1705 if ( message->Selection().Count() > 0 ) |
1595 { |
1706 { |
1596 // Check whether the body text is requested |
1707 // Check whether the body text is requested |
1597 if ( message->Selection()[0] == aMessagePartId.Id() ) |
1708 if ( message->Selection()[0] == aMessagePartId.Id() ) |
1598 { |
1709 { |
1599 CParaFormatLayer* globalParaLayer = CParaFormatLayer::NewL(); |
1710 CParaFormatLayer* globalParaLayer = CParaFormatLayer::NewL(); |
1600 CleanupStack::PushL(globalParaLayer); |
1711 CleanupStack::PushL(globalParaLayer); |
1601 CCharFormatLayer* globalCharLayer = CCharFormatLayer::NewL(); |
1712 CCharFormatLayer* globalCharLayer = CCharFormatLayer::NewL(); |
1602 CleanupStack::PushL(globalCharLayer); |
1713 CleanupStack::PushL(globalCharLayer); |
1603 |
1714 |
1604 CRichText* bodyText = CRichText::NewL( |
1715 CRichText* bodyText = CRichText::NewL( |
1605 globalParaLayer, globalCharLayer); |
1716 globalParaLayer, globalCharLayer); |
1606 CleanupStack::PushL( bodyText ); |
1717 CleanupStack::PushL( bodyText ); |
1607 |
1718 |
1608 message->GetBodyTextL( |
1719 message->GetBodyTextL( |
1609 aMessageId.Id(), CImEmailMessage::EThisMessageOnly, |
1720 aMessageId.Id(), CImEmailMessage::EThisMessageOnly, |
1610 *bodyText, *globalParaLayer, *globalCharLayer ); |
1721 *bodyText, *globalParaLayer, *globalCharLayer ); |
1611 |
1722 |
1612 bodyText->Extract( aBuffer, aStartOffset, aBuffer.MaxLength() ); |
1723 bodyText->Extract( aBuffer, aStartOffset, aBuffer.MaxLength() ); |
1613 |
1724 |
1614 CleanupStack::PopAndDestroy(bodyText); |
1725 CleanupStack::PopAndDestroy(bodyText); |
1615 CleanupStack::PopAndDestroy(globalCharLayer); |
1726 CleanupStack::PopAndDestroy(globalCharLayer); |
1616 CleanupStack::PopAndDestroy(globalParaLayer); |
1727 CleanupStack::PopAndDestroy(globalParaLayer); |
1617 } |
1728 } |
1618 } |
1729 } |
1619 } |
1730 } |
1620 } |
1731 } |
1621 |
1732 |
1622 // ---------------------------------------------------------------------------- |
1733 // ---------------------------------------------------------------------------- |
1623 // ---------------------------------------------------------------------------- |
1734 // ---------------------------------------------------------------------------- |
1624 void CIpsPlgSosBasePlugin::SetContentL( |
1735 void CIpsPlgSosBasePlugin::SetContentL( |
1625 const TDesC& aBuffer, |
1736 const TDesC& aBuffer, |
1626 const TFSMailMsgId& /* aMailBoxId */, |
1737 const TFSMailMsgId& /* aMailBoxId */, |
1627 const TFSMailMsgId& /* aParentFolderId */, |
1738 const TFSMailMsgId& /* aParentFolderId */, |
1628 const TFSMailMsgId& /* aMessageId */, |
1739 const TFSMailMsgId& /* aMessageId */, |
1629 const TFSMailMsgId& aMessagePartId ) |
1740 const TFSMailMsgId& aMessagePartId ) |
1630 { |
1741 { |
1631 FUNC_LOG; |
1742 FUNC_LOG; |
1632 |
1743 |
1633 //<qmail> |
1744 //<qmail> Rewritten in Qmail: CIpsPlgOperationWait is no longer used |
1634 // Notice that SetContentL sets only the content of text/plain message part: |
1745 // Notice that SetContentL sets only the content of text/plain message part: |
1635 // text/html part can be modified directly using GetMessagePartFileL |
1746 // text/html part can be modified directly using GetMessagePartFileL |
1636 CMsvEntry* cEntry( NULL ); |
1747 CMsvEntry* cEntry( NULL ); |
1637 CMsvStore* store = NULL; |
1748 CMsvStore* store = NULL; |
1638 |
1749 |
1654 store->StoreBodyTextL(*text); |
1765 store->StoreBodyTextL(*text); |
1655 store->CommitL(); |
1766 store->CommitL(); |
1656 CleanupStack::PopAndDestroy( 4, store ); |
1767 CleanupStack::PopAndDestroy( 4, store ); |
1657 } |
1768 } |
1658 CleanupStack::PopAndDestroy(cEntry); |
1769 CleanupStack::PopAndDestroy(cEntry); |
1659 //</qmail> |
1770 //</qmail> |
1660 } |
1771 } |
1661 |
1772 |
1662 // ---------------------------------------------------------------------------- |
1773 // ---------------------------------------------------------------------------- |
1663 // ---------------------------------------------------------------------------- |
1774 // ---------------------------------------------------------------------------- |
1664 void CIpsPlgSosBasePlugin::RemovePartContentL( |
1775 void CIpsPlgSosBasePlugin::RemovePartContentL( |
1665 const TFSMailMsgId& /* aMailBoxId */, |
1776 const TFSMailMsgId& /* aMailBoxId */, |
1666 const TFSMailMsgId& /* aParentFolderId */, |
1777 const TFSMailMsgId& /* aParentFolderId */, |
1667 const TFSMailMsgId& /* aMessageId */, |
1778 const TFSMailMsgId& /* aMessageId */, |
1668 const RArray<TFSMailMsgId>& /* aPartIds */) |
1779 const RArray<TFSMailMsgId>& aPartIds ) |
1669 { |
1780 { |
1670 } |
1781 TInt count( aPartIds.Count() ); |
1671 |
1782 |
1672 // ---------------------------------------------------------------------------- |
1783 for( TInt i(0); i < count; i++ ) |
1673 // ---------------------------------------------------------------------------- |
1784 { |
|
1785 CMsvEntry* cEntry = iSession->GetEntryL( aPartIds[i].Id() ); |
|
1786 CleanupStack::PushL( cEntry ); |
|
1787 CMsvStore* store = NULL; |
|
1788 TBool hasStore = cEntry->HasStoreL(); |
|
1789 if ( hasStore ) |
|
1790 { |
|
1791 store = cEntry->EditStoreL(); |
|
1792 } |
|
1793 |
|
1794 if ( !store || !hasStore ) |
|
1795 { |
|
1796 User::Leave( KErrNotFound ); |
|
1797 } |
|
1798 CleanupStack::PushL( store ); |
|
1799 MMsvAttachmentManager& attachmentMgr = store->AttachmentManagerL(); |
|
1800 |
|
1801 // It is assumed that the attachment file is always in the index 0 |
|
1802 if ( attachmentMgr.AttachmentCount() ) |
|
1803 { |
|
1804 // delete attachment file |
|
1805 CIpsPlgOperationWait* waiter = CIpsPlgOperationWait::NewLC(); |
|
1806 attachmentMgr.RemoveAttachmentL( 0, waiter->iStatus ); |
|
1807 waiter->Start(); |
|
1808 CleanupStack::PopAndDestroy( waiter ); |
|
1809 store->CommitL(); |
|
1810 |
|
1811 // clear complete flag |
|
1812 TMsvEntry tEntry( cEntry->Entry() ); |
|
1813 tEntry.SetComplete( EFalse ); |
|
1814 |
|
1815 waiter = CIpsPlgOperationWait::NewLC(); |
|
1816 CMsvOperation* ops = cEntry->ChangeL( tEntry, waiter->iStatus ); |
|
1817 CleanupStack::PushL( ops ); |
|
1818 waiter->Start(); |
|
1819 CleanupStack::PopAndDestroy( 2, waiter ); |
|
1820 } |
|
1821 else |
|
1822 { |
|
1823 User::Leave( KErrNotFound ); |
|
1824 } |
|
1825 CleanupStack::PopAndDestroy( store ); |
|
1826 CleanupStack::PopAndDestroy( cEntry ); |
|
1827 } |
|
1828 } |
|
1829 |
|
1830 // ---------------------------------------------------------------------------- |
|
1831 // ---------------------------------------------------------------------------- |
1674 void CIpsPlgSosBasePlugin::SetPartContentFromFileL( |
1832 void CIpsPlgSosBasePlugin::SetPartContentFromFileL( |
1675 const TFSMailMsgId& /* aMailBoxId */, |
1833 const TFSMailMsgId& /* aMailBoxId */, |
1676 const TFSMailMsgId& /* aParentFolderId */, |
1834 const TFSMailMsgId& /* aParentFolderId */, |
1677 const TFSMailMsgId& /* aMessageId */, |
1835 const TFSMailMsgId& /* aMessageId */, |
1678 const TFSMailMsgId& /* aMessagePartId */, |
1836 const TFSMailMsgId& /* aMessagePartId */, |
1679 const TDesC& /* aFilePath */) |
1837 const TDesC& /* aFilePath */) |
1680 { |
1838 { |
1681 } |
1839 } |
1682 |
1840 |
1683 // ---------------------------------------------------------------------------- |
1841 // ---------------------------------------------------------------------------- |
1684 // ---------------------------------------------------------------------------- |
1842 // ---------------------------------------------------------------------------- |
1685 void CIpsPlgSosBasePlugin::StoreMessagePartL( |
1843 void CIpsPlgSosBasePlugin::StoreMessagePartL( |
1686 const TFSMailMsgId& /* aMailBoxId */, |
1844 const TFSMailMsgId& /* aMailBoxId */, |
1687 const TFSMailMsgId& /* aParentFolderId */, |
1845 const TFSMailMsgId& /* aParentFolderId */, |
1688 const TFSMailMsgId& /* aMessageId */, |
1846 const TFSMailMsgId& /* aMessageId */, |
1689 CFSMailMessagePart& /* aMessagePart */) |
1847 CFSMailMessagePart& /* aMessagePart */) |
1801 } |
1980 } |
1802 } |
1981 } |
1803 |
1982 |
1804 // ---------------------------------------------------------------------------- |
1983 // ---------------------------------------------------------------------------- |
1805 // ---------------------------------------------------------------------------- |
1984 // ---------------------------------------------------------------------------- |
1806 void CIpsPlgSosBasePlugin::SearchL( |
1985 void CIpsPlgSosBasePlugin::SearchL( |
1807 const TFSMailMsgId& aMailBoxId, |
1986 const TFSMailMsgId& aMailBoxId, |
1808 const RArray<TFSMailMsgId>& aFolderIds, |
1987 const RArray<TFSMailMsgId>& aFolderIds, |
1809 const RPointerArray<TDesC>& aSearchStrings, |
1988 const RPointerArray<TDesC>& aSearchStrings, |
1810 const TFSMailSortCriteria& aSortCriteria, |
1989 const TFSMailSortCriteria& aSortCriteria, |
1811 MFSMailBoxSearchObserver& aSearchObserver ) |
1990 MFSMailBoxSearchObserver& aSearchObserver ) |
1812 { |
1991 { |
1813 FUNC_LOG; |
1992 FUNC_LOG; |
1814 iSearch->SearchL( |
1993 iSearch->SearchL( |
1815 aMailBoxId, |
1994 aMailBoxId, |
1816 aFolderIds, |
1995 aFolderIds, |
1817 aSearchStrings, |
1996 aSearchStrings, |
1818 aSortCriteria, |
1997 aSortCriteria, |
1819 aSearchObserver ); |
1998 aSearchObserver ); |
1820 } |
1999 } |
1821 |
2000 |
1822 // ---------------------------------------------------------------------------- |
2001 // ---------------------------------------------------------------------------- |
1823 // ---------------------------------------------------------------------------- |
2002 // ---------------------------------------------------------------------------- |
1824 void CIpsPlgSosBasePlugin::CancelSearch( const TFSMailMsgId& /* aMailBoxId */ ) |
2003 void CIpsPlgSosBasePlugin::CancelSearch( const TFSMailMsgId& /* aMailBoxId */ ) |
1825 { |
2004 { |
1826 FUNC_LOG; |
2005 FUNC_LOG; |
1827 iSearch->Cancel(); |
2006 iSearch->Cancel(); |
1828 } |
2007 } |
1829 |
2008 |
1830 // ---------------------------------------------------------------------------- |
2009 // ---------------------------------------------------------------------------- |
1831 // ---------------------------------------------------------------------------- |
2010 // ---------------------------------------------------------------------------- |
1832 void CIpsPlgSosBasePlugin::ClearSearchResultCache( |
2011 void CIpsPlgSosBasePlugin::ClearSearchResultCache( |
1833 const TFSMailMsgId& /* aMailBoxId */ ) |
2012 const TFSMailMsgId& /* aMailBoxId */ ) |
1834 { |
2013 { |
1835 FUNC_LOG; |
2014 FUNC_LOG; |
1836 iSearch->ClearCache(); |
2015 iSearch->ClearCache(); |
1837 } |
2016 } |
1838 |
2017 |
1839 // ---------------------------------------------------------------------------- |
2018 // ---------------------------------------------------------------------------- |
1840 // ---------------------------------------------------------------------------- |
2019 // ---------------------------------------------------------------------------- |
1841 void CIpsPlgSosBasePlugin::AddObserverL(MFSMailEventObserver& aObserver) |
2020 void CIpsPlgSosBasePlugin::AddObserverL(MFSMailEventObserver& aObserver) |
1842 { |
2021 { |
1843 FUNC_LOG; |
2022 FUNC_LOG; |
1844 iEventHandler->AddPluginObserverL( &aObserver ); |
2023 iEventHandler->AddPluginObserverL( &aObserver ); |
1845 } |
2024 } |
1846 |
2025 |
1847 // ---------------------------------------------------------------------------- |
2026 // ---------------------------------------------------------------------------- |
1848 // ---------------------------------------------------------------------------- |
2027 // ---------------------------------------------------------------------------- |
1849 void CIpsPlgSosBasePlugin::RemoveObserver(MFSMailEventObserver& aObserver) |
2028 void CIpsPlgSosBasePlugin::RemoveObserver(MFSMailEventObserver& aObserver) |
1850 { |
2029 { |
1851 //don't delete. we don't own this. |
2030 //don't delete. we don't own this. |
1852 iEventHandler->RemovePluginObserver( &aObserver ); |
2031 iEventHandler->RemovePluginObserver( &aObserver ); |
1853 } |
2032 } |
1854 |
2033 |
1855 // ---------------------------------------------------------------------------- |
2034 // ---------------------------------------------------------------------------- |
1856 // ---------------------------------------------------------------------------- |
2035 // ---------------------------------------------------------------------------- |
1857 void CIpsPlgSosBasePlugin::DeleteMessagesByUidL( |
2036 void CIpsPlgSosBasePlugin::DeleteMessagesByUidL( |
1858 const TFSMailMsgId& /*aMailBoxId*/, |
2037 const TFSMailMsgId& /*aMailBoxId*/, |
1859 const TFSMailMsgId& /*aFolderId*/, |
2038 const TFSMailMsgId& /*aFolderId*/, |
1860 const RArray<TFSMailMsgId>& aMessages ) |
2039 const RArray<TFSMailMsgId>& aMessages ) |
1861 { |
2040 { |
1862 FUNC_LOG; |
2041 FUNC_LOG; |
1863 CMsvEntrySelection* sel=new(ELeave) CMsvEntrySelection; |
2042 CMsvEntrySelection* sel=new(ELeave) CMsvEntrySelection; |
1864 CleanupStack::PushL(sel); |
2043 CleanupStack::PushL(sel); |
1865 |
2044 |
1866 TInt count = aMessages.Count(); |
2045 TInt count = aMessages.Count(); |
1867 TMsvEntry tEntry; |
2046 TMsvEntry tEntry; |
1868 TMsvId service; |
2047 TMsvId service; |
1869 |
2048 |
1870 for(TInt i=0; i<count; i++) |
2049 for(TInt i=0; i<count; i++) |
1879 } |
2058 } |
1880 } |
2059 } |
1881 |
2060 |
1882 CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL( *this ); |
2061 CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL( *this ); |
1883 CleanupStack::PushL( watcher ); |
2062 CleanupStack::PushL( watcher ); |
1884 CMsvOperation* op = CIpsPlgDeleteRemote::NewL( *iSession, |
2063 //<qmail> |
1885 watcher->iStatus, *sel ); |
2064 CMsvOperation* op = CIpsPlgDeleteOperation::NewL( *iSession, |
|
2065 watcher->iStatus, sel ); |
|
2066 //</qmail> |
1886 watcher->SetOperation( op ); |
2067 watcher->SetOperation( op ); |
1887 iOperations.AppendL( watcher ); |
2068 iOperations.AppendL( watcher ); |
1888 CleanupStack::Pop( watcher ); |
2069 CleanupStack::Pop( watcher ); |
1889 CleanupStack::PopAndDestroy( sel ); |
2070 //<qmail> |
1890 } |
2071 CleanupStack::Pop( sel ); |
1891 |
2072 //</qmail> |
1892 // ---------------------------------------------------------------------------- |
2073 } |
1893 // ---------------------------------------------------------------------------- |
2074 |
|
2075 // ---------------------------------------------------------------------------- |
|
2076 // ---------------------------------------------------------------------------- |
1894 void CIpsPlgSosBasePlugin::SubscribeMailboxEventsL( |
2077 void CIpsPlgSosBasePlugin::SubscribeMailboxEventsL( |
1895 const TFSMailMsgId& aMailboxId, |
2078 const TFSMailMsgId& aMailboxId, |
1896 MFSMailEventObserver& aObserver) |
2079 MFSMailEventObserver& aObserver) |
1897 { |
2080 { |
1898 FUNC_LOG; |
2081 FUNC_LOG; |
|
2082 // <qmail> |
1899 TUint32 key(0); |
2083 TUint32 key(0); |
1900 |
2084 // </qmail> |
|
2085 |
1901 iEventHandler->SubscribeMailboxEventsL( aMailboxId, aObserver, key ); |
2086 iEventHandler->SubscribeMailboxEventsL( aMailboxId, aObserver, key ); |
1902 } |
2087 } |
1903 |
2088 |
1904 // ---------------------------------------------------------------------------- |
2089 // ---------------------------------------------------------------------------- |
1905 // ---------------------------------------------------------------------------- |
2090 // ---------------------------------------------------------------------------- |
1906 void CIpsPlgSosBasePlugin::UnsubscribeMailboxEvents( |
2091 void CIpsPlgSosBasePlugin::UnsubscribeMailboxEvents( |
1907 const TFSMailMsgId& aMailboxId, |
2092 const TFSMailMsgId& aMailboxId, |
1908 MFSMailEventObserver& aObserver) |
2093 MFSMailEventObserver& aObserver) |
1909 { |
2094 { |
1910 FUNC_LOG; |
2095 FUNC_LOG; |
1911 iEventHandler->UnsubscribeMailboxEvents( aMailboxId, aObserver ); |
2096 iEventHandler->UnsubscribeMailboxEvents( aMailboxId, aObserver ); |
1912 } |
2097 } |
1913 |
2098 |
1914 // ---------------------------------------------------------------------------- |
2099 // ---------------------------------------------------------------------------- |
1915 // ---------------------------------------------------------------------------- |
2100 // ---------------------------------------------------------------------------- |
1916 TSSMailSyncState CIpsPlgSosBasePlugin::CurrentSyncState( |
2101 TSSMailSyncState CIpsPlgSosBasePlugin::CurrentSyncState( |
1917 const TFSMailMsgId& aMailBoxId ) |
2102 const TFSMailMsgId& aMailBoxId ) |
1918 { |
2103 { |
1919 FUNC_LOG; |
2104 FUNC_LOG; |
1920 return iSyncStateHandler->GetCurrentSyncState( aMailBoxId ); |
2105 return iSyncStateHandler->GetCurrentSyncState( aMailBoxId ); |
1924 // ---------------------------------------------------------------------------- |
2109 // ---------------------------------------------------------------------------- |
1925 TInt CIpsPlgSosBasePlugin::WizardDataAvailableL( ) |
2110 TInt CIpsPlgSosBasePlugin::WizardDataAvailableL( ) |
1926 { |
2111 { |
1927 FUNC_LOG; |
2112 FUNC_LOG; |
1928 TInt error = KErrNone; |
2113 TInt error = KErrNone; |
1929 |
2114 // <qmail> iSettingsApi not available in Qmail |
|
2115 /*error = iSettingsApi->HandleMailboxCreation( MtmId(), *iSession ); |
1930 if ( error == KErrNotSupported ) |
2116 if ( error == KErrNotSupported ) |
1931 { |
2117 { |
1932 // this means that wizard data is not meaned for this plugin (instance) |
2118 // this means that wizard data is not meaned for this plugin (instance) |
1933 // just return KErrNone at the moment |
2119 // just return KErrNone at the moment |
1934 return KErrNone; |
2120 return KErrNone; |
1935 } |
2121 }*/ |
|
2122 // </qmail> |
1936 return error; |
2123 return error; |
1937 } |
2124 } |
1938 |
2125 |
1939 // ---------------------------------------------------------------------------- |
2126 // ---------------------------------------------------------------------------- |
1940 // ---------------------------------------------------------------------------- |
2127 // ---------------------------------------------------------------------------- |
1941 TInt CIpsPlgSosBasePlugin::GetConnectionId( |
2128 TInt CIpsPlgSosBasePlugin::GetConnectionId( |
1942 TFSMailMsgId /*aMailBoxId*/, |
2129 TFSMailMsgId /*aMailBoxId*/, |
1943 TUint32& /*aConnectionId*/ ) |
2130 TUint32& /*aConnectionId*/ ) |
1944 { |
2131 { |
1945 return KErrNotSupported; |
2132 return KErrNotSupported; |
1946 } |
2133 } |
1947 |
2134 |
1948 // ---------------------------------------------------------------------------- |
2135 // ---------------------------------------------------------------------------- |
1949 // ---------------------------------------------------------------------------- |
2136 // ---------------------------------------------------------------------------- |
1950 TInt CIpsPlgSosBasePlugin::IsConnectionAllowedWhenRoaming( |
2137 TInt CIpsPlgSosBasePlugin::IsConnectionAllowedWhenRoaming( |
1951 TFSMailMsgId /*aMailBoxId*/, |
2138 TFSMailMsgId /*aMailBoxId*/, |
1952 TBool& /*aConnectionAllowed*/ ) |
2139 TBool& /*aConnectionAllowed*/ ) |
1953 { |
2140 { |
1954 return KErrNotSupported; |
2141 return KErrNotSupported; |
1955 } |
2142 } |
1956 |
2143 |
1997 // </qmail> |
2184 // </qmail> |
1998 } |
2185 } |
1999 |
2186 |
2000 // ---------------------------------------------------------------------------- |
2187 // ---------------------------------------------------------------------------- |
2001 // CIpsPlgSosBasePlugin::GetMessageEntryL( ) |
2188 // CIpsPlgSosBasePlugin::GetMessageEntryL( ) |
2002 // Checks whether the requested message is already cached. If not, the cached |
2189 // Checks whether the requested message is already cached. If not, the cached |
2003 // objects are deleted and new objects are created. |
2190 // objects are deleted and new objects are created. |
2004 // ---------------------------------------------------------------------------- |
2191 // ---------------------------------------------------------------------------- |
2005 void CIpsPlgSosBasePlugin::GetMessageEntryL( |
2192 void CIpsPlgSosBasePlugin::GetMessageEntryL( |
2006 TMsvId aId, |
2193 TMsvId aId, |
2007 CMsvEntry*& aMessageEntry, |
2194 CMsvEntry*& aMessageEntry, |
2008 CImEmailMessage*& aImEmailMessage ) |
2195 CImEmailMessage*& aImEmailMessage ) |
2009 { |
2196 { |
2010 FUNC_LOG; |
2197 FUNC_LOG; |
2011 if ( !iCachedEntry || ( aId != iCachedEntry->Entry().Id() ) || |
2198 if ( !iCachedEntry || ( aId != iCachedEntry->Entry().Id() ) || |
2012 iCachedEmailMessage->IsActive() ) |
2199 iCachedEmailMessage->IsActive() ) |
2013 { |
2200 { |
2014 CleanCachedMessageEntries(); |
2201 CleanCachedMessageEntries(); |
2015 |
2202 |
2016 iCachedEntry = iSession->GetEntryL( aId ); |
2203 iCachedEntry = iSession->GetEntryL( aId ); |
2017 if ( iCachedEntry->Entry().iType == KUidMsvMessageEntry ) |
2204 if ( iCachedEntry->Entry().iType == KUidMsvMessageEntry ) |
2018 { |
2205 { |
2019 iCachedEmailMessage = CImEmailMessage::NewL( *iCachedEntry ); |
2206 iCachedEmailMessage = CImEmailMessage::NewL( *iCachedEntry ); |
2020 } |
2207 } |
2021 } |
2208 } |
2022 aMessageEntry = iCachedEntry; |
2209 aMessageEntry = iCachedEntry; |
2023 aImEmailMessage = iCachedEmailMessage; |
2210 aImEmailMessage = iCachedEmailMessage; |
2024 } |
2211 } |
2025 |
2212 |
|
2213 |
|
2214 // ---------------------------------------------------------------------------- |
|
2215 // CIpsPlgSosBasePlugin::TakeMessageEntryL( ) |
|
2216 // Takes ownership of the cached objects or creates new ones |
|
2217 // ---------------------------------------------------------------------------- |
|
2218 |
|
2219 void CIpsPlgSosBasePlugin::TakeMessageEntryLC( |
|
2220 TMsvId aId, |
|
2221 CMsvEntry*& aMessageEntry, |
|
2222 CImEmailMessage*& aImEmailMessage ) |
|
2223 { |
|
2224 FUNC_LOG; |
|
2225 if ( !iCachedEntry || ( aId != iCachedEntry->Entry().Id() ) || |
|
2226 iCachedEmailMessage->IsActive() ) |
|
2227 { |
|
2228 // Can't use the ones that are in cache, create new ones and don't replace the ones in cache |
|
2229 aMessageEntry = iSession->GetEntryL( aId ); |
|
2230 aImEmailMessage = 0; |
|
2231 |
|
2232 if ( aMessageEntry->Entry().iType == KUidMsvMessageEntry ) |
|
2233 { |
|
2234 CleanupStack::PushL( aMessageEntry ); |
|
2235 aImEmailMessage = CImEmailMessage::NewL( *aMessageEntry ); |
|
2236 CleanupStack::Pop(); |
|
2237 } |
|
2238 } |
|
2239 else |
|
2240 { |
|
2241 // Take ownership of the cached objects |
|
2242 aMessageEntry = iCachedEntry; |
|
2243 aImEmailMessage = iCachedEmailMessage; |
|
2244 iCachedEntry = 0; |
|
2245 iCachedEmailMessage = 0; |
|
2246 } |
|
2247 |
|
2248 // Ownership is transferred to the caller |
|
2249 CleanupStack::PushL( aMessageEntry ); |
|
2250 CleanupStack::PushL( aImEmailMessage ); |
|
2251 } |
|
2252 |
|
2253 // ---------------------------------------------------------------------------- |
|
2254 // ---------------------------------------------------------------------------- |
|
2255 void CIpsPlgSosBasePlugin::ReturnMessageEntry( |
|
2256 CMsvEntry* aMessageEntry, |
|
2257 CImEmailMessage* aImEmailMessage ) |
|
2258 { |
|
2259 // Clean old ones from the cache |
|
2260 CleanCachedMessageEntries(); |
|
2261 |
|
2262 // Always save the latest ones in the cache |
|
2263 iCachedEntry = aMessageEntry; |
|
2264 iCachedEmailMessage = aImEmailMessage; |
|
2265 } |
|
2266 |
2026 // ---------------------------------------------------------------------------- |
2267 // ---------------------------------------------------------------------------- |
2027 // ---------------------------------------------------------------------------- |
2268 // ---------------------------------------------------------------------------- |
2028 // |
2269 // |
2029 void CIpsPlgSosBasePlugin::CleanCachedMessageEntries() |
2270 void CIpsPlgSosBasePlugin::CleanCachedMessageEntries() |
2030 { |
2271 { |
2090 if ( iActivitytimers[i]->FSMailboxId().Id() == aMailBoxId.Id() ) |
2331 if ( iActivitytimers[i]->FSMailboxId().Id() == aMailBoxId.Id() ) |
2091 { |
2332 { |
2092 timer = iActivitytimers[i]; |
2333 timer = iActivitytimers[i]; |
2093 } |
2334 } |
2094 } |
2335 } |
2095 |
2336 |
2096 if ( !timer ) |
2337 if ( !timer ) |
2097 { |
2338 { |
2098 // No timer for mailbox found create new |
2339 // No timer for mailbox found create new |
2099 timer = CIpsPlgTimerOperation::NewL( aMailBoxId, *this ); |
2340 timer = CIpsPlgTimerOperation::NewL( aMailBoxId, *this ); |
2100 CleanupStack::PushL( timer ); |
2341 CleanupStack::PushL( timer ); |
2101 User::LeaveIfError( iActivitytimers.Append( timer ) ); |
2342 User::LeaveIfError( iActivitytimers.Append( timer ) ); |
2102 CleanupStack::Pop( timer ); |
2343 CleanupStack::Pop( timer ); |
2103 } |
2344 } |
2104 return *timer; |
2345 return *timer; |
2105 } |
2346 } |
2106 |
2347 |
2107 // ---------------------------------------------------------------------------- |
2348 // ---------------------------------------------------------------------------- |
2108 // ---------------------------------------------------------------------------- |
2349 // ---------------------------------------------------------------------------- |
2109 CIpsPlgSyncStateHandler& CIpsPlgSosBasePlugin::GetSyncStateHandler() |
2350 CIpsPlgSyncStateHandler& CIpsPlgSosBasePlugin::GetSyncStateHandler() |
2110 { |
2351 { |
2111 return *iSyncStateHandler; |
2352 return *iSyncStateHandler; |
2112 } |
2353 } |
2113 |
2354 |
2114 // ---------------------------------------------------------------------------- |
2355 // ---------------------------------------------------------------------------- |
2115 // ---------------------------------------------------------------------------- |
2356 // ---------------------------------------------------------------------------- |
2116 void CIpsPlgSosBasePlugin::CancelAllOnlineOperations( |
2357 void CIpsPlgSosBasePlugin::CancelAllOnlineOperations( |
2117 const TFSMailMsgId& aMailboxId ) |
2358 const TFSMailMsgId& aMailboxId ) |
2118 { |
2359 { |
2119 FUNC_LOG; |
2360 FUNC_LOG; |
2120 // cancel all ongoing operations |
2361 // cancel all ongoing operations |
2121 for ( TInt i = iOperations.Count()-1; i >= 0; i-- ) |
2362 for ( TInt i = iOperations.Count()-1; i >= 0; i-- ) |
2129 } |
2370 } |
2130 } |
2371 } |
2131 |
2372 |
2132 // --------------------------------------------------------------------------- |
2373 // --------------------------------------------------------------------------- |
2133 // --------------------------------------------------------------------------- |
2374 // --------------------------------------------------------------------------- |
2134 void CIpsPlgSosBasePlugin::DeleteAndRemoveOperation( |
2375 void CIpsPlgSosBasePlugin::DeleteAndRemoveOperation( |
2135 const TInt aOpArrayIndex, TInt aCompleteCode ) |
2376 const TInt aOpArrayIndex, TInt aCompleteCode ) |
2136 { |
2377 { |
2137 FUNC_LOG; |
2378 FUNC_LOG; |
2138 CIpsPlgSingleOpWatcher* opWatcher = iOperations[aOpArrayIndex]; |
2379 CIpsPlgSingleOpWatcher* opWatcher = iOperations[aOpArrayIndex]; |
2139 |
2380 |
2140 // <qmail> removed; does nothing |
2381 // <qmail> removed; does nothing |
2141 // The operations matches, handle it in protocol plugin...if needed. |
2382 // The operations matches, handle it in protocol plugin...if needed. |
2142 //TRAP_IGNORE( HandleOpCompletedL( *opWatcher, aCompleteCode ) ); |
2383 //TRAP_IGNORE( HandleOpCompletedL( *opWatcher, aCompleteCode ) ); |
2143 // </qmail> |
2384 // </qmail> |
2144 const CIpsPlgBaseOperation* op = opWatcher->BaseOperation(); |
2385 const CIpsPlgBaseOperation* op = opWatcher->BaseOperation(); |
2145 TMsvId service = KErrNotFound; |
2386 TMsvId service = KErrNotFound; |
2146 TUint pluginId = PluginId(); |
2387 TUint pluginId = PluginId(); |
2147 if ( op && ( |
2388 if ( op && ( |
2148 op->IpsOpType() == EIpsOpTypeImap4SyncOp || |
2389 op->IpsOpType() == EIpsOpTypeImap4SyncOp || |
2149 op->IpsOpType() == EIpsOpTypePop3SyncOp || |
2390 op->IpsOpType() == EIpsOpTypePop3SyncOp || |
2150 op->IpsOpType() == EIpsOpTypeImap4PopulateOp ) ) |
2391 op->IpsOpType() == EIpsOpTypeImap4PopulateOp ) ) |
2151 { |
2392 { |
2152 service = op->Service(); |
2393 service = op->Service(); |
2153 } |
2394 } |
2154 iOperations.Remove( aOpArrayIndex ); |
2395 iOperations.Remove( aOpArrayIndex ); |
2155 delete opWatcher; |
2396 delete opWatcher; |
2156 opWatcher = NULL; |
2397 opWatcher = NULL; |
2157 // need to remove operation first because after signaling |
2398 // need to remove operation first because after signaling |
2158 // sync complete mailbox status is asked immediatelly |
2399 // sync complete mailbox status is asked immediatelly |
2159 // and function checks connects ops also (see GetMailBoxStatus) |
2400 // and function checks connects ops also (see GetMailBoxStatus) |
2160 if ( service != KErrNotFound ) |
2401 if ( service != KErrNotFound ) |
2161 { |
2402 { |
2162 iEventHandler->SetNewPropertyEvent( |
2403 iEventHandler->SetNewPropertyEvent( |
2163 service, KIpsSosEmailSyncCompleted, aCompleteCode ); |
2404 service, KIpsSosEmailSyncCompleted, aCompleteCode ); |
2164 } |
2405 } |
2165 } |
2406 } |
2166 |
2407 |
2167 // --------------------------------------------------------------------------- |
2408 // --------------------------------------------------------------------------- |
2168 // --------------------------------------------------------------------------- |
2409 // --------------------------------------------------------------------------- |
2169 void CIpsPlgSosBasePlugin::DisconnectL( |
2410 void CIpsPlgSosBasePlugin::FixReplyForwardHeaderL( |
2170 const TFSMailMsgId& aMailBoxId, |
2411 CFSMailMessage* aMessage, |
|
2412 const TFSMailMsgId& aMailBoxId, |
|
2413 const TFSMailMsgId& aOriginalMessageId, |
|
2414 const TDesC& aHeaderDescriptor ) |
|
2415 { |
|
2416 FUNC_LOG; |
|
2417 CFSMailMessagePart* textBodyPart = aMessage->PlainTextBodyPartL(); |
|
2418 if ( textBodyPart ) |
|
2419 { |
|
2420 CleanupStack::PushL( textBodyPart ); |
|
2421 CFSMailMessage* origMsg = GetMessageByUidL( |
|
2422 aMailBoxId, |
|
2423 TFSMailMsgId(), |
|
2424 aOriginalMessageId, |
|
2425 EFSMsgDataStructure ); |
|
2426 if ( origMsg ) |
|
2427 { |
|
2428 CleanupStack::PushL( origMsg ); |
|
2429 CFSMailMessagePart* origMsgTextBodyPart = |
|
2430 origMsg->PlainTextBodyPartL(); |
|
2431 if ( origMsgTextBodyPart ) |
|
2432 { |
|
2433 CleanupStack::PushL( origMsgTextBodyPart ); |
|
2434 // Use the content provided in aHeaderDescriptor |
|
2435 // instead of what is provided by |
|
2436 // CreateForwardSmtpMessage.. |
|
2437 TPckgBuf<TReplyForwardParams> pckg; |
|
2438 pckg.Copy( aHeaderDescriptor ); |
|
2439 TPtr hPtr( pckg().iHeader->Des() ); |
|
2440 HBufC* body = HBufC::NewLC( |
|
2441 textBodyPart->FetchedContentSize() ); |
|
2442 TPtr bPtr( body->Des() ); |
|
2443 origMsgTextBodyPart->GetContentToBufferL( bPtr, 0 ); |
|
2444 HBufC* content = HBufC::NewLC( |
|
2445 hPtr.Length() + bPtr.Length() ); |
|
2446 TPtr cPtr( content->Des() ); |
|
2447 cPtr.Append( hPtr ); |
|
2448 cPtr.Append( bPtr ); |
|
2449 textBodyPart->SetContent( cPtr ); |
|
2450 textBodyPart->SaveL(); |
|
2451 CleanupStack::PopAndDestroy( content ); |
|
2452 CleanupStack::PopAndDestroy( body ); |
|
2453 CleanupStack::PopAndDestroy( origMsgTextBodyPart ); |
|
2454 } |
|
2455 CleanupStack::PopAndDestroy( origMsg ); |
|
2456 } |
|
2457 CleanupStack::PopAndDestroy( textBodyPart ); |
|
2458 } |
|
2459 } |
|
2460 |
|
2461 // --------------------------------------------------------------------------- |
|
2462 // --------------------------------------------------------------------------- |
|
2463 void CIpsPlgSosBasePlugin::DisconnectL( |
|
2464 const TFSMailMsgId& aMailBoxId, |
2171 MFSMailRequestObserver& aObserver, |
2465 MFSMailRequestObserver& aObserver, |
2172 const TInt aRequestId, |
2466 const TInt aRequestId, |
2173 TBool /*aRemoveAccountAlso*/ ) |
2467 TBool /*aRemoveAccountAlso*/ ) |
2174 { |
2468 { |
2175 FUNC_LOG; |
2469 FUNC_LOG; |
2176 TMsvId service = aMailBoxId.Id(); |
2470 TMsvId service = aMailBoxId.Id(); |
2177 TMsvEntry tEntry; |
2471 TMsvEntry tEntry; |
2178 TMsvId serv; |
2472 TMsvId serv; |
2179 iSession->GetEntry( service, serv, tEntry ); |
2473 iSession->GetEntry( service, serv, tEntry ); |
2180 |
2474 |
2181 if ( tEntry.Connected() ) |
2475 if ( tEntry.Connected() ) |
2182 { |
2476 { |
2183 CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this); |
2477 CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this); |
2184 CleanupStack::PushL( watcher ); |
2478 CleanupStack::PushL( watcher ); |
2185 |
2479 |
2186 TBuf8<1> dummyParams; |
2480 TBuf8<1> dummyParams; |
2187 dummyParams.Zero(); |
2481 dummyParams.Zero(); |
2199 &aObserver, |
2493 &aObserver, |
2200 aRequestId ); |
2494 aRequestId ); |
2201 |
2495 |
2202 watcher->SetOperation( op ); |
2496 watcher->SetOperation( op ); |
2203 CleanupStack::PopAndDestroy( sel ); |
2497 CleanupStack::PopAndDestroy( sel ); |
2204 iOperations.AppendL( watcher ); |
2498 iOperations.AppendL( watcher ); |
2205 CleanupStack::Pop( watcher ); |
2499 CleanupStack::Pop( watcher ); |
2206 } |
2500 } |
2207 } |
2501 } |
2208 |
2502 |
2209 // ---------------------------------------------------------------------------- |
2503 // ---------------------------------------------------------------------------- |
2210 // ---------------------------------------------------------------------------- |
2504 // ---------------------------------------------------------------------------- |
2211 void CIpsPlgSosBasePlugin::HandleTimerFiredL( const TFSMailMsgId& aMailboxId ) |
2505 void CIpsPlgSosBasePlugin::HandleTimerFiredL( const TFSMailMsgId& aMailboxId ) |
2212 { |
2506 { |
2213 FUNC_LOG; |
2507 FUNC_LOG; |
2214 for ( TInt i = 0; i < iActivitytimers.Count(); i++ ) |
2508 for ( TInt i = 0; i < iActivitytimers.Count(); i++ ) |
2215 { |
2509 { |
2216 // do not disconnect automatically mailboxes that are set to |
2510 // do not disconnect automatically mailboxes that are set to |
2217 // "connected" |
2511 // "connected" |
2218 if ( iActivitytimers[i]->FSMailboxId().Id() == aMailboxId.Id() ) |
2512 if ( iActivitytimers[i]->FSMailboxId().Id() == aMailboxId.Id() ) |
2219 { |
2513 { |
2220 // 0 for request id |
2514 // 0 for request id |
2221 DisconnectL( iActivitytimers[i]->FSMailboxId(), *this, 0 ); |
2515 DisconnectL( iActivitytimers[i]->FSMailboxId(), *this, 0 ); |
2222 } |
2516 } |
2223 } |
2517 } |
2224 } |
2518 } |
2225 |
2519 |
2226 // --------------------------------------------------------------------------- |
2520 // --------------------------------------------------------------------------- |
2227 // --------------------------------------------------------------------------- |
2521 // --------------------------------------------------------------------------- |
2228 void CIpsPlgSosBasePlugin::RequestResponseL( |
2522 void CIpsPlgSosBasePlugin::RequestResponseL( |
2229 TFSProgress /*aEvent*/, |
2523 TFSProgress /*aEvent*/, |
2230 TInt /*aRequestId*/ ) |
2524 TInt /*aRequestId*/ ) |
2231 { |
2525 { |
2232 } |
2526 } |
2233 |
2527 |
2234 // --------------------------------------------------------------------------- |
2528 // --------------------------------------------------------------------------- |
2235 // --------------------------------------------------------------------------- |
2529 // --------------------------------------------------------------------------- |
2236 void CIpsPlgSosBasePlugin::EmptyOutboxL( const TFSMailMsgId& aMailBoxId ) |
2530 void CIpsPlgSosBasePlugin::EmptyOutboxL( const TFSMailMsgId& aMailBoxId ) |
2237 { |
2531 { |
2238 FUNC_LOG; |
2532 FUNC_LOG; |
2239 CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this); |
2533 CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this); |
2240 CleanupStack::PushL(watcher); |
2534 CleanupStack::PushL(watcher); |
2241 // <qmail> |
2535 // <qmail> |
2242 CIpsPlgSmtpOperation* op = CIpsPlgSmtpOperation::NewLC( *iSession, watcher->iStatus ); |
2536 CIpsPlgSmtpOperation* op = CIpsPlgSmtpOperation::NewLC( *iSession, watcher->iStatus ); |
2243 // </qmail> |
2537 // </qmail> |
|
2538 op->SetEventHandler(iEventHandler); |
2244 watcher->SetOperation(op); |
2539 watcher->SetOperation(op); |
2245 op->EmptyOutboxFromPendingMessagesL( aMailBoxId.Id() ); |
2540 op->EmptyOutboxFromPendingMessagesL( aMailBoxId.Id() ); |
2246 iOperations.AppendL(watcher); |
2541 iOperations.AppendL(watcher); |
2247 CleanupStack::Pop( 2, watcher ); |
2542 CleanupStack::Pop( 2, watcher ); |
2248 } |
2543 } |
2251 // --------------------------------------------------------------------------- |
2546 // --------------------------------------------------------------------------- |
2252 TBool CIpsPlgSosBasePlugin::CanConnectL( const TFSMailMsgId& /*aMailboxId*/, |
2547 TBool CIpsPlgSosBasePlugin::CanConnectL( const TFSMailMsgId& /*aMailboxId*/, |
2253 TInt& /*aReason*/ ) |
2548 TInt& /*aReason*/ ) |
2254 { |
2549 { |
2255 FUNC_LOG; |
2550 FUNC_LOG; |
2256 #ifdef __WINS__ |
2551 #ifdef __WINS__ |
2257 return ETrue; |
2552 return ETrue; |
2258 #endif |
2553 #endif |
2259 TBool ret=ETrue; |
2554 TBool ret=ETrue; |
2260 //check offline mode. If set, we can't connect. |
2555 //check offline mode. If set, we can't connect. |
2261 ret = !OfflineModeSetL(); |
2556 ret = !OfflineModeSetL(); |
2262 if( ret ) |
2557 if( ret ) |
2263 { |
2558 { |
2264 ret = RoamingCheckL(); |
2559 ret = RoamingCheckL(); |
2265 } |
2560 } |
2266 return ret; |
2561 return ret; |
2267 } |
2562 } |
2268 |
2563 |
2269 // --------------------------------------------------------------------------- |
2564 // --------------------------------------------------------------------------- |
2270 // --------------------------------------------------------------------------- |
2565 // --------------------------------------------------------------------------- |
2271 TBool CIpsPlgSosBasePlugin::IsUnderUiProcess() |
2566 TBool CIpsPlgSosBasePlugin::IsUnderUiProcess() |
2272 { |
2567 { |
2273 return iIsUnderUiProcess; |
2568 return iIsUnderUiProcess; |
2274 } |
2569 } |
2275 |
2570 |
2276 // --------------------------------------------------------------------------- |
2571 // --------------------------------------------------------------------------- |
2277 // --------------------------------------------------------------------------- |
2572 // --------------------------------------------------------------------------- |
2278 TBool CIpsPlgSosBasePlugin::OfflineModeSetL() |
2573 TBool CIpsPlgSosBasePlugin::OfflineModeSetL() |
2279 { |
2574 { |
2280 FUNC_LOG; |
2575 FUNC_LOG; |
2281 return !LocalFeatureL( KCRUidCoreApplicationUIs, |
2576 return !LocalFeatureL( KCRUidCoreApplicationUIs, |
2282 KCoreAppUIsNetworkConnectionAllowed, 1 ); |
2577 KCoreAppUIsNetworkConnectionAllowed, 1 ); |
2283 } |
2578 } |
2284 |
2579 |
2285 // --------------------------------------------------------------------------- |
2580 // --------------------------------------------------------------------------- |
2286 // --------------------------------------------------------------------------- |
2581 // --------------------------------------------------------------------------- |
2287 TBool CIpsPlgSosBasePlugin::LocalFeatureL( |
2582 TBool CIpsPlgSosBasePlugin::LocalFeatureL( |
2288 const TUid& aCenRepUid, |
2583 const TUid& aCenRepUid, |
2289 const TUint32 aKeyId, |
2584 const TUint32 aKeyId, |
2290 const TUint32 aFlag ) |
2585 const TUint32 aFlag ) |
2291 { |
2586 { |
2331 //in any case. |
2626 //in any case. |
2332 //any different handling needed here? |
2627 //any different handling needed here? |
2333 return EFalse; |
2628 return EFalse; |
2334 } |
2629 } |
2335 } |
2630 } |
2336 |
2631 |
2337 // --------------------------------------------------------------------------- |
2632 // --------------------------------------------------------------------------- |
2338 // --------------------------------------------------------------------------- |
2633 // --------------------------------------------------------------------------- |
2339 TInt CIpsPlgSosBasePlugin::RegistrationStatusL() |
2634 TInt CIpsPlgSosBasePlugin::RegistrationStatusL() |
2340 { |
2635 { |
2341 FUNC_LOG; |
2636 FUNC_LOG; |
2342 TRequestStatus status; |
2637 TRequestStatus status; |
2343 TInt registrationStatus( 0 ); |
2638 TInt registrationStatus( 0 ); |
2344 |
2639 |
2345 //check network status |
2640 //check network status |
2346 iConMon.ConnectL(); |
2641 iConMon.ConnectL(); |
2347 |
2642 |
2348 iConMon.GetIntAttribute( |
2643 iConMon.GetIntAttribute( |
2349 EBearerIdGSM, 0, KNetworkRegistration, |
2644 EBearerIdGSM, 0, KNetworkRegistration, |
2350 registrationStatus, status ); |
2645 registrationStatus, status ); |
2351 |
2646 |
2352 User::WaitForRequest( status ); // faulty CS warning |
2647 User::WaitForRequest( status ); // faulty CS warning |
2353 |
2648 |
2354 iConMon.Close(); |
2649 iConMon.Close(); |
2355 |
2650 |
2356 return registrationStatus; |
2651 return registrationStatus; |
2357 } |
2652 } |
2358 |
2653 |
2359 // --------------------------------------------------------------------------- |
2654 // --------------------------------------------------------------------------- |
2360 // --------------------------------------------------------------------------- |
2655 // --------------------------------------------------------------------------- |
2361 // |
2656 // |
2362 void CIpsPlgSosBasePlugin::BlockCopyMoveFromFoldersL( |
2657 void CIpsPlgSosBasePlugin::BlockCopyMoveFromFoldersL( |
2363 CMsvEntry* aFolderEntry, |
2658 CMsvEntry* aFolderEntry, |
2364 TFSMailMsgId aFolderId, |
2659 TFSMailMsgId aFolderId, |
2365 CFSMailFolder& aFSMailFolder ) |
2660 CFSMailFolder& aFSMailFolder ) |
2366 { |
2661 { |
2367 FUNC_LOG; |
2662 FUNC_LOG; |
2368 RArray<TFSFolderType> blockFoldersOnline; |
2663 // Currently IPS plugin can connect automatically when doing the actual |
2369 CleanupClosePushL( blockFoldersOnline ); |
2664 // move/copy operation, so no need to block offline moves separately |
2370 RArray<TFSFolderType> blockFoldersOffline; |
2665 RArray<TFSFolderType> blockFolders; |
2371 CleanupClosePushL( blockFoldersOffline ); |
2666 CleanupClosePushL( blockFolders ); |
|
2667 |
2372 // Move/Copy operations only between remote folders (+ IMAP Inbox) and |
2668 // Move/Copy operations only between remote folders (+ IMAP Inbox) and |
2373 // Outbox -> Drafts, block others. |
2669 // Outbox -> Drafts, block others. |
2374 blockFoldersOnline.Reset(); |
2670 blockFolders.Reset(); |
2375 blockFoldersOffline.Reset(); |
2671 |
2376 |
|
2377 if( ( GetFolderType( aFolderEntry, aFolderId ) != EFSOther ) && |
2672 if( ( GetFolderType( aFolderEntry, aFolderId ) != EFSOther ) && |
2378 ( GetFolderType( aFolderEntry, aFolderId ) != EFSInbox ) ) |
2673 ( GetFolderType( aFolderEntry, aFolderId ) != EFSInbox ) ) |
2379 { |
2674 { |
2380 blockFoldersOnline.Append( EFSInbox ); |
2675 blockFolders.Append( EFSInbox ); |
2381 blockFoldersOnline.Append( EFSOther ); |
2676 blockFolders.Append( EFSOther ); |
2382 } |
2677 } |
2383 |
2678 |
2384 if( GetFolderType( aFolderEntry, aFolderId ) != EFSDraftsFolder ) |
2679 if( GetFolderType( aFolderEntry, aFolderId ) != EFSDraftsFolder ) |
2385 { |
2680 { |
2386 blockFoldersOnline.Append( EFSOutbox ); |
2681 blockFolders.Append( EFSOutbox ); |
2387 blockFoldersOffline.Append( EFSOutbox ); |
2682 } |
2388 } |
2683 blockFolders.Append( EFSSentFolder ); |
2389 blockFoldersOnline.Append( EFSSentFolder ); |
2684 blockFolders.Append( EFSDraftsFolder ); |
2390 blockFoldersOnline.Append( EFSDraftsFolder ); |
2685 blockFolders.Append( EFSDeleted ); |
2391 blockFoldersOnline.Append( EFSDeleted ); |
2686 |
2392 blockFoldersOffline.Append( EFSSentFolder ); |
2687 // Block move/copy to this folder from blocklist, same blocklist |
2393 blockFoldersOffline.Append( EFSDraftsFolder ); |
2688 // applies to both online and offline moves/copies |
2394 blockFoldersOffline.Append( EFSDeleted ); |
2689 aFSMailFolder.BlockCopyFromL( blockFolders, EFSMailBoxOnline ); |
2395 blockFoldersOffline.Append( EFSInbox ); |
2690 aFSMailFolder.BlockMoveFromL( blockFolders, EFSMailBoxOnline ); |
2396 blockFoldersOffline.Append( EFSOther ); |
2691 aFSMailFolder.BlockCopyFromL( blockFolders, EFSMailBoxOffline ); |
2397 |
2692 aFSMailFolder.BlockMoveFromL( blockFolders, EFSMailBoxOffline ); |
2398 // Block move/copy to this folder from blocklist |
2693 |
2399 aFSMailFolder.BlockCopyFromL( blockFoldersOnline, EFSMailBoxOnline ); |
2694 CleanupStack::PopAndDestroy( &blockFolders ); |
2400 aFSMailFolder.BlockMoveFromL( blockFoldersOnline, EFSMailBoxOnline ); |
2695 } |
2401 aFSMailFolder.BlockCopyFromL( blockFoldersOffline, EFSMailBoxOffline ); |
2696 |
2402 aFSMailFolder.BlockMoveFromL( blockFoldersOffline, EFSMailBoxOffline ); |
2697 // --------------------------------------------------------------------------- |
2403 |
2698 // --------------------------------------------------------------------------- |
2404 CleanupStack::PopAndDestroy( &blockFoldersOffline ); |
|
2405 CleanupStack::PopAndDestroy( &blockFoldersOnline ); |
|
2406 } |
|
2407 |
|
2408 // --------------------------------------------------------------------------- |
|
2409 // --------------------------------------------------------------------------- |
|
2410 void CIpsPlgSosBasePlugin::StoreIMEIToMailboxL( const TMsvId aMailboxId ) |
2699 void CIpsPlgSosBasePlugin::StoreIMEIToMailboxL( const TMsvId aMailboxId ) |
2411 { |
2700 { |
2412 FUNC_LOG; |
2701 FUNC_LOG; |
2413 CMsvEntry* centry = iSession->GetEntryL( aMailboxId ); |
2702 CMsvEntry* centry = iSession->GetEntryL( aMailboxId ); |
2414 CleanupStack::PushL( centry ); |
2703 CleanupStack::PushL( centry ); |