72 } |
77 } |
73 |
78 |
74 // ----------------------------------------------------------------------------- |
79 // ----------------------------------------------------------------------------- |
75 // CFSMailBox::ConstructL |
80 // CFSMailBox::ConstructL |
76 // ----------------------------------------------------------------------------- |
81 // ----------------------------------------------------------------------------- |
77 void CFSMailBox::ConstructL( TFSMailMsgId aMailBoxId ) |
82 void CFSMailBox::ConstructL(TFSMailMsgId aMailBoxId) |
78 { |
83 { |
79 FUNC_LOG; |
84 FUNC_LOG; |
|
85 // <qmail> |
80 CFSMailBoxBase::ConstructL(aMailBoxId); |
86 CFSMailBoxBase::ConstructL(aMailBoxId); |
|
87 // </qmail> |
81 } |
88 } |
82 |
89 |
83 // ----------------------------------------------------------------------------- |
90 // ----------------------------------------------------------------------------- |
84 // CFSMailBox::GoOnlineL |
91 // CFSMailBox::GoOnlineL |
85 // ----------------------------------------------------------------------------- |
92 // ----------------------------------------------------------------------------- |
86 EXPORT_C void CFSMailBox::GoOnlineL() |
93 EXPORT_C void CFSMailBox::GoOnlineL() |
87 { |
94 { |
88 FUNC_LOG; |
95 FUNC_LOG; |
|
96 |
89 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
97 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
90 { |
98 { |
91 plugin->GoOnlineL( GetId() ); |
99 plugin->GoOnlineL( GetId() ); |
92 } |
100 } |
93 } |
101 } |
94 |
102 |
95 // ----------------------------------------------------------------------------- |
103 // ----------------------------------------------------------------------------- |
96 // CFSMailBox::GoOfflineL |
104 // CFSMailBox::GoOfflineL |
97 // ----------------------------------------------------------------------------- |
105 // ----------------------------------------------------------------------------- |
98 EXPORT_C void CFSMailBox::GoOfflineL() |
106 EXPORT_C void CFSMailBox::GoOfflineL() |
99 { |
107 { |
100 FUNC_LOG; |
108 FUNC_LOG; |
|
109 |
101 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
110 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
102 { |
111 { |
103 plugin->GoOfflineL( GetId() ); |
112 plugin->GoOfflineL( GetId() ); |
104 } |
113 } |
105 } |
114 |
|
115 } |
106 |
116 |
107 // ----------------------------------------------------------------------------- |
117 // ----------------------------------------------------------------------------- |
108 // CFSMailBox::CancelSyncL |
118 // CFSMailBox::CancelSyncL |
109 // ----------------------------------------------------------------------------- |
119 // ----------------------------------------------------------------------------- |
110 EXPORT_C void CFSMailBox::CancelSyncL() |
120 EXPORT_C void CFSMailBox::CancelSyncL() |
111 { |
121 { |
112 FUNC_LOG; |
122 FUNC_LOG; |
|
123 |
113 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
124 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
114 { |
125 { |
115 plugin->CancelSyncL( GetId() ); |
126 plugin->CancelSyncL( GetId() ); |
116 } |
127 } |
117 } |
128 } |
118 |
129 |
119 // ----------------------------------------------------------------------------- |
130 // ----------------------------------------------------------------------------- |
120 // CFSMailBox::GetLastSyncStatusL |
131 // CFSMailBox::GetLastSyncStatusL |
121 // ----------------------------------------------------------------------------- |
132 // ----------------------------------------------------------------------------- |
122 EXPORT_C TFSProgress CFSMailBox::GetLastSyncStatusL() |
133 EXPORT_C TFSProgress CFSMailBox::GetLastSyncStatusL() |
123 { |
134 { |
124 FUNC_LOG; |
135 FUNC_LOG; |
125 TFSProgress progress; |
136 TFSProgress progress; |
126 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
137 progress.iError = EFalse; |
127 { |
138 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
128 progress = plugin->GetLastSyncStatusL( GetId() ); |
139 { |
|
140 progress = plugin->GetLastSyncStatusL( GetId() ); |
129 } |
141 } |
130 return progress; |
142 return progress; |
131 } |
143 } |
132 |
144 |
133 // ----------------------------------------------------------------------------- |
145 // ----------------------------------------------------------------------------- |
134 // CFSMailBox::RefreshNowL |
146 // CFSMailBox::RefreshNowL |
135 // ----------------------------------------------------------------------------- |
147 // ----------------------------------------------------------------------------- |
136 EXPORT_C TInt CFSMailBox::RefreshNowL( |
148 EXPORT_C TInt CFSMailBox::RefreshNowL( |
137 MFSMailRequestObserver& aOperationObserver ) |
149 MFSMailRequestObserver& aOperationObserver ) |
138 { |
150 { |
139 FUNC_LOG; |
151 FUNC_LOG; |
140 |
152 |
141 TFSPendingRequest request; |
153 TFSPendingRequest request; |
|
154 request.iRequestId = 0; |
142 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
155 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
143 { |
156 { |
144 // init asynchronous request |
157 // init asynchronous request |
145 request = iRequestHandler->InitAsyncRequestL( GetId().PluginId(), |
158 request = iRequestHandler->InitAsyncRequestL( GetId().PluginId(), |
146 aOperationObserver ); |
159 aOperationObserver ); |
147 MFSMailRequestObserver* observer = request.iObserver; |
160 MFSMailRequestObserver* observer = request.iObserver; |
148 TRAPD(err,plugin->RefreshNowL( GetId(), *observer, request.iRequestId)); |
161 TRAPD(err,plugin->RefreshNowL( GetId(), *observer, request.iRequestId)); |
149 if(err != KErrNone) |
162 if(err != KErrNone) |
150 { |
163 { |
151 iRequestHandler->CompleteRequest(request.iRequestId); |
164 iRequestHandler->CompleteRequest(request.iRequestId); |
152 User::Leave(err); |
165 User::Leave(err); |
153 } |
166 } |
154 } |
167 } |
155 return request.iRequestId; |
168 return request.iRequestId; |
156 } |
169 |
|
170 } |
157 |
171 |
158 // ----------------------------------------------------------------------------- |
172 // ----------------------------------------------------------------------------- |
159 // CFSMailBox::RefreshNowL |
173 // CFSMailBox::RefreshNowL |
160 // ----------------------------------------------------------------------------- |
174 // ----------------------------------------------------------------------------- |
161 EXPORT_C TInt CFSMailBox::RefreshNowL() |
175 EXPORT_C TInt CFSMailBox::RefreshNowL( ) |
162 { |
176 { |
163 FUNC_LOG; |
177 FUNC_LOG; |
164 |
178 |
165 TFSPendingRequest request; |
179 TFSPendingRequest request; |
|
180 request.iRequestId = 0; |
166 MFSMailRequestObserver* observer = NULL; |
181 MFSMailRequestObserver* observer = NULL; |
167 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
182 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
168 { |
183 { |
169 // init asynchronous request |
184 // init asynchronous request |
170 request = iRequestHandler->InitAsyncRequestL( GetId().PluginId(), *observer ); |
185 request = iRequestHandler->InitAsyncRequestL( GetId().PluginId(), *observer ); |
171 |
186 |
172 observer = request.iObserver; |
187 observer = request.iObserver; |
173 TRAPD(err,plugin->RefreshNowL( GetId(), *observer, request.iRequestId)); |
188 TRAPD(err,plugin->RefreshNowL( GetId(), *observer, request.iRequestId)); |
174 if(err != KErrNone) |
189 if(err != KErrNone) |
175 { |
190 { |
176 iRequestHandler->CompleteRequest(request.iRequestId); |
191 iRequestHandler->CompleteRequest(request.iRequestId); |
177 User::Leave(err); |
192 User::Leave(err); |
178 } |
193 } |
179 } |
194 } |
180 return request.iRequestId; |
195 return request.iRequestId; |
181 } |
196 |
|
197 } |
182 |
198 |
183 // ----------------------------------------------------------------------------- |
199 // ----------------------------------------------------------------------------- |
184 // CFSMailBox::CreateMessageToSend |
200 // CFSMailBox::CreateMessageToSend |
185 // ----------------------------------------------------------------------------- |
201 // ----------------------------------------------------------------------------- |
186 EXPORT_C CFSMailMessage* CFSMailBox::CreateMessageToSend() |
202 EXPORT_C CFSMailMessage* CFSMailBox::CreateMessageToSend( ) |
187 { |
203 { |
188 FUNC_LOG; |
204 FUNC_LOG; |
189 |
205 |
190 CFSMailMessage* message = NULL; |
206 CFSMailMessage* message = NULL; |
191 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
207 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
481 |
497 |
482 // ----------------------------------------------------------------------------- |
498 // ----------------------------------------------------------------------------- |
483 // CFSMailBox::ListFolders |
499 // CFSMailBox::ListFolders |
484 // ----------------------------------------------------------------------------- |
500 // ----------------------------------------------------------------------------- |
485 EXPORT_C void CFSMailBox::ListFolders( TFSMailMsgId aFolder, |
501 EXPORT_C void CFSMailBox::ListFolders( TFSMailMsgId aFolder, |
486 RPointerArray<CFSMailFolder>& aFolderList ) |
502 RPointerArray<CFSMailFolder>& aFolderList) |
487 { |
503 { |
488 FUNC_LOG; |
504 FUNC_LOG; |
489 |
505 |
490 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
506 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
491 { |
507 { |
492 TRAPD(err, plugin->ListFoldersL(GetId(),aFolder,aFolderList)); |
508 TRAPD(err, plugin->ListFoldersL(GetId(),aFolder,aFolderList)); |
493 if(err != KErrNone) |
509 if(err != KErrNone) |
494 { |
510 { |
495 aFolderList.ResetAndDestroy(); |
511 aFolderList.ResetAndDestroy(); |
496 } |
512 } |
497 } |
513 } |
498 } |
514 } |
499 |
515 |
500 // ----------------------------------------------------------------------------- |
516 // ----------------------------------------------------------------------------- |
501 // CFSMailBox::ListFolders |
517 // CFSMailBox::ListFolders |
502 // ----------------------------------------------------------------------------- |
518 // ----------------------------------------------------------------------------- |
503 EXPORT_C RPointerArray<CFSMailFolder>& CFSMailBox::ListFolders() |
519 EXPORT_C RPointerArray<CFSMailFolder>& CFSMailBox::ListFolders( ) |
504 { |
520 { |
505 iFolders.ResetAndDestroy(); |
521 iFolders.ResetAndDestroy(); |
506 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
522 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
507 { |
523 { |
508 TRAPD(err,plugin->ListFoldersL(GetId(),iFolders)); |
524 TRAPD(err,plugin->ListFoldersL(GetId(),iFolders)); |
509 if(err != KErrNone) |
525 if(err != KErrNone) |
510 { |
526 { |
511 iFolders.ResetAndDestroy(); |
527 iFolders.ResetAndDestroy(); |
512 } |
528 } |
513 } |
529 } |
|
530 |
514 return iFolders; |
531 return iFolders; |
515 } |
532 } |
516 |
533 |
517 // ----------------------------------------------------------------------------- |
534 // ----------------------------------------------------------------------------- |
518 // CFSMailBox::GetBrandingIdL |
535 // CFSMailBox::GetBrandingIdL |
519 // ----------------------------------------------------------------------------- |
536 // ----------------------------------------------------------------------------- |
520 EXPORT_C TDesC& CFSMailBox::GetBrandingIdL() |
537 EXPORT_C TDesC& CFSMailBox::GetBrandingIdL( ) |
521 { |
538 { |
522 FUNC_LOG; |
539 FUNC_LOG; |
523 return BrandingId(); |
540 return BrandingId(); |
524 } |
541 } |
525 |
542 |
526 // ----------------------------------------------------------------------------- |
543 // ----------------------------------------------------------------------------- |
527 // CFSMailBox::MoveMessagesL |
544 // CFSMailBox::MoveMessagesL |
528 // ----------------------------------------------------------------------------- |
545 // ----------------------------------------------------------------------------- |
529 EXPORT_C void CFSMailBox::MoveMessagesL( const RArray<TFSMailMsgId>& aMessageIds, |
546 EXPORT_C void CFSMailBox::MoveMessagesL( const RArray<TFSMailMsgId>& aMessageIds, |
530 const TFSMailMsgId aSourceFolderId, |
547 const TFSMailMsgId aSourceFolderId, |
531 const TFSMailMsgId aDestinationFolderId ) |
548 const TFSMailMsgId aDestinationFolderId ) |
532 { |
549 { |
533 FUNC_LOG; |
550 FUNC_LOG; |
534 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
551 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
535 { |
552 { |
536 plugin->MoveMessagesL(GetId(), aMessageIds, aSourceFolderId, aDestinationFolderId); |
553 plugin->MoveMessagesL(GetId(), aMessageIds, aSourceFolderId, aDestinationFolderId); |
537 } |
554 } |
538 } |
555 } |
539 |
556 |
540 // ----------------------------------------------------------------------------- |
557 // ----------------------------------------------------------------------------- |
|
558 // CFSMailBox::MoveMessagesL |
|
559 // ----------------------------------------------------------------------------- |
|
560 EXPORT_C TInt CFSMailBox::MoveMessagesL( MFSMailRequestObserver& aOperationObserver, |
|
561 const RArray<TFSMailMsgId>& aMessageIds, |
|
562 const TFSMailMsgId aSourceFolderId, |
|
563 const TFSMailMsgId aDestinationFolderId ) |
|
564 { |
|
565 FUNC_LOG; |
|
566 TFSPendingRequest request; |
|
567 if( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetId() ) ) |
|
568 { |
|
569 // init asynchronous request |
|
570 request = iRequestHandler->InitAsyncRequestL( GetId().PluginId(), |
|
571 aOperationObserver ); |
|
572 plugin->MoveMessagesL( |
|
573 GetId(), |
|
574 aMessageIds, |
|
575 aSourceFolderId, |
|
576 aDestinationFolderId, |
|
577 aOperationObserver, |
|
578 request.iRequestId ); |
|
579 } |
|
580 return request.iRequestId; |
|
581 } |
|
582 |
|
583 // ----------------------------------------------------------------------------- |
541 // CFSMailBox::CopyMessagesL |
584 // CFSMailBox::CopyMessagesL |
542 // ----------------------------------------------------------------------------- |
585 // ----------------------------------------------------------------------------- |
543 EXPORT_C void CFSMailBox::CopyMessagesL( const RArray<TFSMailMsgId>& aMessageIds, |
586 EXPORT_C void CFSMailBox::CopyMessagesL( const RArray<TFSMailMsgId>& aMessageIds, |
544 RArray<TFSMailMsgId>& aNewMessages, |
587 RArray<TFSMailMsgId>& aNewMessages, |
545 const TFSMailMsgId aSourceFolderId, |
588 const TFSMailMsgId aSourceFolderId, |
546 const TFSMailMsgId aDestinationFolderId ) |
589 const TFSMailMsgId aDestinationFolderId ) |
547 { |
590 { |
548 FUNC_LOG; |
591 FUNC_LOG; |
549 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
592 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
550 { |
593 { |
551 plugin->CopyMessagesL(GetId(), aMessageIds, aNewMessages, |
594 plugin->CopyMessagesL(GetId(), aMessageIds, aNewMessages, |
552 aSourceFolderId, aDestinationFolderId ); |
595 aSourceFolderId, aDestinationFolderId ); |
553 } |
596 } |
554 } |
597 } |
555 |
598 |
556 // ----------------------------------------------------------------------------- |
599 // ----------------------------------------------------------------------------- |
557 // CFSMailBox::SearchL |
600 // CFSMailBox::SearchL |
558 // ----------------------------------------------------------------------------- |
601 // ----------------------------------------------------------------------------- |
559 EXPORT_C void CFSMailBox::SearchL( const RPointerArray<TDesC>& /*aSearchStrings*/, |
602 EXPORT_C void CFSMailBox::SearchL( const RPointerArray<TDesC>& /*aSearchStrings*/, |
560 const TFSMailSortCriteria& /*aSortCriteria*/, |
603 const TFSMailSortCriteria& /*aSortCriteria*/, |
561 MFSMailBoxSearchObserver& /*aSearchObserver*/, |
604 MFSMailBoxSearchObserver& /*aSearchObserver*/, |
562 const RArray<TFSMailMsgId> /*aFolderIds */ ) |
605 const RArray<TFSMailMsgId> /*aFolderIds */ ) |
563 { |
606 { |
564 FUNC_LOG; |
607 FUNC_LOG; |
565 } |
608 |
566 |
609 } |
|
610 |
567 // ----------------------------------------------------------------------------- |
611 // ----------------------------------------------------------------------------- |
568 // CFSMailBox::SearchL |
612 // CFSMailBox::SearchL |
569 // ----------------------------------------------------------------------------- |
613 // ----------------------------------------------------------------------------- |
570 EXPORT_C void CFSMailBox::SearchL( const RPointerArray<TDesC>& aSearchStrings, |
614 EXPORT_C void CFSMailBox::SearchL( const RPointerArray<TDesC>& aSearchStrings, |
571 const TFSMailSortCriteria& aSortCriteria, |
615 const TFSMailSortCriteria& aSortCriteria, |
572 MFSMailBoxSearchObserver& aSearchObserver ) |
616 MFSMailBoxSearchObserver& aSearchObserver ) |
573 { |
617 { |
574 FUNC_LOG; |
618 FUNC_LOG; |
575 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
619 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
576 { |
620 { |
|
621 |
577 // get mailbox folder list |
622 // get mailbox folder list |
578 iFolders.ResetAndDestroy(); |
623 iFolders.ResetAndDestroy(); |
579 plugin->ListFoldersL(GetId(),iFolders); |
624 plugin->ListFoldersL(GetId(),iFolders); |
580 |
625 |
581 TFSMailMsgId draftsFolderId = GetStandardFolderId( EFSDraftsFolder ); |
626 TFSMailMsgId draftsFolderId = GetStandardFolderId( EFSDraftsFolder ); |
582 TFSMailMsgId outboxId = GetStandardFolderId( EFSOutbox ); |
627 TFSMailMsgId outboxId = GetStandardFolderId( EFSOutbox ); |
583 |
628 |
584 // remove outbox, drafts folder from folder list |
629 // remove outbox, drafts folder from folder list |
585 RArray<TFSMailMsgId> folderIds; |
630 RArray<TFSMailMsgId> folderIds; |
586 folderIds.Reset(); |
631 folderIds.Reset(); |
587 for(TInt i=0;i<iFolders.Count();i++) |
632 for(TInt i=0;i<iFolders.Count();i++) |
588 { |
633 { |
589 TFSMailMsgId id = iFolders[i]->GetFolderId(); |
634 TFSMailMsgId id = iFolders[i]->GetFolderId(); |
590 if( id != draftsFolderId && id != outboxId ) |
635 if( id != draftsFolderId && id != outboxId ) |
591 { |
636 { |
592 folderIds.Append(id); |
637 folderIds.Append(id); |
593 } |
638 } |
594 } |
639 } |
595 |
640 |
596 // start search |
641 // start search |
597 plugin->SearchL( GetId(), folderIds, aSearchStrings, aSortCriteria, aSearchObserver ); |
642 plugin->SearchL( GetId(), folderIds, aSearchStrings, aSortCriteria, aSearchObserver ); |
598 folderIds.Reset(); |
643 folderIds.Reset(); |
599 } |
644 } |
600 } |
645 } |
601 |
646 |
602 // ----------------------------------------------------------------------------- |
647 // ----------------------------------------------------------------------------- |
603 // CFSMailBox::CancelSearch |
648 // CFSMailBox::CancelSearch |
604 // ----------------------------------------------------------------------------- |
649 // ----------------------------------------------------------------------------- |
605 EXPORT_C void CFSMailBox::CancelSearch() |
650 EXPORT_C void CFSMailBox::CancelSearch() |
606 { |
651 { |
607 FUNC_LOG; |
652 FUNC_LOG; |
608 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
653 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
609 { |
654 { |
610 plugin->CancelSearch( GetId() ); |
655 plugin->CancelSearch( GetId() ); |
611 } |
656 } |
612 } |
657 } |
613 |
658 |
614 // ----------------------------------------------------------------------------- |
659 // ----------------------------------------------------------------------------- |
615 // CFSMailBox::ClearSearchResultCache |
660 // CFSMailBox::ClearSearchResultCache |
616 // ----------------------------------------------------------------------------- |
661 // ----------------------------------------------------------------------------- |
617 EXPORT_C void CFSMailBox::ClearSearchResultCache() |
662 EXPORT_C void CFSMailBox::ClearSearchResultCache() |
618 { |
663 { |
619 FUNC_LOG; |
664 FUNC_LOG; |
620 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
665 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
621 { |
666 { |
622 plugin->ClearSearchResultCache( GetId() ); |
667 plugin->ClearSearchResultCache( GetId() ); |
623 } |
668 } |
624 } |
669 } |
625 |
670 |
626 // ----------------------------------------------------------------------------- |
671 // ----------------------------------------------------------------------------- |
627 // CFSMailBox::ListMrusL |
672 // CFSMailBox::ListMrusL |
628 // ----------------------------------------------------------------------------- |
673 // ----------------------------------------------------------------------------- |
629 EXPORT_C MDesCArray* CFSMailBox::ListMrusL() const |
674 EXPORT_C MDesCArray* CFSMailBox::ListMrusL() const |
630 { |
675 { |
631 FUNC_LOG; |
676 FUNC_LOG; |
632 MDesCArray* mruList(0); |
677 MDesCArray* mruList(0); |
633 if ( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId() ) ) |
678 if ( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId() ) ) |
634 { |
679 { |
635 mruList = plugin->GetMrusL( GetId() ); |
680 mruList = plugin->GetMrusL( GetId() ); |
636 } |
681 } |
637 return mruList; |
682 return mruList; |
638 } |
683 } |
639 |
684 |
640 |
685 |
641 // ----------------------------------------------------------------------------- |
686 // ----------------------------------------------------------------------------- |
642 // CFSMailBox::CurrentSyncState |
687 // CFSMailBox::CurrentSyncState |
643 // ----------------------------------------------------------------------------- |
688 // ----------------------------------------------------------------------------- |
644 EXPORT_C TSSMailSyncState CFSMailBox::CurrentSyncState() const |
689 EXPORT_C TSSMailSyncState CFSMailBox::CurrentSyncState() const |
645 { |
690 { |
646 FUNC_LOG; |
691 FUNC_LOG; |
647 TSSMailSyncState syncState(Idle); |
692 TSSMailSyncState syncState(Idle); |
648 if ( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetId() ) ) |
693 if ( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetId() ) ) |
649 { |
694 { |
650 syncState = plugin->CurrentSyncState( GetId() ); |
695 syncState = plugin->CurrentSyncState( GetId() ); |
651 } |
696 } |
652 return syncState; |
697 return syncState; |
653 } |
698 } |
654 |
699 |
655 // ----------------------------------------------------------------------------- |
700 // ----------------------------------------------------------------------------- |
656 // CFSMailBox::HasCapability |
701 // CFSMailBox::HasCapability |
657 // ----------------------------------------------------------------------------- |
702 // ----------------------------------------------------------------------------- |
658 EXPORT_C TBool CFSMailBox::HasCapability( const TFSMailBoxCapabilities aCapability ) const |
703 EXPORT_C TBool CFSMailBox::HasCapability( const TFSMailBoxCapabilities aCapability ) const |
713 { |
758 { |
714 folder->RemoveDownLoadedAttachmentsL(); |
759 folder->RemoveDownLoadedAttachmentsL(); |
715 delete folder; |
760 delete folder; |
716 } |
761 } |
717 } |
762 } |
718 } |
763 } |
719 |
764 |
720 // ----------------------------------------------------------------------------- |
765 // ----------------------------------------------------------------------------- |
721 // CFSMailBox::GetConnectionId |
766 // CFSMailBox::GetConnectionId |
722 // ----------------------------------------------------------------------------- |
767 // ----------------------------------------------------------------------------- |
723 EXPORT_C TInt CFSMailBox::GetConnectionId( TUint32& aConnectionId ) |
768 EXPORT_C TInt CFSMailBox::GetConnectionId( TUint32& aConnectionId ) |
724 { |
769 { |
725 FUNC_LOG; |
770 FUNC_LOG; |
726 TInt rcode = KErrNotSupported; |
771 TInt rcode = KErrNotSupported; |
727 if ( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetId() ) ) |
772 if ( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetId() ) ) |
728 { |
773 { |
729 rcode = plugin->GetConnectionId( GetId(), aConnectionId ); |
774 rcode = plugin->GetConnectionId( GetId(), aConnectionId ); |
730 } |
775 } |
731 return rcode; |
776 return rcode; |
732 } |
777 } |
733 |
778 |
734 // ----------------------------------------------------------------------------- |
779 // ----------------------------------------------------------------------------- |
735 // CFSMailBox::IsConnectionAllowedWhenRoaming |
780 // CFSMailBox::IsConnectionAllowedWhenRoaming |
736 // ----------------------------------------------------------------------------- |
781 // ----------------------------------------------------------------------------- |
737 EXPORT_C TInt CFSMailBox::IsConnectionAllowedWhenRoaming( TBool& aConnectionAllowed ) |
782 EXPORT_C TInt CFSMailBox::IsConnectionAllowedWhenRoaming( TBool& aConnectionAllowed ) |
738 { |
783 { |
739 FUNC_LOG; |
784 FUNC_LOG; |
740 TInt rcode = KErrNotSupported; |
785 TInt rcode = KErrNotSupported; |
741 if ( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetId() ) ) |
786 if ( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetId() ) ) |
742 { |
787 { |
743 rcode = plugin->IsConnectionAllowedWhenRoaming( GetId(), aConnectionAllowed ); |
788 rcode = plugin->IsConnectionAllowedWhenRoaming( GetId(), aConnectionAllowed ); |
744 } |
789 } |
745 return rcode; |
790 return rcode; |
|
791 } |
|
792 |
|
793 // ----------------------------------------------------------------------------- |
|
794 // CFSMailBox::CreateMessageFromFileL |
|
795 // ----------------------------------------------------------------------------- |
|
796 EXPORT_C CFSMailMessage* CFSMailBox::CreateMessageFromFileL( const RFile& aFile ) |
|
797 { |
|
798 FUNC_LOG; |
|
799 CFSMailMessage* message = NULL; |
|
800 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId())) |
|
801 { |
|
802 message = plugin->CreateMessageFromFileL( GetId(), aFile ); |
|
803 } |
|
804 return message; |
746 } |
805 } |
747 |
806 |
748 // ----------------------------------------------------------------------------- |
807 // ----------------------------------------------------------------------------- |
749 // CFSMailBox::UpdateMrusL |
808 // CFSMailBox::UpdateMrusL |
750 // ----------------------------------------------------------------------------- |
809 // ----------------------------------------------------------------------------- |
751 void CFSMailBox::UpdateMrusL( |
810 void CFSMailBox::UpdateMrusL( |
752 const RPointerArray<CFSMailAddress>& aRecipients, |
811 const RPointerArray<CFSMailAddress>& aRecipients, |
753 const RPointerArray<CFSMailAddress>& aCCRecipients, |
812 const RPointerArray<CFSMailAddress>& aCCRecipients, |
754 const RPointerArray<CFSMailAddress>& aBCCRecipients ) const |
813 const RPointerArray<CFSMailAddress>& aBCCRecipients ) const |
755 { |
814 { |
756 FUNC_LOG; |
815 FUNC_LOG; |
757 |
816 |
758 // First lets make a copy of the current mru list |
817 // First lets make a copy of the current mru list |
759 // whose content we can later alter as we wish |
818 // whose content we can later alter as we wish |
760 MDesCArray* currentMruList( NULL ); |
819 MDesCArray* currentMruList( NULL ); |
901 |
960 |
902 aPos = aMruList.Count(); |
961 aPos = aMruList.Count(); |
903 return 1; |
962 return 1; |
904 } |
963 } |
905 |
964 |
|
965 |
|
966 |
|
967 |
906 // ----------------------------------------------------------------------------- |
968 // ----------------------------------------------------------------------------- |
907 // CFSMailBox::AddAndRemoveExcessMruL |
969 // CFSMailBox::AddAndRemoveExcessMruL |
908 // ----------------------------------------------------------------------------- |
970 // ----------------------------------------------------------------------------- |
909 void CFSMailBox::AddAndRemoveExcessMruL( CDesCArraySeg& aMruList, |
971 void CFSMailBox::AddAndRemoveExcessMruL( CDesCArraySeg& aMruList, |
910 CFSMailAddress& aToBeAdded ) const |
972 CFSMailAddress& aToBeAdded ) const |
911 { |
973 { |
912 FUNC_LOG; |
974 FUNC_LOG; |
913 if ( aMruList.Count() == KMaxMruEntries ) |
975 if ( aMruList.Count() == KMaxMruEntries ) |
914 { |
976 { |
915 // Remove the oldest entry pair from the beginning |
977 // Remove the oldest entry pair from the beginning |
916 aMruList.Delete( 0, 2 ); |
978 aMruList.Delete( 0, 2 ); |
917 } |
979 } |
918 // Latest address is always found from the end. |
980 // Latest address is always found from the end. |
919 AppendMruItemL( aMruList, aToBeAdded ); |
981 AppendMruItemL( aMruList, aToBeAdded ); |
920 } |
982 } |
921 |
983 |
922 // ----------------------------------------------------------------------------- |
984 // ----------------------------------------------------------------------------- |
923 // CFSMailBox::SetAsMostRecentMruL |
985 // CFSMailBox::SetAsMostRecentMruL |
924 // ----------------------------------------------------------------------------- |
986 // ----------------------------------------------------------------------------- |
925 void CFSMailBox::SetAsMostRecentMruL( CDesCArraySeg& aMruList, |
987 void CFSMailBox::SetAsMostRecentMruL( CDesCArraySeg& aMruList, |
926 TInt aPosition, |
988 TInt aPosition, |
927 CFSMailAddress& aMostRecent ) const |
989 CFSMailAddress& aMostRecent ) const |
928 { |
990 { |
929 FUNC_LOG; |
991 FUNC_LOG; |
930 // Position of the address is given so the possible display name is |
992 // Position of the address is given so the possible display name is |
931 // in the previous slot. Delete both. |
993 // in the previous slot. Delete both. |
932 aMruList.Delete( aPosition - 1, 2 ); |
994 aMruList.Delete( aPosition - 1, 2 ); |
933 // Latest address is always found from the end. |
995 // Latest address is always found from the end. |
934 AppendMruItemL( aMruList, aMostRecent ); |
996 AppendMruItemL( aMruList, aMostRecent ); |
935 } |
997 } |
936 |
998 |
937 // ----------------------------------------------------------------------------- |
999 // ----------------------------------------------------------------------------- |
938 // CFSMailBox::AppendMruItemL |
1000 // CFSMailBox::AppendMruItemL |
939 // ----------------------------------------------------------------------------- |
1001 // ----------------------------------------------------------------------------- |
940 void CFSMailBox::AppendMruItemL( CDesCArraySeg& aMruList, |
1002 void CFSMailBox::AppendMruItemL( CDesCArraySeg& aMruList, |
941 CFSMailAddress& aToBeAppended ) const |
1003 CFSMailAddress& aToBeAppended ) const |
942 { |
1004 { |
943 FUNC_LOG; |
1005 FUNC_LOG; |
944 // In the array, display name is always the first and then comes |
1006 // In the array, display name is always the first and then comes |
945 // the actual address. |
1007 // the actual address. |
946 |
1008 |
947 // <cmail> avoid setting email address as display name so it won't |
1009 // <cmail> avoid setting email address as display name so it won't |
948 // be displayed twice in the list |
1010 // be displayed twice in the list |
949 TDesC* displayName = &aToBeAppended.GetDisplayName(); |
1011 TDesC* displayName = &aToBeAppended.GetDisplayName(); |
950 TDesC* emailAddress = &aToBeAppended.GetEmailAddress(); |
1012 TDesC* emailAddress = &aToBeAppended.GetEmailAddress(); |
951 |
1013 |
952 if( displayName->Length() > 0 && displayName->Compare(*emailAddress) == 0 ) |
1014 if( displayName->Length() > 0 && displayName->Compare(*emailAddress) == 0 ) |
953 { |
1015 { |
954 aMruList.AppendL( KNullDesC ); |
1016 aMruList.AppendL( KNullDesC ); |
955 } |
1017 } |
956 else |
1018 else |
957 { |
1019 { |
958 aMruList.AppendL( *displayName ); |
1020 aMruList.AppendL( *displayName ); |
959 } |
1021 } |
960 |
1022 |
961 aMruList.AppendL( *emailAddress ); |
1023 aMruList.AppendL( *emailAddress ); |
962 // </cmail> |
1024 } |
963 } |
1025 |
964 |
1026 // ----------------------------------------------------------------------------- |
|
1027 // CFSMailBox::ReleaseExtension |
|
1028 // ----------------------------------------------------------------------------- |
|
1029 EXPORT_C void CFSMailBox::ReleaseExtension( CEmailExtension* aExtension ) |
|
1030 { |
|
1031 FUNC_LOG; |
|
1032 // no specialized behaviour, call base class |
|
1033 CExtendableEmail::ReleaseExtension( aExtension ); |
|
1034 } |
|
1035 |
|
1036 // ----------------------------------------------------------------------------- |
|
1037 // CFSMailBox::ExtensionL |
|
1038 // ----------------------------------------------------------------------------- |
|
1039 EXPORT_C CEmailExtension* CFSMailBox::ExtensionL( const TUid& aInterfaceUid ) |
|
1040 { |
|
1041 FUNC_LOG; |
|
1042 CEmailExtension* extension = NULL; |
|
1043 if ( aInterfaceUid == KMailboxExtMrCalInfo ) |
|
1044 { |
|
1045 extension = CExtendableEmail::ExtensionL( aInterfaceUid ); |
|
1046 if ( extension == NULL ) |
|
1047 { |
|
1048 extension = new ( ELeave ) CMRCalendarInfoImpl(); |
|
1049 CleanupStack::PushL( extension ); |
|
1050 iExtensions.AddL( extension ); |
|
1051 CleanupStack::Pop(); // calInfo |
|
1052 } |
|
1053 } |
|
1054 else if ( aInterfaceUid == KEmailMailboxStateExtensionUid ) |
|
1055 { |
|
1056 if ( !extension ) |
|
1057 { |
|
1058 // check that plugin supports requested extension. |
|
1059 if ( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetId() ) ) |
|
1060 { |
|
1061 // request extension from plugin, leaves if not supported |
|
1062 extension = plugin->ExtensionL( aInterfaceUid ); |
|
1063 } |
|
1064 |
|
1065 } |
|
1066 } |
|
1067 else |
|
1068 { |
|
1069 User::Leave( KErrNotSupported ); |
|
1070 } |
|
1071 return extension; |
|
1072 } |
|
1073 |