contentstorage/srvsrc/castorageproxy.cpp
branchRCL_3
changeset 113 0efa10d348c0
equal deleted inserted replaced
111:053c6c7c14f3 113:0efa10d348c0
       
     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:
       
    15  *
       
    16  */
       
    17 
       
    18 #include <driveinfo.h>
       
    19 #include <hbtextresolversymbian.h>
       
    20 
       
    21 #include "castorage.h"
       
    22 #include "castorageproxy.h"
       
    23 #include "castoragefactory.h"
       
    24 #include "cainnerentry.h"
       
    25 #include "cainnerquery.h"
       
    26 #include "caarraycleanup.inl"
       
    27 #include "calocalizationentry.h"
       
    28 #include "casrvsession.h"
       
    29 
       
    30 
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 //
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 CCaStorageProxy::CCaStorageProxy()
       
    37     {
       
    38     }
       
    39 
       
    40 // ---------------------------------------------------------------------------
       
    41 //
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 void CCaStorageProxy::ConstructL()
       
    45     {
       
    46     iStorage = CaStorageFactory::NewDatabaseL();
       
    47     }
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 CCaStorageProxy* CCaStorageProxy::NewL()
       
    54     {
       
    55     CCaStorageProxy* self = CCaStorageProxy::NewLC();
       
    56     CleanupStack::Pop( self );
       
    57     return self;
       
    58     }
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 CCaStorageProxy* CCaStorageProxy::NewLC()
       
    65     {
       
    66     CCaStorageProxy* self = new ( ELeave ) CCaStorageProxy();
       
    67     CleanupStack::PushL( self );
       
    68     self->ConstructL();
       
    69     return self;
       
    70     }
       
    71 
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 // ---------------------------------------------------------------------------
       
    75 //
       
    76 CCaStorageProxy::~CCaStorageProxy()
       
    77     {
       
    78     delete iStorage;
       
    79     iHandlerNotifier.Close();
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 //
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 EXPORT_C void CCaStorageProxy::GetEntriesL(const CCaInnerQuery* aQuery,
       
    87         RPointerArray<CCaInnerEntry>& aResultContainer )
       
    88     {
       
    89     iStorage->GetEntriesL( aQuery, aResultContainer );
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 //
       
    94 // ---------------------------------------------------------------------------
       
    95 //
       
    96 EXPORT_C void CCaStorageProxy::GetEntriesIdsL(const CCaInnerQuery* aQuery,
       
    97         RArray<TInt>& aResultIdArray)
       
    98     {
       
    99     iStorage->GetEntriesIdsL( aQuery, aResultIdArray );
       
   100     }
       
   101 
       
   102 // ---------------------------------------------------------------------------
       
   103 //
       
   104 // ---------------------------------------------------------------------------
       
   105 //
       
   106 EXPORT_C void CCaStorageProxy::AddL( CCaInnerEntry* aEntry,
       
   107     TBool aUpdate,
       
   108     TItemAppearance aItemAppearanceChange )
       
   109     {
       
   110     TChangeType changeType = EAddChangeType;
       
   111     RArray<TInt> parentArray;
       
   112     CleanupClosePushL( parentArray );
       
   113           
       
   114     if( aEntry->GetId() > 0 )
       
   115         {
       
   116         changeType = EUpdateChangeType;
       
   117         RArray<TInt> id;
       
   118         CleanupClosePushL( id );
       
   119         id.AppendL( aEntry->GetId() );
       
   120         if (aItemAppearanceChange == EItemUninstallProgressChanged)
       
   121             {
       
   122             // no need to search for parent parents for uninstall 
       
   123             // progress change
       
   124             iStorage->GetParentsIdsL( id, parentArray, EFalse );
       
   125             }
       
   126         else
       
   127             {
       
   128             iStorage->GetParentsIdsL( id, parentArray );
       
   129             }
       
   130         CleanupStack::PopAndDestroy( &id );
       
   131         }
       
   132 
       
   133     if( aItemAppearanceChange==EItemDisappeared )
       
   134         {
       
   135         changeType = ERemoveChangeType;
       
   136         }
       
   137     else if( aItemAppearanceChange==EItemAppeared )
       
   138         {
       
   139         changeType = EAddChangeType;
       
   140         }
       
   141     
       
   142     // do not update entry in db with uninstall progress
       
   143     if (aItemAppearanceChange != EItemUninstallProgressChanged)
       
   144         {
       
   145         RPointerArray<CCaLocalizationEntry> localizations;
       
   146 	    CleanupResetAndDestroyPushL( localizations );
       
   147         CCaLocalizationEntry* tempLocalization = NULL;
       
   148         if( aEntry->isLocalized( CCaInnerEntry::ENameLocalized ) )		
       
   149             {
       
   150             tempLocalization = LocalizeTextL( aEntry );
       
   151             if( tempLocalization )
       
   152                 {
       
   153                 localizations.Append( tempLocalization );
       
   154                 tempLocalization = NULL;
       
   155                 }
       
   156             }
       
   157         if( aEntry->isLocalized( CCaInnerEntry::EDescriptionLocalized ) )
       
   158             {
       
   159             tempLocalization = LocalizeDescriptionL( aEntry );
       
   160             if (tempLocalization)
       
   161                 {
       
   162                 localizations.Append(tempLocalization);
       
   163                 tempLocalization = NULL;
       
   164                 }
       
   165             }
       
   166         
       
   167         iStorage->AddL( aEntry, aUpdate );
       
   168         
       
   169         for( TInt j =0; j < localizations.Count(); j++ )
       
   170             {
       
   171             localizations[j]->SetRowId( aEntry->GetId() );
       
   172             AddLocalizationL( *( localizations[j] ) );
       
   173             }
       
   174 		if( localizations.Count() > 0 )
       
   175             {
       
   176             HbTextResolverSymbian::Init( _L(""), KLocalizationFilepathZ );
       
   177             }
       
   178 		 CleanupStack::PopAndDestroy( &localizations );
       
   179         }
       
   180     
       
   181         
       
   182     for( TInt i = 0; i < iHandlerNotifier.Count(); i++ )
       
   183         {
       
   184         iHandlerNotifier[i]->EntryChanged( aEntry, changeType, parentArray );
       
   185         }
       
   186     CleanupStack::PopAndDestroy( &parentArray );
       
   187     }
       
   188 
       
   189 // ---------------------------------------------------------------------------
       
   190 //
       
   191 // ---------------------------------------------------------------------------
       
   192 //
       
   193 EXPORT_C void CCaStorageProxy::RemoveL( const RArray<TInt>& aEntryIds )
       
   194     {
       
   195     CCaInnerQuery* query = CCaInnerQuery::NewLC();
       
   196     query->SetIdsL( aEntryIds );
       
   197     RPointerArray<CCaInnerEntry> resultContainer;
       
   198     CleanupResetAndDestroyPushL( resultContainer );
       
   199     RArray<TInt> parentArray;
       
   200     CleanupClosePushL( parentArray );
       
   201     if( aEntryIds.Count() > 0 )
       
   202         {
       
   203         iStorage->GetEntriesL( query, resultContainer );
       
   204         iStorage->GetParentsIdsL( aEntryIds, parentArray );
       
   205         }
       
   206     iStorage->RemoveL( aEntryIds );
       
   207     for( TInt i( 0 ); i < resultContainer.Count(); i++ )
       
   208         {
       
   209         for( TInt j( 0 ); j < iHandlerNotifier.Count(); j++ )
       
   210             {
       
   211             iHandlerNotifier[j]->EntryChanged( resultContainer[i],
       
   212                     ERemoveChangeType, parentArray );
       
   213             }
       
   214         }
       
   215     CleanupStack::PopAndDestroy( &parentArray );
       
   216     CleanupStack::PopAndDestroy( &resultContainer );
       
   217     CleanupStack::PopAndDestroy( query );
       
   218     }
       
   219 
       
   220 // ---------------------------------------------------------------------------
       
   221 //
       
   222 // ---------------------------------------------------------------------------
       
   223 //
       
   224 EXPORT_C void CCaStorageProxy::OrganizeL( const RArray<TInt>& aEntryIds,
       
   225         TCaOperationParams aParams )
       
   226     {
       
   227     iStorage->OrganizeL( aEntryIds, aParams );
       
   228     RArray<TInt> parentArray;
       
   229     CleanupClosePushL( parentArray );
       
   230     parentArray.AppendL( aParams.iGroupId );
       
   231     iStorage->GetParentsIdsL( parentArray, parentArray );
       
   232     for( TInt i = 0; i < iHandlerNotifier.Count(); i++ )
       
   233         {
       
   234         iHandlerNotifier[i]->GroupContentChanged( parentArray );
       
   235         }
       
   236     CleanupStack::PopAndDestroy( &parentArray );
       
   237     }
       
   238 
       
   239 // ---------------------------------------------------------------------------
       
   240 //
       
   241 // ---------------------------------------------------------------------------
       
   242 //
       
   243 EXPORT_C void CCaStorageProxy::TouchL( CCaInnerEntry* aEntry )
       
   244     {
       
   245     CCaInnerQuery* touchQuery = CCaInnerQuery::NewLC();
       
   246 
       
   247     TInt entryId = aEntry->GetId();
       
   248 
       
   249     if ( entryId == 0 && aEntry->GetUid() != 0)
       
   250         {
       
   251         CCaInnerQuery* idQuery = CCaInnerQuery::NewLC();
       
   252         idQuery->SetUid( static_cast<TUint>( aEntry->GetUid()) );
       
   253 
       
   254         RArray<TInt> idArray;
       
   255         CleanupClosePushL( idArray );
       
   256 
       
   257         iStorage->GetEntriesIdsL( idQuery, idArray );
       
   258 
       
   259         if (idArray.Count() == 1 )
       
   260             {
       
   261             entryId = idArray[0];
       
   262             aEntry->SetId( entryId );
       
   263             }
       
   264 
       
   265         CleanupStack::PopAndDestroy( &idArray );
       
   266         CleanupStack::PopAndDestroy( idQuery );
       
   267         }
       
   268 
       
   269     RArray<TInt> id;
       
   270     CleanupClosePushL( id );
       
   271     id.AppendL( entryId );
       
   272     touchQuery->SetIdsL( id );
       
   273     RPointerArray<CCaInnerEntry> resultArray;
       
   274     CleanupResetAndDestroyPushL( resultArray );
       
   275     iStorage->GetEntriesL( touchQuery, resultArray );
       
   276     iStorage->TouchL( entryId, aEntry->GetFlags() & ERemovable );
       
   277     for( TInt i = 0; i < iHandlerNotifier.Count(); i++ )
       
   278         {
       
   279         iHandlerNotifier[i]->EntryTouched( entryId );
       
   280         }
       
   281     if( resultArray.Count() > 0 )
       
   282         {
       
   283         if( !( resultArray[0]->GetFlags() & EUsed ) )
       
   284             {
       
   285             RArray<TInt> parentArray;
       
   286             CleanupClosePushL( parentArray );
       
   287             iStorage->GetParentsIdsL( id, parentArray );
       
   288             for( TInt i = 0; i < iHandlerNotifier.Count(); i++ )
       
   289                 {
       
   290                 resultArray[0]->SetFlags( 
       
   291                         resultArray[0]->GetFlags() | EUsed );
       
   292                 iHandlerNotifier[i]->EntryChanged( resultArray[0],
       
   293                         EUpdateChangeType,
       
   294                         parentArray );
       
   295                 }
       
   296             CleanupStack::PopAndDestroy( &parentArray );
       
   297             }
       
   298         }
       
   299     CleanupStack::PopAndDestroy( &resultArray );
       
   300     CleanupStack::PopAndDestroy( &id );
       
   301     CleanupStack::PopAndDestroy( touchQuery );
       
   302     }
       
   303 
       
   304 // ---------------------------------------------------------------------------
       
   305 //
       
   306 // ---------------------------------------------------------------------------
       
   307 //
       
   308 EXPORT_C void CCaStorageProxy::GetLocalizationsL(
       
   309         RPointerArray<CCaLocalizationEntry>& aResultArray )
       
   310     {
       
   311     iStorage->GetLocalizationsL( aResultArray );
       
   312     }
       
   313 
       
   314 // ---------------------------------------------------------------------------
       
   315 //
       
   316 // ---------------------------------------------------------------------------
       
   317 //
       
   318 EXPORT_C void CCaStorageProxy::LocalizeEntryL(
       
   319         CCaLocalizationEntry& aLocalization )
       
   320     {
       
   321     iStorage->LocalizeEntryL( aLocalization );
       
   322     }
       
   323 
       
   324 // ---------------------------------------------------------------------------
       
   325 //
       
   326 // ---------------------------------------------------------------------------
       
   327 //
       
   328 EXPORT_C void CCaStorageProxy::AddLocalizationL(
       
   329 		const CCaLocalizationEntry& aLocalization)
       
   330 	{
       
   331 	iStorage->AddLocalizationL(aLocalization);
       
   332 	}
       
   333 
       
   334 // ---------------------------------------------------------------------------
       
   335 //
       
   336 // ---------------------------------------------------------------------------
       
   337 //
       
   338 EXPORT_C void CCaStorageProxy::DbPropertyL( const TDesC& aProperty,
       
   339         TDes& aPropertyValue )
       
   340     {
       
   341     iStorage->DbPropertyL( aProperty, aPropertyValue );
       
   342     }
       
   343 
       
   344 // ---------------------------------------------------------------------------
       
   345 //
       
   346 // ---------------------------------------------------------------------------
       
   347 //
       
   348 EXPORT_C void CCaStorageProxy::SetDBPropertyL( const TDesC& aProperty,
       
   349         const TDesC& aPropertyValue )
       
   350     {
       
   351     iStorage->SetDBPropertyL( aProperty, aPropertyValue );
       
   352     }
       
   353 
       
   354 // ---------------------------------------------------------------------------
       
   355 //
       
   356 // ---------------------------------------------------------------------------
       
   357 //
       
   358 EXPORT_C void CCaStorageProxy::CustomSortL( const RArray<TInt>& aEntryIds,
       
   359         const TInt aGroupId )
       
   360     {
       
   361     iStorage->CustomSortL( aEntryIds, aGroupId );
       
   362 
       
   363     RArray<TInt> parentArray;
       
   364     CleanupClosePushL( parentArray );
       
   365     parentArray.AppendL( aGroupId );
       
   366     iStorage->GetParentsIdsL( parentArray, parentArray );
       
   367     for( TInt i = 0; i < iHandlerNotifier.Count(); i++ )
       
   368         {
       
   369         iHandlerNotifier[i]->GroupContentChanged( parentArray );
       
   370         }
       
   371     CleanupStack::PopAndDestroy( &parentArray );
       
   372     }
       
   373 
       
   374 // ---------------------------------------------------------------------------
       
   375 //
       
   376 // ---------------------------------------------------------------------------
       
   377 //
       
   378 #ifdef COVERAGE_MEASUREMENT
       
   379 #pragma CTC SKIP
       
   380 #endif //COVERAGE_MEASUREMENT (calls another method)
       
   381 
       
   382 EXPORT_C void CCaStorageProxy::SaveDatabaseL()
       
   383     {
       
   384     iStorage->SaveDatabaseL();
       
   385     }
       
   386 #ifdef COVERAGE_MEASUREMENT
       
   387 #pragma CTC ENDSKIP
       
   388 #endif //COVERAGE_MEASUREMENT
       
   389 
       
   390 
       
   391 // ---------------------------------------------------------------------------
       
   392 //
       
   393 // ---------------------------------------------------------------------------
       
   394 //
       
   395 #ifdef COVERAGE_MEASUREMENT
       
   396 #pragma CTC SKIP
       
   397 #endif //COVERAGE_MEASUREMENT (calls another method)
       
   398 
       
   399 EXPORT_C void CCaStorageProxy::RestoreDatabaseL()
       
   400     {
       
   401     iStorage->RestoreDatabaseL();
       
   402     }
       
   403 #ifdef COVERAGE_MEASUREMENT
       
   404 #pragma CTC ENDSKIP
       
   405 #endif //COVERAGE_MEASUREMENT
       
   406 
       
   407 
       
   408 // ---------------------------------------------------------------------------
       
   409 //
       
   410 // ---------------------------------------------------------------------------
       
   411 //
       
   412 #ifdef COVERAGE_MEASUREMENT
       
   413 #pragma CTC SKIP
       
   414 #endif //COVERAGE_MEASUREMENT (calls another method)
       
   415 
       
   416 EXPORT_C void CCaStorageProxy::LoadDataBaseFromRomL()
       
   417     {
       
   418     iStorage->LoadDataBaseFromRomL();
       
   419     }
       
   420 #ifdef COVERAGE_MEASUREMENT
       
   421 #pragma CTC ENDSKIP
       
   422 #endif //COVERAGE_MEASUREMENT
       
   423 
       
   424 // ---------------------------------------------------------
       
   425 //
       
   426 // ---------------------------------------------------------
       
   427 //
       
   428 void CCaStorageProxy::AddSessionL( MCaSessionNorifier* aHandlerNotifier )
       
   429     {
       
   430     __ASSERT_ALWAYS(
       
   431             iHandlerNotifier.Find( aHandlerNotifier ) == KErrNotFound,
       
   432             User::Invariant() );
       
   433     iHandlerNotifier.AppendL( aHandlerNotifier );
       
   434     }
       
   435 
       
   436 // ---------------------------------------------------------
       
   437 //
       
   438 // ---------------------------------------------------------
       
   439 //
       
   440 void CCaStorageProxy::RemoveSession( MCaSessionNorifier* aHandlerNotifier )
       
   441     {
       
   442     TInt i = iHandlerNotifier.Find( aHandlerNotifier );
       
   443     if( i != KErrNotFound )
       
   444         {
       
   445         iHandlerNotifier.Remove( i );
       
   446         }
       
   447     }
       
   448 
       
   449 // ---------------------------------------------------------
       
   450 //
       
   451 // ---------------------------------------------------------
       
   452 //
       
   453 CCaLocalizationEntry* CCaStorageProxy::LocalizeTextL( CCaInnerEntry* aEntry )
       
   454     {
       
   455 	CCaLocalizationEntry* result = NULL;
       
   456 	TInt textLength = aEntry->GetText().Length();
       
   457 	if (textLength > 0)
       
   458 		{
       
   459 		TChar delimiter = '/'; // cannot add it as global
       
   460 		RBuf title;
       
   461 		CleanupClosePushL( title );
       
   462 		title.CreateL( aEntry->GetText() );
       
   463 		TInt pos = title.LocateReverse( delimiter );
       
   464 		if ( pos > 0 && pos + 1 < textLength )   // 1 is for delimiters
       
   465 			{
       
   466 			TPtrC16 logString = title.Mid( pos + 1 ); 
       
   467 			TInt qmFileNameLength = textLength - charsToFilename - 1 - logString.Length();
       
   468 			TPtrC16 qmFile = title.Mid( charsToFilename, qmFileNameLength );
       
   469 			if ( InitializeTranslatorL( qmFile ) )
       
   470 				{
       
   471 			    result = CCaLocalizationEntry::NewLC();			
       
   472 				HBufC* translatedString = HbTextResolverSymbian::LoadLC( logString );
       
   473 				if ( translatedString->Compare( logString ) )
       
   474 					{
       
   475 					result->SetStringIdL( logString );
       
   476 					aEntry->SetTextL( *translatedString );
       
   477 					if( translatedString )
       
   478 						{
       
   479 					    CleanupStack::PopAndDestroy( translatedString );
       
   480 						}
       
   481 					result->SetTableNameL( KLocalizationCaEntry );
       
   482 					result->SetAttributeNameL( KLocalizationEnText );
       
   483 					result->SetQmFilenameL( qmFile );
       
   484 					result->SetRowId( aEntry->GetId() ? 0 : aEntry->GetId() ); // must be added when present
       
   485 					CleanupStack::Pop( result );
       
   486 					}
       
   487 				else 
       
   488 					{
       
   489 					CleanupStack::PopAndDestroy(translatedString);
       
   490 					CleanupStack::PopAndDestroy(result);
       
   491 					result = NULL;
       
   492 					}
       
   493 				}
       
   494 			}
       
   495 		CleanupStack::PopAndDestroy( &title );
       
   496 		}
       
   497 	return result;
       
   498 	}
       
   499 
       
   500 // ---------------------------------------------------------
       
   501 //
       
   502 // ---------------------------------------------------------
       
   503 //
       
   504 CCaLocalizationEntry* CCaStorageProxy::LocalizeDescriptionL( CCaInnerEntry* aEntry )
       
   505     {
       
   506 	CCaLocalizationEntry* result = NULL;
       
   507 	TInt dscLength = aEntry->GetDescription().Length();
       
   508 	if ( dscLength )
       
   509 		{
       
   510 		TChar delimiter = '/'; // cannot add it as global
       
   511 		RBuf description;
       
   512 		CleanupClosePushL( description );
       
   513 		description.CreateL( aEntry->GetDescription() );
       
   514 		TInt pos = description.LocateReverse( delimiter );
       
   515 		if ( pos > 0 && pos + 1 < dscLength )   // 1 is for delimiters
       
   516 			{
       
   517 			TPtrC16 logString = description.Mid(pos + 1);
       
   518 			TInt qmFileNameLength = dscLength - charsToFilename - 1 - logString.Length();
       
   519 			TPtrC16 qmFile = description.Mid(charsToFilename, qmFileNameLength);
       
   520 			if ( InitializeTranslatorL( qmFile ) )
       
   521 				{
       
   522 			    result = CCaLocalizationEntry::NewLC();
       
   523 				HBufC* translatedString = HbTextResolverSymbian::LoadLC( logString );
       
   524 				if ( translatedString->Compare( logString ) )
       
   525 					{
       
   526 					result->SetStringIdL( logString );
       
   527 					aEntry->SetDescriptionL( *translatedString );
       
   528 					CleanupStack::PopAndDestroy( translatedString );
       
   529 					result->SetTableNameL( KLocalizationCaEntry );
       
   530 					result->SetAttributeNameL( KLocalizationEnDescription );
       
   531 					result->SetQmFilenameL( qmFile );
       
   532 					result->SetRowId( aEntry->GetId() ? 0 : aEntry->GetId() ); // must be added when present
       
   533 					CleanupStack::Pop( result );
       
   534 					}
       
   535 				else 
       
   536 					{
       
   537 				    CleanupStack::PopAndDestroy( translatedString );
       
   538 				    CleanupStack::PopAndDestroy( result );
       
   539 				    result = NULL;
       
   540 					}
       
   541 				
       
   542 				}
       
   543 			}
       
   544 		CleanupStack::PopAndDestroy( &description );
       
   545 		}
       
   546 	
       
   547 	return result;
       
   548 	}
       
   549 
       
   550 // ---------------------------------------------------------
       
   551 //
       
   552 // ---------------------------------------------------------
       
   553 //
       
   554 TBool CCaStorageProxy::InitializeTranslatorL( TDesC& aQmFilename )
       
   555     {
       
   556 	TBool result = HbTextResolverSymbian::Init( aQmFilename, KLocalizationFilepathC );
       
   557 	if ( !result )
       
   558 		{
       
   559 		// this should not be called too often 
       
   560 		TChar currentDriveLetter;
       
   561 		TDriveList driveList;
       
   562 		RFs fs;
       
   563 		User::LeaveIfError( fs.Connect() );
       
   564 		User::LeaveIfError( fs.DriveList( driveList ) );
       
   565 
       
   566 		RBuf path;
       
   567 		CleanupClosePushL( path );
       
   568 		path.CreateL( KLocalizationFilepath().Length() + 1 );
       
   569 
       
   570 		for ( TInt driveNr = EDriveY; driveNr >= EDriveA; driveNr-- )
       
   571 			{
       
   572 			if ( driveList[driveNr] )
       
   573 				{
       
   574 				User::LeaveIfError(fs.DriveToChar( driveNr, currentDriveLetter ));
       
   575 				path.Append( currentDriveLetter );
       
   576 				path.Append( KLocalizationFilepath );
       
   577 				if (HbTextResolverSymbian::Init( aQmFilename, path ))
       
   578 					{
       
   579 				    result = ETrue;
       
   580 					break;
       
   581 					}
       
   582 				}
       
   583 			path.Zero();
       
   584 			}
       
   585 		CleanupStack::PopAndDestroy( &path );
       
   586 		fs.Close();
       
   587 		
       
   588 		if( !result )
       
   589 			{
       
   590 		    result = HbTextResolverSymbian::Init( aQmFilename, KLocalizationFilepathZ );
       
   591 			}
       
   592 		}
       
   593 	return result;
       
   594 	}