contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp
changeset 115 3ab5c078b490
parent 109 e0aa398e6810
equal deleted inserted replaced
109:e0aa398e6810 115:3ab5c078b490
   636 //
   636 //
   637 void CCaWidgetScannerParser::ParseIconL( TXmlEngElement& aElement,
   637 void CCaWidgetScannerParser::ParseIconL( TXmlEngElement& aElement,
   638         const TDesC& aPackageUid, CCaWidgetDescription* aWidgetDescriptor,
   638         const TDesC& aPackageUid, CCaWidgetDescription* aWidgetDescriptor,
   639         TChar& aDrive )
   639         TChar& aDrive )
   640     {
   640     {
   641     aWidgetDescriptor->SetIconUriL( 
   641     HBufC *const graphicsName = 
   642         *GetThemableGraphicsNameLC(aElement, aPackageUid, aDrive ) );
   642         GetThemableGraphicsNameLC(aElement, aPackageUid, aDrive );   
       
   643     
       
   644     aWidgetDescriptor->SetIconUriL( *graphicsName );
   643    
   645    
   644     CleanupStack::PopAndDestroy( );
   646     CleanupStack::PopAndDestroy( graphicsName );
   645     }
   647     }
   646 
   648 
   647 // ----------------------------------------------------------------------------
   649 // ----------------------------------------------------------------------------
   648 //
   650 //
   649 // ----------------------------------------------------------------------------
   651 // ----------------------------------------------------------------------------
   652         TXmlEngElement & aElement,
   654         TXmlEngElement & aElement,
   653         const TDesC & aPackageUid,
   655         const TDesC & aPackageUid,
   654         CCaWidgetDescription* aWidgetDescriptor,
   656         CCaWidgetDescription* aWidgetDescriptor,
   655         TChar& aDrive )
   657         TChar& aDrive )
   656     {
   658     {
   657     aWidgetDescriptor->SetPreviewImageNameL( 
   659     HBufC *const graphicsName = 
   658         *GetThemableGraphicsNameLC(aElement, aPackageUid, aDrive ) );
   660         GetThemableGraphicsNameLC(aElement, aPackageUid, aDrive );
   659     
   661     
   660     CleanupStack::PopAndDestroy();
   662     aWidgetDescriptor->SetPreviewImageNameL( *graphicsName );
       
   663     
       
   664     CleanupStack::PopAndDestroy( graphicsName );
   661     }
   665     }
   662 
   666 
   663 // ----------------------------------------------------------------------------
   667 // ----------------------------------------------------------------------------
   664 //
   668 //
   665 // ----------------------------------------------------------------------------
   669 // ----------------------------------------------------------------------------
   729         const TDesC& aPackageUid,
   733         const TDesC& aPackageUid,
   730         TChar& aDrive ) const
   734         TChar& aDrive ) const
   731     {
   735     {
   732     RBuf graphicsName;
   736     RBuf graphicsName;
   733     graphicsName.CleanupClosePushL();
   737     graphicsName.CleanupClosePushL();
   734     HBufC* result; 
   738 
   735 
   739     RBuf elementText;
   736     
   740     elementText.CleanupClosePushL();
   737     if ( aElement.Text() != KNullDesC8 )
   741     
   738         {
   742     elementText.Assign( 
   739         RBuf elementText;
   743         CnvUtfConverter::ConvertToUnicodeFromUtf8L( aElement.Text() ) );
   740         elementText.CleanupClosePushL();
   744     
       
   745     if ( TParsePtrC(elementText).Ext() != KNullDesC )
       
   746         {
       
   747         HBufC* const manifestDirectoryPath( 
       
   748             GetManifestDirectoryPathLC( aPackageUid, aDrive ) );
   741         
   749         
   742         elementText.Assign( 
   750         graphicsName.CreateL( manifestDirectoryPath->Length() + 
   743             CnvUtfConverter::ConvertToUnicodeFromUtf8L( aElement.Text() ) );
   751             elementText.Length() );
       
   752         graphicsName.Append( *manifestDirectoryPath );
   744         
   753         
   745         if ( TParsePtrC(elementText).Ext() != KNullDesC )
   754         CleanupStack::PopAndDestroy( manifestDirectoryPath );
   746             {
       
   747             HBufC* const manifestDirectoryPath( 
       
   748                 GetManifestDirectoryPathLC( aPackageUid, aDrive ) );
       
   749             
       
   750             graphicsName.CreateL( manifestDirectoryPath->Length() + 
       
   751                 elementText.Length() );
       
   752             graphicsName.Append( *manifestDirectoryPath );
       
   753             
       
   754             CleanupStack::PopAndDestroy( manifestDirectoryPath );
       
   755             }
       
   756         else
       
   757             {   
       
   758             graphicsName.CreateL( elementText.Length() );
       
   759             }
       
   760         
       
   761         graphicsName.Append( elementText );
       
   762         result = HBufC::NewL( graphicsName.Length() ) ;
       
   763         *result = graphicsName;
       
   764         
       
   765         CleanupStack::PopAndDestroy( &elementText );
       
   766         }
   755         }
   767     else
   756     else
   768     	{
   757         {   
   769         result = HBufC::NewL( 1 ) ;
   758         graphicsName.CreateL( elementText.Length() );
   770     	}
   759         }
   771         CleanupStack::PopAndDestroy( &graphicsName );
   760     
   772         CleanupStack::PushL( result );
   761     graphicsName.Append( elementText );
   773         
   762 
   774         return result;
   763     
       
   764     CleanupStack::PopAndDestroy( &elementText );
       
   765     
       
   766     HBufC *result = HBufC::NewL( graphicsName.Length() ) ;
       
   767     *result = graphicsName;
       
   768     
       
   769     CleanupStack::PopAndDestroy( &graphicsName );
       
   770     
       
   771     CleanupStack::PushL( result );
       
   772     
       
   773     return result;
   775     }
   774     }
   776 
   775 
   777 
   776 
   778 //  End of File
   777 //  End of File