234 |
231 |
235 // |
232 // |
236 // Class CApaAppData |
233 // Class CApaAppData |
237 // |
234 // |
238 |
235 |
239 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
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 |
240 CApaAppData::CApaAppData(RFs& aFs) |
245 CApaAppData::CApaAppData(RFs& aFs) |
241 :iCaption(NULL), iShortCaption(NULL), |
246 :iCaption(NULL), iShortCaption(NULL), |
242 iFs(aFs), |
247 iIsPresent(CApaAppData::EIsPresent), iFs(aFs), |
243 iNonMbmIconFile(EFalse), |
248 iNonMbmIconFile(EFalse), |
244 iApplicationLanguage(ELangNone), iIndexOfFirstOpenService(-1), |
249 iApplicationLanguage(ELangNone), iIndexOfFirstOpenService(-1), |
245 iShortCaptionFromResourceFile(NULL) |
250 iNonNativeApplicationType(TUid::Null()), |
246 { |
251 iShortCaptionFromResourceFile(NULL) |
247 } |
252 { |
248 EXPORT_C CApaAppData* CApaAppData::NewL(const Usif::CApplicationRegistrationData& aAppInfo, RFs& aFs, const Usif::RSoftwareComponentRegistry& aScrCon) |
253 } |
249 { |
|
250 CApaAppData* self=new(ELeave) CApaAppData(aFs); |
|
251 CleanupStack::PushL(self); |
|
252 self->ConstructL(aAppInfo, aScrCon); |
|
253 CleanupStack::Pop(self); // self |
|
254 return self; |
|
255 } |
|
256 |
|
257 void CApaAppData::ConstructL(const Usif::CApplicationRegistrationData& aAppInfo, const Usif::RSoftwareComponentRegistry& aScrCon) |
|
258 { |
|
259 iCapabilityBuf.FillZ(iCapabilityBuf.MaxLength()); |
|
260 iIcons = CApaAppIconArray::NewL(); |
|
261 iViewDataArray=new(ELeave) CArrayPtrFlat<CApaAppViewData>(1); |
|
262 iOwnedFileArray=new(ELeave) CDesCArraySeg(1); |
|
263 User::LeaveIfError(ReadApplicationInformationFromSCRL(aAppInfo, aScrCon)); |
|
264 } |
|
265 |
|
266 //Initializes the CApaAppData object with information read from SCR. Leaves if any error occurs during initialization. |
|
267 |
|
268 TInt CApaAppData::ReadApplicationInformationFromSCRL(const Usif::CApplicationRegistrationData& aAppInfo, const Usif::RSoftwareComponentRegistry& aScrCon) |
|
269 { |
|
270 HBufC* caption = NULL; |
|
271 HBufC* shortCaption = NULL; |
|
272 |
|
273 CApaAppInfoReader* appInfoReader = NULL; |
|
274 appInfoReader = CApaAppInfoReader::NewL(iFs, aAppInfo, aScrCon); |
|
275 CleanupStack::PushL(appInfoReader); |
|
276 TBool readSuccessful=EFalse; |
|
277 readSuccessful= appInfoReader->ReadL(); |
|
278 |
|
279 iFullName=appInfoReader->AppBinaryFullName(); |
|
280 |
|
281 iUidType = appInfoReader->AppBinaryUidType(); |
|
282 |
|
283 caption = appInfoReader->Caption(); |
|
284 shortCaption = appInfoReader->ShortCaption(); |
|
285 |
|
286 CApaAppIconArray* icons = appInfoReader->Icons(); |
|
287 if(icons) |
|
288 { |
|
289 delete iIcons; |
|
290 iIcons = icons; |
|
291 iIconLoader = appInfoReader->IconLoader(); |
|
292 } |
|
293 else |
|
294 { |
|
295 TRAPD(err, icons = CApaAppIconArray::NewL()); |
|
296 if(err == KErrNone) |
|
297 { |
|
298 delete iIcons; |
|
299 iIcons = icons; |
|
300 } |
|
301 } |
|
302 |
|
303 |
|
304 iOpaqueData = appInfoReader->OpaqueData(); |
|
305 |
|
306 if (readSuccessful) |
|
307 { |
|
308 appInfoReader->Capability(iCapabilityBuf); |
|
309 |
|
310 iDefaultScreenNumber = appInfoReader->DefaultScreenNumber(); |
|
311 |
|
312 delete iIconFileName; |
|
313 iIconFileName = appInfoReader->IconFileName(); |
|
314 iNonMbmIconFile = appInfoReader->NonMbmIconFile(); |
|
315 iNumOfAppIcons = appInfoReader->NumOfAppIcons(); |
|
316 iApplicationLanguage = appInfoReader->AppLanguage(); |
|
317 |
|
318 // views |
|
319 iViewDataArray->ResetAndDestroy(); |
|
320 CArrayPtrFlat<CApaAppViewData>* viewDataArray = appInfoReader->Views(); |
|
321 if (viewDataArray) |
|
322 { |
|
323 delete iViewDataArray; |
|
324 iViewDataArray = viewDataArray; |
|
325 |
|
326 if(!iIconLoader && ViewMbmIconsRequireLoading()) |
|
327 { |
|
328 //if VIEW_DATA contains a MBM icon we need to initialize iIconLoader |
|
329 iIconLoader = appInfoReader->IconLoader(); |
|
330 } |
|
331 } |
|
332 |
|
333 // owned files |
|
334 iOwnedFileArray->Reset(); |
|
335 CDesCArray* const ownedFileArray = appInfoReader->OwnedFiles(); |
|
336 if (ownedFileArray) |
|
337 { |
|
338 delete iOwnedFileArray; |
|
339 iOwnedFileArray = ownedFileArray; |
|
340 } |
|
341 |
|
342 UpdateServiceArray(appInfoReader->ServiceArray(iIndexOfFirstOpenService)); |
|
343 } |
|
344 |
|
345 CleanupStack::PopAndDestroy(appInfoReader); |
|
346 |
|
347 if (!caption) |
|
348 { |
|
349 TParsePtrC parse (*iFullName); |
|
350 caption = parse.Name().Alloc(); |
|
351 } |
|
352 |
|
353 // Put the captions into place |
|
354 if (caption) |
|
355 { |
|
356 if (!shortCaption) |
|
357 { |
|
358 shortCaption = caption->Alloc(); |
|
359 if (!shortCaption) |
|
360 { |
|
361 delete caption; |
|
362 caption = NULL; |
|
363 } |
|
364 } |
|
365 |
|
366 delete iCaption; |
|
367 iCaption = caption; |
|
368 delete iShortCaption; |
|
369 iShortCaption = shortCaption; |
|
370 } |
|
371 |
|
372 return caption ? KErrNone : KErrNoMemory; |
|
373 } |
|
374 |
|
375 |
|
376 EXPORT_C TUid CApaAppData::NonNativeApplicationType() const |
|
377 /** @internalComponent */ |
|
378 { |
|
379 if (iCapabilityBuf().iAttributes & TApaAppCapability::ENonNative) |
|
380 return iUidType[1]; |
|
381 else |
|
382 return TUid::Null(); |
|
383 } |
|
384 |
|
385 EXPORT_C TBool CApaAppData::IsLangChangePending() |
|
386 { |
|
387 return iIsLangChangePending; |
|
388 } |
|
389 |
|
390 #else |
|
391 CApaAppData::CApaAppData(RFs& aFs) |
|
392 :iCaption(NULL), iShortCaption(NULL), |
|
393 iIsPresent(CApaAppData::EIsPresent), iFs(aFs), |
|
394 iNonMbmIconFile(EFalse), |
|
395 iApplicationLanguage(ELangNone), iIndexOfFirstOpenService(-1), |
|
396 iNonNativeApplicationType(TUid::Null()), |
|
397 iShortCaptionFromResourceFile(NULL) |
|
398 { |
|
399 } |
|
400 |
|
401 EXPORT_C CApaAppData* CApaAppData::NewL(const TApaAppEntry& aAppEntry, RFs& aFs) |
|
402 { |
|
403 CApaAppData* self=new(ELeave) CApaAppData(aFs); |
|
404 CleanupStack::PushL(self); |
|
405 self->ConstructL(aAppEntry); |
|
406 CleanupStack::Pop(); // self |
|
407 return self; |
|
408 } |
|
409 |
254 |
410 void CApaAppData::ConstructL(const TApaAppEntry& aAppEntry) |
255 void CApaAppData::ConstructL(const TApaAppEntry& aAppEntry) |
411 { |
256 { |
412 iUidType = aAppEntry.iUidType; // if the 2nd UID is KUidAppRegistrationFile, iUidType will be updated in ReadApplicationInformationFromResourceFiles() to reflect the TUidType for the application binary |
257 iUidType = aAppEntry.iUidType; // if the 2nd UID is KUidAppRegistrationFile, iUidType will be updated in ReadApplicationInformationFromResourceFiles() to reflect the TUidType for the application binary |
413 |
258 if (ApaUtils::TypeUidIsForRegistrationFile(aAppEntry.iUidType)) |
414 if (ApaUtils::TypeUidIsForRegistrationFile(aAppEntry.iUidType)) |
259 { |
415 { |
260 iRegistrationFile = aAppEntry.iFullName.AllocL(); |
416 iRegistrationFile = aAppEntry.iFullName.AllocL(); |
261 } |
417 } |
262 else |
418 else |
263 { |
419 { |
264 iFullName = aAppEntry.iFullName.AllocL(); |
420 iFullName = aAppEntry.iFullName.AllocL(); |
265 } |
421 } |
266 |
422 |
267 iCapabilityBuf.FillZ(iCapabilityBuf.MaxLength()); |
423 iCapabilityBuf.FillZ(iCapabilityBuf.MaxLength()); |
268 iIcons = CApaAppIconArray::NewL(); |
424 iIcons = CApaAppIconArray::NewL(); |
269 iViewDataArray=new(ELeave) CArrayPtrFlat<CApaAppViewData>(1); |
425 iViewDataArray=new(ELeave) CArrayPtrFlat<CApaAppViewData>(1); |
270 iOwnedFileArray=new(ELeave) CDesCArraySeg(1); |
426 iOwnedFileArray=new(ELeave) CDesCArraySeg(1); |
271 User::LeaveIfError(ReadApplicationInformationFromResourceFiles()); |
427 User::LeaveIfError(ReadApplicationInformationFromResourceFiles()); |
272 } |
428 } |
|
429 |
273 |
430 // Return a standard error code |
274 // Return a standard error code |
431 // The value returned only reflect the caption status |
275 // The value returned only reflect the caption status |
432 // If there is errors setting up captions the old values are retained |
276 // If there is errors setting up captions the old values are retained |
433 // All other errors are silently ignored |
277 // All other errors are silently ignored |
435 // 1. This method is deliberately very similar to the old CApaAppData::GetAifData |
279 // 1. This method is deliberately very similar to the old CApaAppData::GetAifData |
436 // in order to maintain behavioural compatibility for V1 apps |
280 // in order to maintain behavioural compatibility for V1 apps |
437 // 2. Be very careful in this method, because it can be called on a newly constructed object, |
281 // 2. Be very careful in this method, because it can be called on a newly constructed object, |
438 // or on an existing object, so don't assume member data pointers will be NULL |
282 // or on an existing object, so don't assume member data pointers will be NULL |
439 TInt CApaAppData::ReadApplicationInformationFromResourceFiles() |
283 TInt CApaAppData::ReadApplicationInformationFromResourceFiles() |
440 { |
284 { |
441 HBufC* caption = NULL; |
285 HBufC* caption = NULL; |
442 HBufC* shortCaption = NULL; |
286 HBufC* shortCaption = NULL; |
443 |
287 |
444 iTimeStamp = TTime(0); // cannot init in constructor because this function can be called on an existing CApaAppData object |
288 iTimeStamp = TTime(0); // cannot init in constructor because this function can be called on an existing CApaAppData object |
445 |
289 |
446 if(iRegistrationFile) |
290 if(iRegistrationFile) |
447 { |
291 { |
448 CApaAppInfoReader* appInfoReader = NULL; |
292 CApaAppInfoReader* appInfoReader = NULL; |
449 TRAP_IGNORE(appInfoReader = CApaAppInfoReader::NewL(iFs, *iRegistrationFile, iUidType[2])); |
293 TRAP_IGNORE(appInfoReader = CApaAppInfoReader::NewL(iFs, *iRegistrationFile, iUidType[2])); |
450 if (!appInfoReader) |
294 if (!appInfoReader) |
451 { |
295 { |
452 if (!iFullName) |
296 if (!iFullName) |
453 { |
297 { |
454 // assume that if iFullName is NULL, this method has been called as part |
298 // assume that if iFullName is NULL, this method has been called as part |
455 // of constructing a new app data object. The CApaAppInfoReader derived object |
299 // of constructing a new app data object. The CApaAppInfoReader derived object |
456 // could not be created, therefore we have no way to determine the full filename |
300 // could not be created, therefore we have no way to determine the full filename |
457 // of the app binary, so give up |
301 // of the app binary, so give up |
458 return KErrNoMemory; |
302 return KErrNoMemory; |
459 } |
303 } |
460 } |
304 } |
461 else |
305 else |
462 { |
306 { |
463 TBool readSuccessful=EFalse; |
307 TBool readSuccessful=EFalse; |
464 TRAP_IGNORE(readSuccessful= appInfoReader->ReadL()); |
308 TRAP_IGNORE(readSuccessful= appInfoReader->ReadL()); |
465 |
309 |
466 HBufC* const appBinaryFullName = appInfoReader->AppBinaryFullName(); |
310 HBufC* const appBinaryFullName = appInfoReader->AppBinaryFullName(); |
467 if (appBinaryFullName) |
311 if (appBinaryFullName) |
468 { |
312 { |
469 delete iFullName; |
313 delete iFullName; |
470 iFullName = appBinaryFullName; |
314 iFullName = appBinaryFullName; |
471 } |
315 } |
472 |
316 |
473 if (!iFullName) |
317 if (!iFullName) |
474 { |
318 { |
475 delete appInfoReader; |
319 delete appInfoReader; |
476 return KErrNoMemory; |
320 return KErrNoMemory; |
477 } |
321 } |
478 |
322 |
479 // if this object has just been constructed, iUidType is currently the TUidType |
323 // if this object has just been constructed, iUidType is currently the TUidType |
480 // of the registration file, it should be the TUidType of the app binary file |
324 // of the registration file, it should be the TUidType of the app binary file |
481 TUidType uidType = appInfoReader->AppBinaryUidType(); |
325 TUidType uidType = appInfoReader->AppBinaryUidType(); |
482 if (uidType[1].iUid != KNullUid.iUid) |
326 if (uidType[1].iUid != KNullUid.iUid) |
483 iUidType = uidType; |
327 iUidType = uidType; |
484 |
328 |
485 // must get captions regardless of value of readSuccessful, |
329 // must get captions regardless of value of readSuccessful, |
486 // because the V1 reader might have read captions |
330 // because the V1 reader might have read captions |
487 // this is done to maintain behavioural compatibility with V1 |
331 // this is done to maintain behavioural compatibility with V1 |
488 caption = appInfoReader->Caption(); |
332 caption = appInfoReader->Caption(); |
489 shortCaption = appInfoReader->ShortCaption(); |
333 shortCaption = appInfoReader->ShortCaption(); |
490 |
334 |
491 CApaAppIconArray* icons = appInfoReader->Icons(); |
335 CApaAppIconArray* icons = appInfoReader->Icons(); |
492 if(icons) |
336 if(icons) |
493 { |
337 { |
494 delete iIcons; |
338 delete iIcons; |
495 iIcons = icons; |
339 iIcons = icons; |
496 iIconLoader = appInfoReader->IconLoader(); |
340 iIconLoader = appInfoReader->IconLoader(); |
497 } |
341 } |
498 else |
342 else |
499 { |
343 { |
500 TRAPD(err, icons = CApaAppIconArray::NewL()); |
344 TRAPD(err, icons = CApaAppIconArray::NewL()); |
501 if(err == KErrNone) |
345 if(err == KErrNone) |
502 { |
346 { |
503 delete iIcons; |
347 delete iIcons; |
504 iIcons = icons; |
348 iIcons = icons; |
505 } |
349 } |
506 } |
350 } |
507 |
351 |
508 iTimeStamp = appInfoReader->TimeStamp(); |
352 iTimeStamp = appInfoReader->TimeStamp(); |
509 delete iLocalisableResourceFileName; |
353 delete iLocalisableResourceFileName; |
510 iLocalisableResourceFileName = appInfoReader->LocalisableResourceFileName(); |
354 iLocalisableResourceFileName = appInfoReader->LocalisableResourceFileName(); |
511 iLocalisableResourceFileTimeStamp = appInfoReader->LocalisableResourceFileTimeStamp(); |
355 iLocalisableResourceFileTimeStamp = appInfoReader->LocalisableResourceFileTimeStamp(); |
512 |
356 |
513 const TBool isNonNativeApp = |
357 const TBool isNonNativeApp = |
514 (TParsePtrC(*iRegistrationFile).Path().CompareF(KLitPathForNonNativeResourceAndIconFiles) == 0); |
358 (TParsePtrC(*iRegistrationFile).Path().CompareF(KLitPathForNonNativeResourceAndIconFiles) == 0); |
515 |
359 |
516 if (isNonNativeApp) |
360 if (isNonNativeApp) |
517 { |
361 { |
518 // In the case of a non-native app, the resource file has been prefixed with a |
362 // In the case of a non-native app, the resource file has been prefixed with a |
519 // TCheckedUid, the second of whose UIDs is the non-native application type uid. |
363 // TCheckedUid, the second of whose UIDs is the non-native application type uid. |
520 TEntry entry; |
364 TEntry entry; |
521 const TInt error=iFs.Entry(*iRegistrationFile, entry); |
365 const TInt error=iFs.Entry(*iRegistrationFile, entry); |
522 if (error!=KErrNone) |
366 if (error!=KErrNone) |
523 { |
367 { |
524 delete appInfoReader; |
368 delete appInfoReader; |
525 return error; |
369 return error; |
526 } |
370 } |
527 |
371 |
528 __ASSERT_DEBUG(entry.iType[0].iUid==KUidPrefixedNonNativeRegistrationResourceFile, Panic(EPanicUnexpectedUid)); |
372 __ASSERT_DEBUG(entry.iType[0].iUid==KUidPrefixedNonNativeRegistrationResourceFile, Panic(EPanicUnexpectedUid)); |
529 iNonNativeApplicationType=entry.iType[1]; |
373 iNonNativeApplicationType=entry.iType[1]; |
530 } |
374 } |
531 |
375 |
532 delete iOpaqueData; |
376 delete iOpaqueData; |
533 iOpaqueData = appInfoReader->OpaqueData(); |
377 iOpaqueData = appInfoReader->OpaqueData(); |
534 |
378 |
535 if (readSuccessful) |
379 if (readSuccessful) |
536 { |
380 { |
537 appInfoReader->Capability(iCapabilityBuf); |
381 appInfoReader->Capability(iCapabilityBuf); |
538 |
382 |
539 iDefaultScreenNumber = appInfoReader->DefaultScreenNumber(); |
383 iDefaultScreenNumber = appInfoReader->DefaultScreenNumber(); |
540 |
384 |
541 delete iIconFileName; |
385 delete iIconFileName; |
542 iIconFileName = appInfoReader->IconFileName(); |
386 iIconFileName = appInfoReader->IconFileName(); |
543 iIconFileTimeStamp = appInfoReader->IconFileTimeStamp(); |
387 iIconFileTimeStamp = appInfoReader->IconFileTimeStamp(); |
544 iNonMbmIconFile = appInfoReader->NonMbmIconFile(); |
388 iNonMbmIconFile = appInfoReader->NonMbmIconFile(); |
545 iNumOfAppIcons = appInfoReader->NumOfAppIcons(); |
389 iNumOfAppIcons = appInfoReader->NumOfAppIcons(); |
546 iApplicationLanguage = appInfoReader->AppLanguage(); |
390 iApplicationLanguage = appInfoReader->AppLanguage(); |
547 |
391 |
548 // views |
392 // views |
549 iViewDataArray->ResetAndDestroy(); |
393 iViewDataArray->ResetAndDestroy(); |
550 CArrayPtrFlat<CApaAppViewData>* viewDataArray = appInfoReader->Views(); |
394 CArrayPtrFlat<CApaAppViewData>* viewDataArray = appInfoReader->Views(); |
551 if (viewDataArray) |
395 if (viewDataArray) |
552 { |
396 { |
553 delete iViewDataArray; |
397 delete iViewDataArray; |
554 iViewDataArray = viewDataArray; |
398 iViewDataArray = viewDataArray; |
555 |
399 |
556 if(!iIconLoader && ViewMbmIconsRequireLoading()) |
400 if(!iIconLoader && ViewMbmIconsRequireLoading()) |
557 { |
401 { |
558 //if VIEW_DATA contains a MBM icon we need to initialize iIconLoader |
402 //if VIEW_DATA contains a MBM icon we need to initialize iIconLoader |
559 iIconLoader = appInfoReader->IconLoader(); |
403 iIconLoader = appInfoReader->IconLoader(); |
560 } |
404 } |
561 } |
405 } |
562 |
406 |
563 // owned files |
407 // owned files |
564 iOwnedFileArray->Reset(); |
408 iOwnedFileArray->Reset(); |
565 CDesCArray* const ownedFileArray = appInfoReader->OwnedFiles(); |
409 CDesCArray* const ownedFileArray = appInfoReader->OwnedFiles(); |
566 if (ownedFileArray) |
410 if (ownedFileArray) |
567 { |
411 { |
568 delete iOwnedFileArray; |
412 delete iOwnedFileArray; |
569 iOwnedFileArray = ownedFileArray; |
413 iOwnedFileArray = ownedFileArray; |
570 } |
414 } |
571 |
415 |
572 UpdateServiceArray(appInfoReader->ServiceArray(iIndexOfFirstOpenService)); |
416 UpdateServiceArray(appInfoReader->ServiceArray(iIndexOfFirstOpenService)); |
573 } |
417 } |
574 |
418 |
575 delete appInfoReader; |
419 delete appInfoReader; |
576 } |
420 } |
577 } |
421 } |
578 |
422 |
579 if (!caption) |
423 if (!caption) |
580 { |
424 { |
581 TParsePtrC parse (*iFullName); |
425 TParsePtrC parse (*iFullName); |
582 caption = parse.Name().Alloc(); |
426 caption = parse.Name().Alloc(); |
583 } |
427 } |
584 |
428 |
585 // Put the captions into place |
429 // Put the captions into place |
586 if (caption) |
430 if (caption) |
587 { |
431 { |
588 if (!shortCaption) |
432 if (!shortCaption) |
589 { |
433 { |
590 shortCaption = caption->Alloc(); |
434 shortCaption = caption->Alloc(); |
591 if (!shortCaption) |
435 if (!shortCaption) |
592 { |
436 { |
593 delete caption; |
437 delete caption; |
594 caption = NULL; |
438 caption = NULL; |
595 } |
439 } |
596 } |
440 } |
597 |
441 |
598 delete iCaption; |
442 delete iCaption; |
599 iCaption = caption; |
443 iCaption = caption; |
600 delete iShortCaption; |
444 delete iShortCaption; |
601 iShortCaption = shortCaption; |
445 iShortCaption = shortCaption; |
602 } |
446 } |
603 |
447 |
604 return caption ? KErrNone : KErrNoMemory; |
448 return caption ? KErrNone : KErrNoMemory; |
605 } |
449 } |
606 |
|
607 |
|
608 /** Returns true if app info was provided by a registration file |
|
609 |
|
610 @return true if app info was provided by a registration file |
|
611 */ |
|
612 EXPORT_C TBool CApaAppData::RegistrationFileUsed() const |
|
613 { |
|
614 return iRegistrationFile != NULL; |
|
615 } |
|
616 |
|
617 /** Returns the full filename of the registration resource file |
|
618 |
|
619 @return The full path and filename of the registration resource file. |
|
620 @internalTechnology |
|
621 */ |
|
622 EXPORT_C TPtrC CApaAppData::RegistrationFileName() const |
|
623 { |
|
624 if (iRegistrationFile) |
|
625 { |
|
626 return *iRegistrationFile; |
|
627 } |
|
628 else |
|
629 { |
|
630 return TPtrC(KNullDesC); |
|
631 } |
|
632 } |
|
633 |
|
634 |
|
635 /** Returns the full filename of the localisable resource file |
|
636 |
|
637 @return The full path and filename of the localisable resource file. |
|
638 @internalTechnology |
|
639 */ |
|
640 EXPORT_C TPtrC CApaAppData::LocalisableResourceFileName() const |
|
641 { |
|
642 if (iLocalisableResourceFileName) |
|
643 { |
|
644 return *iLocalisableResourceFileName; |
|
645 } |
|
646 else |
|
647 { |
|
648 return TPtrC(KNullDesC); |
|
649 } |
|
650 } |
|
651 |
|
652 |
|
653 TBool CApaAppData::Update() |
|
654 // returns true if changes were made to the cached data |
|
655 { |
|
656 __APA_PROFILE_START(17); |
|
657 TBool changed=EFalse; |
|
658 |
|
659 // Get app info file entry |
|
660 TEntry entry; |
|
661 TInt ret; |
|
662 if (iRegistrationFile != NULL) |
|
663 { |
|
664 ret = iFs.Entry(*iRegistrationFile, entry); |
|
665 if (ret==KErrNone && entry.iModified!=iTimeStamp) |
|
666 { |
|
667 // assume registration file may have changed |
|
668 changed = ETrue; |
|
669 } |
|
670 else |
|
671 { |
|
672 if (iLocalisableResourceFileName) |
|
673 { |
|
674 // see if localisable resource information might have changed |
|
675 TParse parse; |
|
676 ret = parse.SetNoWild(KAppResourceFileExtension, iLocalisableResourceFileName, NULL); |
|
677 if (ret == KErrNone) |
|
678 { |
|
679 TFileName resourceFileName(parse.FullName()); |
|
680 TLanguage language; |
|
681 BaflUtils::NearestLanguageFileV2(iFs, resourceFileName, language); |
|
682 (void)language; |
|
683 if (resourceFileName.CompareF(*iLocalisableResourceFileName)!=0) |
|
684 { |
|
685 changed = ETrue; |
|
686 } |
|
687 else |
|
688 { |
|
689 ret = iFs.Entry(*iLocalisableResourceFileName, entry); |
|
690 if ((ret==KErrNotFound && iLocalisableResourceFileTimeStamp!=TTime(0)) || |
|
691 (ret==KErrNone && entry.iModified!=iLocalisableResourceFileTimeStamp)) |
|
692 { |
|
693 changed = ETrue; |
|
694 } |
|
695 } |
|
696 } |
|
697 } |
|
698 } |
|
699 } |
|
700 if (changed) |
|
701 { |
|
702 // re-read data |
|
703 // Ignore result, nothing we can do in case failure |
|
704 // and the old values should be preserved |
|
705 const TInt ignore = ReadApplicationInformationFromResourceFiles(); |
|
706 } //lint !e529 Symbol 'ignore' not subsequently referenced |
|
707 |
|
708 else |
|
709 { |
|
710 if (iIconFileName) |
|
711 { |
|
712 ret = iFs.Entry(*iIconFileName, entry); |
|
713 // See if the icon file has been "modified" |
|
714 // It could have been replaced with a differnt version, deleted or added |
|
715 // if the icon file specified in the resource was missing |
|
716 if ((ret==KErrNotFound && iIconFileTimeStamp!=TTime(0)) || |
|
717 (ret==KErrNone && entry.iModified!=iIconFileTimeStamp)) |
|
718 { |
|
719 // Assume the icon file has changed |
|
720 iIconFileTimeStamp = entry.iModified; |
|
721 changed = ETrue; |
|
722 } |
|
723 } |
|
724 } |
|
725 |
|
726 __APA_PROFILE_END(17); |
|
727 return changed; |
|
728 } |
|
729 |
|
730 EXPORT_C TBool CApaAppData::IsPending() const |
|
731 /* Returns true if the app info is not yet updated by the current scan. */ |
|
732 { |
|
733 return (iIsPresent==CApaAppData::EPresentPendingUpdate |
|
734 || iIsPresent==CApaAppData::ENotPresentPendingUpdate); |
|
735 } |
|
736 |
|
737 EXPORT_C TUid CApaAppData::NonNativeApplicationType() const |
|
738 /** @internalComponent */ |
|
739 { |
|
740 return iNonNativeApplicationType; |
|
741 } |
|
742 |
|
743 void CApaAppData::SetAppPending() |
|
744 { |
|
745 if (iIsPresent == CApaAppData::ENotPresent |
|
746 || iIsPresent == CApaAppData::ENotPresentPendingUpdate) |
|
747 { |
|
748 iIsPresent = CApaAppData::ENotPresentPendingUpdate; |
|
749 } |
|
750 else |
|
751 { |
|
752 iIsPresent = CApaAppData::EPresentPendingUpdate; |
|
753 } |
|
754 } |
|
755 #endif |
|
756 |
|
757 EXPORT_C TApaAppEntry CApaAppData::AppEntry() const |
|
758 /** Constructs an application entry based on this object. |
|
759 |
|
760 @return The application entry. */ |
|
761 { |
|
762 return TApaAppEntry(iUidType,*iFullName); |
|
763 } |
|
764 |
450 |
765 EXPORT_C CApaAppData::~CApaAppData() |
451 EXPORT_C CApaAppData::~CApaAppData() |
766 // Just delete components, NOT iNext (next CApaAppData in the list). |
452 // Just delete components, NOT iNext (next CApaAppData in the list). |
767 { |
453 { |
768 delete iSuccessor; |
454 delete iSuccessor; |
921 EXPORT_C CDesCArray* CApaAppData::OwnedFiles() const |
612 EXPORT_C CDesCArray* CApaAppData::OwnedFiles() const |
922 { |
613 { |
923 return iOwnedFileArray; |
614 return iOwnedFileArray; |
924 } |
615 } |
925 |
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 } |
926 |
693 |
927 EXPORT_C TDataTypePriority CApaAppData::DataType(const TDataType& aDataType) const |
694 EXPORT_C TDataTypePriority CApaAppData::DataType(const TDataType& aDataType) const |
928 // returns the priority of the data type |
695 // returns the priority of the data type |
929 /** If the application supports the specified data type, the function returns |
696 /** If the application supports the specified data type, the function returns |
930 the priority with which it should be selected for handling it. |
697 the priority with which it should be selected for handling it. |