13 * |
13 * |
14 * Description: This file implements class CFSMailBrand. |
14 * Description: This file implements class CFSMailBrand. |
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 <barsread.h> |
24 #include <barsread.h> |
24 //<qmail> Commented out in Qmail |
25 //<qmail> Commented out in Qmail |
25 //#include <AknIconUtils.h> |
26 //#include <AknIconUtils.h> |
26 //</qmail> |
27 //</qmail> |
27 #include <gulicon.h> |
28 #include <gulicon.h> |
43 // ----------------------------------------------------------------------------- |
44 // ----------------------------------------------------------------------------- |
44 // CFSMailBrand::NewL |
45 // CFSMailBrand::NewL |
45 // ----------------------------------------------------------------------------- |
46 // ----------------------------------------------------------------------------- |
46 CFSMailBrand* CFSMailBrand::NewL( TResourceReader& aReader, TBool aIsWhiteLabel ) |
47 CFSMailBrand* CFSMailBrand::NewL( TResourceReader& aReader, TBool aIsWhiteLabel ) |
47 { |
48 { |
48 FUNC_LOG; |
49 NM_FUNCTION; |
|
50 |
49 CFSMailBrand* brManager = CFSMailBrand::NewLC(aReader, aIsWhiteLabel); |
51 CFSMailBrand* brManager = CFSMailBrand::NewLC(aReader, aIsWhiteLabel); |
50 CleanupStack:: Pop(brManager); |
52 CleanupStack:: Pop(brManager); |
51 return brManager; |
53 return brManager; |
52 } |
54 } |
53 |
55 |
54 // ----------------------------------------------------------------------------- |
56 // ----------------------------------------------------------------------------- |
55 // CFSMailBrand::NewLC |
57 // CFSMailBrand::NewLC |
56 // ----------------------------------------------------------------------------- |
58 // ----------------------------------------------------------------------------- |
57 CFSMailBrand* CFSMailBrand::NewLC( TResourceReader& aReader, TBool aIsWhiteLabel ) |
59 CFSMailBrand* CFSMailBrand::NewLC( TResourceReader& aReader, TBool aIsWhiteLabel ) |
58 { |
60 { |
59 FUNC_LOG; |
61 NM_FUNCTION; |
|
62 |
60 CFSMailBrand* self = new ( ELeave ) CFSMailBrand(); |
63 CFSMailBrand* self = new ( ELeave ) CFSMailBrand(); |
61 CleanupStack::PushL( self ); |
64 CleanupStack::PushL( self ); |
62 if ( aIsWhiteLabel ) |
65 if ( aIsWhiteLabel ) |
63 { |
66 { |
64 self->ConstructFromCenrepL( ); |
67 self->ConstructFromCenrepL( ); |
74 // ----------------------------------------------------------------------------- |
77 // ----------------------------------------------------------------------------- |
75 // CFSMailBrand::ConstructFromCenrepL |
78 // CFSMailBrand::ConstructFromCenrepL |
76 // ----------------------------------------------------------------------------- |
79 // ----------------------------------------------------------------------------- |
77 void CFSMailBrand::ConstructFromCenrepL( ) |
80 void CFSMailBrand::ConstructFromCenrepL( ) |
78 { |
81 { |
79 FUNC_LOG; |
82 NM_FUNCTION; |
80 |
83 |
81 /* |
84 /* |
82 TBuf<KMaxStringLenFromCenrep> tBuf; // Temporary buffer |
85 TBuf<KMaxStringLenFromCenrep> tBuf; // Temporary buffer |
83 HBufC* mailboxName; |
86 HBufC* mailboxName; |
84 |
87 |
142 // ----------------------------------------------------------------------------- |
145 // ----------------------------------------------------------------------------- |
143 // CFSMailBrand::ConstructFromResourceL |
146 // CFSMailBrand::ConstructFromResourceL |
144 // ----------------------------------------------------------------------------- |
147 // ----------------------------------------------------------------------------- |
145 void CFSMailBrand::ConstructFromResourceL( TResourceReader& aReader ) |
148 void CFSMailBrand::ConstructFromResourceL( TResourceReader& aReader ) |
146 { |
149 { |
147 FUNC_LOG; |
150 NM_FUNCTION; |
148 |
151 |
149 // read icon filepath |
152 // read icon filepath |
150 iIconFilePath = aReader.ReadHBufCL(); |
153 iIconFilePath = aReader.ReadHBufCL(); |
151 |
154 |
152 // read match strings |
155 // read match strings |
204 // ----------------------------------------------------------------------------- |
207 // ----------------------------------------------------------------------------- |
205 // CFSMailBrand::~CFSMailBrand() |
208 // CFSMailBrand::~CFSMailBrand() |
206 // ----------------------------------------------------------------------------- |
209 // ----------------------------------------------------------------------------- |
207 CFSMailBrand::~CFSMailBrand() |
210 CFSMailBrand::~CFSMailBrand() |
208 { |
211 { |
209 FUNC_LOG; |
212 NM_FUNCTION; |
|
213 |
210 iBrandMatchStrings.ResetAndDestroy(); |
214 iBrandMatchStrings.ResetAndDestroy(); |
211 delete iIconFilePath; |
215 delete iIconFilePath; |
212 delete iGraphicElements; |
216 delete iGraphicElements; |
213 delete iTextElements; |
217 delete iTextElements; |
214 delete iColorElements; |
218 delete iColorElements; |
219 // ----------------------------------------------------------------------------- |
223 // ----------------------------------------------------------------------------- |
220 // CFSMailBrand::CFSMailBrand() |
224 // CFSMailBrand::CFSMailBrand() |
221 // ----------------------------------------------------------------------------- |
225 // ----------------------------------------------------------------------------- |
222 CFSMailBrand::CFSMailBrand() |
226 CFSMailBrand::CFSMailBrand() |
223 { |
227 { |
224 FUNC_LOG; |
228 NM_FUNCTION; |
|
229 |
225 // prepare null empty descriptor |
230 // prepare null empty descriptor |
226 iEmpty = HBufC::New(1); |
231 iEmpty = HBufC::New(1); |
227 iEmpty->Des().Copy(KNullDesC()); |
232 iEmpty->Des().Copy(KNullDesC()); |
228 |
233 |
229 } |
234 } |
231 // ----------------------------------------------------------------------------- |
236 // ----------------------------------------------------------------------------- |
232 // CFSMailBrand::IsMatching |
237 // CFSMailBrand::IsMatching |
233 // ----------------------------------------------------------------------------- |
238 // ----------------------------------------------------------------------------- |
234 TBool CFSMailBrand::IsMatching( const TDesC& aBrandId ) |
239 TBool CFSMailBrand::IsMatching( const TDesC& aBrandId ) |
235 { |
240 { |
236 FUNC_LOG; |
241 NM_FUNCTION; |
237 |
242 |
238 TInt count = iBrandMatchStrings.Count(); |
243 TInt count = iBrandMatchStrings.Count(); |
239 for(TInt i=0;i<count;i++) |
244 for(TInt i=0;i<count;i++) |
240 { |
245 { |
241 if ( aBrandId.MatchC( *iBrandMatchStrings[i] ) == KErrNone ) |
246 if ( aBrandId.MatchC( *iBrandMatchStrings[i] ) == KErrNone ) |
249 // ----------------------------------------------------------------------------- |
254 // ----------------------------------------------------------------------------- |
250 // CFSMailBrand::GetText |
255 // CFSMailBrand::GetText |
251 // ----------------------------------------------------------------------------- |
256 // ----------------------------------------------------------------------------- |
252 TDesC& CFSMailBrand::GetText( TFSBrandElement aElementId ) |
257 TDesC& CFSMailBrand::GetText( TFSBrandElement aElementId ) |
253 { |
258 { |
254 FUNC_LOG; |
259 NM_FUNCTION; |
|
260 |
255 TInt textCount( iTextElements->Count() ); |
261 TInt textCount( iTextElements->Count() ); |
256 |
262 |
257 for ( TInt i( 0 ); i < textCount; i++ ) |
263 for ( TInt i( 0 ); i < textCount; i++ ) |
258 { |
264 { |
259 if ( iTextElements->At( i ).iElementId == aElementId ) |
265 if ( iTextElements->At( i ).iElementId == aElementId ) |
268 // ----------------------------------------------------------------------------- |
274 // ----------------------------------------------------------------------------- |
269 // CFSMailBrand::GetColor |
275 // CFSMailBrand::GetColor |
270 // ----------------------------------------------------------------------------- |
276 // ----------------------------------------------------------------------------- |
271 TInt CFSMailBrand::GetColor( TFSBrandElement aElementId, TRgb& aColor ) |
277 TInt CFSMailBrand::GetColor( TFSBrandElement aElementId, TRgb& aColor ) |
272 { |
278 { |
273 FUNC_LOG; |
279 NM_FUNCTION; |
|
280 |
274 TInt colorCount( iColorElements->Count() ); |
281 TInt colorCount( iColorElements->Count() ); |
275 |
282 |
276 for ( TInt i( 0 ); i < colorCount; i++ ) |
283 for ( TInt i( 0 ); i < colorCount; i++ ) |
277 { |
284 { |
278 if ( iColorElements->At( i ).iElementId == aElementId ) |
285 if ( iColorElements->At( i ).iElementId == aElementId ) |
288 // ----------------------------------------------------------------------------- |
295 // ----------------------------------------------------------------------------- |
289 // CFSMailBrand::GetGraphicL |
296 // CFSMailBrand::GetGraphicL |
290 // ----------------------------------------------------------------------------- |
297 // ----------------------------------------------------------------------------- |
291 CGulIcon* CFSMailBrand::GetGraphicL( TFSBrandElement aElementId ) |
298 CGulIcon* CFSMailBrand::GetGraphicL( TFSBrandElement aElementId ) |
292 { |
299 { |
293 FUNC_LOG; |
300 NM_FUNCTION; |
|
301 |
294 TInt graphicsCount( iGraphicElements->Count() ); |
302 TInt graphicsCount( iGraphicElements->Count() ); |
295 |
303 |
296 for ( TInt i( 0 ); i < graphicsCount; i++ ) |
304 for ( TInt i( 0 ); i < graphicsCount; i++ ) |
297 { |
305 { |
298 TBrandedGraphic element = iGraphicElements->At( i ); |
306 TBrandedGraphic element = iGraphicElements->At( i ); |
338 // CFSMailBrand::GetGraphicIdsL |
346 // CFSMailBrand::GetGraphicIdsL |
339 // ----------------------------------------------------------------------------- |
347 // ----------------------------------------------------------------------------- |
340 TInt CFSMailBrand::GetGraphicIdsL( TFSBrandElement aElementId, |
348 TInt CFSMailBrand::GetGraphicIdsL( TFSBrandElement aElementId, |
341 TDes& aIconIds) |
349 TDes& aIconIds) |
342 { |
350 { |
343 FUNC_LOG; |
351 NM_FUNCTION; |
344 |
352 |
345 aIconIds.Zero(); |
353 aIconIds.Zero(); |
346 TInt graphicsCount( iGraphicElements->Count() ); |
354 TInt graphicsCount( iGraphicElements->Count() ); |
347 |
355 |
348 for ( TInt i( 0 ); i < graphicsCount; i++ ) |
356 for ( TInt i( 0 ); i < graphicsCount; i++ ) |