--- a/contentstorage/casrv/calocalizerscanner/src/calocalizerscannerproxy.cpp Fri Apr 30 15:22:08 2010 +0300
+++ b/contentstorage/casrv/calocalizerscanner/src/calocalizerscannerproxy.cpp Fri May 14 17:24:44 2010 +0300
@@ -67,13 +67,8 @@
//
void CCaLocalizerScannerProxy::ConstructL()
{
- TBuf<KCaMaxAttrNameLen> filenameDsc;
- iStorageProxy->DbPropertyL( KCaDbPropQMfile, filenameDsc );
- iResolver = new (ELeave) HbTextResolverSymbian;
- iResolver->Init(filenameDsc, KPathLoc);
+ iRecentQmFile.CreateL( KCaMaxAttrLenght );
UpdateLocalNamesL();
- delete iResolver;
- iResolver = NULL;
}
// ---------------------------------------------------------------------------
@@ -95,10 +90,7 @@
//
CCaLocalizerScannerProxy::~CCaLocalizerScannerProxy()
{
- if (iResolver)
- {
- delete iResolver;
- }
+ iRecentQmFile.Close();
}
// ---------------------------------------------------------------------------
@@ -126,13 +118,12 @@
CleanupResetAndDestroyPushL( entries );
RArray<TInt> ids;
CleanupClosePushL( ids );
-
+ //gets all localizations
GetLocalizationRowsL( locals );
-
TInt locCount = locals.Count();
- for( TInt idx = 0; idx < locCount; idx++ )
+ for( TInt i = 0; i < locCount; i++ )
{
- ids.Append( locals[idx]->GetRowId() );
+ ids.Append( locals[i]->GetRowId() );
}
CCaInnerQuery* query = CCaInnerQuery::NewLC();
query->SetIdsL( ids );
@@ -142,19 +133,14 @@
HBufC16* localizedName;
for( TInt i = 0; i < locCount; i++ )
{
- localizedName = iResolver->LoadLC( locals[i]->GetStringId() );
+ localizedName = GetLocalizedNameLC( locals[i] );
+
if( localizedName->Compare(
GetEntryText( entries, locals[i]->GetRowId() ) ) )
// translation different than text
{
locals[i]->SetLocalizedStringL( *localizedName );
iStorageProxy->LocalizeEntryL( *( locals[i] ) );
- }
- else if( !localizedName->Compare(KNullDesC) )
- // no translation, string id as text
- {
- locals[i]->SetLocalizedStringL( locals[i]->GetStringId() );
- iStorageProxy->LocalizeEntryL( *( locals[i] ) );
}
CleanupStack::PopAndDestroy( localizedName );
}
@@ -166,11 +152,29 @@
// ---------------------------------------------------------------------------
-// CCaLocalizerScannerProxy::LocalGetEntryById
+//
+// ---------------------------------------------------------------------------
+//
+HBufC* CCaLocalizerScannerProxy::GetLocalizedNameLC(
+ const CCaLocalizationEntry* aLocEntry)
+ {
+ if( iRecentQmFile.Compare( aLocEntry->GetQmFilename() ) )
+ {
+ HbTextResolverSymbian::Init( aLocEntry->GetQmFilename(), KPathLoc );
+ // keeping last qm filename to avoid another initialization
+ iRecentQmFile.Close();
+ iRecentQmFile.Create( aLocEntry->GetQmFilename().Length() );
+ iRecentQmFile.Copy( aLocEntry->GetQmFilename() );
+ }
+ return HbTextResolverSymbian::LoadLC( aLocEntry->GetStringId() );
+ }
+
+// ---------------------------------------------------------------------------
+//
// ---------------------------------------------------------------------------
//
const TDesC& CCaLocalizerScannerProxy::GetEntryText(
- RPointerArray<CCaInnerEntry> aEntries, TInt aId )
+ const RPointerArray<CCaInnerEntry>& aEntries, TInt aId )
{
TInt entriesCount = aEntries.Count();
for( TInt i=0; i < entriesCount; i++ )