35 // ----------------------------------------------------------------------------- |
35 // ----------------------------------------------------------------------------- |
36 EXPORT_C CFSMailClient* CFSMailClient::NewLC(TInt aConfiguration) |
36 EXPORT_C CFSMailClient* CFSMailClient::NewLC(TInt aConfiguration) |
37 { |
37 { |
38 NM_FUNCTION; |
38 NM_FUNCTION; |
39 |
39 |
40 CFSMailClient* client = Instance(); |
40 CFSMailClient* client = Instance(); |
41 if(!client) |
41 if( !client ) |
42 { |
42 { |
43 client = new (ELeave) CFSMailClient(); |
43 client = new (ELeave) CFSMailClient(); |
44 CleanupStack:: PushL(client); |
44 // The new client needs to be deleted rather than closed, up until |
45 client->ConstructL(aConfiguration); |
45 // the TLS has been set properly. |
46 TInt err = Dll::SetTls(static_cast<TAny*>(client)); |
46 CleanupStack::PushL( client ); |
47 User::LeaveIfError(err); |
47 client->ConstructL( aConfiguration ); |
48 } |
48 TInt err = Dll::SetTls( static_cast<TAny*>( client )); |
49 else |
49 User::LeaveIfError( err ); |
50 { |
50 // Now that the TLS has been set, we no longer want the new client |
51 CleanupStack:: PushL(client); |
51 // to be deleted if there's a problem, so pop it off the cleanup |
52 } |
52 // stack (it will be pushed back on for closing below). |
53 |
53 CleanupStack::Pop( client ); |
54 client->IncReferenceCount(); |
54 } |
55 |
55 |
56 return client; |
56 // Increment reference count before calling CleanupClosePushL so that |
57 |
57 // the reference count is correct if CleanupClosePushL leaves. |
|
58 client->IncReferenceCount(); |
|
59 CleanupClosePushL( *client ); |
|
60 |
|
61 return client; |
58 } |
62 } |
59 |
63 |
60 // ----------------------------------------------------------------------------- |
64 // ----------------------------------------------------------------------------- |
61 // CFSMailClient::NewL |
65 // CFSMailClient::NewL |
62 // ----------------------------------------------------------------------------- |
66 // ----------------------------------------------------------------------------- |
134 mailBox = plugin->GetMailBoxByUidL(aMailBoxId); |
138 mailBox = plugin->GetMailBoxByUidL(aMailBoxId); |
135 } |
139 } |
136 |
140 |
137 return mailBox; |
141 return mailBox; |
138 } |
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // CFSMailClient::GetMailBoxByUidLC |
|
146 // ----------------------------------------------------------------------------- |
|
147 EXPORT_C CFSMailBox* CFSMailClient::GetMailBoxByUidLC(const TFSMailMsgId aMailBoxId) |
|
148 { |
|
149 NM_FUNCTION; |
|
150 CFSMailBox* mailBox = GetMailBoxByUidL( aMailBoxId ); |
|
151 CleanupStack::PushL( mailBox ); |
|
152 return mailBox; |
|
153 } |
|
154 |
|
155 |
139 |
156 |
140 // ----------------------------------------------------------------------------- |
157 // ----------------------------------------------------------------------------- |
141 // CFSMailClient::GetFolderByUidL |
158 // CFSMailClient::GetFolderByUidL |
142 // ----------------------------------------------------------------------------- |
159 // ----------------------------------------------------------------------------- |
143 EXPORT_C CFSMailFolder* CFSMailClient::GetFolderByUidL( const TFSMailMsgId aMailBoxId, |
160 EXPORT_C CFSMailFolder* CFSMailClient::GetFolderByUidL( const TFSMailMsgId aMailBoxId, |
557 if ( plugin ) |
574 if ( plugin ) |
558 { |
575 { |
559 plugin->SetMailboxName( aMailboxId, aMailboxName ); |
576 plugin->SetMailboxName( aMailboxId, aMailboxName ); |
560 } |
577 } |
561 } |
578 } |
562 |
579 |
|
580 // ----------------------------------------------------------------------------- |
|
581 // CFSMailClient::PrepareMrDescriptionL |
|
582 // ----------------------------------------------------------------------------- |
|
583 EXPORT_C void CFSMailClient::PrepareMrDescriptionL( const TFSMailMsgId& aMailBoxId, |
|
584 const TFSMailMsgId& aMessageId ) |
|
585 { |
|
586 NM_FUNCTION; |
|
587 // select plugin |
|
588 CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByUid( aMessageId ); |
|
589 if ( plugin ) |
|
590 { |
|
591 // set MR description from the plugin |
|
592 plugin->PrepareMrDescriptionL( aMailBoxId, aMessageId ); |
|
593 } |
|
594 } |
|
595 |
563 // ----------------------------------------------------------------------------- |
596 // ----------------------------------------------------------------------------- |
564 // CFSMailClient::Close |
597 // CFSMailClient::Close |
565 // ----------------------------------------------------------------------------- |
598 // ----------------------------------------------------------------------------- |
566 EXPORT_C void CFSMailClient::Close() |
599 EXPORT_C void CFSMailClient::Close() |
567 { |
600 { |