264 { |
265 { |
265 CFSMailMessage* fsMessage = iFsMailbox->CreateMessageToSend(); |
266 CFSMailMessage* fsMessage = iFsMailbox->CreateMessageToSend(); |
266 User::LeaveIfNull( fsMessage ); |
267 User::LeaveIfNull( fsMessage ); |
267 CleanupStack::PushL( fsMessage ); |
268 CleanupStack::PushL( fsMessage ); |
268 MEmailMessage* message = CEmailMessage::NewL( iPluginData, fsMessage, EClientOwns ); |
269 MEmailMessage* message = CEmailMessage::NewL( iPluginData, fsMessage, EClientOwns ); |
269 CleanupStack::Pop(); // fsMessage |
270 CleanupStack::Pop( fsMessage ); |
270 |
271 |
271 return message; |
272 return message; |
272 } |
273 } |
273 |
274 |
274 // ----------------------------------------------------------------------------- |
275 // ----------------------------------------------------------------------------- |
275 // |
276 // |
276 // ----------------------------------------------------------------------------- |
277 // ----------------------------------------------------------------------------- |
277 MEmailMessage* CEmailMailbox::CreateReplyMessageL( const TMessageId& aMessageId, const TBool aReplyToAll ) const |
278 MEmailMessage* CEmailMailbox::CreateReplyMessageL( |
278 { |
279 const TMessageId& aMessageId, const TBool aReplyToAll ) const |
279 CFSMailMessage* fsMessage = iFsMailbox->CreateReplyMessage( FsMsgId( iPluginData, aMessageId ), aReplyToAll ); |
280 { |
|
281 CFSMailMessage* fsMessage = iFsMailbox->CreateReplyMessage( |
|
282 FsMsgId( iPluginData, aMessageId ), aReplyToAll ); |
280 User::LeaveIfNull( fsMessage ); |
283 User::LeaveIfNull( fsMessage ); |
281 CleanupStack::PushL( fsMessage ); |
284 CleanupStack::PushL( fsMessage ); |
282 MEmailMessage* message = CEmailMessage::NewL( iPluginData, fsMessage, EClientOwns ); |
285 MEmailMessage* message = CEmailMessage::NewL( iPluginData, fsMessage, EClientOwns ); |
283 CleanupStack::Pop(); // fsMessage |
286 CleanupStack::Pop( fsMessage ); |
284 |
287 |
285 return message; |
288 return message; |
286 } |
289 } |
287 |
290 |
288 // ----------------------------------------------------------------------------- |
291 // ----------------------------------------------------------------------------- |
289 // |
292 // |
290 // ----------------------------------------------------------------------------- |
293 // ----------------------------------------------------------------------------- |
291 MEmailMessage* CEmailMailbox::CreateForwardMessageL( const TMessageId& aMessageId ) const |
294 MEmailMessage* CEmailMailbox::CreateForwardMessageL( const TMessageId& aMessageId ) const |
292 { |
295 { |
293 // create temp header descriptor |
|
294 TReplyForwardParams params; |
|
295 params.iHeader = HBufC::NewLC(1); |
|
296 params.iHeader->Des().Copy(KNullDesC()); |
|
297 params.iSmartTag = HBufC::NewLC(1); |
|
298 params.iSmartTag->Des().Copy(KNullDesC()); |
|
299 TPckgBuf<TReplyForwardParams> buf( params ); |
|
300 HBufC* temp = HBufC::NewLC( buf.Length() ); |
|
301 temp->Des().Copy( buf ); |
|
302 |
|
303 CFSMailMessage* fsMessage = iFsMailbox->CreateForwardMessage( |
296 CFSMailMessage* fsMessage = iFsMailbox->CreateForwardMessage( |
304 FsMsgId( iPluginData, aMessageId ), *temp ); |
297 FsMsgId( iPluginData, aMessageId ), KNewLine() ); |
305 User::LeaveIfNull( fsMessage ); |
298 User::LeaveIfNull( fsMessage ); |
306 CleanupStack::PushL( fsMessage ); |
299 CleanupStack::PushL( fsMessage ); |
307 MEmailMessage* message = CEmailMessage::NewL( iPluginData, fsMessage, EClientOwns ); |
300 MEmailMessage* message = CEmailMessage::NewL( iPluginData, fsMessage, EClientOwns ); |
308 CleanupStack::Pop(); // fsMessage |
301 CleanupStack::Pop( fsMessage ); |
309 |
302 |
310 CleanupStack::PopAndDestroy( temp ); |
|
311 CleanupStack::PopAndDestroy( params.iSmartTag ); |
|
312 CleanupStack::PopAndDestroy( params.iHeader ); |
|
313 |
|
314 return message; |
303 return message; |
315 } |
304 } |
316 |
305 |
317 // ----------------------------------------------------------------------------- |
306 // ----------------------------------------------------------------------------- |
318 // |
307 // |
350 // ----------------------------------------------------------------------------- |
339 // ----------------------------------------------------------------------------- |
351 // |
340 // |
352 // ----------------------------------------------------------------------------- |
341 // ----------------------------------------------------------------------------- |
353 MEmailMessageSearchAsync* CEmailMailbox::MessageSearchL() |
342 MEmailMessageSearchAsync* CEmailMailbox::MessageSearchL() |
354 { |
343 { |
355 MEmailMessageSearchAsync* searchAPI = CEmailMessageSearchAsync::NewL( iPluginData, iMailboxId ); |
344 MEmailMessageSearchAsync* searchAPI = |
|
345 CEmailMessageSearchAsync::NewL( iPluginData, iMailboxId ); |
356 return searchAPI; |
346 return searchAPI; |
357 } |
347 } |
358 |
348 |
|
349 // ----------------------------------------------------------------------------- |
|
350 // |
|
351 // ----------------------------------------------------------------------------- |
359 void CEmailMailbox::ShowInboxL() |
352 void CEmailMailbox::ShowInboxL() |
360 { |
353 { |
361 TMailListActivationData mailListData; |
354 User::Leave( KErrNotSupported ); |
362 |
355 } |
363 mailListData.iMailBoxId = FsMsgId(iPluginData, iMailboxId); |
356 |
364 |
357 // ----------------------------------------------------------------------------- |
365 TPckgBuf<TMailListActivationData> pkgOut( mailListData ); |
358 // |
366 CVwsSessionWrapper* viewSrvSession = CVwsSessionWrapper::NewLC(); |
359 // ----------------------------------------------------------------------------- |
367 viewSrvSession->ActivateView(TVwsViewId(KFSEmailUiUid, MailListId), KStartListWithFolderId, pkgOut); |
|
368 CleanupStack::PopAndDestroy(); |
|
369 } |
|
370 |
|
371 void CEmailMailbox::EditNewMessageL() |
360 void CEmailMailbox::EditNewMessageL() |
372 { |
361 { |
373 TEditorLaunchParams editorLaunchData; |
362 bool syncronous; |
374 editorLaunchData.iExtra = NULL; |
363 |
375 editorLaunchData.iMailboxId = FsMsgId(iPluginData, iMailboxId); |
364 XQServiceRequest request( emailInterfaceNameSend, |
376 editorLaunchData.iActivatedExternally = ETrue; |
365 emailOperationSendMail, |
377 |
366 syncronous ); |
378 TPckgBuf<TEditorLaunchParams> pckgData( editorLaunchData ); |
367 |
379 CVwsSessionWrapper* viewSrvSession = CVwsSessionWrapper::NewLC(); |
368 QVariant returnValue; |
380 TUid command = TUid::Uid(KEditorCmdCreateNew); |
369 if ( !request.send( returnValue ) ) |
381 viewSrvSession->ActivateView(TVwsViewId(KFSEmailUiUid, MailEditorId), command, pckgData); |
370 User::Leave( KErrGeneral ); |
382 CleanupStack::PopAndDestroy( viewSrvSession ); |
371 } |
383 } |
372 |
384 /* |
|
385 void CEmailMailbox::GetLatestMail() |
|
386 { |
|
387 CFSMailFolder* fsFolder = NULL; |
|
388 TFSMailMsgId fsFolderId = iPlugin->GetStandardFolderIdL( FsMailboxId(), EFSInbox ); |
|
389 |
|
390 } |
|
391 */ |
|
392 // ----------------------------------------------------------------------------- |
373 // ----------------------------------------------------------------------------- |
393 // |
374 // |
394 // ----------------------------------------------------------------------------- |
375 // ----------------------------------------------------------------------------- |
395 CEmailMailbox::TObserverEventMapper::TObserverEventMapper( |
376 CEmailMailbox::TObserverEventMapper::TObserverEventMapper( |
396 CFSMailPlugin* aPlugin, |
377 CFSMailPlugin* aPlugin, |
488 TEventMapFunc method = KMailboxEventHandlers[ index ]; |
473 TEventMapFunc method = KMailboxEventHandlers[ index ]; |
489 (this->*method)(id, aParam1,aParam2,aParam3 ); |
474 (this->*method)(id, aParam1,aParam2,aParam3 ); |
490 } |
475 } |
491 } |
476 } |
492 |
477 |
493 void CEmailMailbox::TObserverEventMapper::ConvertParamsL( TMailboxId aMailbox, TAny* aParam1, |
478 // ----------------------------------------------------------------------------- |
494 TAny* aParam2, REmailMessageIdArray& aMessageIds, TFolderId& aFolderId ) |
479 // |
495 { |
480 // ----------------------------------------------------------------------------- |
|
481 void CEmailMailbox::TObserverEventMapper::ConvertParamsL( |
|
482 TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, |
|
483 REmailMessageIdArray& aMessageIds, TFolderId& aFolderId ) |
|
484 { |
496 RArray<TFSMailMsgId>* newEntries( static_cast< RArray<TFSMailMsgId>* >( aParam1 ) ); |
485 RArray<TFSMailMsgId>* newEntries( static_cast< RArray<TFSMailMsgId>* >( aParam1 ) ); |
497 CleanupClosePushL( *newEntries ); |
486 CleanupClosePushL( *newEntries ); |
498 TFSMailMsgId* parentFolder = static_cast<TFSMailMsgId*>( aParam2 ); |
487 TFSMailMsgId* parentFolder = static_cast<TFSMailMsgId*>( aParam2 ); |
499 aFolderId = TFolderId( parentFolder->Id(), aMailbox ); |
488 aFolderId = TFolderId( parentFolder->Id(), aMailbox ); |
500 |
489 |
501 for (TInt j = 0; j < newEntries->Count(); j++ ) |
490 for ( TInt j = 0; j < newEntries->Count(); j++ ) |
502 { |
491 { |
503 TFSMailMsgId fsId(( *newEntries )[j]); |
492 TFSMailMsgId fsId(( *newEntries )[j] ); |
504 TMessageId messageId( fsId.Id(), aFolderId.iId, aMailbox); |
493 TMessageId messageId( fsId.Id(), aFolderId.iId, aMailbox ); |
505 aMessageIds.Append(messageId); |
494 aMessageIds.Append( messageId ); |
506 } |
495 } |
507 |
496 |
508 CleanupStack::PopAndDestroy( newEntries ); |
497 CleanupStack::PopAndDestroy( newEntries ); |
509 } |
498 } |
510 |
499 |
|
500 // ----------------------------------------------------------------------------- |
|
501 // |
|
502 // ----------------------------------------------------------------------------- |
511 void CEmailMailbox::TObserverEventMapper::IgnoreEventL( |
503 void CEmailMailbox::TObserverEventMapper::IgnoreEventL( |
512 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
504 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
513 { |
505 { |
514 } |
506 } |
515 |
507 |
|
508 // ----------------------------------------------------------------------------- |
|
509 // |
|
510 // ----------------------------------------------------------------------------- |
516 void CEmailMailbox::TObserverEventMapper::NewMessageL( |
511 void CEmailMailbox::TObserverEventMapper::NewMessageL( |
517 TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* /*aParam3*/ ) |
512 TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* /*aParam3*/ ) |
518 { |
513 { |
|
514 REmailMessageIdArray messageIds; |
|
515 TFolderId folderId; |
|
516 ConvertParamsL( aMailbox, aParam1, aParam2, messageIds, folderId ); |
|
517 CleanupClosePushL( messageIds ); |
|
518 |
|
519 for ( TInt i = 0; i < iClientObservers.Count(); i++ ) |
|
520 { |
|
521 MMailboxContentObserver* observer = iClientObservers[i]; |
|
522 if (observer) |
|
523 observer->NewMessageEventL( aMailbox, messageIds, folderId ); |
|
524 } |
|
525 |
|
526 CleanupStack::PopAndDestroy( &messageIds ); |
|
527 } |
|
528 |
|
529 // ----------------------------------------------------------------------------- |
|
530 // |
|
531 // ----------------------------------------------------------------------------- |
|
532 void CEmailMailbox::TObserverEventMapper::MessageChangedL( |
|
533 TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* /*aParam3*/ ) |
|
534 { |
|
535 REmailMessageIdArray messageIds; |
|
536 TFolderId folderId; |
|
537 ConvertParamsL( aMailbox, aParam1, aParam2, messageIds, folderId ); |
|
538 CleanupClosePushL( messageIds ); |
|
539 |
|
540 for ( TInt i = 0; i < iClientObservers.Count(); i++ ) |
|
541 { |
|
542 MMailboxContentObserver* observer = iClientObservers[i]; |
|
543 if (observer) |
|
544 observer->MessageChangedEventL( aMailbox, messageIds, folderId ); |
|
545 } |
|
546 CleanupStack::PopAndDestroy( &messageIds ); |
|
547 } |
|
548 |
|
549 // ----------------------------------------------------------------------------- |
|
550 // |
|
551 // ----------------------------------------------------------------------------- |
|
552 void CEmailMailbox::TObserverEventMapper::MessageDeletedL( |
|
553 TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* /*aParam3*/ ) |
|
554 { |
519 REmailMessageIdArray messageIds; |
555 REmailMessageIdArray messageIds; |
520 TFolderId folderId; |
556 TFolderId folderId; |
521 ConvertParamsL( aMailbox, aParam1, aParam2, messageIds, folderId ); |
557 ConvertParamsL( aMailbox, aParam1, aParam2, messageIds, folderId ); |
522 for ( TInt i = 0; i < iClientObservers.Count(); i++ ) |
558 CleanupClosePushL( messageIds ); |
|
559 |
|
560 for ( TInt i = 0; i < iClientObservers.Count(); i++ ) |
523 { |
561 { |
524 MMailboxContentObserver* observer = iClientObservers[i]; |
562 MMailboxContentObserver* observer = iClientObservers[i]; |
525 observer->NewMessageEventL( aMailbox, messageIds, folderId ); |
563 if (observer) |
526 } |
564 observer->MessageDeletedEventL( aMailbox, messageIds, folderId ); |
527 } |
565 } |
528 |
|
529 void CEmailMailbox::TObserverEventMapper::MessageChangedL( |
|
530 TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* /*aParam3*/ ) |
|
531 { |
|
532 REmailMessageIdArray messageIds; |
|
533 TFolderId folderId; |
|
534 ConvertParamsL( aMailbox, aParam1, aParam2, messageIds, folderId ); |
|
535 |
566 |
536 for ( TInt i = 0; i < iClientObservers.Count(); i++ ) |
567 CleanupStack::PopAndDestroy( &messageIds ); |
537 { |
568 } |
538 MMailboxContentObserver* observer = iClientObservers[i]; |
569 |
539 observer->MessageChangedEventL( aMailbox, messageIds, folderId ); |
570 // ----------------------------------------------------------------------------- |
540 } |
571 // |
541 } |
572 // ----------------------------------------------------------------------------- |
542 |
|
543 void CEmailMailbox::TObserverEventMapper::MessageDeletedL( |
|
544 TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* /*aParam3*/ ) |
|
545 { |
|
546 REmailMessageIdArray messageIds; |
|
547 TFolderId folderId; |
|
548 ConvertParamsL( aMailbox, aParam1, aParam2, messageIds, folderId ); |
|
549 |
|
550 for ( TInt i = 0; i < iClientObservers.Count(); i++ ) |
|
551 { |
|
552 MMailboxContentObserver* observer = iClientObservers[i]; |
|
553 observer->MessageDeletedEventL( aMailbox, messageIds, folderId ); |
|
554 } |
|
555 } |
|
556 |
|
557 void CEmailMailbox::TObserverEventMapper::MessageMoved( |
573 void CEmailMailbox::TObserverEventMapper::MessageMoved( |
558 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
574 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
559 { |
575 { |
560 } |
576 } |
561 |
577 |
|
578 // ----------------------------------------------------------------------------- |
|
579 // |
|
580 // ----------------------------------------------------------------------------- |
562 void CEmailMailbox::TObserverEventMapper::MessageCopiedL( |
581 void CEmailMailbox::TObserverEventMapper::MessageCopiedL( |
563 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
582 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
564 { |
583 { |
565 } |
584 } |
566 |
585 |
|
586 // ----------------------------------------------------------------------------- |
|
587 // |
|
588 // ----------------------------------------------------------------------------- |
567 void CEmailMailbox::TObserverEventMapper::NewFolderL( |
589 void CEmailMailbox::TObserverEventMapper::NewFolderL( |
568 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
590 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
569 { |
591 { |
570 } |
592 } |
571 |
593 |
|
594 // ----------------------------------------------------------------------------- |
|
595 // |
|
596 // ----------------------------------------------------------------------------- |
572 void CEmailMailbox::TObserverEventMapper::FolderChangeL( |
597 void CEmailMailbox::TObserverEventMapper::FolderChangeL( |
573 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
598 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
574 { |
599 { |
575 } |
600 } |
576 |
601 |
|
602 // ----------------------------------------------------------------------------- |
|
603 // |
|
604 // ----------------------------------------------------------------------------- |
577 void CEmailMailbox::TObserverEventMapper::FoldersDeletedL( |
605 void CEmailMailbox::TObserverEventMapper::FoldersDeletedL( |
578 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
606 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
579 { |
607 { |
580 } |
608 } |
581 |
609 |
|
610 // ----------------------------------------------------------------------------- |
|
611 // |
|
612 // ----------------------------------------------------------------------------- |
582 void CEmailMailbox::TObserverEventMapper::FoldersMovedL( |
613 void CEmailMailbox::TObserverEventMapper::FoldersMovedL( |
583 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
614 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
584 { |
615 { |
585 } |
616 } |
586 |
617 |
|
618 // ----------------------------------------------------------------------------- |
|
619 // |
|
620 // ----------------------------------------------------------------------------- |
587 void CEmailMailbox::TObserverEventMapper::ExceptionL( |
621 void CEmailMailbox::TObserverEventMapper::ExceptionL( |
588 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
622 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
589 { |
623 { |
590 } |
624 } |
591 |
625 |
592 |
626 // ----------------------------------------------------------------------------- |
593 // ----------------------------------------------------------------------------- |
627 // |
594 // |
628 // ----------------------------------------------------------------------------- |
595 // ----------------------------------------------------------------------------- |
629 TBool CEmailMailbox::TObserverEventMapper::Equals( |
596 TBool CEmailMailbox::TObserverEventMapper::Equals( const MMailboxContentObserver& a1, const MMailboxContentObserver& a2 ) |
630 const MMailboxContentObserver& a1, const MMailboxContentObserver& a2 ) |
597 { |
631 { |
598 return ( &a1 == &a2 ); |
632 return ( &a1 == &a2 ); |
599 } |
633 } |
600 |
634 // ----------------------------------------------------------------------------- |
601 |
635 // |
|
636 // ----------------------------------------------------------------------------- |
602 CEmailMailbox::CEmailRequestObserver::CEmailRequestObserver() : iObserver( NULL ) |
637 CEmailMailbox::CEmailRequestObserver::CEmailRequestObserver() : iObserver( NULL ) |
603 { |
638 { |
604 } |
639 } |
605 |
640 |
606 |
641 // ----------------------------------------------------------------------------- |
607 void CEmailMailbox::CEmailRequestObserver::RequestResponseL( TFSProgress aEvent, TInt /* aRequestId */ ) |
642 // |
608 { |
643 // ----------------------------------------------------------------------------- |
609 if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete) |
644 void CEmailMailbox::CEmailRequestObserver::RequestResponseL( |
|
645 TFSProgress aEvent, TInt /* aRequestId */ ) |
|
646 { |
|
647 if ( iObserver && aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete ) |
610 { |
648 { |
611 iObserver->MailboxSynchronisedL(aEvent.iError); |
649 iObserver->MailboxSynchronisedL(aEvent.iError); |
612 } |
650 } |
613 } |
651 } |
614 |
652 |
|
653 // ----------------------------------------------------------------------------- |
|
654 // |
|
655 // ----------------------------------------------------------------------------- |
615 void CEmailMailbox::CEmailRequestObserver::SetObserverL( MMailboxSyncObserver* aObserver ) |
656 void CEmailMailbox::CEmailRequestObserver::SetObserverL( MMailboxSyncObserver* aObserver ) |
616 { |
657 { |
617 iObserver = aObserver; |
658 iObserver = aObserver; |
618 } |
659 } |
619 |
660 |
620 // End of file. |
661 // End of file |
621 |
662 |