327 void CIpsPlgImap4Plugin::MoveMessagesL( |
325 void CIpsPlgImap4Plugin::MoveMessagesL( |
328 const TFSMailMsgId& aMailBoxId, |
326 const TFSMailMsgId& aMailBoxId, |
329 const RArray<TFSMailMsgId>& aMessageIds, |
327 const RArray<TFSMailMsgId>& aMessageIds, |
330 const TFSMailMsgId& aSourceFolderId, |
328 const TFSMailMsgId& aSourceFolderId, |
331 const TFSMailMsgId& aDestinationFolderId ) |
329 const TFSMailMsgId& aDestinationFolderId ) |
332 { |
330 { |
333 FUNC_LOG; |
331 FUNC_LOG; |
334 if( aDestinationFolderId.Id() == KMsvDraftEntryId ) |
332 if( aDestinationFolderId.Id() == KMsvDraftEntryId ) |
335 { |
333 { |
336 // Move to Drafts folder |
334 // Move to Drafts folder |
337 MoveMessagesToDraftL( aMailBoxId, |
335 MoveMessagesToDraftL( aMailBoxId, |
338 aMessageIds, |
336 aMessageIds, |
339 aSourceFolderId, |
337 aSourceFolderId, |
340 aDestinationFolderId ); |
338 aDestinationFolderId ); |
341 } |
339 } |
342 else if( aDestinationFolderId.Id() != aSourceFolderId.Id() ) |
340 else if( aDestinationFolderId.Id() != aSourceFolderId.Id() ) |
343 { |
341 { |
344 TMsvId service = aMailBoxId.Id(); |
342 TMsvId service = aMailBoxId.Id(); |
345 |
343 |
346 CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this); |
344 CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this); |
347 CleanupStack::PushL( watcher ); |
345 CleanupStack::PushL( watcher ); |
348 |
346 |
349 CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection; |
347 CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection; |
350 CleanupStack::PushL(sel); |
348 CleanupStack::PushL(sel); |
351 sel->AppendL( service ); |
349 sel->AppendL( service ); |
352 |
350 |
353 TInt msgIdCount( aMessageIds.Count() ); |
351 TInt msgIdCount( aMessageIds.Count() ); |
354 for ( TInt i(0); i< msgIdCount; i++ ) |
352 for ( TInt i(0); i< msgIdCount; i++ ) |
355 { |
353 { |
356 sel->AppendL( aMessageIds[i].Id() ); |
354 sel->AppendL( aMessageIds[i].Id() ); |
357 } |
355 } |
358 |
356 |
359 TPckgBuf<TImImap4GetMailInfo> optionsBuf; |
357 TPckgBuf<TImImap4GetMailInfo> optionsBuf; |
360 TImImap4GetMailInfo& options = optionsBuf(); |
358 TImImap4GetMailInfo& options = optionsBuf(); |
361 options.iMaxEmailSize = KMaxTInt32; |
359 options.iMaxEmailSize = KMaxTInt32; |
362 options.iGetMailBodyParts = EGetImap4EmailHeaders; |
360 options.iGetMailBodyParts = EGetImap4EmailBodyTextAndAttachments; |
363 options.iDestinationFolder = aDestinationFolderId.Id(); |
361 options.iDestinationFolder = aDestinationFolderId.Id(); |
364 |
362 |
365 CIpsPlgImap4MoveRemoteOpObserver* observer = |
363 MFSMailRequestObserver* observer = NULL; |
366 CIpsPlgImap4MoveRemoteOpObserver::NewL( *iSession, *iEventHandler, |
|
367 aSourceFolderId, aMessageIds ); |
|
368 watcher->SetRequestObserver( observer ); |
|
369 |
|
370 // Synchronous operation |
364 // Synchronous operation |
371 CIpsPlgBaseOperation* op = CIpsPlgImap4MoveRemoteOp::NewL( |
365 CIpsPlgBaseOperation* op = CIpsPlgImap4MoveRemoteOp::NewL( |
372 *iSession, |
366 *iSession, |
373 watcher->iStatus, |
367 watcher->iStatus, |
374 KIMAP4MTMMoveMailSelectionWhenAlreadyConnected, |
368 KIMAP4MTMMoveMailSelectionWhenAlreadyConnected, |
375 service, |
369 service, |
376 ActivityTimerL( aMailBoxId ), |
370 ActivityTimerL( aMailBoxId ), |
377 options, |
371 options, |
378 *sel, |
372 *sel, |
379 aMailBoxId, |
373 aMailBoxId, |
380 *observer, // async not supported |
374 *observer, // async not supported |
381 0 ); // async not supported |
375 0 ); // async not supported |
382 |
376 |
383 watcher->SetOperation( op ); |
377 watcher->SetOperation( op ); |
384 CleanupStack::PopAndDestroy( sel ); |
378 CleanupStack::PopAndDestroy( sel ); |
385 iOperations.AppendL( watcher ); |
379 iOperations.AppendL( watcher ); |
386 CleanupStack::Pop( watcher ); |
380 CleanupStack::Pop( watcher ); |
387 } |
381 } |
388 else |
382 else |
389 { |
383 { |
390 //do nothing |
384 //do nothing |
391 } |
385 } |
392 } |
386 } |
393 |
|
394 // --------------------------------------------------------------------------- |
|
395 // CIpsPlgImap4Plugin::MoveMessagesL() |
|
396 // asynchronic move message function |
|
397 // --------------------------------------------------------------------------- |
|
398 // |
|
399 TInt CIpsPlgImap4Plugin::MoveMessagesL( |
|
400 const TFSMailMsgId& aMailBoxId, |
|
401 const RArray<TFSMailMsgId>& aMessageIds, |
|
402 const TFSMailMsgId& aSourceFolderId, |
|
403 const TFSMailMsgId& aDestinationFolderId, |
|
404 MFSMailRequestObserver& aOperationObserver, |
|
405 TInt aRequestId ) |
|
406 { |
|
407 FUNC_LOG; |
|
408 TInt ret = KErrNone; |
|
409 if( aDestinationFolderId.Id() == KMsvDraftEntryId ) |
|
410 { |
|
411 // Move to Drafts folder |
|
412 MoveMessagesToDraftL( aMailBoxId, |
|
413 aMessageIds, |
|
414 aSourceFolderId, |
|
415 aDestinationFolderId ); |
|
416 TFSProgress progress = { |
|
417 TFSProgress::EFSStatus_RequestComplete, 0, 0, ret }; |
|
418 aOperationObserver.RequestResponseL( |
|
419 progress, aRequestId ); |
|
420 } |
|
421 else if( aDestinationFolderId.Id() != aSourceFolderId.Id() ) |
|
422 { |
|
423 TMsvId service = aMailBoxId.Id(); |
|
424 |
|
425 CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this); |
|
426 CleanupStack::PushL( watcher ); |
|
427 |
|
428 CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection; |
|
429 CleanupStack::PushL(sel); |
|
430 sel->AppendL( service ); |
|
431 |
|
432 TInt msgIdCount( aMessageIds.Count() ); |
|
433 for ( TInt i(0); i< msgIdCount; i++ ) |
|
434 { |
|
435 sel->AppendL( aMessageIds[i].Id() ); |
|
436 } |
|
437 |
|
438 TPckgBuf<TImImap4GetMailInfo> optionsBuf; |
|
439 TImImap4GetMailInfo& options = optionsBuf(); |
|
440 options.iMaxEmailSize = KMaxTInt32; |
|
441 options.iGetMailBodyParts = EGetImap4EmailBodyTextAndAttachments; |
|
442 options.iDestinationFolder = aDestinationFolderId.Id(); |
|
443 |
|
444 CIpsPlgBaseOperation* op = CIpsPlgImap4MoveRemoteOp::NewL( |
|
445 *iSession, |
|
446 watcher->iStatus, |
|
447 KIMAP4MTMMoveMailSelectionWhenAlreadyConnected, |
|
448 service, |
|
449 ActivityTimerL( aMailBoxId ), |
|
450 options, |
|
451 *sel, |
|
452 aMailBoxId, |
|
453 aOperationObserver, |
|
454 aRequestId ); |
|
455 |
|
456 watcher->SetOperation( op ); |
|
457 CleanupStack::PopAndDestroy( sel ); |
|
458 iOperations.AppendL( watcher ); |
|
459 CleanupStack::Pop( watcher ); |
|
460 } |
|
461 else |
|
462 { |
|
463 ret = KErrNotSupported; |
|
464 TFSProgress progress = { |
|
465 TFSProgress::EFSStatus_RequestComplete, 0, 0, ret }; |
|
466 aOperationObserver.RequestResponseL( |
|
467 progress, aRequestId ); |
|
468 } |
|
469 return ret; |
|
470 } |
|
471 |
387 |
472 // --------------------------------------------------------------------------- |
388 // --------------------------------------------------------------------------- |
473 // CIpsPlgImap4Plugin::FetchMessagePartsL() |
389 // CIpsPlgImap4Plugin::FetchMessagePartsL() |
474 // --------------------------------------------------------------------------- |
390 // --------------------------------------------------------------------------- |
475 // |
391 // |