|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This file implements class CEmailMailbox. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <e32cmn.h> |
|
19 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
20 #include <viewclipartner.h> |
|
21 #include <vwsdefpartner.h> |
|
22 #else |
|
23 #include <viewcli.h> |
|
24 #include <vwsdef.h> |
|
25 #endif // SYMBIAN_ENABLE_SPLIT_HEADERS |
|
26 |
|
27 #include <mmailboxsyncobserver.h> |
|
28 #include "emailmailbox.h" |
|
29 #include "emailapiutils.h" |
|
30 #include "emailaddress.h" |
|
31 #include "emailfolder.h" |
|
32 #include "emailmessage.h" |
|
33 #include "emailmessagesearch.h" |
|
34 #include "cfsmailclient.h" |
|
35 #include "emailclientapiimpl.h" |
|
36 #include "cfsmailplugin.h" |
|
37 #include "cfsmailbox.h" |
|
38 #include "cfsmailfolder.h" |
|
39 #include "emailclientapi.hrh" |
|
40 |
|
41 #include <XQServiceRequest.h> |
|
42 #include "email_services_api.h" |
|
43 |
|
44 // Constants |
|
45 |
|
46 #include <QStringList> |
|
47 |
|
48 _LIT( KNewLine, "\n" ); |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 // ----------------------------------------------------------------------------- |
|
53 CEmailMailbox* CEmailMailbox::NewL( |
|
54 CPluginData& aPluginData, |
|
55 const TMailboxId& aMailboxId ) |
|
56 { |
|
57 CEmailMailbox* self = new ( ELeave ) CEmailMailbox( aPluginData, aMailboxId ); |
|
58 CleanupStack::PushL( self ); |
|
59 self->ConstructL(); |
|
60 CleanupStack::Pop( self ); |
|
61 return self; |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 // ----------------------------------------------------------------------------- |
|
67 CEmailMailbox::CEmailMailbox( |
|
68 CPluginData& aPluginData, |
|
69 const TMailboxId& aMailboxId ) |
|
70 : iPluginData( aPluginData ), |
|
71 iMailboxId( aMailboxId.iId ) |
|
72 { |
|
73 } |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 // ----------------------------------------------------------------------------- |
|
78 void CEmailMailbox::ConstructL() |
|
79 { |
|
80 iPlugin = iPluginData.ClaimInstanceL(); |
|
81 iEventMapper = new ( ELeave ) TObserverEventMapper( |
|
82 iPlugin, iPluginData.Uid(), iMailboxId ); |
|
83 iFsMailbox = iPlugin->GetMailBoxByUidL( FsMailboxId() ); |
|
84 iSyncObserver = new ( ELeave ) CEmailMailbox::CEmailRequestObserver(); |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 // ----------------------------------------------------------------------------- |
|
90 CEmailMailbox::~CEmailMailbox() |
|
91 { |
|
92 delete iFsMailbox; |
|
93 delete iEventMapper; |
|
94 delete iAddress; |
|
95 iPluginData.ReleaseInstance(); |
|
96 delete iSyncObserver; |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 // ----------------------------------------------------------------------------- |
|
102 TEmailTypeId CEmailMailbox::InterfaceId() const |
|
103 { |
|
104 return KEmailIFUidMailbox; |
|
105 } |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 // ----------------------------------------------------------------------------- |
|
110 void CEmailMailbox::Release() |
|
111 { |
|
112 delete this; |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 // ----------------------------------------------------------------------------- |
|
118 TMailboxId CEmailMailbox::MailboxId() const |
|
119 { |
|
120 return iMailboxId; |
|
121 } |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 // ----------------------------------------------------------------------------- |
|
126 MEmailAddress* CEmailMailbox::AddressL() const |
|
127 { |
|
128 if ( !iAddress ) |
|
129 { |
|
130 iAddress = CEmailAddress::NewL( |
|
131 MEmailAddress::ESender, EAPIOwns ); |
|
132 iAddress->SetDisplayNameL( iFsMailbox->GetName() ); |
|
133 iAddress->SetAddressL( iFsMailbox->OwnMailAddress().GetEmailAddress() ); |
|
134 } |
|
135 return iAddress; |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 // ----------------------------------------------------------------------------- |
|
141 TPtrC CEmailMailbox::MailboxName() const |
|
142 { |
|
143 return iFsMailbox->GetName(); |
|
144 } |
|
145 |
|
146 // ----------------------------------------------------------------------------- |
|
147 // Constructs and returns type mailbox id of internal data type TFSMailMsgId |
|
148 // ----------------------------------------------------------------------------- |
|
149 TFSMailMsgId CEmailMailbox::FsMailboxId() const |
|
150 { |
|
151 return FsMsgId( iPluginData, iMailboxId ); |
|
152 } |
|
153 |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 // ----------------------------------------------------------------------------- |
|
157 TInt CEmailMailbox::GetFoldersL( RFolderArray& aFolders ) const |
|
158 { |
|
159 TFSMailMsgId rootId = TFSMailMsgId(); |
|
160 RPointerArray<CFSMailFolder> folders; |
|
161 CleanupResetAndDestroyPushL( folders ); |
|
162 iPlugin->ListFoldersL( FsMailboxId(), rootId, folders ); |
|
163 TInt res( folders.Count() ); |
|
164 for ( TInt i = 0; i < res; i++ ) |
|
165 { |
|
166 const CFSMailFolder* fsfolder = folders[i]; |
|
167 const TEntryId id = fsfolder->GetFolderId().Id(); |
|
168 const TFolderId folderId( id, iMailboxId ); |
|
169 CEmailFolder* folder = CEmailFolder::NewLC( iPluginData, folderId, folders[i] ); |
|
170 aFolders.AppendL( folder ); |
|
171 CleanupStack::Pop( folder ); |
|
172 } |
|
173 CleanupStack::Pop( &folders ); |
|
174 folders.Close(); // close but don't delete folders because they are |
|
175 // owned by CEmailFolder |
|
176 return res; |
|
177 } |
|
178 |
|
179 // ----------------------------------------------------------------------------- |
|
180 // |
|
181 // ----------------------------------------------------------------------------- |
|
182 MEmailFolder* CEmailMailbox::FolderL( const TFolderId& aFolderId ) const |
|
183 { |
|
184 CFSMailFolder* fsFolder = iPlugin->GetFolderByUidL( |
|
185 FsMsgId( iPluginData, iMailboxId ), |
|
186 FsMsgId( iPluginData, aFolderId ) ); |
|
187 CleanupStack::PushL( fsFolder ); |
|
188 |
|
189 CEmailFolder* folder = CEmailFolder::NewL( iPluginData, |
|
190 aFolderId, fsFolder ); |
|
191 CleanupStack::Pop( fsFolder ); |
|
192 |
|
193 return folder; |
|
194 } |
|
195 |
|
196 // ----------------------------------------------------------------------------- |
|
197 // |
|
198 // ----------------------------------------------------------------------------- |
|
199 MEmailFolder* CEmailMailbox::FolderByTypeL( |
|
200 const TFolderType aFolderType ) const |
|
201 { |
|
202 TFSMailMsgId fsFolderId; |
|
203 |
|
204 switch ( aFolderType ) |
|
205 { |
|
206 case EInbox: |
|
207 fsFolderId = iPlugin->GetStandardFolderIdL( FsMailboxId(), EFSInbox ); |
|
208 break; |
|
209 case EOutbox: |
|
210 fsFolderId = iPlugin->GetStandardFolderIdL( FsMailboxId(), EFSOutbox ); |
|
211 break; |
|
212 case EDrafts: |
|
213 fsFolderId = iPlugin->GetStandardFolderIdL( FsMailboxId(), EFSDraftsFolder ); |
|
214 break; |
|
215 case EDeleted: |
|
216 fsFolderId = iPlugin->GetStandardFolderIdL( FsMailboxId(), EFSDeleted ); |
|
217 break; |
|
218 case ESent: |
|
219 fsFolderId = iPlugin->GetStandardFolderIdL( FsMailboxId(), EFSSentFolder ); |
|
220 break; |
|
221 case EOther: |
|
222 default: |
|
223 User::Leave( KErrNotFound ); |
|
224 break; |
|
225 } |
|
226 |
|
227 const TFolderId folderId( fsFolderId.Id(), iMailboxId ); |
|
228 |
|
229 CFSMailFolder* fsFolder = iPlugin->GetFolderByUidL( |
|
230 FsMsgId( iPluginData, iMailboxId ), |
|
231 fsFolderId ); |
|
232 CleanupStack::PushL( fsFolder ); |
|
233 |
|
234 CEmailFolder* folder = CEmailFolder::NewL( iPluginData, |
|
235 folderId, |
|
236 fsFolder ); |
|
237 |
|
238 CleanupStack::Pop( fsFolder ); |
|
239 |
|
240 return folder; |
|
241 } |
|
242 |
|
243 // ----------------------------------------------------------------------------- |
|
244 // |
|
245 // ----------------------------------------------------------------------------- |
|
246 MEmailMessage* CEmailMailbox::MessageL( const TMessageId& aMessageId ) |
|
247 { |
|
248 CFSMailMessage *fsMessage = iPlugin->GetMessageByUidL( |
|
249 FsMsgId( iPluginData, aMessageId.iFolderId.iMailboxId ), |
|
250 FsMsgId( iPluginData, aMessageId.iFolderId ), |
|
251 FsMsgId( iPluginData, aMessageId ), |
|
252 EFSMsgDataEnvelope ); |
|
253 |
|
254 CleanupStack::PushL( fsMessage ); |
|
255 CEmailMessage* message = CEmailMessage::NewL( iPluginData, fsMessage, EClientOwns ); |
|
256 CleanupStack::Pop( fsMessage ); |
|
257 |
|
258 return message; |
|
259 } |
|
260 |
|
261 // ----------------------------------------------------------------------------- |
|
262 // |
|
263 // ----------------------------------------------------------------------------- |
|
264 MEmailMessage* CEmailMailbox::CreateDraftMessageL() const |
|
265 { |
|
266 CFSMailMessage* fsMessage = iFsMailbox->CreateMessageToSend(); |
|
267 User::LeaveIfNull( fsMessage ); |
|
268 CleanupStack::PushL( fsMessage ); |
|
269 MEmailMessage* message = CEmailMessage::NewL( iPluginData, fsMessage, EClientOwns ); |
|
270 CleanupStack::Pop( fsMessage ); |
|
271 |
|
272 return message; |
|
273 } |
|
274 |
|
275 // ----------------------------------------------------------------------------- |
|
276 // |
|
277 // ----------------------------------------------------------------------------- |
|
278 MEmailMessage* CEmailMailbox::CreateReplyMessageL( |
|
279 const TMessageId& aMessageId, const TBool aReplyToAll ) const |
|
280 { |
|
281 CFSMailMessage* fsMessage = iFsMailbox->CreateReplyMessage( |
|
282 FsMsgId( iPluginData, aMessageId ), aReplyToAll ); |
|
283 User::LeaveIfNull( fsMessage ); |
|
284 CleanupStack::PushL( fsMessage ); |
|
285 MEmailMessage* message = CEmailMessage::NewL( iPluginData, fsMessage, EClientOwns ); |
|
286 CleanupStack::Pop( fsMessage ); |
|
287 |
|
288 return message; |
|
289 } |
|
290 |
|
291 // ----------------------------------------------------------------------------- |
|
292 // |
|
293 // ----------------------------------------------------------------------------- |
|
294 MEmailMessage* CEmailMailbox::CreateForwardMessageL( const TMessageId& aMessageId ) const |
|
295 { |
|
296 CFSMailMessage* fsMessage = iFsMailbox->CreateForwardMessage( |
|
297 FsMsgId( iPluginData, aMessageId ), KNewLine() ); |
|
298 User::LeaveIfNull( fsMessage ); |
|
299 CleanupStack::PushL( fsMessage ); |
|
300 MEmailMessage* message = CEmailMessage::NewL( iPluginData, fsMessage, EClientOwns ); |
|
301 CleanupStack::Pop( fsMessage ); |
|
302 |
|
303 return message; |
|
304 } |
|
305 |
|
306 // ----------------------------------------------------------------------------- |
|
307 // |
|
308 // ----------------------------------------------------------------------------- |
|
309 void CEmailMailbox::SynchroniseL( MMailboxSyncObserver& aObserver ) |
|
310 { |
|
311 iSyncObserver->SetObserverL( &aObserver ); |
|
312 iRequestId = iFsMailbox->RefreshNowL( *iSyncObserver ); |
|
313 } |
|
314 |
|
315 // ----------------------------------------------------------------------------- |
|
316 // |
|
317 // ----------------------------------------------------------------------------- |
|
318 void CEmailMailbox::CancelSynchronise() |
|
319 { |
|
320 iFsMailbox->CancelSearch(); |
|
321 } |
|
322 |
|
323 // ----------------------------------------------------------------------------- |
|
324 // |
|
325 // ----------------------------------------------------------------------------- |
|
326 void CEmailMailbox::RegisterObserverL( MMailboxContentObserver& aObserver ) |
|
327 { |
|
328 iEventMapper->AddObserverL( aObserver ); |
|
329 } |
|
330 |
|
331 // ----------------------------------------------------------------------------- |
|
332 // |
|
333 // ----------------------------------------------------------------------------- |
|
334 void CEmailMailbox::UnregisterObserver( MMailboxContentObserver& aObserver ) |
|
335 { |
|
336 iEventMapper->RemoveObserver( aObserver ); |
|
337 } |
|
338 |
|
339 // ----------------------------------------------------------------------------- |
|
340 // |
|
341 // ----------------------------------------------------------------------------- |
|
342 MEmailMessageSearchAsync* CEmailMailbox::MessageSearchL() |
|
343 { |
|
344 MEmailMessageSearchAsync* searchAPI = |
|
345 CEmailMessageSearchAsync::NewL( iPluginData, iMailboxId ); |
|
346 return searchAPI; |
|
347 } |
|
348 |
|
349 // ----------------------------------------------------------------------------- |
|
350 // |
|
351 // ----------------------------------------------------------------------------- |
|
352 void CEmailMailbox::ShowInboxL() |
|
353 { |
|
354 User::Leave( KErrNotSupported ); |
|
355 } |
|
356 |
|
357 // ----------------------------------------------------------------------------- |
|
358 // |
|
359 // ----------------------------------------------------------------------------- |
|
360 void CEmailMailbox::EditNewMessageL() |
|
361 { |
|
362 bool syncronous; |
|
363 |
|
364 XQServiceRequest request( emailInterfaceNameSend, |
|
365 emailOperationSendMail, |
|
366 syncronous ); |
|
367 |
|
368 QVariant returnValue; |
|
369 if ( !request.send( returnValue ) ) |
|
370 User::Leave( KErrGeneral ); |
|
371 } |
|
372 |
|
373 // ----------------------------------------------------------------------------- |
|
374 // |
|
375 // ----------------------------------------------------------------------------- |
|
376 CEmailMailbox::TObserverEventMapper::TObserverEventMapper( |
|
377 CFSMailPlugin* aPlugin, |
|
378 TUid aPluginUid, const TMailboxId& aMailboxId ) |
|
379 : iPlugin( aPlugin ), |
|
380 iFsMailboxId( aPluginUid.iUid, aMailboxId.iId ) |
|
381 { |
|
382 } |
|
383 |
|
384 // ----------------------------------------------------------------------------- |
|
385 // |
|
386 // ----------------------------------------------------------------------------- |
|
387 CEmailMailbox::TObserverEventMapper::~TObserverEventMapper() |
|
388 { |
|
389 iClientObservers.Close(); |
|
390 } |
|
391 |
|
392 // ----------------------------------------------------------------------------- |
|
393 // Adds mailbox observer and subscribes to plugin mailbox events if there |
|
394 // were no previous observers. |
|
395 // ----------------------------------------------------------------------------- |
|
396 void CEmailMailbox::TObserverEventMapper::AddObserverL( |
|
397 MMailboxContentObserver& aObserver ) |
|
398 { |
|
399 TIdentityRelation<MMailboxContentObserver> relation( |
|
400 &CEmailMailbox::TObserverEventMapper::Equals ); |
|
401 if ( iClientObservers.Find( &aObserver, relation ) == KErrNotFound ) |
|
402 { |
|
403 const TInt count( iClientObservers.Count() ); |
|
404 if ( !count ) |
|
405 { |
|
406 iPlugin->SubscribeMailboxEventsL( iFsMailboxId, *this ); |
|
407 } |
|
408 iClientObservers.AppendL( &aObserver ); |
|
409 } |
|
410 } |
|
411 |
|
412 // ----------------------------------------------------------------------------- |
|
413 // Removes an observer and removes event subscription if the observer was |
|
414 // last in observer array. |
|
415 // ----------------------------------------------------------------------------- |
|
416 void CEmailMailbox::TObserverEventMapper::RemoveObserver( |
|
417 MMailboxContentObserver& aObserver ) |
|
418 { |
|
419 TIdentityRelation<MMailboxContentObserver> relation( |
|
420 &CEmailMailbox::TObserverEventMapper::Equals ); |
|
421 const TInt index( iClientObservers.Find( &aObserver, relation ) ); |
|
422 if ( index != KErrNotFound ) |
|
423 { |
|
424 iClientObservers.Remove( index ); |
|
425 const TInt count( iClientObservers.Count() ); |
|
426 if ( !count ) |
|
427 { |
|
428 iPlugin->UnsubscribeMailboxEvents( iFsMailboxId, *this ); |
|
429 } |
|
430 } |
|
431 } |
|
432 |
|
433 // ----------------------------------------------------------------------------- |
|
434 // Maps protocol a plugin event to client event |
|
435 // ----------------------------------------------------------------------------- |
|
436 void CEmailMailbox::TObserverEventMapper::EventL( |
|
437 TFSMailEvent aEvent, |
|
438 TFSMailMsgId aMailbox, |
|
439 TAny* aParam1, |
|
440 TAny* aParam2, |
|
441 TAny* aParam3 ) |
|
442 { |
|
443 const TEventMapFunc KMailboxEventHandlers[] = { |
|
444 &CEmailMailbox::TObserverEventMapper::IgnoreEventL, |
|
445 &CEmailMailbox::TObserverEventMapper::IgnoreEventL, |
|
446 &CEmailMailbox::TObserverEventMapper::IgnoreEventL, |
|
447 &CEmailMailbox::TObserverEventMapper::IgnoreEventL, |
|
448 &CEmailMailbox::TObserverEventMapper::IgnoreEventL, |
|
449 &CEmailMailbox::TObserverEventMapper::IgnoreEventL, |
|
450 &CEmailMailbox::TObserverEventMapper::IgnoreEventL, |
|
451 &CEmailMailbox::TObserverEventMapper::IgnoreEventL, |
|
452 &CEmailMailbox::TObserverEventMapper::IgnoreEventL, |
|
453 &CEmailMailbox::TObserverEventMapper::IgnoreEventL, |
|
454 &CEmailMailbox::TObserverEventMapper::IgnoreEventL, |
|
455 &CEmailMailbox::TObserverEventMapper::NewMessageL, |
|
456 &CEmailMailbox::TObserverEventMapper::MessageChangedL, |
|
457 &CEmailMailbox::TObserverEventMapper::MessageDeletedL, |
|
458 &CEmailMailbox::TObserverEventMapper::MessageMoved, |
|
459 &CEmailMailbox::TObserverEventMapper::MessageCopiedL, |
|
460 &CEmailMailbox::TObserverEventMapper::NewFolderL, |
|
461 &CEmailMailbox::TObserverEventMapper::FolderChangeL, |
|
462 &CEmailMailbox::TObserverEventMapper::FoldersDeletedL, |
|
463 &CEmailMailbox::TObserverEventMapper::FoldersMovedL, |
|
464 &CEmailMailbox::TObserverEventMapper::ExceptionL |
|
465 }; |
|
466 |
|
467 TMailboxId id( aMailbox.Id() ); |
|
468 // boundary check |
|
469 const TInt index( aEvent ); |
|
470 if ( index < sizeof( KMailboxEventHandlers ) / sizeof( KMailboxEventHandlers[ index ] ) ) |
|
471 { |
|
472 // call event handler function |
|
473 TEventMapFunc method = KMailboxEventHandlers[ index ]; |
|
474 (this->*method)(id, aParam1,aParam2,aParam3 ); |
|
475 } |
|
476 } |
|
477 |
|
478 // ----------------------------------------------------------------------------- |
|
479 // |
|
480 // ----------------------------------------------------------------------------- |
|
481 void CEmailMailbox::TObserverEventMapper::ConvertParamsL( |
|
482 TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, |
|
483 REmailMessageIdArray& aMessageIds, TFolderId& aFolderId ) |
|
484 { |
|
485 RArray<TFSMailMsgId>* newEntries( static_cast< RArray<TFSMailMsgId>* >( aParam1 ) ); |
|
486 CleanupClosePushL( *newEntries ); |
|
487 TFSMailMsgId* parentFolder = static_cast<TFSMailMsgId*>( aParam2 ); |
|
488 aFolderId = TFolderId( parentFolder->Id(), aMailbox ); |
|
489 |
|
490 for ( TInt j = 0; j < newEntries->Count(); j++ ) |
|
491 { |
|
492 TFSMailMsgId fsId(( *newEntries )[j] ); |
|
493 TMessageId messageId( fsId.Id(), aFolderId.iId, aMailbox ); |
|
494 aMessageIds.Append( messageId ); |
|
495 } |
|
496 |
|
497 CleanupStack::PopAndDestroy( newEntries ); |
|
498 } |
|
499 |
|
500 // ----------------------------------------------------------------------------- |
|
501 // |
|
502 // ----------------------------------------------------------------------------- |
|
503 void CEmailMailbox::TObserverEventMapper::IgnoreEventL( |
|
504 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
|
505 { |
|
506 } |
|
507 |
|
508 // ----------------------------------------------------------------------------- |
|
509 // |
|
510 // ----------------------------------------------------------------------------- |
|
511 void CEmailMailbox::TObserverEventMapper::NewMessageL( |
|
512 TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* /*aParam3*/ ) |
|
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 { |
|
555 REmailMessageIdArray messageIds; |
|
556 TFolderId folderId; |
|
557 ConvertParamsL( aMailbox, aParam1, aParam2, messageIds, folderId ); |
|
558 CleanupClosePushL( messageIds ); |
|
559 |
|
560 for ( TInt i = 0; i < iClientObservers.Count(); i++ ) |
|
561 { |
|
562 MMailboxContentObserver* observer = iClientObservers[i]; |
|
563 if (observer) |
|
564 observer->MessageDeletedEventL( aMailbox, messageIds, folderId ); |
|
565 } |
|
566 |
|
567 CleanupStack::PopAndDestroy( &messageIds ); |
|
568 } |
|
569 |
|
570 // ----------------------------------------------------------------------------- |
|
571 // |
|
572 // ----------------------------------------------------------------------------- |
|
573 void CEmailMailbox::TObserverEventMapper::MessageMoved( |
|
574 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
|
575 { |
|
576 } |
|
577 |
|
578 // ----------------------------------------------------------------------------- |
|
579 // |
|
580 // ----------------------------------------------------------------------------- |
|
581 void CEmailMailbox::TObserverEventMapper::MessageCopiedL( |
|
582 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
|
583 { |
|
584 } |
|
585 |
|
586 // ----------------------------------------------------------------------------- |
|
587 // |
|
588 // ----------------------------------------------------------------------------- |
|
589 void CEmailMailbox::TObserverEventMapper::NewFolderL( |
|
590 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
|
591 { |
|
592 } |
|
593 |
|
594 // ----------------------------------------------------------------------------- |
|
595 // |
|
596 // ----------------------------------------------------------------------------- |
|
597 void CEmailMailbox::TObserverEventMapper::FolderChangeL( |
|
598 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
|
599 { |
|
600 } |
|
601 |
|
602 // ----------------------------------------------------------------------------- |
|
603 // |
|
604 // ----------------------------------------------------------------------------- |
|
605 void CEmailMailbox::TObserverEventMapper::FoldersDeletedL( |
|
606 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
|
607 { |
|
608 } |
|
609 |
|
610 // ----------------------------------------------------------------------------- |
|
611 // |
|
612 // ----------------------------------------------------------------------------- |
|
613 void CEmailMailbox::TObserverEventMapper::FoldersMovedL( |
|
614 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
|
615 { |
|
616 } |
|
617 |
|
618 // ----------------------------------------------------------------------------- |
|
619 // |
|
620 // ----------------------------------------------------------------------------- |
|
621 void CEmailMailbox::TObserverEventMapper::ExceptionL( |
|
622 TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
|
623 { |
|
624 } |
|
625 |
|
626 // ----------------------------------------------------------------------------- |
|
627 // |
|
628 // ----------------------------------------------------------------------------- |
|
629 TBool CEmailMailbox::TObserverEventMapper::Equals( |
|
630 const MMailboxContentObserver& a1, const MMailboxContentObserver& a2 ) |
|
631 { |
|
632 return ( &a1 == &a2 ); |
|
633 } |
|
634 // ----------------------------------------------------------------------------- |
|
635 // |
|
636 // ----------------------------------------------------------------------------- |
|
637 CEmailMailbox::CEmailRequestObserver::CEmailRequestObserver() : iObserver( NULL ) |
|
638 { |
|
639 } |
|
640 |
|
641 // ----------------------------------------------------------------------------- |
|
642 // |
|
643 // ----------------------------------------------------------------------------- |
|
644 void CEmailMailbox::CEmailRequestObserver::RequestResponseL( |
|
645 TFSProgress aEvent, TInt /* aRequestId */ ) |
|
646 { |
|
647 if ( iObserver && aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete ) |
|
648 { |
|
649 iObserver->MailboxSynchronisedL(aEvent.iError); |
|
650 } |
|
651 } |
|
652 |
|
653 // ----------------------------------------------------------------------------- |
|
654 // |
|
655 // ----------------------------------------------------------------------------- |
|
656 void CEmailMailbox::CEmailRequestObserver::SetObserverL( MMailboxSyncObserver* aObserver ) |
|
657 { |
|
658 iObserver = aObserver; |
|
659 } |
|
660 |
|
661 // End of file |
|
662 |