contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp
changeset 96 5d243a69bdda
parent 94 dbb8300717f7
child 98 d2f833ab7940
equal deleted inserted replaced
95:c739008478cc 96:5d243a69bdda
    20 
    20 
    21 #include "cadef.h"
    21 #include "cadef.h"
    22 #include "cawidgetdescription.h"
    22 #include "cawidgetdescription.h"
    23 #include "cainnerentry.h"
    23 #include "cainnerentry.h"
    24 #include "widgetscannerutils.h"
    24 #include "widgetscannerutils.h"
    25 
    25 #include "hbtextresolversymbian.h"
    26 // CONST
    26 
    27 const TInt KNoId = -1;
    27 #include "cawidgetscannerdef.h"
    28 _LIT( KDoubleSlash, "\\" );
       
    29 
       
    30 // ============================ MEMBER FUNCTIONS ===============================
    28 // ============================ MEMBER FUNCTIONS ===============================
    31 
    29 
    32 // -----------------------------------------------------------------------------
    30 // -----------------------------------------------------------------------------
    33 // CCaWidgetDescription::CCaWidgetDescription
    31 // CCaWidgetDescription::CCaWidgetDescription
    34 // C++ default constructor can NOT contain any code, that
    32 // C++ default constructor can NOT contain any code, that
   141     iPath.Close();
   139     iPath.Close();
   142     iModificationTime.Close();
   140     iModificationTime.Close();
   143     iMmcId.Close();
   141     iMmcId.Close();
   144     iServiceXml.Close();
   142     iServiceXml.Close();
   145     iManifestFilePathName.Close();
   143     iManifestFilePathName.Close();
       
   144     iStringIdTitle.Close();
       
   145     iStringIdDescription.Close();
   146     }
   146     }
   147 
   147 
   148 // ----------------------------------------------------------------------------
   148 // ----------------------------------------------------------------------------
   149 //
   149 //
   150 // ----------------------------------------------------------------------------
   150 // ----------------------------------------------------------------------------
   309 
   309 
   310 // -----------------------------------------------------------------------------
   310 // -----------------------------------------------------------------------------
   311 //
   311 //
   312 // -----------------------------------------------------------------------------
   312 // -----------------------------------------------------------------------------
   313 //
   313 //
       
   314 void CCaWidgetDescription::SetStringIdDescriptionL( const TDesC& aStringIdDescription )
       
   315     {
       
   316     iStringIdDescription.Close();
       
   317     iStringIdDescription.CreateL( aStringIdDescription );
       
   318     }
       
   319 
       
   320 // -----------------------------------------------------------------------------
       
   321 //
       
   322 // -----------------------------------------------------------------------------
       
   323 //
       
   324 void CCaWidgetDescription::SetStringidTitleL( const TDesC& aStringIdTitle )
       
   325     {
       
   326     iStringIdTitle.Close();
       
   327     iStringIdTitle.CreateL( aStringIdTitle );
       
   328     }
       
   329 
       
   330 // -----------------------------------------------------------------------------
       
   331 //
       
   332 // -----------------------------------------------------------------------------
       
   333 //
   314 TInt CCaWidgetDescription::GetEntryId( ) const
   334 TInt CCaWidgetDescription::GetEntryId( ) const
   315     {
   335     {
   316     return iEntryId;
   336     return iEntryId;
   317     }
   337     }
   318 
   338 
   323 TPtrC CCaWidgetDescription::GetMmcId( ) const
   343 TPtrC CCaWidgetDescription::GetMmcId( ) const
   324     {
   344     {
   325     return iMmcId;
   345     return iMmcId;
   326     }
   346     }
   327 
   347 
       
   348 // -----------------------------------------------------------------------------
       
   349 //
       
   350 // -----------------------------------------------------------------------------
       
   351 //
       
   352 TPtrC CCaWidgetDescription::GetStringIdDescription() const
       
   353     {
       
   354     return iStringIdDescription;
       
   355     }
       
   356 
       
   357 // -----------------------------------------------------------------------------
       
   358 //
       
   359 // -----------------------------------------------------------------------------
       
   360 //
       
   361 
       
   362 TPtrC CCaWidgetDescription::GetStringIdTitle() const
       
   363     {
       
   364     return iStringIdTitle;
       
   365     }
   328 // -----------------------------------------------------------------------------
   366 // -----------------------------------------------------------------------------
   329 //
   367 //
   330 // -----------------------------------------------------------------------------
   368 // -----------------------------------------------------------------------------
   331 //
   369 //
   332 TPtrC CCaWidgetDescription::GetLibrary( ) const
   370 TPtrC CCaWidgetDescription::GetLibrary( ) const
   551 TPtrC CCaWidgetDescription::GetServiceXml() const
   589 TPtrC CCaWidgetDescription::GetServiceXml() const
   552     {
   590     {
   553     return iServiceXml;
   591     return iServiceXml;
   554     }
   592     }
   555 
   593 
       
   594 void CCaWidgetDescription::LocalizeTextsL()
       
   595 	{
       
   596     
       
   597     
       
   598 	if( iUri.Length() )
       
   599 		{
       
   600 	    RBuf uri;
       
   601 	    uri.Create( iUri.Length() + 1 );
       
   602 	    CleanupClosePushL( uri );
       
   603 	    uri.Copy( iUri );
       
   604 	    uri.Append( KWidgetScannerUnderline );
       
   605 	       
       
   606 	    
       
   607 	    if( !HbTextResolverSymbian::Init( uri, KLocalizationFilepathC ) )
       
   608 	      {
       
   609 	      if( !HbTextResolverSymbian::Init( uri, KLocalizationFilepathZ ) )
       
   610 	          {
       
   611 	          // this should not be called too often 
       
   612               TChar currentDriveLetter;
       
   613 	          TDriveList driveList;
       
   614 	          RFs fs;
       
   615 	          User::LeaveIfError( fs.Connect() );
       
   616 	          User::LeaveIfError( fs.DriveList( driveList ) );
       
   617 
       
   618 	          RBuf path;
       
   619 	          path.Create( KLocalizationFilepath().Length() + 1 );
       
   620 	          CleanupClosePushL( path );
       
   621 	          
       
   622   	          for ( TInt driveNr=EDriveY; driveNr >= EDriveA; driveNr-- )
       
   623 	              {
       
   624 	              if ( driveList[driveNr] )
       
   625 	                  {
       
   626 	                  User::LeaveIfError( fs.DriveToChar( driveNr,
       
   627 	                          currentDriveLetter ) );
       
   628 	                  path.Append( currentDriveLetter );
       
   629 	                  path.Append( KLocalizationFilepath );
       
   630 	                  if( HbTextResolverSymbian::Init( uri, path ) )
       
   631 	                      {
       
   632 	                      break;
       
   633 	                      }
       
   634 	                  }
       
   635 	              path.Zero();
       
   636 	              }
       
   637   	          CleanupStack::PopAndDestroy( &path );
       
   638   	          fs.Close();
       
   639 	          }
       
   640 	       }
       
   641 	    
       
   642 	    HBufC* tmp;
       
   643 	    
       
   644 	    if( iTitle.Length() )
       
   645 	    	{
       
   646 	        SetStringidTitleL( iTitle );
       
   647 	        tmp = HbTextResolverSymbian::LoadLC( iTitle );
       
   648 	        SetTitleL( *tmp );
       
   649 	        CleanupStack::PopAndDestroy( tmp );
       
   650 	    	}
       
   651 	    if( iDescription.Length() )
       
   652 	    	{
       
   653 	        SetStringIdDescriptionL( iDescription );
       
   654 	        tmp = HbTextResolverSymbian::LoadLC( iDescription );
       
   655 	        SetDescriptionL( *tmp );
       
   656 	        CleanupStack::PopAndDestroy( tmp );
       
   657 	    	}
       
   658 	    CleanupStack::PopAndDestroy( &uri );
       
   659 		}
       
   660 	}
       
   661 
   556 /*
   662 /*
   557  * Set manifest file path name
   663  * Set manifest file path name
   558  * @param aManifestFilePt
   664  * @param aManifestFilePt
   559  */
   665  */
   560 void CCaWidgetDescription::SetManifestFilePathNameL( 
   666 void CCaWidgetDescription::SetManifestFilePathNameL(