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