diff -r 6b5524b4f673 -r 38bb213f60ba phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridFiller.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridFiller.cpp Wed Sep 15 11:56:55 2010 +0300 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridFiller.cpp Wed Oct 13 14:15:33 2010 +0300 @@ -124,12 +124,6 @@ delete iSearchString; delete iFindUtil; iDigraphContactsTitleArray.ResetAndDestroy(); - - if (iFeatureManagerInitialized) - { - // It can be safely called UnInitializeLib as it has been really intialized. - FeatureManager::UnInitializeLib(); // Decreases ref.count - } } @@ -156,10 +150,6 @@ { iKeyMap = HBufC::NewL( KAdaptiveSearchKeyMapGranularity ); iFindUtil = CFindUtil::NewL(); - - // Initialize feature manager - FeatureManager::InitializeLibL(); - iFeatureManagerInitialized = ETrue; // UI Language TLanguage uiLanguage = User::Language(); if ( uiLanguage != ELangJapanese && uiLanguage != ELangPrcChinese && @@ -424,16 +414,40 @@ void CPbk2AdaptiveSearchGridFiller::SetAdaptiveGridCharsL( const TInt aMaxSpacesNumber, const TInt aSearchStringSpacesNumber ) - { + { + TPtr ptr = iKeyMap->Des(); + + // Do upper case for all characters + ptr.UpperCase(); + CDesCArray* array = new (ELeave) CDesCArrayFlat( KAdaptiveSearchKeyMapGranularity ); + CleanupStack::PushL( array ); + TInt length = ptr.Length(); + + for( TInt ii = 0; ii < length; ii++ ) + { + array->AppendL( ptr.Mid( ii, 1 ) ); + } + + // Alphabetical sort + array->Sort( ECmpCollated ); + ptr.Zero(); + // Add space character only if: // - user typed already some characters in the find pane, // - and more spaces can be found in contacts than in the current search string, // - and space is not the last character in the search string. - TBool addSpace = ( iSearchString->Length() > 0 - && aMaxSpacesNumber > aSearchStringSpacesNumber - && (*iSearchString)[iSearchString->Length() - 1] != TChar( ' ' ) ); - - SortGridL( addSpace ); + if ( iSearchString->Length() > 0 + && aMaxSpacesNumber > aSearchStringSpacesNumber + && (*iSearchString)[iSearchString->Length() - 1] != TChar( ' ' ) ) + { + ptr.Append( TChar( ' ' ) ); + } + + for( TInt ii = 0; ii < length; ii++ ) + { + ptr.Append(array->MdcaPoint( ii )); + } + CleanupStack::PopAndDestroy();//array if( iCurrentGrid ) { @@ -465,36 +479,6 @@ } -void CPbk2AdaptiveSearchGridFiller::SortGridL( TBool aAddSpace ) - { - TPtr ptr = iKeyMap->Des(); - - // Do upper case for all characters - ptr.UpperCase(); - CDesCArray* array = new (ELeave) CDesCArrayFlat( KAdaptiveSearchKeyMapGranularity ); - CleanupStack::PushL( array ); - TInt length = ptr.Length(); - - for( TInt ii = 0; ii < length; ii++ ) - { - array->AppendL( ptr.Mid( ii, 1 ) ); - } - - // Alphabetical sort - array->Sort( ECmpCollated ); - ptr.Zero(); - - if ( aAddSpace ) - { - ptr.Append( TChar( ' ' ) ); - } - - for( TInt ii = 0; ii < length; ii++ ) - { - ptr.Append( array->MdcaPoint( ii ) ); - } - CleanupStack::PopAndDestroy();//array - } CDesC16Array* CPbk2AdaptiveSearchGridFiller::SplitContactFieldTextIntoArrayLC( const TDesC& aText ) @@ -528,23 +512,7 @@ // Scan for next word beg = end; } - - // consonent based adaptive search: - if ( FeatureManager::FeatureSupported( KFeatureIdKorean ) ) - { - /* - When user has a contact with first name "??" and last name "?", - It should be displayed with "? ??" in Korea variant. - That means it should be found with search keyword, "?" or "??". - Thus, need to put the "? ??" in the item list which is delivered to FindUtil. - no need to care about just one word like "???" - */ - if ( array->MdcaCount() != 1 ) - { - array->AppendL( aText ); - } - } - + return array; } @@ -781,8 +749,6 @@ iKeyMap = iKeyMap->ReAllocL( gridChars.Length() ); } iKeyMap->Des().Copy( gridChars ); - // Sort the grid, space is not needed - SortGridL( EFalse ); delete iCurrentGrid; iCurrentGrid = NULL;