contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp
changeset 104 9b022b1f357c
parent 103 b99b84bcd2d1
child 109 e0aa398e6810
equal deleted inserted replaced
103:b99b84bcd2d1 104:9b022b1f357c
   279                 }
   279                 }
   280             else if ( element.Name() == KPreviewImageElementName )
   280             else if ( element.Name() == KPreviewImageElementName )
   281                 {
   281                 {
   282                 ParsePreviewImageNameL( element, aPackageUid, widgetDescriptor, aDrive );
   282                 ParsePreviewImageNameL( element, aPackageUid, widgetDescriptor, aDrive );
   283                 }
   283                 }
       
   284             else if ( element.Name() == KTranslationFileName )
       
   285                 {
       
   286                 ParseTranslationFileNameL( element, widgetDescriptor );
       
   287                 }
   284             }
   288             }
   285         CleanupStack::PopAndDestroy( &childElementList );
   289         CleanupStack::PopAndDestroy( &childElementList );
   286 
   290 
       
   291         //set path for hs to use, trim last 2 chars (doubleslash)
       
   292         HBufC *libraryPath = GetManifestDirectoryPathLC( aPackageUid, aDrive );
       
   293         widgetDescriptor->SetPathL(libraryPath->Mid(0,libraryPath->Length()-1));
       
   294         CleanupStack::PopAndDestroy(libraryPath);
       
   295 
       
   296         
   287         HBufC *libraryPath2 = GetManifestDirectoryPathLC( aPackageUid, aDrive );
   297         HBufC *libraryPath2 = GetManifestDirectoryPathLC( aPackageUid, aDrive );
   288         libraryPath2 = libraryPath2->ReAllocL( libraryPath2->Length()
   298         libraryPath2 = libraryPath2->ReAllocL( libraryPath2->Length()
   289                 + widgetDescriptor->GetUri().Length() );
   299                 + widgetDescriptor->GetUri().Length() );
   290         libraryPath2->Des().Append( widgetDescriptor->GetUri() );
   300         libraryPath2->Des().Append( widgetDescriptor->GetUri() );
   291         widgetDescriptor->SetLibraryL( *libraryPath2 );
   301         widgetDescriptor->SetLibraryL( *libraryPath2 );
   324     SetVisibilityL( aElement, widget );
   334     SetVisibilityL( aElement, widget );
   325     SetIconUriL( aElement, aPackageUid, widget, aDrive );
   335     SetIconUriL( aElement, aPackageUid, widget, aDrive );
   326     widget->SetPackageUidL( aPackageUid );
   336     widget->SetPackageUidL( aPackageUid );
   327     widget->SetManifestFilePathNameL( aFilePath );
   337     widget->SetManifestFilePathNameL( aFilePath );
   328     SetMmcIdL( widget, aDrive );
   338     SetMmcIdL( widget, aDrive );
       
   339     SetTranslationFileNameL( aElement, widget );
   329 
   340 
   330     SetModificationTimeL( aFilePath, widget );
   341     SetModificationTimeL( aFilePath, widget );
   331 
   342 
   332     TInt index = iWidgets.Find( widget, CCaWidgetDescription::Compare );
   343     TInt index = iWidgets.Find( widget, CCaWidgetDescription::Compare );
   333     if ( index != KErrNotFound )
   344     if ( index != KErrNotFound )
   351     CleanupStack::PushL( attributeValue );
   362     CleanupStack::PushL( attributeValue );
   352 
   363 
   353     if ( attributeValue->Compare( KNullDesC ) != 0 )
   364     if ( attributeValue->Compare( KNullDesC ) != 0 )
   354         {
   365         {
   355         aWidget->SetUriL( *attributeValue );
   366         aWidget->SetUriL( *attributeValue );
       
   367         aWidget->SetTranslationFileNameL( *attributeValue );
       
   368         }
       
   369     CleanupStack::PopAndDestroy( attributeValue );
       
   370     }
       
   371 
       
   372 // ----------------------------------------------------------------------------
       
   373 //
       
   374 // ----------------------------------------------------------------------------
       
   375 //
       
   376 void CCaWidgetScannerParser::SetTranslationFileNameL( TXmlEngElement& aElement,
       
   377         CCaWidgetDescription* aWidget )
       
   378     {
       
   379     HBufC *attributeValue = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
       
   380             aElement.AttributeValueL( KTranslationFileName ) );
       
   381     CleanupStack::PushL( attributeValue );
       
   382 
       
   383     if ( attributeValue->Compare( KNullDesC ) != 0 )
       
   384         {
       
   385         aWidget->SetTranslationFileNameL( *attributeValue );
   356         }
   386         }
   357     CleanupStack::PopAndDestroy( attributeValue );
   387     CleanupStack::PopAndDestroy( attributeValue );
   358     }
   388     }
   359 
   389 
   360 // ----------------------------------------------------------------------------
   390 // ----------------------------------------------------------------------------
   369     CleanupStack::PushL( attributeValue );
   399     CleanupStack::PushL( attributeValue );
   370 
   400 
   371     if ( attributeValue->Compare( KNullDesC ) != 0 )
   401     if ( attributeValue->Compare( KNullDesC ) != 0 )
   372         {
   402         {
   373         HBufC *libraryPath = GetManifestDirectoryPathLC( aPackageUid, aDrive );
   403         HBufC *libraryPath = GetManifestDirectoryPathLC( aPackageUid, aDrive );
       
   404 
       
   405         //set path for hs to use, trim last 2 chars (doubleslash)
       
   406         aWidget->SetPathL(libraryPath->Mid(0,libraryPath->Length()-1));
   374 
   407 
   375         libraryPath->ReAllocL( libraryPath->Length() + attributeValue->Length() );
   408         libraryPath->ReAllocL( libraryPath->Length() + attributeValue->Length() );
   376 
   409 
   377         TPtr libraryPathModifier( libraryPath->Des() );
   410         TPtr libraryPathModifier( libraryPath->Des() );
   378         libraryPathModifier.Append( *attributeValue );
   411         libraryPathModifier.Append( *attributeValue );
   567 //
   600 //
   568 void CCaWidgetScannerParser::ParseUriL( TXmlEngElement& aElement,
   601 void CCaWidgetScannerParser::ParseUriL( TXmlEngElement& aElement,
   569         CCaWidgetDescription* aWidgetDescriptor )
   602         CCaWidgetDescription* aWidgetDescriptor )
   570     {
   603     {
   571     aWidgetDescriptor->SetUriL( *GetElementTextLC( aElement )  );
   604     aWidgetDescriptor->SetUriL( *GetElementTextLC( aElement )  );
   572     CleanupStack::PopAndDestroy( );
   605     CleanupStack::PopAndDestroy();
       
   606     
       
   607     if( aWidgetDescriptor->GetTranslationFileName().Compare( KNullDesC ) == 0 )
       
   608         {
       
   609         ParseTranslationFileNameL( aElement, aWidgetDescriptor );
       
   610         }
   573     }
   611     }
   574 
   612 
   575 // ----------------------------------------------------------------------------
   613 // ----------------------------------------------------------------------------
   576 //
   614 //
   577 // ----------------------------------------------------------------------------
   615 // ----------------------------------------------------------------------------
   608         TChar& aDrive )
   646         TChar& aDrive )
   609     {
   647     {
   610     aWidgetDescriptor->SetPreviewImageNameL( 
   648     aWidgetDescriptor->SetPreviewImageNameL( 
   611         *GetThemableGraphicsNameLC(aElement, aPackageUid, aDrive ) );
   649         *GetThemableGraphicsNameLC(aElement, aPackageUid, aDrive ) );
   612     
   650     
   613     CleanupStack::PopAndDestroy( );
   651     CleanupStack::PopAndDestroy();
       
   652     }
       
   653 
       
   654 // ----------------------------------------------------------------------------
       
   655 //
       
   656 // ----------------------------------------------------------------------------
       
   657 //
       
   658 void CCaWidgetScannerParser::ParseTranslationFileNameL(
       
   659         TXmlEngElement& aElement, CCaWidgetDescription* aWidgetDescriptor )
       
   660     {
       
   661     aWidgetDescriptor->SetTranslationFileNameL( *GetElementTextLC( aElement ) );
       
   662     CleanupStack::PopAndDestroy();
   614     }
   663     }
   615 
   664 
   616 // ----------------------------------------------------------------------------
   665 // ----------------------------------------------------------------------------
   617 //
   666 //
   618 // ----------------------------------------------------------------------------
   667 // ----------------------------------------------------------------------------