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 |
|
19 #include "emailtrace.h" |
18 #include "emailtrace.h" |
|
19 |
|
20 //<qmail> |
|
21 #include <nmcommonheaders.h> |
|
22 //</qmail> |
|
23 |
20 #include <fsmailbrandmanager.rsg> |
24 #include <fsmailbrandmanager.rsg> |
21 #include <barsread.h> |
25 #include <barsread.h> |
22 #include <bautils.h> |
26 #include <bautils.h> |
23 #include <mmf/common/mmfcontrollerpluginresolver.h> // CleanupResetAndDestroy |
27 #include <mmf/common/mmfcontrollerpluginresolver.h> // CleanupResetAndDestroy |
24 // <gmail_brand_issue> |
28 // <gmail_brand_issue> |
27 #include <startupdomainpskeys.h> |
31 #include <startupdomainpskeys.h> |
28 #include <tzlocalizer.h> // CTzLocalizer |
32 #include <tzlocalizer.h> // CTzLocalizer |
29 #include <centralrepository.h> |
33 #include <centralrepository.h> |
30 // </gmail_brand_issue> |
34 // </gmail_brand_issue> |
31 //<cmail> |
35 //<cmail> |
32 #include "cfsmailclient.h" |
36 #include "CFSMailClient.h" |
33 //</cmail> |
37 //</cmail> |
34 |
38 |
35 #include "cfsmailbrandmanagerimpl.h" |
39 #include "CFSMailBrandManagerImpl.h" |
36 #include "cfsmailbrand.h" |
40 #include "CFSMailBrand.h" |
37 |
41 |
38 |
42 |
39 const TInt KBrandArrayGranularity = 5; |
43 const TInt KBrandArrayGranularity = 5; |
40 _LIT( KResourceFilePath,"\\resource\\fsmailbrandmanager.rsc" ); |
44 _LIT( KResourceFilePath,"\\resource\\fsmailbrandmanager.rsc" ); |
41 |
45 |
56 const TInt KMCCValueMaxLength = 3; |
60 const TInt KMCCValueMaxLength = 3; |
57 |
61 |
58 #ifdef __WINS__ |
62 #ifdef __WINS__ |
59 LOCAL_C void RetrieveNextToken( TDes8& aContent, TDes& aToken ) |
63 LOCAL_C void RetrieveNextToken( TDes8& aContent, TDes& aToken ) |
60 { |
64 { |
|
65 NM_FUNCTION; |
|
66 |
61 _LIT8( KComma, "," ); |
67 _LIT8( KComma, "," ); |
62 TInt pos = aContent.Find( KComma ); |
68 TInt pos = aContent.Find( KComma ); |
63 if ( pos != KErrNotFound ) |
69 if ( pos != KErrNotFound ) |
64 { |
70 { |
65 aToken.Copy( aContent.MidTPtr( 0, pos ) ); |
71 aToken.Copy( aContent.MidTPtr( 0, pos ) ); |
75 // ----------------------------------------------------------------------------- |
81 // ----------------------------------------------------------------------------- |
76 CFSMailBrandManagerImpl::CFSMailBrandManagerImpl( |
82 CFSMailBrandManagerImpl::CFSMailBrandManagerImpl( |
77 CFSMailClient& aMailClient ) : |
83 CFSMailClient& aMailClient ) : |
78 iMailClient( aMailClient ) |
84 iMailClient( aMailClient ) |
79 { |
85 { |
80 FUNC_LOG; |
86 NM_FUNCTION; |
81 |
|
82 } |
87 } |
83 |
88 |
84 // ----------------------------------------------------------------------------- |
89 // ----------------------------------------------------------------------------- |
85 // CFSMailBrandManagerImpl::ConstructL |
90 // CFSMailBrandManagerImpl::ConstructL |
86 // ----------------------------------------------------------------------------- |
91 // ----------------------------------------------------------------------------- |
87 void CFSMailBrandManagerImpl::ConstructL() |
92 void CFSMailBrandManagerImpl::ConstructL() |
88 { |
93 { |
89 FUNC_LOG; |
94 NM_FUNCTION; |
90 |
95 |
91 // 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 |
92 TFileName dllFileName; |
97 TFileName dllFileName; |
93 Dll::FileName( dllFileName ); |
98 Dll::FileName( dllFileName ); |
94 |
99 |
121 // ----------------------------------------------------------------------------- |
126 // ----------------------------------------------------------------------------- |
122 // CFSMailBrandManagerImpl::~CFSMailBrandManagerImpl |
127 // CFSMailBrandManagerImpl::~CFSMailBrandManagerImpl |
123 // ----------------------------------------------------------------------------- |
128 // ----------------------------------------------------------------------------- |
124 CFSMailBrandManagerImpl::~CFSMailBrandManagerImpl() |
129 CFSMailBrandManagerImpl::~CFSMailBrandManagerImpl() |
125 { |
130 { |
126 FUNC_LOG; |
131 NM_FUNCTION; |
127 |
132 |
128 iResourceFile.Close(); |
133 iResourceFile.Close(); |
129 iFsSession.Close(); |
134 iFsSession.Close(); |
130 |
135 |
131 if ( iBrands ) |
136 if ( iBrands ) |
139 // CFSMailBrandManagerImpl::NewL |
144 // CFSMailBrandManagerImpl::NewL |
140 // ----------------------------------------------------------------------------- |
145 // ----------------------------------------------------------------------------- |
141 CFSMailBrandManagerImpl* CFSMailBrandManagerImpl::NewL( |
146 CFSMailBrandManagerImpl* CFSMailBrandManagerImpl::NewL( |
142 CFSMailClient& aMailClient ) |
147 CFSMailClient& aMailClient ) |
143 { |
148 { |
144 FUNC_LOG; |
149 NM_FUNCTION; |
|
150 |
145 CFSMailBrandManagerImpl* self = |
151 CFSMailBrandManagerImpl* self = |
146 CFSMailBrandManagerImpl::NewLC( aMailClient ); |
152 CFSMailBrandManagerImpl::NewLC( aMailClient ); |
147 CleanupStack::Pop( self ); |
153 CleanupStack::Pop( self ); |
148 return self; |
154 return self; |
149 } |
155 } |
152 // CFSMailBrandManagerImpl::NewLC |
158 // CFSMailBrandManagerImpl::NewLC |
153 // ----------------------------------------------------------------------------- |
159 // ----------------------------------------------------------------------------- |
154 CFSMailBrandManagerImpl* CFSMailBrandManagerImpl::NewLC( |
160 CFSMailBrandManagerImpl* CFSMailBrandManagerImpl::NewLC( |
155 CFSMailClient& aMailClient ) |
161 CFSMailClient& aMailClient ) |
156 { |
162 { |
157 FUNC_LOG; |
163 NM_FUNCTION; |
|
164 |
158 CFSMailBrandManagerImpl* self = |
165 CFSMailBrandManagerImpl* self = |
159 new( ELeave ) CFSMailBrandManagerImpl( aMailClient ); |
166 new( ELeave ) CFSMailBrandManagerImpl( aMailClient ); |
160 CleanupStack::PushL( self ); |
167 CleanupStack::PushL( self ); |
161 self->ConstructL(); |
168 self->ConstructL(); |
162 return self; |
169 return self; |
165 // ----------------------------------------------------------------------------- |
172 // ----------------------------------------------------------------------------- |
166 // CFSMailBrandManagerImpl::UpdateMailboxNamesL |
173 // CFSMailBrandManagerImpl::UpdateMailboxNamesL |
167 // ----------------------------------------------------------------------------- |
174 // ----------------------------------------------------------------------------- |
168 void CFSMailBrandManagerImpl::UpdateMailboxNamesL( const TFSMailMsgId aMailBoxId ) |
175 void CFSMailBrandManagerImpl::UpdateMailboxNamesL( const TFSMailMsgId aMailBoxId ) |
169 { |
176 { |
170 FUNC_LOG; |
177 NM_FUNCTION; |
171 |
178 |
172 // list all mailboxes |
179 // list all mailboxes |
173 RPointerArray<CFSMailBox> mailBoxes; |
180 RPointerArray<CFSMailBox> mailBoxes; |
174 CleanupResetAndDestroyPushL( mailBoxes ); |
181 CleanupResetAndDestroyPushL( mailBoxes ); |
175 iMailClient.ListMailBoxes( TFSMailMsgId(), mailBoxes ); |
182 iMailClient.ListMailBoxes( TFSMailMsgId(), mailBoxes ); |
215 // ----------------------------------------------------------------------------- |
222 // ----------------------------------------------------------------------------- |
216 CGulIcon* CFSMailBrandManagerImpl::GetGraphicL( |
223 CGulIcon* CFSMailBrandManagerImpl::GetGraphicL( |
217 TFSBrandElement aElement, |
224 TFSBrandElement aElement, |
218 const TFSMailMsgId& aMailboxId ) |
225 const TFSMailMsgId& aMailboxId ) |
219 { |
226 { |
220 FUNC_LOG; |
227 NM_FUNCTION; |
|
228 |
221 CFSMailBox* mailBox( NULL ); |
229 CFSMailBox* mailBox( NULL ); |
222 TRAPD( mailboxError, |
230 TRAPD( mailboxError, |
223 mailBox = iMailClient.GetMailBoxByUidL( aMailboxId ) ); |
231 mailBox = iMailClient.GetMailBoxByUidL( aMailboxId ) ); |
224 if ( mailboxError != KErrNone ) |
232 if ( mailboxError != KErrNone ) |
225 { |
233 { |
245 // ----------------------------------------------------------------------------- |
253 // ----------------------------------------------------------------------------- |
246 CGulIcon* CFSMailBrandManagerImpl::GetGraphicL( |
254 CGulIcon* CFSMailBrandManagerImpl::GetGraphicL( |
247 TFSBrandElement aElement, |
255 TFSBrandElement aElement, |
248 const TDesC& aBrandId ) |
256 const TDesC& aBrandId ) |
249 { |
257 { |
250 FUNC_LOG; |
258 NM_FUNCTION; |
|
259 |
251 CFSMailBrand* brand = FindMatchingBrandL( aBrandId ); |
260 CFSMailBrand* brand = FindMatchingBrandL( aBrandId ); |
252 if ( brand == NULL ) |
261 if ( brand == NULL ) |
253 { |
262 { |
254 return NULL; |
263 return NULL; |
255 } |
264 } |
262 TInt CFSMailBrandManagerImpl::GetGraphicIdsL( |
271 TInt CFSMailBrandManagerImpl::GetGraphicIdsL( |
263 TFSBrandElement aElement, |
272 TFSBrandElement aElement, |
264 const TFSMailMsgId& aMailboxId, |
273 const TFSMailMsgId& aMailboxId, |
265 TDes& aIconIds ) |
274 TDes& aIconIds ) |
266 { |
275 { |
267 FUNC_LOG; |
276 NM_FUNCTION; |
|
277 |
268 CFSMailBox* mailBox( NULL ); |
278 CFSMailBox* mailBox( NULL ); |
269 TRAPD( mailboxError, |
279 TRAPD( mailboxError, |
270 mailBox = iMailClient.GetMailBoxByUidL( aMailboxId ) ); |
280 mailBox = iMailClient.GetMailBoxByUidL( aMailboxId ) ); |
271 if ( mailboxError != KErrNone ) |
281 if ( mailboxError != KErrNone ) |
272 { |
282 { |
293 TInt CFSMailBrandManagerImpl::GetGraphicIdsL( |
303 TInt CFSMailBrandManagerImpl::GetGraphicIdsL( |
294 TFSBrandElement aElement, |
304 TFSBrandElement aElement, |
295 const TDesC& aBrandId, |
305 const TDesC& aBrandId, |
296 TDes& aIconIds ) |
306 TDes& aIconIds ) |
297 { |
307 { |
298 FUNC_LOG; |
308 NM_FUNCTION; |
299 |
309 |
300 CFSMailBrand* brand = FindMatchingBrandL( aBrandId ); |
310 CFSMailBrand* brand = FindMatchingBrandL( aBrandId ); |
301 if ( brand == NULL ) |
311 if ( brand == NULL ) |
302 { |
312 { |
303 return KErrNotFound; |
313 return KErrNotFound; |
310 // ----------------------------------------------------------------------------- |
320 // ----------------------------------------------------------------------------- |
311 TPtrC CFSMailBrandManagerImpl::GetTextL( |
321 TPtrC CFSMailBrandManagerImpl::GetTextL( |
312 TFSBrandElement aElement, |
322 TFSBrandElement aElement, |
313 const TFSMailMsgId& aMailboxId ) |
323 const TFSMailMsgId& aMailboxId ) |
314 { |
324 { |
315 FUNC_LOG; |
325 NM_FUNCTION; |
|
326 |
316 CFSMailBox* mailBox( NULL ); |
327 CFSMailBox* mailBox( NULL ); |
317 TRAPD( mailboxError, |
328 TRAPD( mailboxError, |
318 mailBox = iMailClient.GetMailBoxByUidL( aMailboxId ) ); |
329 mailBox = iMailClient.GetMailBoxByUidL( aMailboxId ) ); |
319 if ( mailboxError != KErrNone ) |
330 if ( mailboxError != KErrNone ) |
320 { |
331 { |
340 // ----------------------------------------------------------------------------- |
351 // ----------------------------------------------------------------------------- |
341 TPtrC CFSMailBrandManagerImpl::GetTextL( |
352 TPtrC CFSMailBrandManagerImpl::GetTextL( |
342 TFSBrandElement aElement, |
353 TFSBrandElement aElement, |
343 const TDesC& aBrandId ) |
354 const TDesC& aBrandId ) |
344 { |
355 { |
345 FUNC_LOG; |
356 NM_FUNCTION; |
346 |
357 |
347 CFSMailBrand* brand = FindMatchingBrandL( aBrandId ); |
358 CFSMailBrand* brand = FindMatchingBrandL( aBrandId ); |
348 if ( brand == NULL ) |
359 if ( brand == NULL ) |
349 { |
360 { |
350 return KNullDesC(); |
361 return KNullDesC(); |
359 TInt CFSMailBrandManagerImpl::GetColorL( |
370 TInt CFSMailBrandManagerImpl::GetColorL( |
360 TFSBrandElement aElement, |
371 TFSBrandElement aElement, |
361 const TFSMailMsgId& aMailboxId, |
372 const TFSMailMsgId& aMailboxId, |
362 TRgb& aColor ) |
373 TRgb& aColor ) |
363 { |
374 { |
364 FUNC_LOG; |
375 NM_FUNCTION; |
|
376 |
365 CFSMailBox* mailBox = iMailClient.GetMailBoxByUidL( aMailboxId ); |
377 CFSMailBox* mailBox = iMailClient.GetMailBoxByUidL( aMailboxId ); |
366 User::LeaveIfNull( mailBox ); |
378 User::LeaveIfNull( mailBox ); |
367 CleanupStack::PushL( mailBox ); |
379 CleanupStack::PushL( mailBox ); |
368 TDesC& brandId = mailBox->GetBrandingIdL(); |
380 TDesC& brandId = mailBox->GetBrandingIdL(); |
369 |
381 |
380 // ----------------------------------------------------------------------------- |
392 // ----------------------------------------------------------------------------- |
381 // CFSMailBrandManagerImpl::ConstructFromResourceL |
393 // CFSMailBrandManagerImpl::ConstructFromResourceL |
382 // ----------------------------------------------------------------------------- |
394 // ----------------------------------------------------------------------------- |
383 void CFSMailBrandManagerImpl::ConstructFromResourceL( TResourceReader& aReader ) |
395 void CFSMailBrandManagerImpl::ConstructFromResourceL( TResourceReader& aReader ) |
384 { |
396 { |
385 FUNC_LOG; |
397 NM_FUNCTION; |
|
398 |
386 iBrands = new ( ELeave ) |
399 iBrands = new ( ELeave ) |
387 CArrayPtrSeg< CFSMailBrand >( KBrandArrayGranularity ); |
400 CArrayPtrSeg< CFSMailBrand >( KBrandArrayGranularity ); |
388 |
401 |
389 // Read White Label Brand from Cenrep |
402 // Read White Label Brand from Cenrep |
390 CFSMailBrand* newBrand = CFSMailBrand::NewLC( aReader, true ); |
403 CFSMailBrand* newBrand = CFSMailBrand::NewLC( aReader, true ); |
406 // ----------------------------------------------------------------------------- |
419 // ----------------------------------------------------------------------------- |
407 // CFSMailBrandManagerImpl::FindMatchingBrandL |
420 // CFSMailBrandManagerImpl::FindMatchingBrandL |
408 // ----------------------------------------------------------------------------- |
421 // ----------------------------------------------------------------------------- |
409 CFSMailBrand* CFSMailBrandManagerImpl::FindMatchingBrandL( const TDesC& aBrandId ) |
422 CFSMailBrand* CFSMailBrandManagerImpl::FindMatchingBrandL( const TDesC& aBrandId ) |
410 { |
423 { |
411 FUNC_LOG; |
424 NM_FUNCTION; |
|
425 |
412 if( aBrandId.Length() ) |
426 if( aBrandId.Length() ) |
413 { |
427 { |
414 TInt brandCount( iBrands->Count() ); |
428 TInt brandCount( iBrands->Count() ); |
415 for ( TInt i( 0 ); i < brandCount; i++ ) |
429 for ( TInt i( 0 ); i < brandCount; i++ ) |
416 { |
430 { |
425 // CFSMailBrandManagerImpl::MailboxMatchingBrandIdL |
439 // CFSMailBrandManagerImpl::MailboxMatchingBrandIdL |
426 // ----------------------------------------------------------------------------- |
440 // ----------------------------------------------------------------------------- |
427 CFSMailBox* CFSMailBrandManagerImpl::MailboxMatchingBrandIdL( |
441 CFSMailBox* CFSMailBrandManagerImpl::MailboxMatchingBrandIdL( |
428 const TDesC& aBrandId ) const |
442 const TDesC& aBrandId ) const |
429 { |
443 { |
|
444 NM_FUNCTION; |
|
445 |
430 RPointerArray<CFSMailBox> mailboxes; |
446 RPointerArray<CFSMailBox> mailboxes; |
431 |
447 |
432 CleanupResetAndDestroyPushL( mailboxes ); |
448 CleanupResetAndDestroyPushL( mailboxes ); |
433 |
449 |
434 iMailClient.ListMailBoxes( TFSMailMsgId(), mailboxes ); |
450 iMailClient.ListMailBoxes( TFSMailMsgId(), mailboxes ); |
466 // ----------------------------------------------------------------------------- |
482 // ----------------------------------------------------------------------------- |
467 // CFSMailBrandManagerImpl::GetMCCValueL |
483 // CFSMailBrandManagerImpl::GetMCCValueL |
468 // ----------------------------------------------------------------------------- |
484 // ----------------------------------------------------------------------------- |
469 void CFSMailBrandManagerImpl::GetMCCValueL( TDes& aMcc ) const |
485 void CFSMailBrandManagerImpl::GetMCCValueL( TDes& aMcc ) const |
470 { |
486 { |
|
487 NM_FUNCTION; |
|
488 |
471 aMcc.Zero(); |
489 aMcc.Zero(); |
472 |
490 |
473 TInt err = KErrNone; |
491 TInt err = KErrNone; |
474 |
492 |
475 #ifndef __WINS__ |
493 #ifndef __WINS__ |
556 // CFSMailBrandManagerImpl::GetMCCValueFromSIML |
574 // CFSMailBrandManagerImpl::GetMCCValueFromSIML |
557 // ---------------------------------------------------------------------------- |
575 // ---------------------------------------------------------------------------- |
558 // |
576 // |
559 void CFSMailBrandManagerImpl::GetMCCValueFromSIML( TDes& aMcc ) const |
577 void CFSMailBrandManagerImpl::GetMCCValueFromSIML( TDes& aMcc ) const |
560 { |
578 { |
|
579 NM_FUNCTION; |
|
580 |
561 RTelServer telServer; |
581 RTelServer telServer; |
562 |
582 |
563 CleanupClosePushL( telServer ); |
583 CleanupClosePushL( telServer ); |
564 |
584 |
565 User::LeaveIfError( telServer.Connect() ); |
585 User::LeaveIfError( telServer.Connect() ); |
596 // CFSMailBrandManagerImpl::GetCurrentCountryL |
616 // CFSMailBrandManagerImpl::GetCurrentCountryL |
597 // ---------------------------------------------------------------------------- |
617 // ---------------------------------------------------------------------------- |
598 // |
618 // |
599 TUint8 CFSMailBrandManagerImpl::GetCurrentCountryL() const |
619 TUint8 CFSMailBrandManagerImpl::GetCurrentCountryL() const |
600 { |
620 { |
|
621 NM_FUNCTION; |
|
622 |
601 CTzLocalizer* localizer = CTzLocalizer::NewLC(); |
623 CTzLocalizer* localizer = CTzLocalizer::NewLC(); |
602 |
624 |
603 CTzLocalizedCity* city = localizer->GetFrequentlyUsedZoneCityL( |
625 CTzLocalizedCity* city = localizer->GetFrequentlyUsedZoneCityL( |
604 CTzLocalizedTimeZone::ECurrentZone ); |
626 CTzLocalizedTimeZone::ECurrentZone ); |
605 |
627 |
622 // CFSMailBrandManagerImpl::VerifyMailAccountName |
644 // CFSMailBrandManagerImpl::VerifyMailAccountName |
623 // ----------------------------------------------------------------------------- |
645 // ----------------------------------------------------------------------------- |
624 void CFSMailBrandManagerImpl::VerifyMailAccountName( |
646 void CFSMailBrandManagerImpl::VerifyMailAccountName( |
625 TPtrC& aBrandedName ) const |
647 TPtrC& aBrandedName ) const |
626 { |
648 { |
|
649 NM_FUNCTION; |
|
650 |
627 // 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 |
628 if ( !aBrandedName.CompareF( KBrandNameGmail ) ) |
652 if ( !aBrandedName.CompareF( KBrandNameGmail ) ) |
629 { |
653 { |
630 // First check timezone id |
654 // First check timezone id |
631 TUint8 timeZone = 0; |
655 TUint8 timeZone = 0; |