--- a/contentstorage/casrv/calocalizerscanner/src/calocalizerscannerproxy.cpp Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/casrv/calocalizerscanner/src/calocalizerscannerproxy.cpp Fri May 28 16:17:03 2010 +0300
@@ -28,8 +28,9 @@
#include "cadef.h"
#include "cainnerquery.h"
#include "cainnerentry.h"
+#include "casqlcommands.h"
-_LIT(KPathLoc,"z:/resource/qt/translations");
+
// ---------------------------------------------------------------------------
// CCaLocalizerScannerProxy::NewL
@@ -135,9 +136,14 @@
{
localizedName = GetLocalizedNameLC( locals[i] );
- if( localizedName->Compare(
- GetEntryText( entries, locals[i]->GetRowId() ) ) )
- // translation different than text
+ if( locals[i]->GetAttributeName().Compare( KColumnEnText) == 0
+ && !localizedName->Compare(
+ GetEntryText( entries, locals[i]->GetRowId() ) ) == 0
+ ||
+ locals[i]->GetAttributeName().Compare( KColumnEnDescription) == 0
+ && !localizedName->Compare(
+ GetEntryDescription( entries, locals[i]->GetRowId() ) ) == 0 )
+ // translations different than text
{
locals[i]->SetLocalizedStringL( *localizedName );
iStorageProxy->LocalizeEntryL( *( locals[i] ) );
@@ -160,7 +166,42 @@
{
if( iRecentQmFile.Compare( aLocEntry->GetQmFilename() ) )
{
- HbTextResolverSymbian::Init( aLocEntry->GetQmFilename(), KPathLoc );
+
+ if( !HbTextResolverSymbian::Init( aLocEntry->GetQmFilename(), KLocalizationFilepathC ) )
+ {
+ if( !HbTextResolverSymbian::Init( aLocEntry->GetQmFilename(), KLocalizationFilepathZ ) )
+ {
+ // this should not be called too often
+ TChar currentDriveLetter;
+ TDriveList driveList;
+ RFs fs;
+ User::LeaveIfError( fs.Connect() );
+ User::LeaveIfError( fs.DriveList( driveList ) );
+
+ RBuf path;
+ path.Create( KLocalizationFilepath().Length() + 1 );
+ CleanupClosePushL( path );
+
+ 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( aLocEntry->GetQmFilename(), path ) )
+ {
+ break;
+ }
+ }
+ path.Zero();
+ }
+ CleanupStack::PopAndDestroy( &path );
+ fs.Close();
+ }
+ }
+
// keeping last qm filename to avoid another initialization
iRecentQmFile.Close();
iRecentQmFile.Create( aLocEntry->GetQmFilename().Length() );
@@ -186,3 +227,21 @@
}
return KNullDesC();
}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+const TDesC& CCaLocalizerScannerProxy::GetEntryDescription(
+ const RPointerArray<CCaInnerEntry>& aEntries, TInt aId )
+ {
+ TInt entriesCount = aEntries.Count();
+ for( TInt i=0; i < entriesCount; i++ )
+ {
+ if( aEntries[i]->GetId() == aId )
+ {
+ return aEntries[i]->GetDescription();
+ }
+ }
+ return KNullDesC();
+ }