uifw/AvKon/src/aknutils.cpp
branchRCL_3
changeset 23 3d340a0166ff
parent 16 71dd06cfe933
child 25 941195f2d488
equal deleted inserted replaced
18:0aa5fbdfbc30 23:3d340a0166ff
  1883         NoCriteriaL( EFalse );
  1883         NoCriteriaL( EFalse );
  1884         }
  1884         }
  1885     
  1885     
  1886     // an index to end of array
  1886     // an index to end of array
  1887     TInt indexEnd = iShownIndexes->Count();
  1887     TInt indexEnd = iShownIndexes->Count();
       
  1888 
       
  1889     TBitFlags32 columnFlag = iSearchField->ListColumnFilterFlags(); 
       
  1890     HBufC16* temptext = HBufC16::NewL( KMatchingBufferLength );  
       
  1891     CleanupStack::PushL( temptext );  
       
  1892     TPtr ptr_temptext( temptext->Des() );  
       
  1893 
  1888     // If adaptive search manage with next characters
  1894     // If adaptive search manage with next characters
  1889     if( iSearchField && IsAdaptiveSearch() )
  1895     if( iSearchField && IsAdaptiveSearch() )
  1890         {        
  1896         {        
  1891         ClearNextChars();
  1897         ClearNextChars();
  1892         TBitFlags32 columnFlag = iSearchField->ListColumnFilterFlags(); 
  1898         
  1893         HBufC16* temptext = HBufC16::NewL( KMatchingBufferLength );  
       
  1894         CleanupStack::PushL( temptext );  
       
  1895         TPtr ptr_temptext( temptext->Des() );  
       
  1896         for ( TInt i = iShownIndexes->Count()-1; i>=0; i-- )
  1899         for ( TInt i = iShownIndexes->Count()-1; i>=0; i-- )
  1897            {
  1900            {
  1898            TInt realindex = iShownIndexes->At( i );        
  1901            TInt realindex = iShownIndexes->At( i );        
  1899            TPtrC itemtext = arr->ItemTextArray()->MdcaPoint(realindex);
  1902            TPtrC itemtext = arr->ItemTextArray()->MdcaPoint(realindex);
  1900            AknFind::UpdateItemTextAccordingToFlag( itemtext, columnFlag, ptr_temptext );
  1903            AknFind::UpdateItemTextAccordingToFlag( itemtext, columnFlag, ptr_temptext );
  1943             nextChars.Append(array->MdcaPoint(i));
  1946             nextChars.Append(array->MdcaPoint(i));
  1944             }  
  1947             }  
  1945         CleanupStack::PopAndDestroy(array);   
  1948         CleanupStack::PopAndDestroy(array);   
  1946 
  1949 
  1947         iSearchField->SetAdaptiveGridChars( *(iExtension->iNextChars) ); 
  1950         iSearchField->SetAdaptiveGridChars( *(iExtension->iNextChars) ); 
  1948         CleanupStack::PopAndDestroy( temptext );
       
  1949         }
  1951         }
  1950     else
  1952     else
  1951         {
  1953         {
  1952         for (TInt i = iShownIndexes->Count()-1; i>=0 ; i--)
  1954         for (TInt i = iShownIndexes->Count()-1; i>=0 ; i--)
  1953             {
  1955             {
  1954             TInt realindex = iShownIndexes->At(i);
  1956 
  1955             TPtrC itemtext = array->MdcaPoint(realindex);
  1957             TInt realindex = iShownIndexes->At( i );        
  1956             TBool isItemVisible = IsItemVisible(itemtext, aCriteria);
  1958             TPtrC itemtext = arr->ItemTextArray()->MdcaPoint( realindex );
       
  1959             AknFind::UpdateItemTextAccordingToFlag( itemtext, columnFlag, ptr_temptext );
       
  1960             TBool isItemVisible = IsItemVisible( ptr_temptext, aCriteria );
       
  1961 
  1957             TBool isItemSelected = IsItemSelected(realindex);
  1962             TBool isItemSelected = IsItemSelected(realindex);
  1958             // EAJA-7SK9UC set indexToSet as current index when found item
  1963             // EAJA-7SK9UC set indexToSet as current index when found item
  1959             if ( isItemVisible )
  1964             if ( isItemVisible )
  1960                 {           
  1965                 {           
  1961                 indexEnd = iShownIndexes->Count() - i;
  1966                 indexEnd = iShownIndexes->Count() - i;
  1962                 }
  1967                 }
  1963             else if ( !(isItemVisible || isItemSelected) )
  1968             else if ( !(isItemVisible || isItemSelected) )
  1964                 {
  1969                 {
  1965                 iShownIndexes->Delete(i);
  1970                 iShownIndexes->Delete(i);
  1966                 }
  1971                 }
       
  1972             ptr_temptext.Zero();  
  1967             }  
  1973             }  
  1968         }   
  1974         } 
       
  1975     CleanupStack::PopAndDestroy( temptext );  
  1969     InstallEmptyTextL();
  1976     InstallEmptyTextL();
  1970 
  1977 
  1971     // Set highlight to the first match item in markable list
  1978     // Set highlight to the first match item in markable list
  1972     if (iListBox)
  1979     if (iListBox)
  1973         {
  1980         {
  1983         }    
  1990         }    
  1984     
  1991     
  1985     // An index to set highlight after find pane updating
  1992     // An index to set highlight after find pane updating
  1986     TInt indexToSet = KInvalidIndex;    
  1993     TInt indexToSet = KInvalidIndex;    
  1987     iShownIndexes->Reset();
  1994     iShownIndexes->Reset();
       
  1995 
       
  1996     const MDesCArray *array = iModel->MatchableTextArray();
       
  1997     const CAknFilteredTextListBoxModel* arr = (CAknFilteredTextListBoxModel*)( iModel->MatchableTextArray() );
       
  1998     TInt count = array->MdcaCount();
       
  1999     TBitFlags32 columnFlag = iSearchField->ListColumnFilterFlags();
       
  2000     HBufC16* temptext = HBufC16::NewL( KMatchingBufferLength ); 
       
  2001     CleanupStack::PushL( temptext );
       
  2002     TPtr ptr_temptext( temptext->Des() );   
       
  2003 
  1988     // If adaptive search field 
  2004     // If adaptive search field 
  1989     if( iSearchField && IsAdaptiveSearch() )
  2005     if( iSearchField && IsAdaptiveSearch() )
  1990         {        
  2006         {        
  1991         ClearNextChars();
  2007         ClearNextChars();
  1992         TBitFlags32 columnFlag = iSearchField->ListColumnFilterFlags();
       
  1993         HBufC16* temptext = HBufC16::NewL( KMatchingBufferLength ); 
       
  1994         CleanupStack::PushL( temptext );
       
  1995         TPtr ptr_temptext( temptext->Des() );       
       
  1996         const MDesCArray *array = iModel->MatchableTextArray();
       
  1997         const CAknFilteredTextListBoxModel* arr = (CAknFilteredTextListBoxModel*)(iModel->MatchableTextArray());
       
  1998         TInt count = array->MdcaCount();
       
  1999         
  2008         
  2000         for (TInt i = 0; i < count; i++)
  2009         for (TInt i = 0; i < count; i++)
  2001            {            
  2010            {            
  2002             TPtrC itemtext = arr->ItemTextArray()->MdcaPoint(i);    
  2011             TPtrC itemtext = arr->ItemTextArray()->MdcaPoint(i);    
  2003             AknFind::UpdateItemTextAccordingToFlag( itemtext, columnFlag, ptr_temptext );
  2012             AknFind::UpdateItemTextAccordingToFlag( itemtext, columnFlag, ptr_temptext );
  2013                 }
  2022                 }
  2014             ptr_temptext.Zero();    
  2023             ptr_temptext.Zero();    
  2015            }                
  2024            }                
  2016         iSearchField->SetAdaptiveGridChars( *(iExtension->iNextChars) ); 
  2025         iSearchField->SetAdaptiveGridChars( *(iExtension->iNextChars) ); 
  2017         InstallEmptyTextL(); 
  2026         InstallEmptyTextL(); 
  2018         CleanupStack::PopAndDestroy( temptext );
       
  2019         }
  2027         }
  2020     else
  2028     else
  2021         {
  2029         {
  2022         const MDesCArray *array = iModel->MatchableTextArray();
  2030 
  2023         TInt count = array->MdcaCount();
       
  2024         TInt i;
  2031         TInt i;
  2025 
  2032 
  2026         if ( aCriteria.Length() == 0)
  2033         if ( aCriteria.Length() == 0)
  2027             {
  2034             {
  2028             /* If there is no search criteria - most commonly when list is
  2035             /* If there is no search criteria - most commonly when list is
  2038             }
  2045             }
  2039         else
  2046         else
  2040             {
  2047             {
  2041             for( i = 0; i < count ; i++ )
  2048             for( i = 0; i < count ; i++ )
  2042                 {
  2049                 {
  2043                 TPtrC itemtext = array->MdcaPoint(i);
  2050 
  2044                 TBool isItemVisible = IsItemVisible(itemtext, aCriteria);
  2051                 TPtrC itemtext = arr->ItemTextArray()->MdcaPoint( i );    
       
  2052                 AknFind::UpdateItemTextAccordingToFlag( itemtext, columnFlag, ptr_temptext );
       
  2053                 TBool isItemVisible = IsItemVisible( temptext->Des(), aCriteria );
  2045                 
  2054                 
  2046                 // Find first match item to set highlight
  2055                 // Find first match item to set highlight
  2047                 if ((indexToSet == KInvalidIndex) && isItemVisible)
  2056                 if ((indexToSet == KInvalidIndex) && isItemVisible)
  2048                     {
  2057                     {
  2049                     indexToSet = iShownIndexes->Count();
  2058                     indexToSet = iShownIndexes->Count();
  2050                     }
  2059                     }
  2051                 if ( isItemVisible || IsItemSelected(i))
  2060                 if ( isItemVisible || IsItemSelected(i))
  2052                     {
  2061                     {
  2053                     iShownIndexes->AppendL(i);
  2062                     iShownIndexes->AppendL(i);
  2054                     }
  2063                     }
       
  2064                 ptr_temptext.Zero();  
  2055                 } 
  2065                 } 
  2056             InstallEmptyTextL();
  2066             InstallEmptyTextL();
  2057             }
  2067             }
  2058         }
  2068         }
       
  2069     CleanupStack::PopAndDestroy( temptext );
  2059     
  2070     
  2060     // Set highlight to the first match item in markable list
  2071     // Set highlight to the first match item in markable list
  2061     if ( iListBox && indexToSet != KInvalidIndex )
  2072     if ( iListBox && indexToSet != KInvalidIndex )
  2062         {
  2073         {
  2063         iListBox->SetCurrentItemIndex( Max(indexToSet, 0) );    
  2074         iListBox->SetCurrentItemIndex( Max(indexToSet, 0) );