uiutils/Findutil/src/FindUtilWestern.cpp
branchRCL_3
changeset 20 d48ab3b357f1
parent 19 aecbbf00d063
child 21 978afdc0236f
equal deleted inserted replaced
19:aecbbf00d063 20:d48ab3b357f1
    27 #include <collate.h>
    27 #include <collate.h>
    28 #include <PtiIndicDefs.h>
    28 #include <PtiIndicDefs.h>
    29 #include "FindUtilKorean.h"
    29 #include "FindUtilKorean.h"
    30 #include <avkon.rsg>
    30 #include <avkon.rsg>
    31 #include <StringLoader.h>
    31 #include <StringLoader.h>
       
    32 #include <featmgr.h>
       
    33 #include <bldvariant.hrh>
       
    34 
    32 const TInt KLitTab('\t');
    35 const TInt KLitTab('\t');
    33 const TInt KLitSpace(' ');
    36 const TInt KLitSpace(' ');
    34 const TInt KLitHyphen('-');
    37 const TInt KLitHyphen('-');
    35 const TInt KLitLineFeed(8233);
    38 const TInt KLitLineFeed(8233);
    36 const TInt KLitStar('*');
    39 const TInt KLitStar('*');
   307         {
   310         {
   308         return iFindUtilKorean->Match( aContactsField, aWord );	
   311         return iFindUtilKorean->Match( aContactsField, aWord );	
   309         }
   312         }
   310     else
   313     else
   311     	{
   314     	{
   312     TInt numChar = 1;
   315         TInt numChar = 1;
   313     	if (!aContactsField.Length())
   316     	if (!aContactsField.Length())
   314         	{
   317         	{
   315         	return EFalse;
   318                 _LIT( KNone, "*" );
       
   319     	        if( aWord.CompareC(KNone()) == 0 )
       
   320                     {
       
   321     	            return ETrue;
       
   322                     }
       
   323                 else
       
   324                     {
       
   325         	    return EFalse;
       
   326                     }
   316         	}        
   327         	}        
   317     	if((aWord.Length() > 1) && aWord[aWord.Length()-2] == 0x200B)
   328     	if((aWord.Length() > 1) && aWord[aWord.Length()-2] == 0x200B)
   318     		{
   329     		{
   319     		numChar = 2;
   330     		numChar = 2;
   320     		}    	
   331     		}    	
   332 // (other items were commented in a header).
   343 // (other items were commented in a header).
   333 // -----------------------------------------------------------------------------
   344 // -----------------------------------------------------------------------------
   334 //
   345 //
   335 TBool CFindUtilWestern::MatchRefineL( const TDesC& aItemString, const TDesC& aSearchText )
   346 TBool CFindUtilWestern::MatchRefineL( const TDesC& aItemString, const TDesC& aSearchText )
   336     {
   347     {
   337     if ( iFindUtilKorean->IsKoreanLanguage( aItemString ) || iFindUtilKorean->IsKoreanLanguage( aSearchText ) )
   348     if ( FeatureManager::FeatureSupported( KFeatureIdKorean ) || 
       
   349          iFindUtilKorean->IsKoreanLanguage( aItemString ) || 
       
   350          iFindUtilKorean->IsKoreanLanguage( aSearchText ) )
   338         {
   351         {
   339         return iFindUtilKorean->MatchRefineL( aItemString, aSearchText );	
   352         return iFindUtilKorean->MatchRefineL( aItemString, aSearchText );	
   340         }
   353         }
   341     else
   354     else
   342     {
   355         {
   343     if ( aItemString.Length() == 0 )
   356         if ( aItemString.Length() == 0 )
   344         {
   357             {
   345         return EFalse;
   358             return EFalse;
   346         }
   359             }
   347 
   360     
   348     if ( aSearchText.Length() == 0 )
   361         if ( aSearchText.Length() == 0 )
   349         {
   362             {
   350         return ETrue;
   363             return ETrue;
   351         }
   364             }
   352     return IsFindMatch( aItemString, aSearchText, iInputLanguage );
   365         return IsFindMatch( aItemString, aSearchText, iInputLanguage );
   353     	}
   366     	}
   354     }
   367     }
   355 
   368 
   356 // -----------------------------------------------------------------------------
   369 // -----------------------------------------------------------------------------
   357 // CFindUtilWestern::IsWordValidForMatching
   370 // CFindUtilWestern::IsWordValidForMatching
  1300 	{
  1313 	{
  1301     if ( aItemString.Length() == 0 )
  1314     if ( aItemString.Length() == 0 )
  1302         {
  1315         {
  1303         return EFalse;
  1316         return EFalse;
  1304         }
  1317         }
       
  1318 		
       
  1319     if ( iFindUtilKorean )
       
  1320         {
       
  1321         return iFindUtilKorean->MatchAdaptiveRefineL(aItemString,aSearchText,aNextChars);   
       
  1322         }
       
  1323 		
  1305     if ( aSearchText.Length() == 0 )
  1324     if ( aSearchText.Length() == 0 )
  1306         {        
  1325         {        
  1307         UpdateNextCharsFromString( aNextChars, aItemString );
  1326         UpdateNextCharsFromString( aNextChars, aItemString );
  1308         return ETrue;
  1327         return ETrue;
  1309         }
  1328         }
  1311     if( iDigraphChars == NULL )
  1330     if( iDigraphChars == NULL )
  1312         {
  1331         {
  1313         iDigraphChars = StringLoader::LoadL( R_QTN_ADS_DIGRAPH );
  1332         iDigraphChars = StringLoader::LoadL( R_QTN_ADS_DIGRAPH );
  1314         TPtr digraph = iDigraphChars->Des();
  1333         TPtr digraph = iDigraphChars->Des();
  1315         digraph.UpperCase();
  1334         digraph.UpperCase();
       
  1335 
       
  1336         _LIT( KMissing,"#MISSING" );
       
  1337         if( digraph.CompareC(KMissing()) == 0 )
       
  1338             {
       
  1339             digraph = KNullDesC;
       
  1340             }
  1316         }
  1341         }
  1317         
  1342         
  1318     TBuf<KAknStringBufferSize> itemString(aItemString);
  1343     TBuf<KAknStringBufferSize> itemString(aItemString);
  1319     itemString.UpperCase();
  1344     itemString.UpperCase();
  1320 
  1345