contentstorage/cautils/src/cautils.cpp
changeset 124 e36b2f4799c0
parent 60 f62f87b200ec
--- a/contentstorage/cautils/src/cautils.cpp	Fri Sep 17 08:32:18 2010 +0300
+++ b/contentstorage/cautils/src/cautils.cpp	Mon Oct 04 00:38:31 2010 +0300
@@ -15,7 +15,12 @@
  *
  */
 
+#include <hbtextresolversymbian.h>
+#include <f32file.h>
+
 #include "cautils.h"
+#include "cadef.h"
+
 _LIT(KHexPrefix, "0x");
 
 // ---------------------------------------------------------
@@ -37,3 +42,46 @@
     return TLex( string ).Val( aInt, radix );
     }
 
+// ---------------------------------------------------------
+// MenuUtils::InitTextResolverSymbian
+// ---------------------------------------------------------
+//
+EXPORT_C void MenuUtils::InitTextResolverSymbianL( const TDesC& aFilename )
+    {
+    if( !HbTextResolverSymbian::Init( aFilename, KLocalizationFilepathC ) )
+       {
+       if( !HbTextResolverSymbian::Init( aFilename, KLocalizationFilepathZ ) )
+           {
+           // this should not be called too often 
+           TChar currentDriveLetter;
+           TDriveList driveList;
+           RFs fs;
+           CleanupClosePushL( fs );
+           User::LeaveIfError( fs.Connect() );
+           User::LeaveIfError( fs.DriveList( driveList ) );
+
+           RBuf path;
+           CleanupClosePushL( path );
+           path.CreateL( KLocalizationFilepath().Length() + 1 );
+           
+           for( TInt driveNr=EDriveY; driveNr >= EDriveA; driveNr-- )
+               {
+               if( driveList[driveNr] )
+                   {
+                   User::LeaveIfError( fs.DriveToChar( driveNr,
+                           currentDriveLetter ) );
+                   path.Append( currentDriveLetter );
+                   path.Append( KLocalizationFilepath );
+                   if( HbTextResolverSymbian::Init( aFilename, path ) )
+                       {
+                       break;
+                       }
+                   }
+               path.Zero();
+               }
+           CleanupStack::PopAndDestroy( &path );
+           CleanupStack::PopAndDestroy( &fs );
+           }
+        }
+    }
+