35 _LIT(KHspsFolder, "\\200159c0\\themes\\" ); |
35 _LIT(KHspsFolder, "\\200159c0\\themes\\" ); |
36 _LIT(KSourcesFolder, "\\sources\\"); |
36 _LIT(KSourcesFolder, "\\sources\\"); |
37 _LIT( KThemesFolder, "\\themes\\" ); |
37 _LIT( KThemesFolder, "\\themes\\" ); |
38 _LIT( KDoubleBackSlash, "\\" ); |
38 _LIT( KDoubleBackSlash, "\\" ); |
39 _LIT8( KHexPrefix8, "0x" ); |
39 _LIT8( KHexPrefix8, "0x" ); |
|
40 _LIT( KClientSources, "c:\\private\\%x\\%D\\%D\\%D\\%S\\sources\\%S" ); |
40 |
41 |
41 // ----------------------------------------------------------------------------- |
42 // ----------------------------------------------------------------------------- |
42 // hspsServerUtil::GenerateConfigurationAttributesL |
43 // hspsServerUtil::GenerateConfigurationAttributesL |
43 // ----------------------------------------------------------------------------- |
44 // ----------------------------------------------------------------------------- |
44 // |
45 // |
556 |
557 |
557 return ptr; |
558 return ptr; |
558 } |
559 } |
559 |
560 |
560 // ----------------------------------------------------------------------------- |
561 // ----------------------------------------------------------------------------- |
|
562 // hspsServerUtil::RemoveResourceFilesL |
|
563 // ----------------------------------------------------------------------------- |
|
564 void hspsServerUtil::RemoveResourceFilesL( |
|
565 CFileMan& aFilemanager, |
|
566 RFs& aFs, |
|
567 const TInt aAppUid, |
|
568 const ChspsODT& aPluginODT ) |
|
569 { |
|
570 // Remove all plug-in resources |
|
571 for( TInt i=0; i< aPluginODT.ResourceCount(); i++ ) |
|
572 { |
|
573 ChspsResource& r = aPluginODT.ResourceL( i ); |
|
574 if( r.FileName().Find( KSourcesFolder ) > 0 ) |
|
575 { |
|
576 TPtrC id( GetFixedOdtName( r.ResourceId() ) ); |
|
577 const TDesC& ver( aPluginODT.ThemeVersion() ); |
|
578 TFileName resource; |
|
579 resource.Format( |
|
580 KClientSources, |
|
581 aAppUid, |
|
582 aPluginODT.RootUid(), |
|
583 aPluginODT.ProviderUid(), |
|
584 aPluginODT.ThemeUid(), |
|
585 &ver, |
|
586 &id ); |
|
587 if( BaflUtils::FileExists( aFs, resource ) ) |
|
588 { |
|
589 aFilemanager.Delete( resource, 0 ); |
|
590 } |
|
591 } |
|
592 } |
|
593 } |
|
594 |
|
595 |
|
596 // ----------------------------------------------------------------------------- |
|
597 // hspsServerUtil::CopyResourceFilesL |
|
598 // ----------------------------------------------------------------------------- |
|
599 TInt hspsServerUtil::CopyResourceFilesL( |
|
600 ChspsODT& aAppODT, |
|
601 RFs& aFs, |
|
602 CFileMan& aFilemanager, |
|
603 const TInt aDeviceLanguage, |
|
604 const TInt aConfUid, |
|
605 const TDesC& aDestination, |
|
606 const TBool aIsRelevant ) |
|
607 { |
|
608 TInt error( KErrNone ); |
|
609 RPointerArray<ChspsResource> widgetResources; // Objects are not owned. |
|
610 CleanupClosePushL( widgetResources ); |
|
611 |
|
612 // Find resources for the language or common to all languages or test resources |
|
613 // if others couldn't be found |
|
614 GetResourcesForLanguageL( |
|
615 aAppODT, |
|
616 aConfUid, |
|
617 (TLanguage)aDeviceLanguage, |
|
618 widgetResources ); |
|
619 |
|
620 // Copy the resources found |
|
621 for( TInt i = 0; ( i < widgetResources.Count() && !error ); i++ ) |
|
622 { |
|
623 ChspsResource* resource = widgetResources[i]; |
|
624 if( !resource ) |
|
625 { |
|
626 continue; |
|
627 } |
|
628 |
|
629 // Get relative path under the themes folder |
|
630 TPath relativePath; |
|
631 GetRelativeResourcePath( |
|
632 resource->FileName(), |
|
633 relativePath ); |
|
634 |
|
635 // Strip language indicator from the relative path |
|
636 GetLocaleIndependentResourcePath( |
|
637 resource->Language(), |
|
638 relativePath ); |
|
639 |
|
640 // Finalize target path |
|
641 TPath targetPath; |
|
642 targetPath.Copy( aDestination ); |
|
643 targetPath.Append( relativePath ); |
|
644 |
|
645 // Create target path and copy files when required |
|
646 error = CopyResourceFileL( |
|
647 aFs, |
|
648 aFilemanager, |
|
649 targetPath, |
|
650 resource->FileName(), |
|
651 aIsRelevant ); |
|
652 if ( error == KErrAlreadyExists ) |
|
653 { |
|
654 error = KErrNone; |
|
655 } |
|
656 |
|
657 } // copy loop |
|
658 |
|
659 widgetResources.Reset(); |
|
660 CleanupStack::PopAndDestroy( 1, &widgetResources ); |
|
661 |
|
662 return error; |
|
663 } |
|
664 |
|
665 // ----------------------------------------------------------------------------- |
561 // hspsServerUtil::CopyResourceFileL |
666 // hspsServerUtil::CopyResourceFileL |
562 // ----------------------------------------------------------------------------- |
667 // ----------------------------------------------------------------------------- |
563 // |
668 // |
564 TInt hspsServerUtil::CopyResourceFileL( |
669 TInt hspsServerUtil::CopyResourceFileL( |
565 RFs& aFs, |
670 RFs& aFs, |
566 CFileMan& aFilemanager, |
671 CFileMan& aFilemanager, |
567 const TPath& aTargetPath, |
672 const TPath& aTargetPath, |
568 const TFileName& aSourceFile ) |
673 const TFileName& aSourceFile, |
|
674 const TBool aIsRelevant ) |
569 { |
675 { |
570 // Construct target file with full path. |
676 // Construct target file with full path. |
571 TFileName targetFile; |
677 TFileName targetFile; |
572 |
678 |
573 TParse targetParser; |
679 TParse targetParser; |
1700 |
1817 |
1701 return ( aFilename.Length() > 0 ); |
1818 return ( aFilename.Length() > 0 ); |
1702 } |
1819 } |
1703 |
1820 |
1704 // ----------------------------------------------------------------------------- |
1821 // ----------------------------------------------------------------------------- |
1705 // hspsServerUtil::GetValidResourcesL |
1822 // hspsServerUtil::GetResourcesForLanguageL |
1706 // ----------------------------------------------------------------------------- |
1823 // ----------------------------------------------------------------------------- |
1707 void hspsServerUtil::GetValidResourcesL( |
1824 void hspsServerUtil::GetResourcesForLanguageL( |
1708 ChspsODT& aODT, |
1825 ChspsODT& aODT, |
1709 const TInt aConfUid, |
1826 const TInt aConfUid, |
1710 const TLanguage aActiveLanguage, |
1827 const TLanguage aActiveLanguage, |
1711 RPointerArray<ChspsResource>& aWidgetResources ) |
1828 RPointerArray<ChspsResource>& aWidgetResources ) |
1712 { |
1829 { |