contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp
changeset 99 7aaf39b772ac
parent 98 d2f833ab7940
child 107 b34d53f6acdf
--- a/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp	Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp	Thu Jun 24 16:18:29 2010 +0300
@@ -281,9 +281,19 @@
                 {
                 ParsePreviewImageNameL( element, aPackageUid, widgetDescriptor, aDrive );
                 }
+            else if ( element.Name() == KTranslationFileName )
+                {
+                ParseTranslationFileNameL( element, widgetDescriptor );
+                }
             }
         CleanupStack::PopAndDestroy( &childElementList );
 
+        //set path for hs to use, trim last 2 chars (doubleslash)
+        HBufC *libraryPath = GetManifestDirectoryPathLC( aPackageUid, aDrive );
+        widgetDescriptor->SetPathL(libraryPath->Mid(0,libraryPath->Length()-1));
+        CleanupStack::PopAndDestroy(libraryPath);
+
+        
         HBufC *libraryPath2 = GetManifestDirectoryPathLC( aPackageUid, aDrive );
         libraryPath2 = libraryPath2->ReAllocL( libraryPath2->Length()
                 + widgetDescriptor->GetUri().Length() );
@@ -326,6 +336,7 @@
     widget->SetPackageUidL( aPackageUid );
     widget->SetManifestFilePathNameL( aFilePath );
     SetMmcIdL( widget, aDrive );
+    SetTranslationFileNameL( aElement, widget );
 
     SetModificationTimeL( aFilePath, widget );
 
@@ -353,6 +364,25 @@
     if ( attributeValue->Compare( KNullDesC ) != 0 )
         {
         aWidget->SetUriL( *attributeValue );
+        aWidget->SetTranslationFileNameL( *attributeValue );
+        }
+    CleanupStack::PopAndDestroy( attributeValue );
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CCaWidgetScannerParser::SetTranslationFileNameL( TXmlEngElement& aElement,
+        CCaWidgetDescription* aWidget )
+    {
+    HBufC *attributeValue = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+            aElement.AttributeValueL( KTranslationFileName ) );
+    CleanupStack::PushL( attributeValue );
+
+    if ( attributeValue->Compare( KNullDesC ) != 0 )
+        {
+        aWidget->SetTranslationFileNameL( *attributeValue );
         }
     CleanupStack::PopAndDestroy( attributeValue );
     }
@@ -372,6 +402,9 @@
         {
         HBufC *libraryPath = GetManifestDirectoryPathLC( aPackageUid, aDrive );
 
+        //set path for hs to use, trim last 2 chars (doubleslash)
+        aWidget->SetPathL(libraryPath->Mid(0,libraryPath->Length()-1));
+
         libraryPath->ReAllocL( libraryPath->Length() + attributeValue->Length() );
 
         TPtr libraryPathModifier( libraryPath->Des() );
@@ -569,7 +602,12 @@
         CCaWidgetDescription* aWidgetDescriptor )
     {
     aWidgetDescriptor->SetUriL( *GetElementTextLC( aElement )  );
-    CleanupStack::PopAndDestroy( );
+    CleanupStack::PopAndDestroy();
+    
+    if( aWidgetDescriptor->GetTranslationFileName().Compare( KNullDesC ) == 0 )
+        {
+        ParseTranslationFileNameL( aElement, aWidgetDescriptor );
+        }
     }
 
 // ----------------------------------------------------------------------------
@@ -610,7 +648,18 @@
     aWidgetDescriptor->SetPreviewImageNameL( 
         *GetThemableGraphicsNameLC(aElement, aPackageUid, aDrive ) );
     
-    CleanupStack::PopAndDestroy( );
+    CleanupStack::PopAndDestroy();
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CCaWidgetScannerParser::ParseTranslationFileNameL(
+        TXmlEngElement& aElement, CCaWidgetDescription* aWidgetDescriptor )
+    {
+    aWidgetDescriptor->SetTranslationFileNameL( *GetElementTextLC( aElement ) );
+    CleanupStack::PopAndDestroy();
     }
 
 // ----------------------------------------------------------------------------