85
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: ?Description
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
119
|
18 |
#include <hbtextresolversymbian.h>
|
|
19 |
#include <f32file.h>
|
|
20 |
|
85
|
21 |
#include "cautils.h"
|
119
|
22 |
#include "cadef.h"
|
|
23 |
|
85
|
24 |
_LIT(KHexPrefix, "0x");
|
|
25 |
|
|
26 |
// ---------------------------------------------------------
|
|
27 |
// MenuUtils::GetTUint
|
|
28 |
// ---------------------------------------------------------
|
|
29 |
//
|
|
30 |
EXPORT_C TInt MenuUtils::GetTUint( const TDesC& aStr, TUint& aInt )
|
|
31 |
{
|
|
32 |
TInt position( aStr.Find( KHexPrefix ) );
|
|
33 |
TPtrC string( aStr );
|
|
34 |
TRadix radix( EDecimal );
|
|
35 |
if( position == 0 )
|
|
36 |
{
|
|
37 |
// is hex
|
|
38 |
radix = EHex;
|
|
39 |
string.Set( aStr.Mid( KHexPrefix().Length() ) );
|
|
40 |
}
|
|
41 |
|
|
42 |
return TLex( string ).Val( aInt, radix );
|
|
43 |
}
|
|
44 |
|
119
|
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 |
|