1 /* |
|
2 * Copyright (c) 2008 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: Brand handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "cvimpstuibranddata.h" |
|
21 #include "conversations.h" |
|
22 #include <AknIconArray.h> |
|
23 #include <cbsfactory.h> |
|
24 #include <mbsaccess.h> |
|
25 #include <mbselement.h> |
|
26 #include <cbsbitmap.h> |
|
27 #include "uiservicetabtracer.h" |
|
28 |
|
29 #include <AknIconUtils.h> |
|
30 #include <AknIconArray.h> |
|
31 #include <eikclbd.h> |
|
32 #include <bautils.h> |
|
33 |
|
34 #include <AknIconUtils.h> |
|
35 #include <AknsUtils.h> |
|
36 |
|
37 #include "mvimpstengine.h" |
|
38 #include "tvimpstconsts.h" |
|
39 #include <vimpstui.mbg> |
|
40 #include <conversations.mbg> |
|
41 #include <avkon.mbg> |
|
42 #include <StringLoader.h> |
|
43 |
|
44 |
|
45 //App Id is used by MeCo and ece to access branding icons and this name should be generic to both applications, so it needs to be changed later. |
|
46 _LIT8(KAppIdForBrand,"xsp"); |
|
47 _LIT8(KDefaultBrandIdForBrand,"xsp"); |
|
48 _LIT(KZDrive,"Z:\\resource\\"); |
|
49 _LIT(KCDrive,"C:\\resource\\"); |
|
50 _LIT(KTOU,"TOU.r"); |
|
51 _LIT(KUnderScore,"_"); |
|
52 |
|
53 // ================= MEMBER FUNCTIONS ======================= |
|
54 |
|
55 // Two-phased constructor. |
|
56 CVIMPSTUiBrandData* CVIMPSTUiBrandData::NewL(MVIMPSTEngine& aEngine) |
|
57 { |
|
58 TRACER_AUTO; |
|
59 CVIMPSTUiBrandData* self = new (ELeave) CVIMPSTUiBrandData; |
|
60 CleanupStack::PushL( self ); |
|
61 self->ConstructL(aEngine); |
|
62 CleanupStack::Pop( self ); |
|
63 return self; |
|
64 } |
|
65 |
|
66 // Destructor |
|
67 CVIMPSTUiBrandData::~CVIMPSTUiBrandData() |
|
68 { |
|
69 delete iIconsArray; |
|
70 if(iBrandingAccess) |
|
71 { |
|
72 iBrandingAccess->Close(); |
|
73 } |
|
74 |
|
75 delete iBrandingFactory; |
|
76 iBrandingFactory = NULL; |
|
77 |
|
78 delete iBrandId; |
|
79 } |
|
80 |
|
81 // C++ default constructor can NOT contain any code, that |
|
82 // might leave. |
|
83 // |
|
84 CVIMPSTUiBrandData::CVIMPSTUiBrandData() : |
|
85 iAppId(KAppIdForBrand) |
|
86 { |
|
87 } |
|
88 |
|
89 // Symbian OS default constructor can leave. |
|
90 void CVIMPSTUiBrandData::ConstructL(MVIMPSTEngine& aEngine) |
|
91 { |
|
92 TRACER_AUTO; |
|
93 |
|
94 iBrandId = HBufC8::NewL( 100 ); |
|
95 TPtr8 brandIdPtr( iBrandId->Des() ); |
|
96 |
|
97 TInt version; |
|
98 |
|
99 aEngine.GetBrandInfoL(iLanguageId, version, brandIdPtr); |
|
100 |
|
101 iBrandingFactory = CBSFactory::NewL( KDefaultBrandIdForBrand, iAppId ); |
|
102 |
|
103 |
|
104 //Get the default MBM path |
|
105 Dll::FileName(iDefaultMbmPath); //get the location of the dll |
|
106 |
|
107 TDriveName drive( TParsePtrC( iDefaultMbmPath ).Drive( ) ); // solve drive |
|
108 |
|
109 // leave to stack, LC method |
|
110 HBufC* resourceFilePath = HBufC::NewLC( KMaxResourcePathLength ); |
|
111 TPtr ptr( resourceFilePath->Des() ); |
|
112 ptr.Append( KDefaultIconFile() ); // without drive |
|
113 ptr.Insert( 0, drive ); // insert drive |
|
114 |
|
115 // NearestLanguageFile takes only TFileName |
|
116 iDefaultMbmPath.Zero(); |
|
117 iDefaultMbmPath.Append( *resourceFilePath ); |
|
118 |
|
119 CleanupStack::PopAndDestroy(); |
|
120 |
|
121 TRACE(" prepare branding access" ); |
|
122 // Leaves if no brand for service, therefore trap |
|
123 PrepareBrandingAccess(); |
|
124 |
|
125 |
|
126 LoadIconsL();// load the existing icons |
|
127 } |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 // CVIMPSTUiBrandData::PrepareBrandingAccess() |
|
131 // --------------------------------------------------------------------------- |
|
132 // |
|
133 TInt CVIMPSTUiBrandData::PrepareBrandingAccess() |
|
134 { |
|
135 TRACER_AUTO; |
|
136 TRAPD(err, iBrandingAccess = iBrandingFactory->CreateAccessL( *iBrandId, iLanguageId )); |
|
137 |
|
138 return err; |
|
139 } |
|
140 |
|
141 |
|
142 // --------------------------------------------------------- |
|
143 // CVIMPSTUiBrandData::LoadIconsLC |
|
144 // Loads necessary icons |
|
145 // (other items were commented in a header). |
|
146 // --------------------------------------------------------- |
|
147 // |
|
148 CAknIconArray* CVIMPSTUiBrandData::LoadIconsLC( ) |
|
149 { |
|
150 TRACER_AUTO; |
|
151 CAknIconArray* copyArray = new( ELeave )CAknIconArray( 4); |
|
152 CleanupStack::PushL( copyArray ); |
|
153 |
|
154 TInt count = iIconsArray->Count(); |
|
155 CGulIcon* newIcon = NULL; |
|
156 CGulIcon* icon = NULL; |
|
157 |
|
158 for( TInt i=0; i<count;i++) |
|
159 { |
|
160 icon = (*iIconsArray)[i]; |
|
161 // bitmap and mask are still valid in iIconsArray array |
|
162 // because of SetBitmapsOwnedExternally |
|
163 newIcon = CGulIcon::NewL( icon->Bitmap(),icon->Mask() ); |
|
164 newIcon->SetBitmapsOwnedExternally( ETrue ); |
|
165 copyArray->AppendL( newIcon ); // takes the ownership of newIcon |
|
166 } |
|
167 |
|
168 return copyArray; // on cleanup stack |
|
169 } |
|
170 |
|
171 // --------------------------------------------------------- |
|
172 // CVIMPSTUiBrandData::LoadIconsL |
|
173 // Loads necessary icons |
|
174 // (other items were commented in a header). |
|
175 // --------------------------------------------------------- |
|
176 // |
|
177 CAknIconArray* CVIMPSTUiBrandData::LoadIconsL() |
|
178 { |
|
179 TRACER_AUTO; |
|
180 //brand data is available |
|
181 TRACE("do load" ); |
|
182 return LoadBrandIconsL(); |
|
183 } |
|
184 |
|
185 // --------------------------------------------------------- |
|
186 // CVIMPSTUiBrandData::LoadBrandIconsLC |
|
187 // Loads necessary icons |
|
188 // (other items were commented in a header). |
|
189 // --------------------------------------------------------- |
|
190 // |
|
191 CAknIconArray* CVIMPSTUiBrandData::LoadBrandIconsL( ) |
|
192 { |
|
193 TRACER_AUTO; |
|
194 delete iIconsArray; |
|
195 iIconsArray = NULL; |
|
196 |
|
197 iIconsArray = new( ELeave )CAknIconArray( 4); |
|
198 // array granularity is 3, because 3 icons are added to array |
|
199 |
|
200 TRACE(" KEMbmConversationsQgnpropimfriendoff" ); |
|
201 iIconsArray->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropimfriendoff) );//0 |
|
202 |
|
203 TRACE("KEMbmConversationsQgnpropimfriendon" ); |
|
204 iIconsArray->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropimfriendon) );//1 |
|
205 |
|
206 TRACE(" KEMbmConversationsQgnpropimfriendaway" ); |
|
207 iIconsArray->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropimfriendaway ) );//2 |
|
208 |
|
209 TRACE("KEMbmConversationsQgnpropimfriendbusy" ); |
|
210 iIconsArray->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropimfriendbusy ) );//3 |
|
211 |
|
212 TRACE(" KEMbmConversationsQgnpropimfriendinvisible" ); |
|
213 iIconsArray->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropimfriendinvisible ) );//4 |
|
214 |
|
215 TRACE(" KEMbmConversationsQgnpropimimsg" ); |
|
216 iIconsArray->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropimimsg ) );//5 |
|
217 |
|
218 TRACE(" KEMbmConversationsQgnpropimimsgnew" ); |
|
219 iIconsArray->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropimimsgnew ) );//6 |
|
220 |
|
221 TRACE(" KEMbmConversationsQgnpropservicedefaultavatar" ); |
|
222 iIconsArray->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropservicedefaultavatar ) );//7 |
|
223 |
|
224 TRACE(" KEMbmConversationsQgnpropservicefriendrequestreceived" ); |
|
225 iIconsArray->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropservicefriendrequestreceived ) );//8 |
|
226 |
|
227 TRACE(" KEMbmConversationsQgnpropservicefriendrequestsent" ); |
|
228 iIconsArray->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropservicefriendrequestsent ) );//9 |
|
229 |
|
230 TRACE(" KEMbmConversationsQgnpropserviceofffriendrequestreceived" ); |
|
231 iIconsArray->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropserviceofffriendrequestreceived ) );//10 |
|
232 |
|
233 TRACE(" KEMbmConversationsQgnpropserviceofffriendrequestsent" ); |
|
234 iIconsArray->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropserviceofffriendrequestsent ) );//11 |
|
235 |
|
236 TRACE(" KEMbmConversationsQgnpropimfriendonmobile" ); |
|
237 iIconsArray->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropimfriendonmobile ) );//12 |
|
238 |
|
239 TRACE(" KEMbmConversationsQgnservtabavatarblocked" ); |
|
240 iIconsArray->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropimuserblocked ) );//13 |
|
241 |
|
242 TRACE(" KEMbmConversationsQgnservtabavatarblocked" ); |
|
243 iIconsArray->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropimusercallforward ) );//14 |
|
244 |
|
245 |
|
246 return iIconsArray; |
|
247 } |
|
248 |
|
249 // ----------------------------------------------------------------------------- |
|
250 // CVIMPSTUiBrandData::LoadBrandBitmapL |
|
251 // (other items were commented in a header). |
|
252 // ----------------------------------------------------------------------------- |
|
253 // |
|
254 CGulIcon* CVIMPSTUiBrandData::LoadBrandBitmapL( const TDesC8& aId ) |
|
255 { |
|
256 TRACER_AUTO; |
|
257 |
|
258 CFbsBitmap* bitmap = NULL; |
|
259 CFbsBitmap* mask = NULL; |
|
260 |
|
261 //EASY WAY TO DO THINGS.. :) |
|
262 //Fetching bitmaps from the server. |
|
263 if(!iBrandingAccess) |
|
264 { |
|
265 TRACE("create access" ); |
|
266 PrepareBrandingAccess(); |
|
267 } |
|
268 TRAPD(err_bitmap, iBrandingAccess->GetBitmapL( aId, bitmap, mask )); |
|
269 if(KErrNone != err_bitmap) |
|
270 { |
|
271 TRACE(" err" ); |
|
272 User::Leave( err_bitmap ); |
|
273 } |
|
274 TRACE("create icon" ); |
|
275 CGulIcon* icon = CGulIcon::NewL(bitmap, mask); |
|
276 icon->SetBitmapsOwnedExternally( EFalse ); |
|
277 TRACE(" return icon" ); |
|
278 return icon; |
|
279 } |
|
280 |
|
281 // ----------------------------------------------------------------------------- |
|
282 // CVIMPSTUiBrandData::LoadDefaultBitmapL |
|
283 // (other items were commented in a header). |
|
284 // ----------------------------------------------------------------------------- |
|
285 // |
|
286 CGulIcon* CVIMPSTUiBrandData::LoadDefaultBitmapL( TInt aBitmapId, TInt aMaskId, |
|
287 const TDesC& aFullPath ) |
|
288 { |
|
289 TRACER_AUTO; |
|
290 |
|
291 CFbsBitmap* bitmap = NULL; |
|
292 CFbsBitmap* mask = NULL; |
|
293 AknIconUtils::CreateIconLC( bitmap,mask, aFullPath,aBitmapId,aMaskId ); |
|
294 CGulIcon* gulIcon = CGulIcon::NewL( bitmap, mask ); |
|
295 CleanupStack::Pop( 2 ); // bitmap, mask |
|
296 return gulIcon; |
|
297 } |
|
298 |
|
299 // --------------------------------------------------------- |
|
300 // CVIMPSTUiBrandData::LoadOwnStatusIconsLC |
|
301 // Loads necessary icons |
|
302 // (other items were commented in a header). |
|
303 // --------------------------------------------------------- |
|
304 // |
|
305 CAknIconArray* CVIMPSTUiBrandData::LoadOwnStatusIconsLC( ) |
|
306 { |
|
307 TRACER_AUTO; |
|
308 //EASY WAY TO DO THINGS.. :) |
|
309 //Fetching bitmaps from the server. |
|
310 if(!iBrandingAccess) |
|
311 { |
|
312 if (KErrNone != PrepareBrandingAccess()) |
|
313 //brand was not found so load the default data |
|
314 { |
|
315 return LoadDefaultOwnStatusIconsLC(iDefaultMbmPath); |
|
316 } |
|
317 } |
|
318 //brand data is available |
|
319 return LoadBrandOwnStatusIconsLC(); |
|
320 } |
|
321 // --------------------------------------------------------- |
|
322 // CVIMPSTUiBrandData::LoadBrandOwnStatusIconsLC |
|
323 // Loads necessary icons |
|
324 // (other items were commented in a header). |
|
325 // --------------------------------------------------------- |
|
326 // |
|
327 CAknIconArray* CVIMPSTUiBrandData::LoadBrandOwnStatusIconsLC( ) |
|
328 { |
|
329 TRACER_AUTO; |
|
330 // array granularity is 3, because 3 icons are added to array |
|
331 CAknIconArray* icons = new( ELeave )CAknIconArray( 5); |
|
332 CleanupStack::PushL( icons ); |
|
333 |
|
334 // online |
|
335 icons->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropimfriendon) );//0 |
|
336 |
|
337 //away |
|
338 icons->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropimfriendaway) );//1 |
|
339 |
|
340 //busy |
|
341 icons->AppendL( LoadBrandBitmapL( KEMbmConversationsQgnpropimfriendbusy) );//2 |
|
342 |
|
343 //invisible |
|
344 icons->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropimfriendinvisible) );//3 |
|
345 |
|
346 //invisible |
|
347 icons->AppendL( LoadBrandBitmapL(KEMbmConversationsQgnpropimfriendoff) );//4 |
|
348 |
|
349 return icons; |
|
350 } |
|
351 |
|
352 // --------------------------------------------------------- |
|
353 // CVIMPSTUiBrandData::LoadDefaultOwnStatusIconsLC |
|
354 // Loads necessary icons |
|
355 // (other items were commented in a header). |
|
356 // --------------------------------------------------------- |
|
357 // |
|
358 CAknIconArray* CVIMPSTUiBrandData::LoadDefaultOwnStatusIconsLC( const TDesC& aMbmFile) |
|
359 { |
|
360 TRACER_AUTO; |
|
361 // array granularity is 4, because 4 icons are added to array |
|
362 CAknIconArray* icons = new( ELeave )CAknIconArray( 5); |
|
363 CleanupStack::PushL( icons ); |
|
364 |
|
365 |
|
366 icons->AppendL( LoadDefaultBitmapL( // 0 |
|
367 EMbmVimpstuiQgn_prop_im_friend_on, |
|
368 EMbmVimpstuiQgn_prop_im_friend_on_mask, |
|
369 aMbmFile ) ); |
|
370 icons->AppendL( LoadDefaultBitmapL( // 1 |
|
371 EMbmVimpstuiQgn_prop_im_friend_away, |
|
372 EMbmVimpstuiQgn_prop_im_friend_away_mask, |
|
373 aMbmFile ) ); |
|
374 icons->AppendL( LoadDefaultBitmapL( // 2 |
|
375 EMbmVimpstuiQgn_prop_im_friend_busy, |
|
376 EMbmVimpstuiQgn_prop_im_friend_busy_mask, |
|
377 aMbmFile ) ); |
|
378 icons->AppendL( LoadDefaultBitmapL( // 3 |
|
379 EMbmVimpstuiQgn_prop_im_friend_invisible, |
|
380 EMbmVimpstuiQgn_prop_im_friend_invisible_mask, |
|
381 aMbmFile ) ); |
|
382 icons->AppendL( LoadDefaultBitmapL( // 4 |
|
383 EMbmVimpstuiQgn_prop_im_friend_off, |
|
384 EMbmVimpstuiQgn_prop_im_friend_off_mask, |
|
385 aMbmFile ) ); |
|
386 return icons; |
|
387 } |
|
388 // --------------------------------------------------------- |
|
389 // CVIMPSTUiBrandData::GetTitlePaneBrandBitmapL |
|
390 // (other items were commented in a header). |
|
391 // --------------------------------------------------------- |
|
392 // |
|
393 |
|
394 TInt CVIMPSTUiBrandData::GetBrandBitmapsL( CFbsBitmap **aBitmap, CFbsBitmap **aMask) |
|
395 { |
|
396 TRACER_AUTO; |
|
397 |
|
398 TInt error =KErrNone; |
|
399 if ( !iBrandingAccess && KErrNone != PrepareBrandingAccess()) |
|
400 { |
|
401 //load default icon |
|
402 AknIconUtils::CreateIconLC( *aBitmap, *aMask, |
|
403 iDefaultMbmPath, EMbmVimpstuiQgn_prop_im_friend_off, |
|
404 EMbmVimpstuiQgn_prop_im_friend_off_mask ); |
|
405 CleanupStack::Pop(2);//aBitmap,aMask. |
|
406 } |
|
407 else |
|
408 { |
|
409 TRAP(error, iBrandingAccess->GetBitmapL( KEMbmConversationsQgnpropimfriendon, *aBitmap, *aMask )); |
|
410 } |
|
411 TRACE("returns: %d", error ); |
|
412 return error; |
|
413 } |
|
414 |
|
415 // --------------------------------------------------------- |
|
416 // --------------------------------------------------------- |
|
417 // CVIMPSTUiBrandData::GetToUBrandedStringL |
|
418 // (other items were commented in a header). |
|
419 // --------------------------------------------------------- |
|
420 // |
|
421 HBufC* CVIMPSTUiBrandData::GetToUBrandedStringL() |
|
422 { |
|
423 TRACER_AUTO; |
|
424 HBufC* prompt= NULL; |
|
425 if(iBrandingAccess || KErrNone == PrepareBrandingAccess()) |
|
426 { |
|
427 TRAP_IGNORE(prompt = iBrandingAccess->GetTextL( KToumessage )); |
|
428 } |
|
429 return prompt; |
|
430 } |
|
431 |
|
432 // --------------------------------------------------------- |
|
433 // CVIMPSTUiBrandData::IsBrandingSupported |
|
434 // (other items were commented in a header). |
|
435 // --------------------------------------------------------- |
|
436 // |
|
437 TBool CVIMPSTUiBrandData::IsBrandingSupported() |
|
438 { |
|
439 TBool ret = EFalse; |
|
440 if(iBrandingAccess) |
|
441 { |
|
442 ret = ETrue; |
|
443 } |
|
444 return ret; |
|
445 } |
|
446 |
|
447 // ----------------------------------------------------------------------------- |
|
448 // CVIMPSTUiBrandData::GetToUStringL() |
|
449 // ----------------------------------------------------------------------------- |
|
450 // |
|
451 HBufC* CVIMPSTUiBrandData::GetToUStringL() |
|
452 { |
|
453 TRACER_AUTO; |
|
454 HBufC* TouDes = NULL; |
|
455 const TInt KLangBufLength = 2; |
|
456 const TInt KLeadingZero = 0; |
|
457 TBuf<KLangBufLength> langBuf; |
|
458 |
|
459 // To get two or more digit language id. |
|
460 if( iLanguageId < 10 ) |
|
461 { |
|
462 langBuf.AppendNum( KLeadingZero ); |
|
463 } |
|
464 langBuf.AppendNum( iLanguageId ); |
|
465 |
|
466 // Number 2 is used in the below equation because |
|
467 // it is multiplied with the length of the underscore |
|
468 // to calculate the over all length of the string. |
|
469 TInt length = KCDrive().Length() + iAppId.Length() + iBrandId->Length() |
|
470 + KTOU().Length() + langBuf.Length() + 2 * KUnderScore().Length(); |
|
471 |
|
472 HBufC* fileName = HBufC::NewLC( length ); |
|
473 TPtr brandFileName( fileName->Des() ); |
|
474 |
|
475 // Converting the HBufC8 iAppId to HBufC appId |
|
476 HBufC* appId = HBufC::NewL( iAppId.Length() ); |
|
477 appId->Des().Copy( iAppId ); |
|
478 |
|
479 // Converting the HBufC8 iBrandId to HBufC brandId |
|
480 HBufC* brandId = HBufC::NewL( iBrandId->Length() ); |
|
481 brandId->Des().Copy( *iBrandId ); |
|
482 |
|
483 //Formation of filename. |
|
484 brandFileName.Append( *appId ); |
|
485 brandFileName.Append( KUnderScore ); |
|
486 brandFileName.Append( *brandId ); |
|
487 brandFileName.Append( KUnderScore ); |
|
488 brandFileName.Append( KTOU ); |
|
489 brandFileName.Append( langBuf ); |
|
490 |
|
491 TFileName temp(KCDrive); |
|
492 |
|
493 HBufC* targetFile = ConcatLC( temp, brandFileName ); |
|
494 |
|
495 // for getting the access to the file. |
|
496 RFs fsSession; |
|
497 RFile file; |
|
498 User::LeaveIfError(fsSession.Connect()); |
|
499 |
|
500 TFileName fullPtr( targetFile->Des() ); |
|
501 BaflUtils::NearestLanguageFile( fsSession, fullPtr ); |
|
502 TInt err = file.Open(fsSession, fullPtr, EFileRead); |
|
503 CleanupStack::PopAndDestroy(); // targetFile |
|
504 |
|
505 if( KErrNone != err ) |
|
506 { |
|
507 temp = KZDrive; |
|
508 targetFile = ConcatLC( temp, brandFileName ); |
|
509 //brandFileName = targetFile->Des(); |
|
510 fullPtr = targetFile->Des(); |
|
511 BaflUtils::NearestLanguageFile( fsSession, fullPtr ); |
|
512 err = file.Open(fsSession, fullPtr, EFileRead); |
|
513 CleanupStack::PopAndDestroy(); // targetFile |
|
514 } |
|
515 |
|
516 // Calculates the size of the file. |
|
517 if( !err ) |
|
518 { |
|
519 err = file.Size( length ); |
|
520 } |
|
521 |
|
522 if( ! err ) |
|
523 { |
|
524 HBufC8* readBuf = HBufC8::NewL( length ); |
|
525 TPtr8 readBufPtr = readBuf->Des(); |
|
526 file.Read( readBufPtr ); |
|
527 TouDes = HBufC::NewL( readBuf->Length() ); |
|
528 TouDes->Des().Copy( *readBuf ); |
|
529 delete readBuf; |
|
530 } |
|
531 file.Close(); |
|
532 fsSession.Close(); |
|
533 CleanupStack::PopAndDestroy(); // fileName |
|
534 delete appId; |
|
535 delete brandId; |
|
536 return TouDes; |
|
537 } |
|
538 |
|
539 // ----------------------------------------------------------------------------- |
|
540 // CVIMPSTUiBrandData::GetToUStringL() |
|
541 // ----------------------------------------------------------------------------- |
|
542 // |
|
543 HBufC* CVIMPSTUiBrandData::ConcatLC( TDesC& aDesc1, TDesC& aDesc2 ) |
|
544 { |
|
545 TRACER_AUTO; |
|
546 HBufC* resultDesc = HBufC::NewLC( aDesc1.Length() + aDesc2.Length() ); |
|
547 resultDesc->Des().Append( aDesc1 ); |
|
548 resultDesc->Des().Append( aDesc2 ); |
|
549 return resultDesc; |
|
550 } |
|
551 |
|
552 // End of File |
|