equal
deleted
inserted
replaced
13 * |
13 * |
14 * Description: ES Protocol Framework branding manager interface definition |
14 * Description: ES Protocol Framework branding manager interface definition |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
|
18 #include "emailtrace.h" |
|
19 |
18 //<qmail> |
20 //<qmail> |
19 #include <nmcommonheaders.h> |
21 #include <nmcommonheaders.h> |
20 //</qmail> |
22 //</qmail> |
21 |
23 |
22 #include "emailtrace.h" |
|
23 #include <FSMAILBRANDMANAGER.rsg> |
24 #include <FSMAILBRANDMANAGER.rsg> |
24 #include <barsread.h> |
25 #include <barsread.h> |
25 #include <bautils.h> |
26 #include <bautils.h> |
26 #include <mmf/common/mmfcontrollerpluginresolver.h> // CleanupResetAndDestroy |
27 #include <mmf/common/mmfcontrollerpluginresolver.h> // CleanupResetAndDestroy |
27 // <gmail_brand_issue> |
28 // <gmail_brand_issue> |
59 const TInt KMCCValueMaxLength = 3; |
60 const TInt KMCCValueMaxLength = 3; |
60 |
61 |
61 #ifdef __WINS__ |
62 #ifdef __WINS__ |
62 LOCAL_C void RetrieveNextToken( TDes8& aContent, TDes& aToken ) |
63 LOCAL_C void RetrieveNextToken( TDes8& aContent, TDes& aToken ) |
63 { |
64 { |
|
65 NM_FUNCTION; |
|
66 |
64 _LIT8( KComma, "," ); |
67 _LIT8( KComma, "," ); |
65 TInt pos = aContent.Find( KComma ); |
68 TInt pos = aContent.Find( KComma ); |
66 if ( pos != KErrNotFound ) |
69 if ( pos != KErrNotFound ) |
67 { |
70 { |
68 aToken.Copy( aContent.MidTPtr( 0, pos ) ); |
71 aToken.Copy( aContent.MidTPtr( 0, pos ) ); |
78 // ----------------------------------------------------------------------------- |
81 // ----------------------------------------------------------------------------- |
79 CFSMailBrandManagerImpl::CFSMailBrandManagerImpl( |
82 CFSMailBrandManagerImpl::CFSMailBrandManagerImpl( |
80 CFSMailClient& aMailClient ) : |
83 CFSMailClient& aMailClient ) : |
81 iMailClient( aMailClient ) |
84 iMailClient( aMailClient ) |
82 { |
85 { |
83 FUNC_LOG; |
86 NM_FUNCTION; |
84 |
|
85 } |
87 } |
86 |
88 |
87 // ----------------------------------------------------------------------------- |
89 // ----------------------------------------------------------------------------- |
88 // CFSMailBrandManagerImpl::ConstructL |
90 // CFSMailBrandManagerImpl::ConstructL |
89 // ----------------------------------------------------------------------------- |
91 // ----------------------------------------------------------------------------- |
90 void CFSMailBrandManagerImpl::ConstructL() |
92 void CFSMailBrandManagerImpl::ConstructL() |
91 { |
93 { |
92 FUNC_LOG; |
94 NM_FUNCTION; |
93 |
95 |
94 // Read resource file, get the drive letter according to the DLL drive |
96 // Read resource file, get the drive letter according to the DLL drive |
95 TFileName dllFileName; |
97 TFileName dllFileName; |
96 Dll::FileName( dllFileName ); |
98 Dll::FileName( dllFileName ); |
97 |
99 |
124 // ----------------------------------------------------------------------------- |
126 // ----------------------------------------------------------------------------- |
125 // CFSMailBrandManagerImpl::~CFSMailBrandManagerImpl |
127 // CFSMailBrandManagerImpl::~CFSMailBrandManagerImpl |
126 // ----------------------------------------------------------------------------- |
128 // ----------------------------------------------------------------------------- |
127 CFSMailBrandManagerImpl::~CFSMailBrandManagerImpl() |
129 CFSMailBrandManagerImpl::~CFSMailBrandManagerImpl() |
128 { |
130 { |
129 FUNC_LOG; |
131 NM_FUNCTION; |
130 |
132 |
131 iResourceFile.Close(); |
133 iResourceFile.Close(); |
132 iFsSession.Close(); |
134 iFsSession.Close(); |
133 |
135 |
134 if ( iBrands ) |
136 if ( iBrands ) |
142 // CFSMailBrandManagerImpl::NewL |
144 // CFSMailBrandManagerImpl::NewL |
143 // ----------------------------------------------------------------------------- |
145 // ----------------------------------------------------------------------------- |
144 CFSMailBrandManagerImpl* CFSMailBrandManagerImpl::NewL( |
146 CFSMailBrandManagerImpl* CFSMailBrandManagerImpl::NewL( |
145 CFSMailClient& aMailClient ) |
147 CFSMailClient& aMailClient ) |
146 { |
148 { |
147 FUNC_LOG; |
149 NM_FUNCTION; |
|
150 |
148 CFSMailBrandManagerImpl* self = |
151 CFSMailBrandManagerImpl* self = |
149 CFSMailBrandManagerImpl::NewLC( aMailClient ); |
152 CFSMailBrandManagerImpl::NewLC( aMailClient ); |
150 CleanupStack::Pop( self ); |
153 CleanupStack::Pop( self ); |
151 return self; |
154 return self; |
152 } |
155 } |
155 // CFSMailBrandManagerImpl::NewLC |
158 // CFSMailBrandManagerImpl::NewLC |
156 // ----------------------------------------------------------------------------- |
159 // ----------------------------------------------------------------------------- |
157 CFSMailBrandManagerImpl* CFSMailBrandManagerImpl::NewLC( |
160 CFSMailBrandManagerImpl* CFSMailBrandManagerImpl::NewLC( |
158 CFSMailClient& aMailClient ) |
161 CFSMailClient& aMailClient ) |
159 { |
162 { |
160 FUNC_LOG; |
163 NM_FUNCTION; |
|
164 |
161 CFSMailBrandManagerImpl* self = |
165 CFSMailBrandManagerImpl* self = |
162 new( ELeave ) CFSMailBrandManagerImpl( aMailClient ); |
166 new( ELeave ) CFSMailBrandManagerImpl( aMailClient ); |
163 CleanupStack::PushL( self ); |
167 CleanupStack::PushL( self ); |
164 self->ConstructL(); |
168 self->ConstructL(); |
165 return self; |
169 return self; |
168 // ----------------------------------------------------------------------------- |
172 // ----------------------------------------------------------------------------- |
169 // CFSMailBrandManagerImpl::UpdateMailboxNamesL |
173 // CFSMailBrandManagerImpl::UpdateMailboxNamesL |
170 // ----------------------------------------------------------------------------- |
174 // ----------------------------------------------------------------------------- |
171 void CFSMailBrandManagerImpl::UpdateMailboxNamesL( const TFSMailMsgId aMailBoxId ) |
175 void CFSMailBrandManagerImpl::UpdateMailboxNamesL( const TFSMailMsgId aMailBoxId ) |
172 { |
176 { |
173 FUNC_LOG; |
177 NM_FUNCTION; |
174 |
178 |
175 // list all mailboxes |
179 // list all mailboxes |
176 RPointerArray<CFSMailBox> mailBoxes; |
180 RPointerArray<CFSMailBox> mailBoxes; |
177 CleanupResetAndDestroyPushL( mailBoxes ); |
181 CleanupResetAndDestroyPushL( mailBoxes ); |
178 iMailClient.ListMailBoxes( TFSMailMsgId(), mailBoxes ); |
182 iMailClient.ListMailBoxes( TFSMailMsgId(), mailBoxes ); |
218 // ----------------------------------------------------------------------------- |
222 // ----------------------------------------------------------------------------- |
219 CGulIcon* CFSMailBrandManagerImpl::GetGraphicL( |
223 CGulIcon* CFSMailBrandManagerImpl::GetGraphicL( |
220 TFSBrandElement aElement, |
224 TFSBrandElement aElement, |
221 const TFSMailMsgId& aMailboxId ) |
225 const TFSMailMsgId& aMailboxId ) |
222 { |
226 { |
223 FUNC_LOG; |
227 NM_FUNCTION; |
|
228 |
224 CFSMailBox* mailBox( NULL ); |
229 CFSMailBox* mailBox( NULL ); |
225 TRAPD( mailboxError, |
230 TRAPD( mailboxError, |
226 mailBox = iMailClient.GetMailBoxByUidL( aMailboxId ) ); |
231 mailBox = iMailClient.GetMailBoxByUidL( aMailboxId ) ); |
227 if ( mailboxError != KErrNone ) |
232 if ( mailboxError != KErrNone ) |
228 { |
233 { |
248 // ----------------------------------------------------------------------------- |
253 // ----------------------------------------------------------------------------- |
249 CGulIcon* CFSMailBrandManagerImpl::GetGraphicL( |
254 CGulIcon* CFSMailBrandManagerImpl::GetGraphicL( |
250 TFSBrandElement aElement, |
255 TFSBrandElement aElement, |
251 const TDesC& aBrandId ) |
256 const TDesC& aBrandId ) |
252 { |
257 { |
253 FUNC_LOG; |
258 NM_FUNCTION; |
|
259 |
254 CFSMailBrand* brand = FindMatchingBrandL( aBrandId ); |
260 CFSMailBrand* brand = FindMatchingBrandL( aBrandId ); |
255 if ( brand == NULL ) |
261 if ( brand == NULL ) |
256 { |
262 { |
257 return NULL; |
263 return NULL; |
258 } |
264 } |
265 TInt CFSMailBrandManagerImpl::GetGraphicIdsL( |
271 TInt CFSMailBrandManagerImpl::GetGraphicIdsL( |
266 TFSBrandElement aElement, |
272 TFSBrandElement aElement, |
267 const TFSMailMsgId& aMailboxId, |
273 const TFSMailMsgId& aMailboxId, |
268 TDes& aIconIds ) |
274 TDes& aIconIds ) |
269 { |
275 { |
270 FUNC_LOG; |
276 NM_FUNCTION; |
|
277 |
271 CFSMailBox* mailBox( NULL ); |
278 CFSMailBox* mailBox( NULL ); |
272 TRAPD( mailboxError, |
279 TRAPD( mailboxError, |
273 mailBox = iMailClient.GetMailBoxByUidL( aMailboxId ) ); |
280 mailBox = iMailClient.GetMailBoxByUidL( aMailboxId ) ); |
274 if ( mailboxError != KErrNone ) |
281 if ( mailboxError != KErrNone ) |
275 { |
282 { |
296 TInt CFSMailBrandManagerImpl::GetGraphicIdsL( |
303 TInt CFSMailBrandManagerImpl::GetGraphicIdsL( |
297 TFSBrandElement aElement, |
304 TFSBrandElement aElement, |
298 const TDesC& aBrandId, |
305 const TDesC& aBrandId, |
299 TDes& aIconIds ) |
306 TDes& aIconIds ) |
300 { |
307 { |
301 FUNC_LOG; |
308 NM_FUNCTION; |
302 |
309 |
303 CFSMailBrand* brand = FindMatchingBrandL( aBrandId ); |
310 CFSMailBrand* brand = FindMatchingBrandL( aBrandId ); |
304 if ( brand == NULL ) |
311 if ( brand == NULL ) |
305 { |
312 { |
306 return KErrNotFound; |
313 return KErrNotFound; |
313 // ----------------------------------------------------------------------------- |
320 // ----------------------------------------------------------------------------- |
314 TPtrC CFSMailBrandManagerImpl::GetTextL( |
321 TPtrC CFSMailBrandManagerImpl::GetTextL( |
315 TFSBrandElement aElement, |
322 TFSBrandElement aElement, |
316 const TFSMailMsgId& aMailboxId ) |
323 const TFSMailMsgId& aMailboxId ) |
317 { |
324 { |
318 FUNC_LOG; |
325 NM_FUNCTION; |
|
326 |
319 CFSMailBox* mailBox( NULL ); |
327 CFSMailBox* mailBox( NULL ); |
320 TRAPD( mailboxError, |
328 TRAPD( mailboxError, |
321 mailBox = iMailClient.GetMailBoxByUidL( aMailboxId ) ); |
329 mailBox = iMailClient.GetMailBoxByUidL( aMailboxId ) ); |
322 if ( mailboxError != KErrNone ) |
330 if ( mailboxError != KErrNone ) |
323 { |
331 { |
343 // ----------------------------------------------------------------------------- |
351 // ----------------------------------------------------------------------------- |
344 TPtrC CFSMailBrandManagerImpl::GetTextL( |
352 TPtrC CFSMailBrandManagerImpl::GetTextL( |
345 TFSBrandElement aElement, |
353 TFSBrandElement aElement, |
346 const TDesC& aBrandId ) |
354 const TDesC& aBrandId ) |
347 { |
355 { |
348 FUNC_LOG; |
356 NM_FUNCTION; |
349 |
357 |
350 CFSMailBrand* brand = FindMatchingBrandL( aBrandId ); |
358 CFSMailBrand* brand = FindMatchingBrandL( aBrandId ); |
351 if ( brand == NULL ) |
359 if ( brand == NULL ) |
352 { |
360 { |
353 return KNullDesC(); |
361 return KNullDesC(); |
362 TInt CFSMailBrandManagerImpl::GetColorL( |
370 TInt CFSMailBrandManagerImpl::GetColorL( |
363 TFSBrandElement aElement, |
371 TFSBrandElement aElement, |
364 const TFSMailMsgId& aMailboxId, |
372 const TFSMailMsgId& aMailboxId, |
365 TRgb& aColor ) |
373 TRgb& aColor ) |
366 { |
374 { |
367 FUNC_LOG; |
375 NM_FUNCTION; |
|
376 |
368 CFSMailBox* mailBox = iMailClient.GetMailBoxByUidL( aMailboxId ); |
377 CFSMailBox* mailBox = iMailClient.GetMailBoxByUidL( aMailboxId ); |
369 User::LeaveIfNull( mailBox ); |
378 User::LeaveIfNull( mailBox ); |
370 CleanupStack::PushL( mailBox ); |
379 CleanupStack::PushL( mailBox ); |
371 TDesC& brandId = mailBox->GetBrandingIdL(); |
380 TDesC& brandId = mailBox->GetBrandingIdL(); |
372 |
381 |
383 // ----------------------------------------------------------------------------- |
392 // ----------------------------------------------------------------------------- |
384 // CFSMailBrandManagerImpl::ConstructFromResourceL |
393 // CFSMailBrandManagerImpl::ConstructFromResourceL |
385 // ----------------------------------------------------------------------------- |
394 // ----------------------------------------------------------------------------- |
386 void CFSMailBrandManagerImpl::ConstructFromResourceL( TResourceReader& aReader ) |
395 void CFSMailBrandManagerImpl::ConstructFromResourceL( TResourceReader& aReader ) |
387 { |
396 { |
388 FUNC_LOG; |
397 NM_FUNCTION; |
|
398 |
389 iBrands = new ( ELeave ) |
399 iBrands = new ( ELeave ) |
390 CArrayPtrSeg< CFSMailBrand >( KBrandArrayGranularity ); |
400 CArrayPtrSeg< CFSMailBrand >( KBrandArrayGranularity ); |
391 |
401 |
392 // Read White Label Brand from Cenrep |
402 // Read White Label Brand from Cenrep |
393 CFSMailBrand* newBrand = CFSMailBrand::NewLC( aReader, true ); |
403 CFSMailBrand* newBrand = CFSMailBrand::NewLC( aReader, true ); |
409 // ----------------------------------------------------------------------------- |
419 // ----------------------------------------------------------------------------- |
410 // CFSMailBrandManagerImpl::FindMatchingBrandL |
420 // CFSMailBrandManagerImpl::FindMatchingBrandL |
411 // ----------------------------------------------------------------------------- |
421 // ----------------------------------------------------------------------------- |
412 CFSMailBrand* CFSMailBrandManagerImpl::FindMatchingBrandL( const TDesC& aBrandId ) |
422 CFSMailBrand* CFSMailBrandManagerImpl::FindMatchingBrandL( const TDesC& aBrandId ) |
413 { |
423 { |
414 FUNC_LOG; |
424 NM_FUNCTION; |
|
425 |
415 if( aBrandId.Length() ) |
426 if( aBrandId.Length() ) |
416 { |
427 { |
417 TInt brandCount( iBrands->Count() ); |
428 TInt brandCount( iBrands->Count() ); |
418 for ( TInt i( 0 ); i < brandCount; i++ ) |
429 for ( TInt i( 0 ); i < brandCount; i++ ) |
419 { |
430 { |
428 // CFSMailBrandManagerImpl::MailboxMatchingBrandIdL |
439 // CFSMailBrandManagerImpl::MailboxMatchingBrandIdL |
429 // ----------------------------------------------------------------------------- |
440 // ----------------------------------------------------------------------------- |
430 CFSMailBox* CFSMailBrandManagerImpl::MailboxMatchingBrandIdL( |
441 CFSMailBox* CFSMailBrandManagerImpl::MailboxMatchingBrandIdL( |
431 const TDesC& aBrandId ) const |
442 const TDesC& aBrandId ) const |
432 { |
443 { |
|
444 NM_FUNCTION; |
|
445 |
433 RPointerArray<CFSMailBox> mailboxes; |
446 RPointerArray<CFSMailBox> mailboxes; |
434 |
447 |
435 CleanupResetAndDestroyPushL( mailboxes ); |
448 CleanupResetAndDestroyPushL( mailboxes ); |
436 |
449 |
437 iMailClient.ListMailBoxes( TFSMailMsgId(), mailboxes ); |
450 iMailClient.ListMailBoxes( TFSMailMsgId(), mailboxes ); |
469 // ----------------------------------------------------------------------------- |
482 // ----------------------------------------------------------------------------- |
470 // CFSMailBrandManagerImpl::GetMCCValueL |
483 // CFSMailBrandManagerImpl::GetMCCValueL |
471 // ----------------------------------------------------------------------------- |
484 // ----------------------------------------------------------------------------- |
472 void CFSMailBrandManagerImpl::GetMCCValueL( TDes& aMcc ) const |
485 void CFSMailBrandManagerImpl::GetMCCValueL( TDes& aMcc ) const |
473 { |
486 { |
|
487 NM_FUNCTION; |
|
488 |
474 aMcc.Zero(); |
489 aMcc.Zero(); |
475 |
490 |
476 TInt err = KErrNone; |
491 TInt err = KErrNone; |
477 |
492 |
478 #ifndef __WINS__ |
493 #ifndef __WINS__ |
559 // CFSMailBrandManagerImpl::GetMCCValueFromSIML |
574 // CFSMailBrandManagerImpl::GetMCCValueFromSIML |
560 // ---------------------------------------------------------------------------- |
575 // ---------------------------------------------------------------------------- |
561 // |
576 // |
562 void CFSMailBrandManagerImpl::GetMCCValueFromSIML( TDes& aMcc ) const |
577 void CFSMailBrandManagerImpl::GetMCCValueFromSIML( TDes& aMcc ) const |
563 { |
578 { |
|
579 NM_FUNCTION; |
|
580 |
564 RTelServer telServer; |
581 RTelServer telServer; |
565 |
582 |
566 CleanupClosePushL( telServer ); |
583 CleanupClosePushL( telServer ); |
567 |
584 |
568 User::LeaveIfError( telServer.Connect() ); |
585 User::LeaveIfError( telServer.Connect() ); |
599 // CFSMailBrandManagerImpl::GetCurrentCountryL |
616 // CFSMailBrandManagerImpl::GetCurrentCountryL |
600 // ---------------------------------------------------------------------------- |
617 // ---------------------------------------------------------------------------- |
601 // |
618 // |
602 TUint8 CFSMailBrandManagerImpl::GetCurrentCountryL() const |
619 TUint8 CFSMailBrandManagerImpl::GetCurrentCountryL() const |
603 { |
620 { |
|
621 NM_FUNCTION; |
|
622 |
604 CTzLocalizer* localizer = CTzLocalizer::NewLC(); |
623 CTzLocalizer* localizer = CTzLocalizer::NewLC(); |
605 |
624 |
606 CTzLocalizedCity* city = localizer->GetFrequentlyUsedZoneCityL( |
625 CTzLocalizedCity* city = localizer->GetFrequentlyUsedZoneCityL( |
607 CTzLocalizedTimeZone::ECurrentZone ); |
626 CTzLocalizedTimeZone::ECurrentZone ); |
608 |
627 |
625 // CFSMailBrandManagerImpl::VerifyMailAccountName |
644 // CFSMailBrandManagerImpl::VerifyMailAccountName |
626 // ----------------------------------------------------------------------------- |
645 // ----------------------------------------------------------------------------- |
627 void CFSMailBrandManagerImpl::VerifyMailAccountName( |
646 void CFSMailBrandManagerImpl::VerifyMailAccountName( |
628 TPtrC& aBrandedName ) const |
647 TPtrC& aBrandedName ) const |
629 { |
648 { |
|
649 NM_FUNCTION; |
|
650 |
630 // Due to legal reasons we don't show brand name "Gmail" in Germany and UK |
651 // Due to legal reasons we don't show brand name "Gmail" in Germany and UK |
631 if ( !aBrandedName.CompareF( KBrandNameGmail ) ) |
652 if ( !aBrandedName.CompareF( KBrandNameGmail ) ) |
632 { |
653 { |
633 // First check timezone id |
654 // First check timezone id |
634 TUint8 timeZone = 0; |
655 TUint8 timeZone = 0; |