contentstorage/cautils/src/cautils.cpp
changeset 124 e36b2f4799c0
parent 60 f62f87b200ec
equal deleted inserted replaced
121:0b3699f6c654 124:e36b2f4799c0
    13  *
    13  *
    14  * Description:  ?Description
    14  * Description:  ?Description
    15  *
    15  *
    16  */
    16  */
    17 
    17 
       
    18 #include <hbtextresolversymbian.h>
       
    19 #include <f32file.h>
       
    20 
    18 #include "cautils.h"
    21 #include "cautils.h"
       
    22 #include "cadef.h"
       
    23 
    19 _LIT(KHexPrefix, "0x");
    24 _LIT(KHexPrefix, "0x");
    20 
    25 
    21 // ---------------------------------------------------------
    26 // ---------------------------------------------------------
    22 // MenuUtils::GetTUint
    27 // MenuUtils::GetTUint
    23 // ---------------------------------------------------------
    28 // ---------------------------------------------------------
    35         }
    40         }
    36 
    41 
    37     return TLex( string ).Val( aInt, radix );
    42     return TLex( string ).Val( aInt, radix );
    38     }
    43     }
    39 
    44 
       
    45 // ---------------------------------------------------------
       
    46 // MenuUtils::InitTextResolverSymbian
       
    47 // ---------------------------------------------------------
       
    48 //
       
    49 EXPORT_C void MenuUtils::InitTextResolverSymbianL( const TDesC& aFilename )
       
    50     {
       
    51     if( !HbTextResolverSymbian::Init( aFilename, KLocalizationFilepathC ) )
       
    52        {
       
    53        if( !HbTextResolverSymbian::Init( aFilename, KLocalizationFilepathZ ) )
       
    54            {
       
    55            // this should not be called too often 
       
    56            TChar currentDriveLetter;
       
    57            TDriveList driveList;
       
    58            RFs fs;
       
    59            CleanupClosePushL( fs );
       
    60            User::LeaveIfError( fs.Connect() );
       
    61            User::LeaveIfError( fs.DriveList( driveList ) );
       
    62 
       
    63            RBuf path;
       
    64            CleanupClosePushL( path );
       
    65            path.CreateL( KLocalizationFilepath().Length() + 1 );
       
    66            
       
    67            for( TInt driveNr=EDriveY; driveNr >= EDriveA; driveNr-- )
       
    68                {
       
    69                if( driveList[driveNr] )
       
    70                    {
       
    71                    User::LeaveIfError( fs.DriveToChar( driveNr,
       
    72                            currentDriveLetter ) );
       
    73                    path.Append( currentDriveLetter );
       
    74                    path.Append( KLocalizationFilepath );
       
    75                    if( HbTextResolverSymbian::Init( aFilename, path ) )
       
    76                        {
       
    77                        break;
       
    78                        }
       
    79                    }
       
    80                path.Zero();
       
    81                }
       
    82            CleanupStack::PopAndDestroy( &path );
       
    83            CleanupStack::PopAndDestroy( &fs );
       
    84            }
       
    85         }
       
    86     }
       
    87