|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // aplapplistitem.cpp |
|
15 // |
|
16 |
|
17 #include "aplapplistitem.h" |
|
18 #include "APGAPLST.H" // KApaIconIndexSmall, KApaIconIndexMedium, KApaIconIndexLarge |
|
19 #include "../apgrfx/APGSTD.H" |
|
20 #include "APFDEF.H" // KAppResourceFileExtension |
|
21 #include "../apparc/TRACE.H" |
|
22 #include <bautils.h> |
|
23 #include "../apgrfx/APGPRIV.H" // KLitPathForNonNativeResourceAndIconFiles |
|
24 #include "../apgrfx/apprivate.h" // KLitPathForNonNativeResourceAndIconFiles |
|
25 #include "aplappinforeader.h" |
|
26 #include <e32uid.h> |
|
27 |
|
28 |
|
29 // Delays in the pseudo idle object that builds the application list |
|
30 // |
|
31 |
|
32 // |
|
33 // Local functions |
|
34 // |
|
35 |
|
36 extern void CleanupServiceArray(TAny* aServiceArray); // Implemented in AplAppList.cpp |
|
37 |
|
38 |
|
39 // |
|
40 // class TApaAppEntry |
|
41 // |
|
42 |
|
43 /** Constructs an empty application entry object. |
|
44 |
|
45 The full path name is empty, and the triplet of UIDs forming the UID type |
|
46 are set to null UIDs. */ |
|
47 EXPORT_C TApaAppEntry::TApaAppEntry() |
|
48 : iUidType(TUidType()), |
|
49 iFullName(KNullDesC) |
|
50 {} |
|
51 |
|
52 |
|
53 /** Constructs an application entry object from the specified application |
|
54 DLL full path name and UID type. |
|
55 @param aAppUidType UID type. |
|
56 @param aDllName Application DLL full path name. */ |
|
57 TApaAppEntry::TApaAppEntry(const TUidType& aAppUidType,const TFileName& aDllName) |
|
58 : iUidType(aAppUidType), |
|
59 iFullName(aDllName) |
|
60 {} |
|
61 |
|
62 |
|
63 /** Externalises the application entry to a write stream. |
|
64 |
|
65 @param aStream The write stream. */ |
|
66 void TApaAppEntry::ExternalizeL(RWriteStream& aStream)const |
|
67 { |
|
68 aStream<< iUidType[0]; |
|
69 aStream<< iUidType[1]; |
|
70 aStream<< iUidType[2]; |
|
71 aStream<< iFullName; |
|
72 } |
|
73 |
|
74 |
|
75 /** Internalises the application entry from a read stream. |
|
76 |
|
77 @param aStream The read stream. */ |
|
78 void TApaAppEntry::InternalizeL(RReadStream& aStream) |
|
79 { |
|
80 TUid uid1; |
|
81 TUid uid2; |
|
82 TUid uid3; |
|
83 aStream>> uid1; |
|
84 aStream>> uid2; |
|
85 aStream>> uid3; |
|
86 iUidType = TUidType(uid1,uid2,uid3); |
|
87 aStream>> iFullName; |
|
88 } |
|
89 |
|
90 // |
|
91 // Class CApaAppViewData |
|
92 // |
|
93 |
|
94 CApaAppViewData::~CApaAppViewData() |
|
95 { |
|
96 delete iIcons; |
|
97 delete iCaption; |
|
98 delete iIconFileName; |
|
99 } |
|
100 |
|
101 CApaAppViewData::CApaAppViewData() |
|
102 : iNonMbmIconFile(EFalse) |
|
103 { |
|
104 } |
|
105 |
|
106 void CApaAppViewData::ConstructL() |
|
107 { |
|
108 iIcons=CApaAppIconArray::NewL(); |
|
109 } |
|
110 |
|
111 CApaAppViewData* CApaAppViewData::NewLC() |
|
112 { |
|
113 CApaAppViewData* self=new(ELeave) CApaAppViewData(); |
|
114 CleanupStack::PushL(self); |
|
115 self->ConstructL(); |
|
116 return self; |
|
117 } |
|
118 |
|
119 void CApaAppViewData::SetUid(TUid aUid) |
|
120 { |
|
121 iUid=aUid; |
|
122 } |
|
123 |
|
124 void CApaAppViewData::SetScreenMode(TInt aScreenMode) |
|
125 { |
|
126 iScreenMode=aScreenMode; |
|
127 } |
|
128 |
|
129 EXPORT_C TInt CApaAppViewData::ScreenMode() const |
|
130 { |
|
131 return iScreenMode; |
|
132 } |
|
133 |
|
134 void CApaAppViewData::SetCaptionL(const TDesC& aCaption) |
|
135 { |
|
136 HBufC* newCaption=aCaption.AllocL(); |
|
137 delete(iCaption); // after the AllocL succeeds |
|
138 iCaption=newCaption; |
|
139 } |
|
140 |
|
141 void CApaAppViewData::SetIconArray(CApaAppIconArray* aIcons) |
|
142 { |
|
143 delete iIcons; |
|
144 iIcons = aIcons; |
|
145 } |
|
146 |
|
147 void CApaAppViewData::SetIconFileNameL(const TDesC& aFileName) |
|
148 { |
|
149 HBufC* fileName = aFileName.AllocL(); |
|
150 delete iIconFileName; // after the AllocL succeeds |
|
151 iIconFileName = fileName; |
|
152 } |
|
153 |
|
154 void CApaAppViewData::SetNumOfViewIcons(TInt aNumOfViewIcons) |
|
155 { |
|
156 iNumOfViewIcons = aNumOfViewIcons; |
|
157 } |
|
158 |
|
159 void CApaAppViewData::SetNonMbmIconFile(TBool aNonMbmIconFile) |
|
160 { |
|
161 iNonMbmIconFile = aNonMbmIconFile; |
|
162 } |
|
163 |
|
164 EXPORT_C TUid CApaAppViewData::Uid() const |
|
165 { |
|
166 return iUid; |
|
167 } |
|
168 |
|
169 EXPORT_C CApaMaskedBitmap* CApaAppViewData::Icon(const TSize& aSize) const |
|
170 { |
|
171 return iIcons->IconBySize(aSize); |
|
172 } |
|
173 |
|
174 EXPORT_C CArrayFixFlat<TSize>* CApaAppViewData::IconSizesL() const |
|
175 { |
|
176 return iIcons->IconSizesL(); |
|
177 } |
|
178 |
|
179 EXPORT_C TPtrC CApaAppViewData::IconFileName() const |
|
180 { |
|
181 if (iIconFileName) |
|
182 { |
|
183 return *iIconFileName; |
|
184 } |
|
185 else |
|
186 { |
|
187 return TPtrC(KNullDesC); |
|
188 } |
|
189 } |
|
190 |
|
191 EXPORT_C TBool CApaAppViewData::NonMbmIconFile() const |
|
192 { |
|
193 return iNonMbmIconFile; |
|
194 } |
|
195 |
|
196 |
|
197 // |
|
198 // class CApaAppEntry |
|
199 // |
|
200 |
|
201 CApaAppEntry* CApaAppEntry::NewL(const TApaAppEntry& aAppEntry) |
|
202 { // static |
|
203 CApaAppEntry* self=new(ELeave) CApaAppEntry(aAppEntry.iUidType); |
|
204 CleanupStack::PushL(self); |
|
205 self->ConstructL(aAppEntry.iFullName); |
|
206 CleanupStack::Pop(self); |
|
207 return self; |
|
208 } |
|
209 |
|
210 CApaAppEntry::~CApaAppEntry() |
|
211 { |
|
212 delete iFullName; |
|
213 } |
|
214 |
|
215 void CApaAppEntry::Get(TApaAppEntry& aAppEntry) const |
|
216 { |
|
217 aAppEntry.iFullName=*iFullName; |
|
218 aAppEntry.iUidType=iUidType; |
|
219 } |
|
220 |
|
221 CApaAppEntry::CApaAppEntry(const TUidType& aUidType) |
|
222 : iUidType(aUidType) |
|
223 { |
|
224 } |
|
225 |
|
226 void CApaAppEntry::ConstructL(const TDesC& aFileName) |
|
227 { |
|
228 iFullName=aFileName.AllocL(); |
|
229 } |
|
230 |
|
231 |
|
232 // |
|
233 // Class CApaAppData |
|
234 // |
|
235 |
|
236 EXPORT_C CApaAppData* CApaAppData::NewL(const TApaAppEntry& aAppEntry, RFs& aFs) |
|
237 { |
|
238 CApaAppData* self=new(ELeave) CApaAppData(aFs); |
|
239 CleanupStack::PushL(self); |
|
240 self->ConstructL(aAppEntry); |
|
241 CleanupStack::Pop(); // self |
|
242 return self; |
|
243 } |
|
244 |
|
245 CApaAppData::CApaAppData(RFs& aFs) |
|
246 :iCaption(NULL), iShortCaption(NULL), |
|
247 iIsPresent(CApaAppData::EIsPresent), iFs(aFs), |
|
248 iNonMbmIconFile(EFalse), |
|
249 iApplicationLanguage(ELangNone), iIndexOfFirstOpenService(-1), |
|
250 iNonNativeApplicationType(TUid::Null()), |
|
251 iShortCaptionFromResourceFile(NULL) |
|
252 { |
|
253 } |
|
254 |
|
255 void CApaAppData::ConstructL(const TApaAppEntry& aAppEntry) |
|
256 { |
|
257 iUidType = aAppEntry.iUidType; // if the 2nd UID is KUidAppRegistrationFile, iUidType will be updated in ReadApplicationInformationFromResourceFiles() to reflect the TUidType for the application binary |
|
258 if (ApaUtils::TypeUidIsForRegistrationFile(aAppEntry.iUidType)) |
|
259 { |
|
260 iRegistrationFile = aAppEntry.iFullName.AllocL(); |
|
261 } |
|
262 else |
|
263 { |
|
264 iFullName = aAppEntry.iFullName.AllocL(); |
|
265 } |
|
266 |
|
267 iCapabilityBuf.FillZ(iCapabilityBuf.MaxLength()); |
|
268 iIcons = CApaAppIconArray::NewL(); |
|
269 iViewDataArray=new(ELeave) CArrayPtrFlat<CApaAppViewData>(1); |
|
270 iOwnedFileArray=new(ELeave) CDesCArraySeg(1); |
|
271 User::LeaveIfError(ReadApplicationInformationFromResourceFiles()); |
|
272 } |
|
273 |
|
274 // Return a standard error code |
|
275 // The value returned only reflect the caption status |
|
276 // If there is errors setting up captions the old values are retained |
|
277 // All other errors are silently ignored |
|
278 // General notes: |
|
279 // 1. This method is deliberately very similar to the old CApaAppData::GetAifData |
|
280 // in order to maintain behavioural compatibility for V1 apps |
|
281 // 2. Be very careful in this method, because it can be called on a newly constructed object, |
|
282 // or on an existing object, so don't assume member data pointers will be NULL |
|
283 TInt CApaAppData::ReadApplicationInformationFromResourceFiles() |
|
284 { |
|
285 HBufC* caption = NULL; |
|
286 HBufC* shortCaption = NULL; |
|
287 |
|
288 iTimeStamp = TTime(0); // cannot init in constructor because this function can be called on an existing CApaAppData object |
|
289 |
|
290 if(iRegistrationFile) |
|
291 { |
|
292 CApaAppInfoReader* appInfoReader = NULL; |
|
293 TRAP_IGNORE(appInfoReader = CApaAppInfoReader::NewL(iFs, *iRegistrationFile, iUidType[2])); |
|
294 if (!appInfoReader) |
|
295 { |
|
296 if (!iFullName) |
|
297 { |
|
298 // assume that if iFullName is NULL, this method has been called as part |
|
299 // of constructing a new app data object. The CApaAppInfoReader derived object |
|
300 // could not be created, therefore we have no way to determine the full filename |
|
301 // of the app binary, so give up |
|
302 return KErrNoMemory; |
|
303 } |
|
304 } |
|
305 else |
|
306 { |
|
307 TBool readSuccessful=EFalse; |
|
308 TRAP_IGNORE(readSuccessful= appInfoReader->ReadL()); |
|
309 |
|
310 HBufC* const appBinaryFullName = appInfoReader->AppBinaryFullName(); |
|
311 if (appBinaryFullName) |
|
312 { |
|
313 delete iFullName; |
|
314 iFullName = appBinaryFullName; |
|
315 } |
|
316 |
|
317 if (!iFullName) |
|
318 { |
|
319 delete appInfoReader; |
|
320 return KErrNoMemory; |
|
321 } |
|
322 |
|
323 // if this object has just been constructed, iUidType is currently the TUidType |
|
324 // of the registration file, it should be the TUidType of the app binary file |
|
325 TUidType uidType = appInfoReader->AppBinaryUidType(); |
|
326 if (uidType[1].iUid != KNullUid.iUid) |
|
327 iUidType = uidType; |
|
328 |
|
329 // must get captions regardless of value of readSuccessful, |
|
330 // because the V1 reader might have read captions |
|
331 // this is done to maintain behavioural compatibility with V1 |
|
332 caption = appInfoReader->Caption(); |
|
333 shortCaption = appInfoReader->ShortCaption(); |
|
334 |
|
335 CApaAppIconArray* icons = appInfoReader->Icons(); |
|
336 if(icons) |
|
337 { |
|
338 delete iIcons; |
|
339 iIcons = icons; |
|
340 iIconLoader = appInfoReader->IconLoader(); |
|
341 } |
|
342 else |
|
343 { |
|
344 TRAPD(err, icons = CApaAppIconArray::NewL()); |
|
345 if(err == KErrNone) |
|
346 { |
|
347 delete iIcons; |
|
348 iIcons = icons; |
|
349 } |
|
350 } |
|
351 |
|
352 iTimeStamp = appInfoReader->TimeStamp(); |
|
353 delete iLocalisableResourceFileName; |
|
354 iLocalisableResourceFileName = appInfoReader->LocalisableResourceFileName(); |
|
355 iLocalisableResourceFileTimeStamp = appInfoReader->LocalisableResourceFileTimeStamp(); |
|
356 |
|
357 const TBool isNonNativeApp = |
|
358 (TParsePtrC(*iRegistrationFile).Path().CompareF(KLitPathForNonNativeResourceAndIconFiles) == 0); |
|
359 |
|
360 if (isNonNativeApp) |
|
361 { |
|
362 // In the case of a non-native app, the resource file has been prefixed with a |
|
363 // TCheckedUid, the second of whose UIDs is the non-native application type uid. |
|
364 TEntry entry; |
|
365 const TInt error=iFs.Entry(*iRegistrationFile, entry); |
|
366 if (error!=KErrNone) |
|
367 { |
|
368 delete appInfoReader; |
|
369 return error; |
|
370 } |
|
371 |
|
372 __ASSERT_DEBUG(entry.iType[0].iUid==KUidPrefixedNonNativeRegistrationResourceFile, Panic(EPanicUnexpectedUid)); |
|
373 iNonNativeApplicationType=entry.iType[1]; |
|
374 } |
|
375 |
|
376 delete iOpaqueData; |
|
377 iOpaqueData = appInfoReader->OpaqueData(); |
|
378 |
|
379 if (readSuccessful) |
|
380 { |
|
381 appInfoReader->Capability(iCapabilityBuf); |
|
382 |
|
383 iDefaultScreenNumber = appInfoReader->DefaultScreenNumber(); |
|
384 |
|
385 delete iIconFileName; |
|
386 iIconFileName = appInfoReader->IconFileName(); |
|
387 iIconFileTimeStamp = appInfoReader->IconFileTimeStamp(); |
|
388 iNonMbmIconFile = appInfoReader->NonMbmIconFile(); |
|
389 iNumOfAppIcons = appInfoReader->NumOfAppIcons(); |
|
390 iApplicationLanguage = appInfoReader->AppLanguage(); |
|
391 |
|
392 // views |
|
393 iViewDataArray->ResetAndDestroy(); |
|
394 CArrayPtrFlat<CApaAppViewData>* viewDataArray = appInfoReader->Views(); |
|
395 if (viewDataArray) |
|
396 { |
|
397 delete iViewDataArray; |
|
398 iViewDataArray = viewDataArray; |
|
399 |
|
400 if(!iIconLoader && ViewMbmIconsRequireLoading()) |
|
401 { |
|
402 //if VIEW_DATA contains a MBM icon we need to initialize iIconLoader |
|
403 iIconLoader = appInfoReader->IconLoader(); |
|
404 } |
|
405 } |
|
406 |
|
407 // owned files |
|
408 iOwnedFileArray->Reset(); |
|
409 CDesCArray* const ownedFileArray = appInfoReader->OwnedFiles(); |
|
410 if (ownedFileArray) |
|
411 { |
|
412 delete iOwnedFileArray; |
|
413 iOwnedFileArray = ownedFileArray; |
|
414 } |
|
415 |
|
416 UpdateServiceArray(appInfoReader->ServiceArray(iIndexOfFirstOpenService)); |
|
417 } |
|
418 |
|
419 delete appInfoReader; |
|
420 } |
|
421 } |
|
422 |
|
423 if (!caption) |
|
424 { |
|
425 TParsePtrC parse (*iFullName); |
|
426 caption = parse.Name().Alloc(); |
|
427 } |
|
428 |
|
429 // Put the captions into place |
|
430 if (caption) |
|
431 { |
|
432 if (!shortCaption) |
|
433 { |
|
434 shortCaption = caption->Alloc(); |
|
435 if (!shortCaption) |
|
436 { |
|
437 delete caption; |
|
438 caption = NULL; |
|
439 } |
|
440 } |
|
441 |
|
442 delete iCaption; |
|
443 iCaption = caption; |
|
444 delete iShortCaption; |
|
445 iShortCaption = shortCaption; |
|
446 } |
|
447 |
|
448 return caption ? KErrNone : KErrNoMemory; |
|
449 } |
|
450 |
|
451 EXPORT_C CApaAppData::~CApaAppData() |
|
452 // Just delete components, NOT iNext (next CApaAppData in the list). |
|
453 { |
|
454 delete iSuccessor; |
|
455 delete iCaption; |
|
456 delete iShortCaption; |
|
457 delete iFullName; |
|
458 delete iShortCaptionFromResourceFile; |
|
459 delete iIcons; |
|
460 delete iIconLoader; |
|
461 if(iViewDataArray) |
|
462 { |
|
463 iViewDataArray->ResetAndDestroy(); |
|
464 delete iViewDataArray; |
|
465 } |
|
466 delete iOwnedFileArray; |
|
467 delete iIconFileName; |
|
468 delete iLocalisableResourceFileName; |
|
469 if (iServiceArray) |
|
470 { |
|
471 CleanupServiceArray(iServiceArray); |
|
472 iServiceArray = NULL; |
|
473 } |
|
474 delete iOpaqueData; |
|
475 delete iRegistrationFile; |
|
476 iNext = NULL; |
|
477 } |
|
478 |
|
479 void CApaAppData::UpdateServiceArray(CArrayFixFlat<TApaAppServiceInfo>* aNewServiceArray) |
|
480 { |
|
481 // clear out any existing service info |
|
482 if (iServiceArray) |
|
483 { |
|
484 CleanupServiceArray(iServiceArray); |
|
485 iServiceArray = NULL; |
|
486 } |
|
487 // store new service array |
|
488 iServiceArray = aNewServiceArray; |
|
489 } |
|
490 |
|
491 TDataTypePriority CApaAppData::DataType(const TDataType& aDataType, const CArrayFixFlat<TDataTypeWithPriority>& aDataTypeArray) const |
|
492 { |
|
493 TInt count=aDataTypeArray.Count(); |
|
494 for (TInt ii=0;ii<count;ii++) |
|
495 { |
|
496 const TDataTypeWithPriority& type=aDataTypeArray[ii]; |
|
497 if (type.iDataType==aDataType) |
|
498 { |
|
499 return type.iPriority; |
|
500 } |
|
501 else |
|
502 { |
|
503 TPtrC8 src=type.iDataType.Des8(); |
|
504 TPtrC8 trg=aDataType.Des8(); |
|
505 if (src.Match(trg)==0 || trg.Match(src)==0) |
|
506 { |
|
507 if (type.iPriority == KDataTypePrioritySystem) |
|
508 { |
|
509 // This is more or less a magic number so don't decrement |
|
510 return KDataTypePrioritySystem; |
|
511 } |
|
512 else |
|
513 { |
|
514 return (TInt16)(type.iPriority-1); |
|
515 } |
|
516 } |
|
517 } |
|
518 } |
|
519 return KDataTypePriorityNotSupported; |
|
520 } |
|
521 |
|
522 /** |
|
523 * Returns the CApaMaskedBitmap of size aSize for the application associated |
|
524 * with this CApaAppData. If the icons for the application are not yet loaded then it would be loaded first. |
|
525 * If there is not a bitmap of exact size aSize then |
|
526 * the icon closest to but smaller than the one asked for is returned, or NULL if |
|
527 * none is smaller. |
|
528 * |
|
529 * @since Uikon1.2 |
|
530 */ |
|
531 EXPORT_C CApaMaskedBitmap* CApaAppData::Icon(TSize aSize) const |
|
532 { |
|
533 return iIcons->IconBySize(aSize); |
|
534 } |
|
535 |
|
536 /** |
|
537 * Returns a pointer to the small, medium or large application icon for aIconIndex equal to 0, 1 or 2 respectively. |
|
538 * Panics if aIconIndex is not one of these three values. |
|
539 * |
|
540 * This method is superseded by an overload which returns the icon by finding the closest match to a specified size. |
|
541 * |
|
542 * @deprecated |
|
543 */ |
|
544 EXPORT_C CApaMaskedBitmap* CApaAppData::Icon(TInt aIconIndex) const |
|
545 { |
|
546 __ASSERT_DEBUG(aIconIndex>-1 && aIconIndex<3, Panic(EDPanicBadIconSize)); //only support old behaviour |
|
547 TSize sizeExpected; |
|
548 switch(aIconIndex) |
|
549 { |
|
550 case KApaIconIndexSmall: |
|
551 sizeExpected=TSize(24,24); |
|
552 break; |
|
553 case KApaIconIndexMedium: |
|
554 sizeExpected=TSize(32,32); |
|
555 break; |
|
556 case KApaIconIndexLarge: |
|
557 sizeExpected=TSize(48,48); |
|
558 break; |
|
559 default: |
|
560 break; |
|
561 } |
|
562 return Icon(sizeExpected); |
|
563 } |
|
564 |
|
565 void CApaAppData::LoadIconsL() |
|
566 { |
|
567 iIconLoader->LoadAllIconsL(); |
|
568 } |
|
569 |
|
570 EXPORT_C CArrayFixFlat<TSize>* CApaAppData::IconSizesL()const |
|
571 /** Gets the sizes of icons available for the application. |
|
572 * If the icons for the application are not yet loaded then it would be loaded first. |
|
573 |
|
574 @return A pointer to an array of the icon sizes. The caller takes ownership. */ |
|
575 { |
|
576 return iIcons->IconSizesL(); |
|
577 } |
|
578 |
|
579 EXPORT_C TApaAppEntry CApaAppData::AppEntry() const |
|
580 /** Constructs an application entry based on this object. |
|
581 |
|
582 @return The application entry. */ |
|
583 { |
|
584 return TApaAppEntry(iUidType,*iFullName); |
|
585 } |
|
586 |
|
587 |
|
588 EXPORT_C void CApaAppData::Capability(TDes8& aCapabilityBuf)const |
|
589 /** Gets the application's capabilities. |
|
590 |
|
591 @param aCapabilityBuf On return, contains the application's capabilities, |
|
592 specified as a TApaAppCapabilityBuf object. */ |
|
593 { |
|
594 TApaAppCapability::CopyCapability(aCapabilityBuf,iCapabilityBuf); |
|
595 } |
|
596 |
|
597 /** |
|
598 * Returns a pointer to the array of view data objects current for this application. Does not imply transfer of ownership. |
|
599 * |
|
600 * @since App-Framework_6.1 |
|
601 */ |
|
602 EXPORT_C CArrayPtrFlat<CApaAppViewData>* CApaAppData::Views() const |
|
603 { |
|
604 return iViewDataArray; |
|
605 } |
|
606 |
|
607 /** |
|
608 * Returns a pointer to the array of files for which this application claims ownership. Does not imply transfer of ownership. |
|
609 * |
|
610 * @since App-Framework_6.1 |
|
611 */ |
|
612 EXPORT_C CDesCArray* CApaAppData::OwnedFiles() const |
|
613 { |
|
614 return iOwnedFileArray; |
|
615 } |
|
616 |
|
617 TBool CApaAppData::Update() |
|
618 // returns true if changes were made to the cached data |
|
619 { |
|
620 __APA_PROFILE_START(17); |
|
621 TBool changed=EFalse; |
|
622 |
|
623 // Get app info file entry |
|
624 TEntry entry; |
|
625 TInt ret; |
|
626 if (iRegistrationFile != NULL) |
|
627 { |
|
628 ret = iFs.Entry(*iRegistrationFile, entry); |
|
629 if (ret==KErrNone && entry.iModified!=iTimeStamp) |
|
630 { |
|
631 // assume registration file may have changed |
|
632 changed = ETrue; |
|
633 } |
|
634 else |
|
635 { |
|
636 if (iLocalisableResourceFileName) |
|
637 { |
|
638 // see if localisable resource information might have changed |
|
639 TParse parse; |
|
640 ret = parse.SetNoWild(KAppResourceFileExtension, iLocalisableResourceFileName, NULL); |
|
641 if (ret == KErrNone) |
|
642 { |
|
643 TFileName resourceFileName(parse.FullName()); |
|
644 TLanguage language; |
|
645 BaflUtils::NearestLanguageFileV2(iFs, resourceFileName, language); |
|
646 (void)language; |
|
647 if (resourceFileName.CompareF(*iLocalisableResourceFileName)!=0) |
|
648 { |
|
649 changed = ETrue; |
|
650 } |
|
651 else |
|
652 { |
|
653 ret = iFs.Entry(*iLocalisableResourceFileName, entry); |
|
654 if ((ret==KErrNotFound && iLocalisableResourceFileTimeStamp!=TTime(0)) || |
|
655 (ret==KErrNone && entry.iModified!=iLocalisableResourceFileTimeStamp)) |
|
656 { |
|
657 changed = ETrue; |
|
658 } |
|
659 } |
|
660 } |
|
661 } |
|
662 } |
|
663 } |
|
664 if (changed) |
|
665 { |
|
666 // re-read data |
|
667 // Ignore result, nothing we can do in case failure |
|
668 // and the old values should be preserved |
|
669 const TInt ignore = ReadApplicationInformationFromResourceFiles(); |
|
670 } //lint !e529 Symbol 'ignore' not subsequently referenced |
|
671 |
|
672 else |
|
673 { |
|
674 if (iIconFileName) |
|
675 { |
|
676 ret = iFs.Entry(*iIconFileName, entry); |
|
677 // See if the icon file has been "modified" |
|
678 // It could have been replaced with a differnt version, deleted or added |
|
679 // if the icon file specified in the resource was missing |
|
680 if ((ret==KErrNotFound && iIconFileTimeStamp!=TTime(0)) || |
|
681 (ret==KErrNone && entry.iModified!=iIconFileTimeStamp)) |
|
682 { |
|
683 // Assume the icon file has changed |
|
684 iIconFileTimeStamp = entry.iModified; |
|
685 changed = ETrue; |
|
686 } |
|
687 } |
|
688 } |
|
689 |
|
690 __APA_PROFILE_END(17); |
|
691 return changed; |
|
692 } |
|
693 |
|
694 EXPORT_C TDataTypePriority CApaAppData::DataType(const TDataType& aDataType) const |
|
695 // returns the priority of the data type |
|
696 /** If the application supports the specified data type, the function returns |
|
697 the priority with which it should be selected for handling it. |
|
698 |
|
699 If the application does not support the specified data type, |
|
700 KDataTypePriorityNotSupported is returned. |
|
701 |
|
702 Note that the function supports wildcard matching, using "*" and "?". In the case |
|
703 of a wildcard match, the priority value returned is reduced by 1, so that in this |
|
704 case, the application could never have the maximum priority |
|
705 (KDataTypePriorityUserSpecified). |
|
706 |
|
707 @param aDataType The data type of interest. |
|
708 @return The priority with which the application should be selected for handling |
|
709 the specified data type, or KDataTypePriorityNotSupported if the data type is |
|
710 not supported. */ |
|
711 { |
|
712 if (iIndexOfFirstOpenService >= 0) |
|
713 { |
|
714 const CArrayFixFlat<TDataTypeWithPriority>& dataTypeArray = |
|
715 (*iServiceArray)[iIndexOfFirstOpenService].DataTypes(); |
|
716 return DataType(aDataType, dataTypeArray); |
|
717 } |
|
718 return KDataTypePriorityNotSupported; |
|
719 } |
|
720 |
|
721 |
|
722 EXPORT_C TBool CApaAppData::IsPending() const |
|
723 /* Returns true if the app info is not yet updated by the current scan. */ |
|
724 { |
|
725 return (iIsPresent==CApaAppData::EPresentPendingUpdate |
|
726 || iIsPresent==CApaAppData::ENotPresentPendingUpdate); |
|
727 } |
|
728 |
|
729 EXPORT_C TBool CApaAppData::CanUseScreenMode(TInt aScreenMode) |
|
730 /** Tests whether the specified screen mode is valid for any of |
|
731 this application's views. If the app has no views, the function |
|
732 assumes that only the default screen mode (at screen mode index |
|
733 zero) is allowed. This function is used by CApaAppList to create |
|
734 a list of valid applications. |
|
735 |
|
736 @param aScreenMode The index of the screen mode. |
|
737 @return True if screen mode is valid, otherwise false. */ |
|
738 { |
|
739 const TInt count=iViewDataArray->Count(); |
|
740 // If there are no views, assume only the default screen mode is allowed |
|
741 TBool ret=(count==0 && aScreenMode==0); |
|
742 for(TInt ii=0;ii<count;ii++) |
|
743 { |
|
744 const CApaAppViewData* data=(*iViewDataArray)[ii]; |
|
745 if(data->ScreenMode()==aScreenMode) |
|
746 { |
|
747 ret=ETrue; |
|
748 break; |
|
749 } |
|
750 } |
|
751 return ret; |
|
752 } |
|
753 |
|
754 EXPORT_C void CApaAppData::GetIconInfo(TInt& aIconCount, TInt& aDefaultIconsUsed) const |
|
755 /** Gets icon information for the app. If the icons for the application are not yet loaded then it would be loaded first. |
|
756 |
|
757 @param aIconCount On return, this contains the number of app icons |
|
758 @param aDefaultIconsUsed On return, this indicates whether the default icons have been used |
|
759 */ |
|
760 { |
|
761 aIconCount = iIcons->Count(); |
|
762 aDefaultIconsUsed = iIcons->DefaultIconsUsed(); |
|
763 } |
|
764 |
|
765 /** Gets the default screen number used by the application. |
|
766 |
|
767 A device may have more than once screen. This function |
|
768 returns the number associated with the screen which will |
|
769 be the default screen used by the application. |
|
770 |
|
771 @return The default screen number |
|
772 */ |
|
773 EXPORT_C TUint CApaAppData::DefaultScreenNumber() const |
|
774 { |
|
775 return iDefaultScreenNumber; |
|
776 } |
|
777 |
|
778 /** Returns true if app info was provided by a registration file |
|
779 |
|
780 @return true if app info was provided by a registration file |
|
781 */ |
|
782 EXPORT_C TBool CApaAppData::RegistrationFileUsed() const |
|
783 { |
|
784 return iRegistrationFile != NULL; |
|
785 } |
|
786 |
|
787 /** Returns the full filename of the registration resource file |
|
788 |
|
789 @return The full path and filename of the registration resource file. |
|
790 @internalTechnology |
|
791 */ |
|
792 EXPORT_C TPtrC CApaAppData::RegistrationFileName() const |
|
793 { |
|
794 if (iRegistrationFile) |
|
795 { |
|
796 return *iRegistrationFile; |
|
797 } |
|
798 else |
|
799 { |
|
800 return TPtrC(KNullDesC); |
|
801 } |
|
802 } |
|
803 |
|
804 |
|
805 /** Returns the full filename of the localisable resource file |
|
806 |
|
807 @return The full path and filename of the localisable resource file. |
|
808 @internalTechnology |
|
809 */ |
|
810 EXPORT_C TPtrC CApaAppData::LocalisableResourceFileName() const |
|
811 { |
|
812 if (iLocalisableResourceFileName) |
|
813 { |
|
814 return *iLocalisableResourceFileName; |
|
815 } |
|
816 else |
|
817 { |
|
818 return TPtrC(KNullDesC); |
|
819 } |
|
820 } |
|
821 |
|
822 |
|
823 /** Returns the non-native application opaque data |
|
824 |
|
825 @return The non-native application opaque data. |
|
826 @internalComponent |
|
827 */ |
|
828 EXPORT_C TPtrC8 CApaAppData::OpaqueData() const |
|
829 { |
|
830 if (iOpaqueData) |
|
831 { |
|
832 return *iOpaqueData; |
|
833 } |
|
834 else |
|
835 { |
|
836 return TPtrC8(KNullDesC8); |
|
837 } |
|
838 } |
|
839 |
|
840 EXPORT_C TUid CApaAppData::NonNativeApplicationType() const |
|
841 /** @internalComponent */ |
|
842 { |
|
843 return iNonNativeApplicationType; |
|
844 } |
|
845 |
|
846 /** Returns the full filename of the file containing application icons |
|
847 |
|
848 @return The full path and filename of the icon file. |
|
849 */ |
|
850 EXPORT_C TPtrC CApaAppData::IconFileName() const |
|
851 { |
|
852 if (iIconFileName) |
|
853 { |
|
854 return *iIconFileName; |
|
855 } |
|
856 else |
|
857 { |
|
858 return TPtrC(KNullDesC); |
|
859 } |
|
860 } |
|
861 |
|
862 /** Returns true if the application provides a non-MBM icon filename. |
|
863 |
|
864 If this function returns false, this does not necessarily mean |
|
865 an MBM icon filename is provided. |
|
866 |
|
867 @return true if the application provides a non-MBM icon filename. |
|
868 */ |
|
869 EXPORT_C TBool CApaAppData::NonMbmIconFile() const |
|
870 { |
|
871 return iNonMbmIconFile; |
|
872 } |
|
873 |
|
874 |
|
875 /** Determines the current language the application is using to display its |
|
876 user interface. |
|
877 @return The current language. |
|
878 */ |
|
879 EXPORT_C TLanguage CApaAppData::ApplicationLanguage() const |
|
880 { |
|
881 return iApplicationLanguage; |
|
882 } |
|
883 |
|
884 /** Returns true if the application implements the specified service. |
|
885 @param aServiceUid The service UID. |
|
886 @return true if the application implements the specified service. |
|
887 @internalComponent |
|
888 */ |
|
889 EXPORT_C TBool CApaAppData::ImplementsService(TUid aServiceUid) const |
|
890 { |
|
891 if (iServiceArray) |
|
892 { |
|
893 TInt count = iServiceArray->Count(); |
|
894 for (TInt i = count-1; i >= 0; i--) |
|
895 { |
|
896 if ((*iServiceArray)[i].Uid() == aServiceUid) |
|
897 { |
|
898 return ETrue; |
|
899 } |
|
900 } |
|
901 } |
|
902 return EFalse; |
|
903 } |
|
904 |
|
905 /** Checks if the application implements the specified service and if the |
|
906 service explicitly supports the datatype. Explicitly means that the datatype is |
|
907 listed in the service's list of datatype in the registration file and is |
|
908 not the general datatype associated with the application (aka the Open service). |
|
909 @param aServiceUid The service UID. |
|
910 @param aDataType The datattype |
|
911 @return The priority. KDataTypePriorityNotSupported if the app doesn't support |
|
912 this service with this datatype. |
|
913 @internalComponent |
|
914 */ |
|
915 TInt CApaAppData::ImplementsServiceWithDataType(TUid aServiceUid, const TDataType& aDataType) const |
|
916 { |
|
917 TInt result = KDataTypePriorityNotSupported; |
|
918 if (iServiceArray) |
|
919 { |
|
920 TInt count = iServiceArray->Count(); |
|
921 for (TInt i = count-1; i >= 0; i--) |
|
922 { |
|
923 // There can be more than one instance of a given service so we iterate |
|
924 // through the whole service list even if we have already found a suitable |
|
925 // service. |
|
926 if ((*iServiceArray)[i].Uid() == aServiceUid) |
|
927 { |
|
928 const CArrayFixFlat<TDataTypeWithPriority>& datatypes = |
|
929 (*iServiceArray)[i].DataTypes(); |
|
930 TInt priority = DataType(aDataType, datatypes); |
|
931 if (priority > result) |
|
932 { |
|
933 result = priority; |
|
934 } |
|
935 } |
|
936 } |
|
937 } |
|
938 return result; |
|
939 } |
|
940 |
|
941 EXPORT_C void CApaAppData::SetShortCaptionL(const TDesC& aShortCaption) |
|
942 { |
|
943 if(iShortCaption->Compare(aShortCaption) != 0) |
|
944 { |
|
945 HBufC* newShortCaption=aShortCaption.AllocL(); |
|
946 if (!iShortCaptionFromResourceFile) |
|
947 { // store the rsc file caption into iShortCaptionFromResourceFile so that it can be externalized. |
|
948 iShortCaptionFromResourceFile = iShortCaption; |
|
949 } |
|
950 else |
|
951 { |
|
952 delete iShortCaption; |
|
953 } |
|
954 iShortCaption = newShortCaption; |
|
955 } |
|
956 } |
|
957 |
|
958 /** Sets the caption of the application. If the caption is from central repository, |
|
959 it overrides tha value from the resource file. |
|
960 */ |
|
961 EXPORT_C void CApaAppData::SetCaptionL(const TDesC& aCaption) |
|
962 { |
|
963 if(iCaption->Compare(aCaption) != 0) |
|
964 { |
|
965 HBufC* newCaption=aCaption.AllocL(); |
|
966 if (!iCaptionFromResourceFile) |
|
967 { // store the rsc file caption into iCaptionFromResourceFile so that it can be externalized. |
|
968 iCaptionFromResourceFile = iCaption; |
|
969 } |
|
970 else |
|
971 { |
|
972 delete iCaption; |
|
973 } |
|
974 iCaption = newCaption; |
|
975 } |
|
976 } |
|
977 |
|
978 /** Sets the icon details of an application. If these details are from the central repository, |
|
979 it overrides the value in the resource file and loads it. |
|
980 */ |
|
981 EXPORT_C void CApaAppData::SetIconsL(const TDesC& aFileName, TInt aNumIcons) |
|
982 { |
|
983 if (iIconFileName && |
|
984 iIconFileName->Compare(aFileName) == 0 && |
|
985 iNumOfAppIcons == aNumIcons) |
|
986 return; |
|
987 |
|
988 if (!iIconFileNameFromResourceFile) |
|
989 { |
|
990 iNumOfAppIconsFromResourceFile = iNumOfAppIcons; |
|
991 iIconFileNameFromResourceFile = iIconFileName; |
|
992 iIconFileName = NULL; |
|
993 iNonMbmIconFileFromResourceFile = iNonMbmIconFile; |
|
994 iIconFileTimeStampFromResourceFile = iIconFileTimeStamp; |
|
995 } |
|
996 |
|
997 iNonMbmIconFile = !CApaAppInfoReader::FileIsMbmWithGenericExtensionL(aFileName); |
|
998 iNumOfAppIcons = aNumIcons; |
|
999 |
|
1000 if (aFileName != KNullDesC) |
|
1001 { |
|
1002 iIconFileName = aFileName.AllocL(); |
|
1003 if (!iNonMbmIconFile) |
|
1004 { |
|
1005 if (iNumOfAppIcons > 0) |
|
1006 { |
|
1007 // Creates an Application Icon Array |
|
1008 CApaAppIconArray* icons = CApaAppIconArray::NewAppIconsL(iNumOfAppIcons, *iIconFileName, *iIconLoader); |
|
1009 delete iIcons; |
|
1010 iIcons = icons; |
|
1011 } |
|
1012 } |
|
1013 else |
|
1014 { // Creates an Empty Icon Array if application has Non-Mbm Icons |
|
1015 CApaAppIconArray* icons = CApaAppIconArray::NewL(); |
|
1016 delete iIcons; |
|
1017 iIcons = icons; |
|
1018 } |
|
1019 } |
|
1020 else |
|
1021 { |
|
1022 CApaAppIconArray* icons = CApaAppIconArray::NewDefaultIconsL(); |
|
1023 delete iIcons; |
|
1024 iIcons = icons; |
|
1025 } |
|
1026 } |
|
1027 |
|
1028 void CApaAppData::SetAppPending() |
|
1029 { |
|
1030 if (iIsPresent == CApaAppData::ENotPresent |
|
1031 || iIsPresent == CApaAppData::ENotPresentPendingUpdate) |
|
1032 { |
|
1033 iIsPresent = CApaAppData::ENotPresentPendingUpdate; |
|
1034 } |
|
1035 else |
|
1036 { |
|
1037 iIsPresent = CApaAppData::EPresentPendingUpdate; |
|
1038 } |
|
1039 } |
|
1040 |
|
1041 void CApaAppData::InternalizeL(RReadStream& aReadStream) |
|
1042 /** Internalizes the appdata from the AppsList.bin file */ |
|
1043 { |
|
1044 TUint highTime = aReadStream.ReadUint32L(); |
|
1045 TUint lowTime = aReadStream.ReadUint32L(); |
|
1046 iTimeStamp = TTime(MAKE_TINT64(highTime, lowTime)); |
|
1047 |
|
1048 highTime = aReadStream.ReadUint32L(); |
|
1049 lowTime = aReadStream.ReadUint32L(); |
|
1050 iIconFileTimeStamp = TTime(MAKE_TINT64(highTime, lowTime)); |
|
1051 iCaption = HBufC::NewL(aReadStream, KMaxFileName); // Caption |
|
1052 iShortCaption = HBufC::NewL(aReadStream, KMaxFileName); // Shortcaption |
|
1053 iFullName = HBufC::NewL(aReadStream, KMaxFileName); // Filename of application binary |
|
1054 |
|
1055 TUid uid1; |
|
1056 uid1.iUid = aReadStream.ReadUint32L(); |
|
1057 TUid uid2; |
|
1058 uid2.iUid = aReadStream.ReadUint32L(); |
|
1059 TUid uid3; |
|
1060 uid3.iUid = aReadStream.ReadUint32L(); |
|
1061 iUidType = TUidType(uid1, uid2, uid3); // Application UID |
|
1062 |
|
1063 aReadStream >> iCapabilityBuf; |
|
1064 iRegistrationFile = HBufC::NewL(aReadStream, KMaxFileName); // Registration Filename |
|
1065 iDefaultScreenNumber = aReadStream.ReadUint32L(); // Default Screen number |
|
1066 iNumOfAppIcons = aReadStream.ReadInt32L(); // No. of icons |
|
1067 iNonMbmIconFile = aReadStream.ReadUint32L(); |
|
1068 |
|
1069 HBufC* iconFileName = HBufC::NewL(aReadStream, KMaxFileName); // Icon Filename |
|
1070 if (*iconFileName != KNullDesC) |
|
1071 { |
|
1072 iIconFileName = iconFileName; |
|
1073 if (!iNonMbmIconFile) |
|
1074 { |
|
1075 if (iNumOfAppIcons > 0) |
|
1076 { // Create IconLoader to load icons |
|
1077 iIconLoader = CApaIconLoader::NewL(iFs); |
|
1078 // Creates an Application Icon Array |
|
1079 iIcons = CApaAppIconArray::NewAppIconsL(iNumOfAppIcons, *iIconFileName, *iIconLoader); |
|
1080 } |
|
1081 else |
|
1082 TRAP_IGNORE(iIcons = CApaAppIconArray::NewDefaultIconsL()); // Creates and Loads Default Icons. |
|
1083 } |
|
1084 else |
|
1085 { // Creates an Empty Icon Array if application has Non-Mbm Icons |
|
1086 iIcons = CApaAppIconArray::NewL(); |
|
1087 } |
|
1088 } |
|
1089 else |
|
1090 { |
|
1091 delete iconFileName; |
|
1092 TRAP_IGNORE(iIcons = CApaAppIconArray::NewDefaultIconsL()); // Creates and Loads Default Icons. |
|
1093 } |
|
1094 |
|
1095 HBufC* localisableResourceFileName = HBufC::NewL(aReadStream, KMaxFileName); // Registration Filename |
|
1096 if (*localisableResourceFileName != KNullDesC) |
|
1097 iLocalisableResourceFileName = localisableResourceFileName; |
|
1098 else |
|
1099 delete localisableResourceFileName; |
|
1100 |
|
1101 highTime = aReadStream.ReadUint32L(); |
|
1102 lowTime = aReadStream.ReadUint32L(); |
|
1103 iLocalisableResourceFileTimeStamp = TTime(MAKE_TINT64(highTime, lowTime)); // Localisable file timestamp |
|
1104 |
|
1105 iApplicationLanguage = (TLanguage)aReadStream.ReadInt32L(); // Application Language |
|
1106 iIndexOfFirstOpenService = aReadStream.ReadUint32L(); // Index of first open service |
|
1107 iNonNativeApplicationType.iUid = aReadStream.ReadUint32L(); |
|
1108 |
|
1109 HBufC8* opaqueData = HBufC8::NewL(aReadStream, KMaxFileName); // Opaque Data |
|
1110 if (*opaqueData != KNullDesC8) |
|
1111 iOpaqueData = opaqueData; |
|
1112 else |
|
1113 delete opaqueData; |
|
1114 |
|
1115 iViewDataArray = new(ELeave) CArrayPtrFlat<CApaAppViewData>(1); // ViewDataArray |
|
1116 const TInt viewCount = aReadStream.ReadInt32L(); |
|
1117 TInt i; |
|
1118 for (i = 0; i < viewCount; ++i) |
|
1119 { |
|
1120 CApaAppViewData* pView = CApaAppViewData::NewLC(); |
|
1121 |
|
1122 pView->iCaption = HBufC::NewL(aReadStream, KMaxFileName); |
|
1123 pView->iNumOfViewIcons = aReadStream.ReadUint32L(); |
|
1124 pView->iNonMbmIconFile = aReadStream.ReadUint32L(); |
|
1125 HBufC* iconFileName = HBufC::NewL(aReadStream, KMaxFileName); // Icon Filename |
|
1126 if (*iconFileName != KNullDesC) |
|
1127 { |
|
1128 pView->iIconFileName = iconFileName; |
|
1129 if (!pView->iNonMbmIconFile) |
|
1130 { |
|
1131 if (pView->iNumOfViewIcons > 0) |
|
1132 { |
|
1133 if (!iIconLoader) |
|
1134 { // Create Icon Loader if it was not done for App or any of the previous views for the App. |
|
1135 iIconLoader = CApaIconLoader::NewL(iFs); |
|
1136 } |
|
1137 // Creates an Application View Icon Array |
|
1138 CApaAppIconArray* iconViewArray = CApaAppIconArray::NewViewIconsL(pView->iNumOfViewIcons, *pView->iIconFileName, *iIconLoader); |
|
1139 pView->SetIconArray(iconViewArray); |
|
1140 } |
|
1141 } |
|
1142 } |
|
1143 else |
|
1144 delete iconFileName; |
|
1145 |
|
1146 pView->iScreenMode = aReadStream.ReadUint32L(); |
|
1147 pView->iUid.iUid = aReadStream.ReadUint32L(); |
|
1148 |
|
1149 iViewDataArray->AppendL(pView); |
|
1150 CleanupStack::Pop(pView); |
|
1151 } |
|
1152 |
|
1153 iServiceArray = new(ELeave) CArrayFixFlat<TApaAppServiceInfo>(1); |
|
1154 const TInt serviceCount = aReadStream.ReadUint32L(); |
|
1155 |
|
1156 for (i = 0; i < serviceCount; ++i) |
|
1157 { |
|
1158 TApaAppServiceInfo serviceInfo ; |
|
1159 aReadStream >> serviceInfo; |
|
1160 iServiceArray->AppendL(serviceInfo); |
|
1161 } |
|
1162 |
|
1163 iOwnedFileArray = new(ELeave) CDesCArraySeg(1); |
|
1164 const TInt fileCount = aReadStream.ReadUint32L(); |
|
1165 for (i = 0; i < fileCount; ++i) |
|
1166 { |
|
1167 TFileName ownedFile; |
|
1168 aReadStream >> ownedFile; |
|
1169 iOwnedFileArray->AppendL(ownedFile); |
|
1170 } |
|
1171 } |
|
1172 |
|
1173 TBool CApaAppData::ViewMbmIconsRequireLoading() const |
|
1174 { |
|
1175 const TInt count = iViewDataArray->Count(); |
|
1176 for (TInt i = 0; i < count; ++i) |
|
1177 { |
|
1178 const CApaAppViewData* const viewData = iViewDataArray->At(i); |
|
1179 if ((!viewData->iNonMbmIconFile) && (!viewData->iIcons->AreViewIconsLoaded())) |
|
1180 { |
|
1181 return ETrue; |
|
1182 } |
|
1183 } |
|
1184 return EFalse; |
|
1185 } |
|
1186 |
|
1187 TBool CApaAppData::MbmIconsRequireLoading() const |
|
1188 { |
|
1189 if (!iNonMbmIconFile) |
|
1190 { |
|
1191 if (!iIcons->AreAppIconsLoaded()) |
|
1192 { |
|
1193 return ETrue; |
|
1194 } |
|
1195 } |
|
1196 |
|
1197 if (ViewMbmIconsRequireLoading()) |
|
1198 {// if a view has mbm icons, and its not yet loaded we should load its icons. |
|
1199 return ETrue; |
|
1200 } |
|
1201 return EFalse; // icons were loaded already so no need to load them again. |
|
1202 } |
|
1203 |
|
1204 void CApaAppData::ExternalizeL(RWriteStream& aWriteStream) const |
|
1205 { |
|
1206 aWriteStream.WriteUint32L(I64HIGH(iTimeStamp.Int64())); |
|
1207 aWriteStream.WriteUint32L(I64LOW(iTimeStamp.Int64())); |
|
1208 |
|
1209 aWriteStream.WriteUint32L(I64HIGH(iIconFileTimeStamp.Int64())); |
|
1210 aWriteStream.WriteUint32L(I64LOW(iIconFileTimeStamp.Int64())); |
|
1211 aWriteStream << *iCaption; // Caption |
|
1212 if (iIconFileNameFromResourceFile) |
|
1213 { |
|
1214 aWriteStream.WriteUint32L(I64HIGH(iIconFileTimeStampFromResourceFile.Int64())); |
|
1215 aWriteStream.WriteUint32L(I64LOW(iIconFileTimeStampFromResourceFile.Int64())); |
|
1216 } |
|
1217 else |
|
1218 { |
|
1219 aWriteStream.WriteUint32L(I64HIGH(iIconFileTimeStamp.Int64())); |
|
1220 aWriteStream.WriteUint32L(I64LOW(iIconFileTimeStamp.Int64())); |
|
1221 } |
|
1222 |
|
1223 if (iCaptionFromResourceFile) // Caption present in the resource file would be externalized if the one in applist has dynamically changed |
|
1224 { |
|
1225 aWriteStream << *iCaptionFromResourceFile; |
|
1226 } |
|
1227 else |
|
1228 { |
|
1229 aWriteStream << *iCaption; // Caption |
|
1230 } |
|
1231 |
|
1232 if (iShortCaptionFromResourceFile) // Short caption present in the resource file would be externalized if the one in applist has dynamically changed |
|
1233 aWriteStream << *iShortCaptionFromResourceFile; |
|
1234 else |
|
1235 aWriteStream << *iShortCaption; |
|
1236 |
|
1237 aWriteStream << *iFullName; // FullName |
|
1238 |
|
1239 TInt i = 0; |
|
1240 for (i = 0; i < 3; ++i) |
|
1241 aWriteStream << iUidType[i]; // Uid Type |
|
1242 |
|
1243 aWriteStream << iCapabilityBuf; |
|
1244 aWriteStream << RegistrationFileName(); // Registration filename |
|
1245 aWriteStream.WriteUint32L(iDefaultScreenNumber); // Default screen number |
|
1246 |
|
1247 if (iIconFileNameFromResourceFile) |
|
1248 { |
|
1249 aWriteStream.WriteUint32L(iNumOfAppIconsFromResourceFile); // number of icons |
|
1250 aWriteStream.WriteUint32L(iNonMbmIconFileFromResourceFile); |
|
1251 aWriteStream << *iIconFileNameFromResourceFile; |
|
1252 } |
|
1253 else |
|
1254 { |
|
1255 aWriteStream.WriteUint32L(iNumOfAppIcons); // number of icons |
|
1256 aWriteStream.WriteUint32L(iNonMbmIconFile); |
|
1257 aWriteStream << IconFileName(); |
|
1258 } |
|
1259 |
|
1260 aWriteStream << LocalisableResourceFileName(); |
|
1261 |
|
1262 aWriteStream.WriteUint32L(I64HIGH(iLocalisableResourceFileTimeStamp.Int64())); |
|
1263 aWriteStream.WriteUint32L(I64LOW(iLocalisableResourceFileTimeStamp.Int64())); |
|
1264 |
|
1265 aWriteStream.WriteInt32L(iApplicationLanguage); |
|
1266 |
|
1267 aWriteStream.WriteUint32L(iIndexOfFirstOpenService); |
|
1268 |
|
1269 aWriteStream.WriteUint32L(iNonNativeApplicationType.iUid); |
|
1270 |
|
1271 aWriteStream << OpaqueData(); |
|
1272 |
|
1273 TInt count = iViewDataArray->Count(); |
|
1274 aWriteStream.WriteUint32L(count); |
|
1275 |
|
1276 for (i = 0; i < count; ++i) |
|
1277 { |
|
1278 const CApaAppViewData* const viewData = iViewDataArray->At(i); |
|
1279 aWriteStream << *(viewData->iCaption); |
|
1280 aWriteStream.WriteUint32L(viewData->iNumOfViewIcons); |
|
1281 aWriteStream.WriteUint32L(viewData->iNonMbmIconFile); |
|
1282 aWriteStream << viewData->IconFileName(); |
|
1283 aWriteStream.WriteUint32L(viewData->iScreenMode); |
|
1284 aWriteStream.WriteUint32L(viewData->iUid.iUid); |
|
1285 } |
|
1286 |
|
1287 // TApaAppServiceInfo service array |
|
1288 if (iServiceArray) |
|
1289 { |
|
1290 count = iServiceArray->Count(); |
|
1291 aWriteStream.WriteUint32L(count); |
|
1292 for (i = 0; i < count; ++i) |
|
1293 aWriteStream << iServiceArray->At(i); |
|
1294 } |
|
1295 else |
|
1296 aWriteStream.WriteUint32L(NULL); |
|
1297 |
|
1298 if (iOwnedFileArray) |
|
1299 { |
|
1300 count = iOwnedFileArray->MdcaCount(); |
|
1301 aWriteStream.WriteUint32L(count); |
|
1302 for (i = 0; i < count; ++i) |
|
1303 aWriteStream << (*iOwnedFileArray)[i]; |
|
1304 } |
|
1305 else |
|
1306 aWriteStream.WriteUint32L(0); |
|
1307 } |
|
1308 |