uifw/AvKon/src/aknutils.cpp
branchRCL_3
changeset 20 d48ab3b357f1
parent 19 aecbbf00d063
child 21 978afdc0236f
equal deleted inserted replaced
19:aecbbf00d063 20:d48ab3b357f1
     1 /*
     1 /*
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   117 #include "AknLayoutUtilsHelpers.h"
   117 #include "AknLayoutUtilsHelpers.h"
   118 
   118 
   119 #include "AknAdaptiveSearch.h"
   119 #include "AknAdaptiveSearch.h"
   120 #include <PtiEngine.h>
   120 #include <PtiEngine.h>
   121 
   121 
   122 #include <akntrace.h> 
   122 #include "akntrace.h"
   123 
   123 
   124 #ifdef RD_HINDI_PHONETIC_INPUT
   124 #ifdef RD_HINDI_PHONETIC_INPUT
   125 #include <ptiindicdefs.h>
   125 #include <ptiindicdefs.h>
   126 #endif
   126 #endif
   127 
   127 
   131 
   131 
   132 const TInt KAknStringBufferSize = 256;
   132 const TInt KAknStringBufferSize = 256;
   133 const TInt KTextColorNone = -1;
   133 const TInt KTextColorNone = -1;
   134 const TInt KFontHeightComparisonDivisor = 20;
   134 const TInt KFontHeightComparisonDivisor = 20;
   135 const TInt KInvalidIndex = -1;
   135 const TInt KInvalidIndex = -1;
       
   136 
       
   137 // Default for list separator line color's alpha value, used if not
       
   138 // found from skin.
       
   139 const TInt KDefaultSeparatorAlpha = 32;
   136 
   140 
   137 enum TAknLayoutEdwinPanic
   141 enum TAknLayoutEdwinPanic
   138     {
   142     {
   139     EAknLayoutEdwinPanicNoEdwin,
   143     EAknLayoutEdwinPanicNoEdwin,
   140     EAknLayoutEdwinPanicNoLinesOverMaxNoLines,
   144     EAknLayoutEdwinPanicNoLinesOverMaxNoLines,
   524     }
   528     }
   525     AknLayoutUtils::LayoutControl(aListBox, aParentControl->Rect(), aListAreaResourceId);
   529     AknLayoutUtils::LayoutControl(aListBox, aParentControl->Rect(), aListAreaResourceId);
   526     _AKNDEBUG(
   530     _AKNDEBUG(
   527             if ( aListBox )
   531             if ( aListBox )
   528                 {
   532                 {
   529     		_AKNTRACE( "[%s][%s] ListBox Rect iTl: %d,%d; iBr: %d,%d", 
   533             _AKNTRACE( "[%s][%s] ListBox Rect iTl: %d,%d; iBr: %d,%d", 
   530     				"AknFind", __FUNCTION__, 
   534                     "AknFind", __FUNCTION__, 
   531     				aParentControl->Rect().iTl.iX, aParentControl->Rect().iTl.iY, 
   535                     aParentControl->Rect().iTl.iX, aParentControl->Rect().iTl.iY, 
   532     				aParentControl->Rect().iBr.iX, aParentControl->Rect().iBr.iY 
   536                     aParentControl->Rect().iBr.iX, aParentControl->Rect().iBr.iY 
   533 				);
   537                 );
   534                 }
   538                 }
   535         );
   539         );
   536     _AKNTRACE_FUNC_EXIT;
   540     _AKNTRACE_FUNC_EXIT;
   537     }
   541     }
   538 
   542 
   615                     );
   619                     );
   616         }
   620         }
   617         
   621         
   618     AknLayoutUtils::LayoutControl(aListBox, aParentControl->Rect(), tempListArea);
   622     AknLayoutUtils::LayoutControl(aListBox, aParentControl->Rect(), tempListArea);
   619     _AKNDEBUG(
   623     _AKNDEBUG(
   620     		if ( aListBox )
   624             if ( aListBox )
   621                 {
   625                 {
   622                 _AKNTRACE( "[%s][%s] ListBox Rect iTl: %d,%d; iBr: %d,%d", 
   626                 _AKNTRACE( "[%s][%s] ListBox Rect iTl: %d,%d; iBr: %d,%d", 
   623                             "AknFind", __FUNCTION__,
   627                             "AknFind", __FUNCTION__,
   624                             aListBox->Rect().iTl.iX, aListBox->Rect().iTl.iY, 
   628                             aListBox->Rect().iTl.iX, aListBox->Rect().iTl.iY, 
   625                             aListBox->Rect().iBr.iX, aListBox->Rect().iBr.iY 
   629                             aListBox->Rect().iBr.iX, aListBox->Rect().iBr.iY 
   626                             );
   630                             );
   627                 }
   631                 }
   628 		);
   632         );
   629     if ( aListBox )
   633     if ( aListBox )
   630         {
   634         {
   631         aListBox->DrawNow();
   635         aListBox->DrawNow();
   632         }
   636         }
   633     _AKNTRACE_FUNC_EXIT;
   637     _AKNTRACE_FUNC_EXIT;
   756  /**
   760  /**
   757  * Checks current character is it special character from Vietnamese language . 
   761  * Checks current character is it special character from Vietnamese language . 
   758  *
   762  *
   759  * @since 5.0
   763  * @since 5.0
   760  * @return @c ETrue If it is accent from Vietnamese language, otherwise EFalse. 
   764  * @return @c ETrue If it is accent from Vietnamese language, otherwise EFalse. 
   761  */	
   765  */ 
   762 inline TBool IsVietnameseSpecialCharacter( TChar aCh )
   766 inline TBool IsVietnameseSpecialCharacter( TChar aCh )
   763     {  
   767     {  
   764     if ( ( aCh >= 0x0300 && aCh <= 0x0303 ) || aCh == 0x0306 ||     
   768     if ( ( aCh >= 0x0300 && aCh <= 0x0303 ) || aCh == 0x0306 ||     
   765            aCh == 0x0309 || aCh == 0x0323 || aCh == 0x031B )
   769            aCh == 0x0309 || aCh == 0x0323 || aCh == 0x031B )
   766             {
   770             {
   773 // Checks the current character for special character from Thai language . 
   777 // Checks the current character for special character from Thai language . 
   774 // ---------------------------------------------------------------------------
   778 // ---------------------------------------------------------------------------
   775 inline TBool IsThaiSpecialCharacter( TChar aCh )
   779 inline TBool IsThaiSpecialCharacter( TChar aCh )
   776     {    
   780     {    
   777     if( ( aCh > 0xE46 && aCh < 0xE4F ) ||  aCh == 0xE3A )
   781     if( ( aCh > 0xE46 && aCh < 0xE4F ) ||  aCh == 0xE3A )
   778 		{
   782         {
   779 		return ETrue;
   783         return ETrue;
   780 		}       
   784         }       
   781 	return EFalse;
   785     return EFalse;
   782     }
   786     }
   783   
   787   
   784 // ---------------------------------------------------------------------------
   788 // ---------------------------------------------------------------------------
   785 // IsAdaptiveFindMatch
   789 // IsAdaptiveFindMatch
   786 // ---------------------------------------------------------------------------
   790 // ---------------------------------------------------------------------------
   787 //
   791 //
   788 EXPORT_C TBool AknFind::IsAdaptiveFindMatch( const TDesC& aItemText, 
   792 EXPORT_C TBool AknFind::IsAdaptiveFindMatch( const TDesC& aItemText, 
   789 										     const TDesC& aSearchText,
   793                                              const TDesC& aSearchText,
   790  										 	 HBufC*& aNextChars )
   794                                              HBufC*& aNextChars )
   791 	{	
   795     {   
   792 	HBufC16* searchText( NULL );
   796     HBufC16* searchText( NULL );
   793 	TRAPD( error, searchText = HBufC16::NewL( KMatchingBufferLength ) );
   797     TRAPD( error, searchText = HBufC16::NewL( KMatchingBufferLength ) );
   794 	if ( error == KErrNone )
   798     if ( error == KErrNone )
   795 	    {
   799         {
   796 	    TInt itemStringLength = aItemText.Length();
   800         TInt itemStringLength = aItemText.Length();
   797         TInt searchTextLength = aSearchText.Length();    
   801         TInt searchTextLength = aSearchText.Length();    
   798         
   802         
   799         if ( searchTextLength < KMatchingBufferLength )
   803         if ( searchTextLength < KMatchingBufferLength )
   800         	{
   804             {
   801         	searchText->Des().Append( aSearchText );
   805             searchText->Des().Append( aSearchText );
   802         	}
   806             }
   803         else
   807         else
   804         	{
   808             {
   805         	searchText->Des().Append( aSearchText.Left(KMatchingBufferLength-1) );
   809             searchText->Des().Append( aSearchText.Left(KMatchingBufferLength-1) );
   806         	}    
   810             }    
   807     	
   811         
   808         searchText->Des().Append( KLitStar );
   812         searchText->Des().Append( KLitStar );
   809             
   813             
   810         TInt all_result = KErrNotFound;
   814         TInt all_result = KErrNotFound;
   811         for( TInt i = 0; i < itemStringLength; i++ )
   815         for( TInt i = 0; i < itemStringLength; i++ )
   812             {
   816             {
   815                 TInt result = aItemText.Mid(i).MatchC( searchText->Des() );
   819                 TInt result = aItemText.Mid(i).MatchC( searchText->Des() );
   816                 
   820                 
   817                 if( result != KErrNotFound ) 
   821                 if( result != KErrNotFound ) 
   818                     {
   822                     {
   819                     all_result = result;
   823                     all_result = result;
   820                     if( i < (itemStringLength-searchTextLength) )                	   	       	   		
   824                     if( i < (itemStringLength-searchTextLength) )                                       
   821                         {                 
   825                         {                 
   822                 	   	 if( !(IsThaiSpecialCharacter(aItemText[i+searchTextLength])) && !(IsVietnameseSpecialCharacter( aItemText[i+searchTextLength]) ))
   826                          if( !(IsThaiSpecialCharacter(aItemText[i+searchTextLength])) && !(IsVietnameseSpecialCharacter( aItemText[i+searchTextLength]) ))
   823                                 {
   827                                 {
   824                                 TRAP_IGNORE( UpdateNextCharsL( aNextChars, aItemText[i+searchTextLength]) );   
   828                                 TRAP_IGNORE( UpdateNextCharsL( aNextChars, aItemText[i+searchTextLength]) );   
   825                                 }   
   829                                 }   
   826                         }
   830                         }
   827                     }                                                                  	   	
   831                     }                                                                       
   828                 } // if (i==0 ..)        
   832                 } // if (i==0 ..)        
   829       	    } // for	 
   833             } // for     
   830 	    
   834         
   831   	    if( all_result != KErrNotFound )
   835         if( all_result != KErrNotFound )
   832             {
   836             {
   833             delete searchText;
   837             delete searchText;
   834             return ETrue;
   838             return ETrue;
   835            	}    
   839             }    
   836         else 
   840         else 
   837             {
   841             {
   838             delete searchText;
   842             delete searchText;
   839             return EFalse;
   843             return EFalse;
   840             }
   844             }
   841         	            		
   845                                 
   842          } // if (error == KErrNone)   
   846          } // if (error == KErrNone)   
   843 
   847 
   844     delete searchText;                 
   848     delete searchText;                 
   845     return EFalse;
   849     return EFalse;
   846 	}
   850     }
   847 	
   851     
   848 
   852 
   849 /**
   853 /**
   850  * For Devanagari AS
   854  * For Devanagari AS
   851  * Checks if the passed string denotes one of the four special
   855  * Checks if the passed string denotes one of the four special
   852  * Devanagari ligatures - refer UI specs for the description of special ligatures
   856  * Devanagari ligatures - refer UI specs for the description of special ligatures
   972 inline TBool IsIndicHalantChar(const TChar aCh)
   976 inline TBool IsIndicHalantChar(const TChar aCh)
   973     {    
   977     {    
   974     return ( aCh == 0x094D );
   978     return ( aCh == 0x094D );
   975     }
   979     }
   976 
   980 
       
   981 static void SortCharsForAdaptiveSearchL( TPtr &aChars )
       
   982     {
       
   983     const TInt KDefaultArraySize = 10;// the default length of for sort
       
   984     CDesCArray* arrayFlat = new ( ELeave ) CDesCArrayFlat( KDefaultArraySize );
       
   985     CleanupStack::PushL( arrayFlat );
       
   986     
       
   987     TInt length = aChars.Length();                 
       
   988     TInt arrayCount( 0 );      
       
   989       
       
   990     for( TInt i = 0; i < length; i++ )
       
   991         {
       
   992         // the "IndicHalant" Chars occupys two spaces.
       
   993         if ( ( i < length-2 ) && IsIndicHalantChar( aChars[i+1] ) )
       
   994            {
       
   995            arrayFlat->AppendL( aChars.Mid( i, 3 ) );
       
   996            // One "IndicHalant" character occupys two spaces
       
   997            i+=2;
       
   998            ++arrayCount;
       
   999            }
       
  1000        else
       
  1001            {
       
  1002            arrayFlat->AppendL( aChars.Mid( i, 1 ) );
       
  1003            ++arrayCount;
       
  1004            }
       
  1005         }  
       
  1006     
       
  1007     // Alphabetical sort        
       
  1008     arrayFlat->Sort( ECmpCollated );
       
  1009     aChars.Delete( 0, aChars.Length() );
       
  1010 
       
  1011     for( TInt i = 0; i < arrayCount; i++ )
       
  1012         {
       
  1013         aChars.Append( arrayFlat->MdcaPoint( i ) );
       
  1014         }  
       
  1015     CleanupStack::PopAndDestroy( arrayFlat );  
       
  1016     }
       
  1017 
   977 // ---------------------------------------------------------------------------
  1018 // ---------------------------------------------------------------------------
   978 // For Devanagari AS
  1019 // For Devanagari AS
   979 // AknFind::UpdateNextCharsL
  1020 // AknFind::UpdateNextCharsL
   980 // ---------------------------------------------------------------------------
  1021 // ---------------------------------------------------------------------------
   981 //
  1022 //
   982 void AknFind::UpdateNextCharsL( HBufC*& aNextChars, const TDesC& aItemString )
  1023 void AknFind::UpdateNextCharsL( HBufC*& aNextChars, const TDesC& aItemString )
   983 	{
  1024     {
   984 	_AKNTRACE_FUNC_ENTER;
  1025     _AKNTRACE_FUNC_ENTER;
   985 	TChar searchChar = aItemString[0];
  1026     TChar searchChar = aItemString[0];
   986 	    //Check if this is an Indic special ligature
  1027         //Check if this is an Indic special ligature
   987 	    if ( IsIndicConsonant(searchChar) && aItemString.Length() > 2
  1028         if ( IsIndicConsonant(searchChar) && aItemString.Length() > 2
   988 	            && IsSpecialIndicLigature(aItemString) 
  1029                 && IsSpecialIndicLigature(aItemString) 
   989 	            && KErrNotFound == (*aNextChars).Find(aItemString.Mid(0,3)) )
  1030                 && KErrNotFound == (*aNextChars).Find(aItemString.Mid(0,3)) )
   990 	        {
  1031             {
   991 	        //Check if we have enough space for 3 more characters
  1032             //Check if we have enough space for 3 more characters
   992 	        if( aNextChars->Des().Length() >= aNextChars->Des().MaxLength()-3 )
  1033             if( aNextChars->Des().Length() >= aNextChars->Des().MaxLength()-3 )
   993 	            {
  1034                 {
   994 	            aNextChars = aNextChars->ReAllocL( aNextChars->Des().MaxLength()+10 );
  1035                 aNextChars = aNextChars->ReAllocL( aNextChars->Des().MaxLength()+10 );
   995 	            TInt length1 = aNextChars->Des().Length();
  1036                 TInt length1 = aNextChars->Des().Length();
   996 	            TInt maxlength1 = aNextChars->Des().MaxLength();
  1037                 TInt maxlength1 = aNextChars->Des().MaxLength();
   997 	            }       
  1038                 }       
   998 	        aNextChars->Des().Append( aItemString.Mid(0,3) );        
  1039             aNextChars->Des().Append( aItemString.Mid(0,3) );        
   999 	        }
  1040             }
  1000 	    else
  1041         else
  1001 	        {
  1042             {
  1002 	        if ( !IsValidCharForASGrid(searchChar) ) 
  1043             if ( !IsValidCharForASGrid(searchChar) ) 
  1003 	            {
  1044                 {
  1004 	            return;	            
  1045                 return;             
  1005 	            }
  1046                 }
  1006 	        //check if this is an Indic combined Char
  1047             //check if this is an Indic combined Char
  1007 	        if ( IsIndicCombinedChar(searchChar) )
  1048             if ( IsIndicCombinedChar(searchChar) )
  1008 	            {
  1049                 {
  1009 	            searchChar = RemoveIndicNukta( searchChar );
  1050                 searchChar = RemoveIndicNukta( searchChar );
  1010 	            }
  1051                 }
  1011 	        //Now update the nextChars string
  1052             //Now update the nextChars string
  1012             TInt strLength = aNextChars->Length();
  1053             TInt strLength = aNextChars->Length();
  1013             for ( TInt i(0); i < strLength ; ++i )
  1054             for ( TInt i(0); i < strLength ; ++i )
  1014                 {
  1055                 {
  1015                 if ( IsSpecialIndicLigature( (*aNextChars).Mid(i) ) )
  1056                 if ( IsSpecialIndicLigature( (*aNextChars).Mid(i) ) )
  1016                     {
  1057                     {
  1031             if( aNextChars->Des().Length() == aNextChars->Des().MaxLength() )
  1072             if( aNextChars->Des().Length() == aNextChars->Des().MaxLength() )
  1032                 {
  1073                 {
  1033                 aNextChars = aNextChars->ReAllocL( aNextChars->Des().MaxLength()+10 );
  1074                 aNextChars = aNextChars->ReAllocL( aNextChars->Des().MaxLength()+10 );
  1034                 }       
  1075                 }       
  1035             aNextChars->Des().Append( searchChar );   
  1076             aNextChars->Des().Append( searchChar );   
  1036 	        }
  1077             }
  1037 	    _AKNTRACE_FUNC_EXIT;
  1078         _AKNTRACE_FUNC_EXIT;
  1038 	}
  1079     }
  1039 
  1080 
  1040 // -----------------------------------------------------------------------------
  1081 // -----------------------------------------------------------------------------
  1041 // AknFind::UpdateNextCharsL
  1082 // AknFind::UpdateNextCharsL
  1042 // (other items were commented in a header).
  1083 // (other items were commented in a header).
  1043 // -----------------------------------------------------------------------------
  1084 // -----------------------------------------------------------------------------
  1062 // ---------------------------------------------------------------------------
  1103 // ---------------------------------------------------------------------------
  1063 // UpdateNextCharsFromString
  1104 // UpdateNextCharsFromString
  1064 // ---------------------------------------------------------------------------
  1105 // ---------------------------------------------------------------------------
  1065 //
  1106 //
  1066 EXPORT_C void AknFind::UpdateNextCharsFromString( HBufC*& aNextChars, const TDesC& aItemString )
  1107 EXPORT_C void AknFind::UpdateNextCharsFromString( HBufC*& aNextChars, const TDesC& aItemString )
  1067 	{
  1108     {
  1068 	TInt itemStringLength = aItemString.Length();
  1109     TInt itemStringLength = aItemString.Length();
  1069 	     
  1110          
  1070 	for( TInt i = 0; i < itemStringLength; i++ )
  1111     for( TInt i = 0; i < itemStringLength; i++ )
  1071 	    {
  1112         {
  1072 	    if ( i == 0 || IsFindWordSeparator( aItemString[i-1] ) )
  1113         if ( i == 0 || IsFindWordSeparator( aItemString[i-1] ) )
  1073 	        {  
  1114             {  
  1074 	        // If Indic letter
  1115             // If Indic letter
  1075 	        if ( aItemString[i] >= 0x0900 && aItemString[i] <= 0x0980 )
  1116             if ( aItemString[i] >= 0x0900 && aItemString[i] <= 0x0980 )
  1076 	            {
  1117                 {
  1077 	            TRAP_IGNORE( UpdateNextCharsL( aNextChars, aItemString.Mid(i) ) );
  1118                 TRAP_IGNORE( UpdateNextCharsL( aNextChars, aItemString.Mid(i) ) );
  1078 	            }
  1119                 }
  1079 	        else  if (!(IsVietnameseSpecialCharacter( aItemString[i])))
  1120             else  if (!(IsVietnameseSpecialCharacter( aItemString[i])))
  1080 	            {
  1121                 {
  1081 	            TRAP_IGNORE( UpdateNextCharsL( aNextChars, aItemString[i] ) );
  1122                 TRAP_IGNORE( UpdateNextCharsL( aNextChars, aItemString[i] ) );
  1082 	            }
  1123                 }
  1083 	        }
  1124             }
  1084 	    }
  1125         }
  1085 	}
  1126     }
  1086 
  1127 
  1087 // ---------------------------------------------------------------------------
  1128 // ---------------------------------------------------------------------------
  1088 // UpdateItemTextAccordingToFlag
  1129 // UpdateItemTextAccordingToFlag
  1089 // ---------------------------------------------------------------------------
  1130 // ---------------------------------------------------------------------------
  1090 //
  1131 //
  1462                 {
  1503                 {
  1463                 AknFind::UpdateNextCharsFromString( iExtension->iNextChars, temptext->Des() );
  1504                 AknFind::UpdateNextCharsFromString( iExtension->iNextChars, temptext->Des() );
  1464                 }
  1505                 }
  1465             ptr_temptext.Zero(); 
  1506             ptr_temptext.Zero(); 
  1466             }
  1507             }
       
  1508         
       
  1509         TPtr nextChars = iExtension->iNextChars->Des();
       
  1510         SortCharsForAdaptiveSearchL( nextChars );
       
  1511         
  1467         iSearchField->SetAdaptiveGridChars( *(iExtension->iNextChars) ); 
  1512         iSearchField->SetAdaptiveGridChars( *(iExtension->iNextChars) ); 
  1468         CleanupStack::PopAndDestroy ( temptext );
  1513         CleanupStack::PopAndDestroy ( temptext );
  1469         }
  1514         }
  1470     iOldItemCount = iModel->MatchableTextArray()->MdcaCount(); 
  1515     iOldItemCount = iModel->MatchableTextArray()->MdcaCount(); 
  1471     if ( iOldItemCount>0 && iListBox ) 
  1516     if ( iOldItemCount>0 && iListBox ) 
  1767     iOldSearchCriteria = newcriteria.AllocL();
  1812     iOldSearchCriteria = newcriteria.AllocL();
  1768 
  1813 
  1769     FetchSelectionIndexesFromListBoxL();
  1814     FetchSelectionIndexesFromListBoxL();
  1770     }
  1815     }
  1771 
  1816 
  1772 
       
  1773 void CAknListBoxFilterItems::NoCriteriaL(TBool aUpdateAS)
  1817 void CAknListBoxFilterItems::NoCriteriaL(TBool aUpdateAS)
  1774     {
  1818     {
  1775     if (iDisableChangesToShownIndexes) return;
  1819     if (iDisableChangesToShownIndexes) return;
  1776     // Handles filtering
  1820     // Handles filtering
  1777     TInt count =0; 
  1821     TInt count =0; 
  1814             ptr_temptext.Zero(); 
  1858             ptr_temptext.Zero(); 
  1815             }
  1859             }
  1816         if( aUpdateAS )
  1860         if( aUpdateAS )
  1817             {
  1861             {
  1818             TPtr nextChars = iExtension->iNextChars->Des(); 
  1862             TPtr nextChars = iExtension->iNextChars->Des(); 
  1819             CDesCArray* array = new (ELeave) CDesCArrayFlat(10);
  1863             SortCharsForAdaptiveSearchL( nextChars );  
  1820             CleanupStack::PushL(array);
       
  1821             
       
  1822             TInt length = nextChars.Length();                 
       
  1823             TInt count(0);      
       
  1824               
       
  1825             for( TInt i = 0; i < length; i++ )
       
  1826                 {
       
  1827                 if ( (i < length-2) && IsIndicHalantChar( nextChars[i+1] ) )
       
  1828                    {
       
  1829                    array->AppendL( nextChars.Mid(i,3) );
       
  1830                    i+=2;
       
  1831                    ++count;
       
  1832                    }
       
  1833                else
       
  1834                    {
       
  1835                    array->AppendL( nextChars.Mid(i,1) );
       
  1836                    ++count;
       
  1837                    }
       
  1838                 }  
       
  1839             
       
  1840             // Alphabetical sort        
       
  1841             array->Sort( ECmpCollated );
       
  1842             nextChars.Delete( 0, nextChars.Length() );
       
  1843 
       
  1844             for( TInt i = 0; i < count; i++ )
       
  1845                 {
       
  1846                 nextChars.Append(array->MdcaPoint(i));
       
  1847                 }  
       
  1848             CleanupStack::PopAndDestroy(array);   
       
  1849             
  1864             
  1850             iSearchField->SetAdaptiveGridChars( *(iExtension->iNextChars) );
  1865             iSearchField->SetAdaptiveGridChars( *(iExtension->iNextChars) );
  1851             }
  1866             }
  1852         CleanupStack::PopAndDestroy( temptext );   
  1867         CleanupStack::PopAndDestroy( temptext );   
  1853         }
  1868         }
  1907                 }
  1922                 }
  1908             ptr_temptext.Zero();    
  1923             ptr_temptext.Zero();    
  1909             }           
  1924             }           
  1910    
  1925    
  1911         TPtr nextChars = iExtension->iNextChars->Des(); 
  1926         TPtr nextChars = iExtension->iNextChars->Des(); 
  1912         CDesCArray* array = new (ELeave) CDesCArrayFlat(10);
  1927         SortCharsForAdaptiveSearchL( nextChars );
  1913         CleanupStack::PushL(array);
       
  1914         
       
  1915         TInt length = nextChars.Length();                 
       
  1916         TInt count(0);      
       
  1917           
       
  1918         for( TInt i = 0; i < length; i++ )
       
  1919             {
       
  1920             if ( (i < length-2) && IsIndicHalantChar( nextChars[i+1] ) )
       
  1921                {
       
  1922                array->AppendL( nextChars.Mid(i,3) );
       
  1923                i+=2;
       
  1924                ++count;
       
  1925                }
       
  1926            else
       
  1927                {
       
  1928                array->AppendL( nextChars.Mid(i,1) );
       
  1929                ++count;
       
  1930                }
       
  1931             }  
       
  1932         
       
  1933         // Alphabetical sort        
       
  1934         array->Sort( ECmpCollated );
       
  1935         nextChars.Delete( 0, nextChars.Length() );
       
  1936 
       
  1937         for( TInt i = 0; i < count; i++ )
       
  1938             {
       
  1939             nextChars.Append(array->MdcaPoint(i));
       
  1940             }  
       
  1941         CleanupStack::PopAndDestroy(array);   
       
  1942 
  1928 
  1943         iSearchField->SetAdaptiveGridChars( *(iExtension->iNextChars) ); 
  1929         iSearchField->SetAdaptiveGridChars( *(iExtension->iNextChars) ); 
  1944         CleanupStack::PopAndDestroy( temptext );
  1930         CleanupStack::PopAndDestroy( temptext );
  1945         }
  1931         }
  1946     else
  1932     else
  1968     if (iListBox)
  1954     if (iListBox)
  1969         {
  1955         {
  1970         iListBox->SetCurrentItemIndex( Max( iShownIndexes->Count() - indexEnd, 0 ));    
  1956         iListBox->SetCurrentItemIndex( Max( iShownIndexes->Count() - indexEnd, 0 ));    
  1971         }
  1957         }
  1972     }
  1958     }
       
  1959 
  1973 
  1960 
  1974 void CAknListBoxFilterItems::ReleaseCriteriaL( const TDesC &aCriteria )
  1961 void CAknListBoxFilterItems::ReleaseCriteriaL( const TDesC &aCriteria )
  1975     {
  1962     {
  1976     if ( iDisableChangesToShownIndexes )
  1963     if ( iDisableChangesToShownIndexes )
  1977         {
  1964         {
  2006             if ( isItemVisible || IsItemSelected(i))
  1993             if ( isItemVisible || IsItemSelected(i))
  2007                 {
  1994                 {
  2008                 iShownIndexes->AppendL(i);
  1995                 iShownIndexes->AppendL(i);
  2009                 }
  1996                 }
  2010             ptr_temptext.Zero();    
  1997             ptr_temptext.Zero();    
  2011            }                
  1998            }  
       
  1999         
       
  2000         TPtr nextChars = iExtension->iNextChars->Des(); 
       
  2001         SortCharsForAdaptiveSearchL( nextChars );
       
  2002         
  2012         iSearchField->SetAdaptiveGridChars( *(iExtension->iNextChars) ); 
  2003         iSearchField->SetAdaptiveGridChars( *(iExtension->iNextChars) ); 
  2013         InstallEmptyTextL(); 
  2004         InstallEmptyTextL(); 
  2014         CleanupStack::PopAndDestroy( temptext );
  2005         CleanupStack::PopAndDestroy( temptext );
  2015         }
  2006         }
  2016     else
  2007     else
  3411     aRect.SetRect( 0, 0, 0, 0 );
  3402     aRect.SetRect( 0, 0, 0, 0 );
  3412     
  3403     
  3413     // No stacon pane active etc. cheking is done here before the switch-case so that we can 
  3404     // No stacon pane active etc. cheking is done here before the switch-case so that we can 
  3414     // have slightly better performance for some other lookups (e.g. screen).
  3405     // have slightly better performance for some other lookups (e.g. screen).
  3415     
  3406     
  3416     switch (aParam)
  3407     switch ( aParam )
  3417         {
  3408         {
  3418         case EScreen:
  3409         case EScreen:
       
  3410             {
  3419             aRect = screenRect;
  3411             aRect = screenRect;
  3420             return ETrue;
  3412             return ETrue;
       
  3413             }
  3421 
  3414 
  3422         case EApplicationWindow:
  3415         case EApplicationWindow:
  3423             rect.LayoutRect(
  3416             {
  3424                 screenRect,
  3417             // Application window is always the same as screen, so skip
  3425                 AknLayoutScalable_Avkon::application_window( 0 ) );
  3418             // reading the application_window from layout data for
  3426             aRect = rect.Rect();
  3419             // performance improvement.
       
  3420             aRect = screenRect;
  3427             return ETrue;
  3421             return ETrue;
       
  3422             }
  3428 
  3423 
  3429         case EStatusPane:
  3424         case EStatusPane:
  3430             {
  3425             {
  3431             CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
  3426             CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
  3432             
  3427             
  3433             if ( statusPane )
  3428             if ( statusPane )
  3434                 {
  3429                 {
  3435                 TInt currentStatusPaneLayoutResId = statusPane->CurrentLayoutResId();
  3430                 TInt currentStatusPaneLayoutResId = statusPane->CurrentLayoutResId();
  3436                 
  3431 
  3437                 if ( AknStatuspaneUtils::StaconPaneActive() )
  3432                 TAknWindowComponentLayout parent;
       
  3433 
       
  3434                 switch ( currentStatusPaneLayoutResId )
  3438                     {
  3435                     {
  3439                     // flat status pane in landscape mode is the whole top pane area  
  3436                     case R_AVKON_STATUS_PANE_LAYOUT_USUAL_WITH_BATTERY_PANE:
  3440                     if ( currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ||
  3437                     case R_AVKON_STATUS_PANE_LAYOUT_USUAL:
  3441                          currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT )
  3438                     case R_AVKON_STATUS_PANE_LAYOUT_POWER_OFF_RECHARGE:
       
  3439                     case R_AVKON_STATUS_PANE_LAYOUT_USUAL_MIRRORED:
       
  3440                     case R_AVKON_STATUS_PANE_LAYOUT_POWER_OFF_RECHARGE_MIRRORED:
       
  3441                     case R_AVKON_STATUS_PANE_LAYOUT_VT:
       
  3442                     case R_AVKON_STATUS_PANE_LAYOUT_VT_MIRRORED:
       
  3443                     case R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT:
       
  3444                     default:
  3442                         {
  3445                         {
  3443                         rect.LayoutRect( screenRect, AknLayoutScalable_Avkon::area_top_pane(8) ); // flat area_top_pane in lsc
  3446                         parent = AknLayoutScalable_Avkon::area_top_pane( 0 );
       
  3447                         line = AknLayoutScalable_Avkon::status_pane( 0 );
       
  3448                         break;
       
  3449                         }
       
  3450                     
       
  3451                     case R_AVKON_STATUS_PANE_LAYOUT_IDLE:
       
  3452                     case R_AVKON_STATUS_PANE_LAYOUT_IDLE_MIRRORED:
       
  3453                         {
       
  3454                         parent = AknLayoutScalable_Avkon::area_top_pane( 7 );
       
  3455                         line = AknLayoutScalable_Avkon::status_idle_pane(); // idle status pane
       
  3456                         break;
       
  3457                         }
       
  3458                         
       
  3459                     case R_AVKON_STATUS_PANE_LAYOUT_SMALL:
       
  3460                     case R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE:
       
  3461                     case R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE_MIRRORED:
       
  3462                         {
       
  3463                         // Small status pane is the whole top area.
       
  3464                         parent = AknLayoutScalable_Avkon::application_window( 0 );
       
  3465                         if ( Layout_Meta_Data::IsLandscapeOrientation() &&
       
  3466                              AknLayoutUtils::CbaLocation() == AknLayoutUtils::EAknCbaLocationBottom )
       
  3467                             {
       
  3468                             line = AknLayoutScalable_Avkon::area_top_pane( 2 );
       
  3469                             }
       
  3470                         else
       
  3471                             {
       
  3472                             line = AknLayoutScalable_Avkon::area_top_pane( 1 );
       
  3473                             }
       
  3474                             
       
  3475                         break;
       
  3476                         }
       
  3477                         
       
  3478                     case R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT:
       
  3479                     case R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT: // fallthrough
       
  3480                         {
       
  3481                         if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
  3482                             {
       
  3483                             parent = AknLayoutScalable_Avkon::area_top_pane( 2 );
       
  3484                             }
       
  3485                         else
       
  3486                             {
       
  3487                             parent = AknLayoutScalable_Avkon::area_top_pane( 6 );
       
  3488                             }
       
  3489                         line   = AknLayoutScalable_Avkon::status_pane( 1 ); // flat status pane
       
  3490                         break;
       
  3491                         }
       
  3492 
       
  3493                     case R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL:
       
  3494                     case R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE: // fallthrough
       
  3495                         {
       
  3496                         parent = AknLayoutScalable_Avkon::area_top_pane( 8 );
       
  3497                         line   = AknLayoutScalable_Avkon::status_pane( 1 );
       
  3498                         break;
       
  3499                         }
       
  3500 
       
  3501                     case R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT:
       
  3502                     case R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT: // fallthrough
       
  3503                         {
       
  3504                         parent = AknLayoutScalable_Avkon::area_top_pane( 2 );
       
  3505                         line   = AknLayoutScalable_Avkon::status_pane( 1 );
       
  3506                         break;
       
  3507                         }
       
  3508                         
       
  3509                     case R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS:
       
  3510                     case R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS: // fallthrough
       
  3511                         {
       
  3512                         parent = AknLayoutScalable_Avkon::area_top_pane( 20 );
       
  3513                         line   = AknLayoutScalable_Avkon::status_pane( 5 );
       
  3514                         break;
       
  3515                         }
       
  3516                         
       
  3517                     case R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT:
       
  3518                     case R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT:
       
  3519                     case R_AVKON_STACON_PANE_LAYOUT_EMPTY_SOFTKEYS_RIGHT:
       
  3520                     case R_AVKON_STACON_PANE_LAYOUT_EMPTY_SOFTKEYS_LEFT:        
       
  3521                     case R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT:
       
  3522                     case R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT:
       
  3523                         {
       
  3524                         rect.LayoutRect(
       
  3525                             screenRect,
       
  3526                             TAknWindowComponentLayout::Compose(
       
  3527                                 AknLayoutScalable_Avkon::area_top_pane( 2 ),
       
  3528                                 AknLayoutScalable_Avkon::stacon_top_pane() ) );
  3444                         aRect = rect.Rect();
  3529                         aRect = rect.Rect();
       
  3530 
       
  3531                         rect.LayoutRect(
       
  3532                             aRect,
       
  3533                             AknLayoutScalable_Avkon::control_top_pane_stacon( 0 ) );
       
  3534 
       
  3535                         // Status pane top = stacon top - control pane top.
       
  3536                         aRect.iBr.iX = rect.Rect().iTl.iX;
  3445                         return ETrue;
  3537                         return ETrue;
  3446                         }    
       
  3447                     else
       
  3448                         {
       
  3449                         rect.LayoutRect( screenRect, AknLayoutScalable_Avkon::area_top_pane(2) ); // classic area_top_pane in lsc
       
  3450                         aRect = rect.Rect();
       
  3451                         rect.LayoutRect( aRect, AknLayoutScalable_Avkon::stacon_top_pane() );
       
  3452                         aRect = rect.Rect();
       
  3453                         rect.LayoutRect( aRect, AknLayoutScalable_Avkon::control_top_pane_stacon(0) );
       
  3454                         aRect.iBr.iX = rect.Rect().iTl.iX;  // Status pane top = stacon top - control pane top.
       
  3455                         return ETrue;   
       
  3456                         }
  3538                         }
  3457                     }
  3539                     }
  3458                 else
  3540                 
  3459                     {
  3541                 rect.LayoutRect(
  3460                     TAknWindowComponentLayout parent;
  3542                     screenRect,
  3461                         
  3543                     TAknWindowComponentLayout::Compose( parent, line ) );
  3462                     switch ( currentStatusPaneLayoutResId )
  3544                 aRect = rect.Rect();
  3463                         {
       
  3464                         case R_AVKON_STATUS_PANE_LAYOUT_USUAL_WITH_BATTERY_PANE:
       
  3465                         case R_AVKON_STATUS_PANE_LAYOUT_USUAL:
       
  3466                         case R_AVKON_STATUS_PANE_LAYOUT_POWER_OFF_RECHARGE:
       
  3467                         case R_AVKON_STATUS_PANE_LAYOUT_USUAL_MIRRORED:
       
  3468                         case R_AVKON_STATUS_PANE_LAYOUT_POWER_OFF_RECHARGE_MIRRORED:
       
  3469                         case R_AVKON_STATUS_PANE_LAYOUT_VT:
       
  3470                         case R_AVKON_STATUS_PANE_LAYOUT_VT_MIRRORED:
       
  3471                         case R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT:
       
  3472                         default:
       
  3473                             parent = AknLayoutScalable_Avkon::area_top_pane(0);
       
  3474                             line = AknLayoutScalable_Avkon::status_pane(0); // classic status pane
       
  3475                             break;
       
  3476                         
       
  3477                         case R_AVKON_STATUS_PANE_LAYOUT_IDLE:
       
  3478                         case R_AVKON_STATUS_PANE_LAYOUT_IDLE_MIRRORED:
       
  3479                             parent = AknLayoutScalable_Avkon::area_top_pane(7);
       
  3480                             line = AknLayoutScalable_Avkon::status_idle_pane(); // idle status pane
       
  3481                             break;
       
  3482                             
       
  3483                         case R_AVKON_STATUS_PANE_LAYOUT_SMALL:
       
  3484                         case R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE:
       
  3485                         case R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE_MIRRORED:
       
  3486                             // Small status pane is the whole top area.
       
  3487                             parent = AknLayoutScalable_Avkon::application_window(0);
       
  3488                             if ( Layout_Meta_Data::IsLandscapeOrientation() &&
       
  3489                                  AknLayoutUtils::CbaLocation() == AknLayoutUtils::EAknCbaLocationBottom )
       
  3490                                 {
       
  3491                                 line = AknLayoutScalable_Avkon::area_top_pane(2);
       
  3492                                 }
       
  3493                             else
       
  3494                                 {
       
  3495                                 line = AknLayoutScalable_Avkon::area_top_pane(1);
       
  3496                                 }
       
  3497                                 
       
  3498                             break;
       
  3499                             
       
  3500                         case R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT:
       
  3501                         case R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT: // fallthrough
       
  3502                             {
       
  3503                             if ( Layout_Meta_Data::IsLandscapeOrientation() &&
       
  3504                                  Layout_Meta_Data::IsPenEnabled() )
       
  3505                                 {
       
  3506                                 parent = AknLayoutScalable_Avkon::area_top_pane( 2 );
       
  3507                                 }
       
  3508                             else
       
  3509                                 {
       
  3510                                 parent = AknLayoutScalable_Avkon::area_top_pane( 6 );
       
  3511                                 }
       
  3512                             line   = AknLayoutScalable_Avkon::status_pane( 1 ); // flat status pane
       
  3513                             break;
       
  3514                             }
       
  3515 
       
  3516                         case R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL:
       
  3517                         case R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE: // fallthrough
       
  3518                             {
       
  3519                             parent = AknLayoutScalable_Avkon::area_top_pane( 8 );
       
  3520                             line   = AknLayoutScalable_Avkon::status_pane( 1 );
       
  3521                             break;
       
  3522                             }
       
  3523 
       
  3524                         case R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT:
       
  3525                         case R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT: // fallthrough
       
  3526                             {
       
  3527                             parent = AknLayoutScalable_Avkon::area_top_pane( 19 );
       
  3528                             line   = AknLayoutScalable_Avkon::status_pane( 4 );
       
  3529                             break;
       
  3530                             }
       
  3531                             
       
  3532                         case R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS:
       
  3533                         case R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS: // fallthrough
       
  3534                             {
       
  3535                             parent = AknLayoutScalable_Avkon::area_top_pane( 20 );
       
  3536                             line   = AknLayoutScalable_Avkon::status_pane( 5 );
       
  3537                             break;
       
  3538                             }
       
  3539                         }
       
  3540                         
       
  3541                     rect.LayoutRect( screenRect, TAknWindowComponentLayout::Compose( parent, line ) );
       
  3542                     aRect = rect.Rect();
       
  3543                     }
       
  3544                 return ETrue;
  3545                 return ETrue;
  3545                 }
  3546                 }
  3546             return EFalse;
  3547 
  3547             }
  3548             return EFalse; // no status pane
       
  3549             }
       
  3550 
  3548         case EPopupParent:
  3551         case EPopupParent:
  3549             {
  3552             {
  3550             if ( screenRect.iBr.iX == 640 && screenRect.iBr.iY == 360 )
  3553             if ( screenRect.iBr.iX == 640 && screenRect.iBr.iY == 360 )
  3551                 {
  3554                 {
  3552                 TInt variety = 16;
  3555                 TInt variety = 16;
  3556                              R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS )
  3559                              R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS )
  3557                     {
  3560                     {
  3558                     variety = 25;
  3561                     variety = 25;
  3559                     }
  3562                     }
  3560 
  3563 
  3561                 rect.LayoutRect( screenRect, TAknWindowComponentLayout::Compose(
  3564                 rect.LayoutRect( screenRect,
  3562                                      AknLayoutScalable_Avkon::application_window( 0 ),
  3565                                  AknLayoutScalable_Avkon::main_pane( variety ) );
  3563                                      AknLayoutScalable_Avkon::main_pane( variety ) ) );
       
  3564                 aRect = rect.Rect();
  3566                 aRect = rect.Rect();
  3565                 return ETrue;
  3567                 return ETrue;
  3566                 }
  3568                 }
  3567             else if ( screenRect.iBr.iX == 360 && screenRect.iBr.iY == 640 )
  3569             else if ( screenRect.iBr.iX == 360 && screenRect.iBr.iY == 640 )
  3568                 {
  3570                 {
  3569                 TInt variety = 1;
  3571                 TInt variety = 1;
  3570                 rect.LayoutRect( screenRect, TAknWindowComponentLayout::Compose(
  3572                 rect.LayoutRect( screenRect,
  3571                                      AknLayoutScalable_Avkon::application_window( 0 ),
  3573                                  AknLayoutScalable_Avkon::main_pane( variety ) );
  3572                                      AknLayoutScalable_Avkon::main_pane( variety ) ) );
       
  3573                 aRect = rect.Rect();
  3574                 aRect = rect.Rect();
  3574                 return ETrue;
  3575                 return ETrue;
  3575                 }
  3576                 }
  3576             else
  3577             else
  3577                 {
  3578                 {
  3578                 return LayoutMetricsRect( EMainPane, aRect );
  3579                 return LayoutMetricsRect( EMainPane, aRect );
  3579                 }
  3580                 }
  3580             }
  3581             }
       
  3582 
  3581         case EMainPane:
  3583         case EMainPane:
  3582             {
  3584             {
  3583             TInt variety = 3; // classic main pane variety by default
  3585             TInt variety = 3; // classic main pane variety by default
  3584             
  3586             
  3585             TInt currentStatusPaneLayoutResId = AknStatuspaneUtils::CurrentStatusPaneLayoutResId();
  3587             TInt currentStatusPaneLayoutResId = AknStatuspaneUtils::CurrentStatusPaneLayoutResId();
  3624                 case R_AVKON_STATUS_PANE_LAYOUT_POWER_OFF_RECHARGE_MIRRORED:
  3626                 case R_AVKON_STATUS_PANE_LAYOUT_POWER_OFF_RECHARGE_MIRRORED:
  3625                 case R_AVKON_STATUS_PANE_LAYOUT_VT:
  3627                 case R_AVKON_STATUS_PANE_LAYOUT_VT:
  3626                 case R_AVKON_STATUS_PANE_LAYOUT_VT_MIRRORED:
  3628                 case R_AVKON_STATUS_PANE_LAYOUT_VT_MIRRORED:
  3627                 case R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT:
  3629                 case R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT:
  3628                     {
  3630                     {
  3629                     // main pane variety for usual portrait main pane with
  3631                     // Main pane variety for usual portrait main pane with
  3630                     // 'area_top_pane' and 'area_bottom_pane'
  3632                     // 'area_top_pane' and 'area_bottom_pane'.
  3631 #ifdef RD_SCALABLE_UI_V2
  3633                     variety = 3;
  3632                     variety = 3; 
  3634 
  3633                     if ( iAvkonAppUi && iAvkonAppUi->TouchPane() && iAvkonAppUi->TouchPane()->IsVisible() )
  3635                     if ( iAvkonAppUi )
  3634                         {
  3636                         {
  3635                         variety = 15;
  3637                         CAknToolbar* toolbar = iAvkonAppUi->CurrentFixedToolbar(); 
  3636                         }
  3638                         if ( toolbar )
  3637                     else if ( iAvkonAppUi && iAvkonAppUi->CurrentFixedToolbar() )
  3639                             {
  3638                         {
  3640                             TInt flags = toolbar->ToolbarFlags(); 
  3639                         if ( AknLayoutUtils::PenEnabled() )
  3641                             if ( flags & KAknToolbarFixed &&
  3640                              {
  3642                                  !( flags & KAknToolbarDefault ) &&
  3641                              CAknToolbar* toolbar = iAvkonAppUi->CurrentFixedToolbar(); 
  3643                                  toolbar->IsShown() ) 
  3642                              TInt flags = toolbar->ToolbarFlags(); 
       
  3643                              if ( flags & KAknToolbarFixed && !( flags & KAknToolbarDefault )
       
  3644                                 && toolbar->IsShown() ) 
       
  3645                                  {
  3644                                  {
  3646                                  variety = 18; 
  3645                                  variety = 18; 
  3647                                  }
  3646                                  }
  3648                              }
  3647                             }
  3649                         }
  3648                         }
  3650 #else
       
  3651                     variety = 3;
       
  3652 #endif // RD_SCALABLE_UI_V2    
       
  3653                     }
  3649                     }
  3654                     break;
  3650                     break;
  3655 
  3651 
  3656                 case R_AVKON_STATUS_PANE_LAYOUT_IDLE:
  3652                 case R_AVKON_STATUS_PANE_LAYOUT_IDLE:
  3657                 case R_AVKON_STATUS_PANE_LAYOUT_IDLE_MIRRORED:
  3653                 case R_AVKON_STATUS_PANE_LAYOUT_IDLE_MIRRORED:
  3665                 case R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT:
  3661                 case R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT:
  3666                 case R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT:
  3662                 case R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT:
  3667                     {                    
  3663                     {                    
  3668                     if ( Layout_Meta_Data::IsLandscapeOrientation() )
  3664                     if ( Layout_Meta_Data::IsLandscapeOrientation() )
  3669                         {
  3665                         {
  3670                         if ( PenEnabled() )
  3666                         // main pane variety with 'area_top_pane' and
  3671                             {
  3667                         // 'area_bottom_pane' in landscape (without touch pane).
  3672                             // This is quite awkward but necessary since the fixed
  3668                         variety = 9;
  3673                             // toolbar area can be used by the application main pane
       
  3674                             // if the application doesn't use toolbar.
       
  3675                             TBool toolbarVisible( EFalse );
       
  3676                             if ( iAvkonAppUi )
       
  3677                                 {
       
  3678                                 CAknToolbar* fixedToolbar =
       
  3679                                     iAvkonAppUi->CurrentFixedToolbar();
       
  3680                                 if ( fixedToolbar )
       
  3681                                     {
       
  3682                                     TInt toolbarFlags(  fixedToolbar->ToolbarFlags() );
       
  3683                                     if ( toolbarFlags & KAknToolbarFixed &&
       
  3684                                          !( toolbarFlags & KAknToolbarDefault ) &&
       
  3685                                          fixedToolbar->IsShown()  )
       
  3686                                         {
       
  3687                                         toolbarVisible = ETrue;
       
  3688                                         }
       
  3689                                     }
       
  3690                                 }
       
  3691 
       
  3692                             variety = toolbarVisible ? 21 : 4;
       
  3693                             }
       
  3694                         else
       
  3695                             {
       
  3696                             // main pane variety with 'area_top_pane' and 
       
  3697                             // 'area_bottom_pane' in landscape (without touch pane).
       
  3698                             variety = 9;             
       
  3699                             }                    
       
  3700                         }
  3669                         }
  3701                     else
  3670                     else
  3702                         {
  3671                         {
  3703                         // main pane variety with thin portrait status pane 
  3672                         // main pane variety with thin portrait status pane 
  3704                         variety = 7;
  3673                         variety = 7;
  3709                 case R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE:
  3678                 case R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE:
  3710                 case R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE_MIRRORED:
  3679                 case R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE_MIRRORED:
  3711                     {
  3680                     {
  3712                     if ( Layout_Meta_Data::IsLandscapeOrientation() )
  3681                     if ( Layout_Meta_Data::IsLandscapeOrientation() )
  3713                         {
  3682                         {
  3714                         if ( PenEnabled() )
  3683                         // main pane variety with small status pane in landscape
  3715                             {
  3684                         // mode with 'area_top_pane', 'area_bottom_pane' and
  3716                             // main pane variety with small status pane in landscape
  3685                         // touch pane
  3717                             // mode with 'area_top_pane', 'area_bottom_pane' and
  3686                         variety = 4;
  3718                             // touch pane
       
  3719                             variety = 4;
       
  3720                             }
       
  3721                         else
       
  3722                             {
       
  3723                             // main pane variety with 'area_top_pane' and
       
  3724                             // 'area_bottom_pane' in landscape (without touch pane)
       
  3725                             variety = 9;
       
  3726                             }
       
  3727                         }
  3687                         }
  3728                     else
  3688                     else
  3729                         {
  3689                         {
  3730                         // main pane variety with small status pane in portrait mode
  3690                         // main pane variety with small status pane in portrait mode
  3731                         // (with 'area_top_pane' and 'area_bottom_pane').
  3691                         // (with 'area_top_pane' and 'area_bottom_pane').
  3732                         variety = 6;                    
  3692                         variety = 6;                    
  3733                         }
  3693                         }
       
  3694 
       
  3695                     break;
  3734                     }
  3696                     }
  3735                     break;
       
  3736 
  3697 
  3737                 case R_AVKON_STATUS_PANE_EMPTY:
  3698                 case R_AVKON_STATUS_PANE_EMPTY:
  3738                 case R_AVKON_STATUS_PANE_LAYOUT_EMPTY:
  3699                 case R_AVKON_STATUS_PANE_LAYOUT_EMPTY:
  3739                     if ( AknStatuspaneUtils::HDLayoutActive() )
  3700                     if ( AknStatuspaneUtils::HDLayoutActive() )
  3740                         {
  3701                         {
  3759                 case R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT:
  3720                 case R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT:
  3760                 case R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT:
  3721                 case R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT:
  3761                     {
  3722                     {
  3762                     if ( Layout_Meta_Data::IsLandscapeOrientation() )
  3723                     if ( Layout_Meta_Data::IsLandscapeOrientation() )
  3763                         {
  3724                         {
  3764                         variety = 21;
  3725                         // This is quite awkward but necessary since the fixed
       
  3726                         // toolbar area can be used by the application main pane
       
  3727                         // if the application doesn't use toolbar.
       
  3728                         TBool toolbarVisible( EFalse );
       
  3729                         if ( iAvkonAppUi )
       
  3730                             {
       
  3731                             CAknToolbar* fixedToolbar =
       
  3732                                 iAvkonAppUi->CurrentFixedToolbar();
       
  3733                             if ( fixedToolbar )
       
  3734                                 {
       
  3735                                 TInt toolbarFlags( fixedToolbar->ToolbarFlags() );
       
  3736                                 if ( toolbarFlags & KAknToolbarFixed &&
       
  3737                                      !( toolbarFlags & KAknToolbarDefault ) &&
       
  3738                                      fixedToolbar->IsShown()  )
       
  3739                                     {
       
  3740                                     toolbarVisible = ETrue;
       
  3741                                     }
       
  3742                                 }
       
  3743                             }
       
  3744 
       
  3745                         variety = toolbarVisible ? 21 : 4;
  3765                         }
  3746                         }
  3766                     break;
  3747                     break;
  3767                     }
  3748                     }
  3768 
  3749 
  3769                 case R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS:
  3750                 case R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS:
  3786                     
  3767                     
  3787                 default:
  3768                 default:
  3788                     break;
  3769                     break;
  3789                 }
  3770                 }
  3790 
  3771 
  3791             rect.LayoutRect( screenRect, TAknWindowComponentLayout::Compose(
  3772             // Application window is always the same as screen, so use screen
  3792                                      AknLayoutScalable_Avkon::application_window( 0 ),
  3773             // as parent and skip reading the application_window from layout
  3793                                      AknLayoutScalable_Avkon::main_pane( variety ) ) );
  3774             // data for performance improvement.
       
  3775             rect.LayoutRect( screenRect,
       
  3776                              AknLayoutScalable_Avkon::main_pane( variety ) );
  3794                 
  3777                 
  3795             aRect = rect.Rect();
  3778             aRect = rect.Rect();
  3796             return ETrue;
  3779             return ETrue;
  3797             }
  3780             }
  3798 
  3781 
  4840 
  4823 
  4841 EXPORT_C void AknDrawWithSkins::DrawEmptyListForSettingPage(const TRect &aRect, CWindowGc &aGc, TPtrC text, CCoeControl *aControl)
  4824 EXPORT_C void AknDrawWithSkins::DrawEmptyListForSettingPage(const TRect &aRect, CWindowGc &aGc, TPtrC text, CCoeControl *aControl)
  4842     {
  4825     {
  4843     if ( aControl && aControl->FindBackground() )
  4826     if ( aControl && aControl->FindBackground() )
  4844         {        
  4827         {        
  4845 		DrawEmptyListImpl_real(  aRect, aGc, text, NULL, ETrue);        
  4828         DrawEmptyListImpl_real(  aRect, aGc, text, NULL, ETrue);        
  4846         return;
  4829         return;
  4847         }
  4830         }
  4848 
  4831 
  4849     DrawEmptyListImpl_real( aRect, aGc, text, aControl, ETrue);
  4832     DrawEmptyListImpl_real( aRect, aGc, text, aControl, ETrue);
  4850     }
  4833     }
  5315             aText, *wrapWidthArray, *font, buffer, ETrue );
  5298             aText, *wrapWidthArray, *font, buffer, ETrue );
  5316 
  5299 
  5317         CleanupStack::PopAndDestroy(); // wrapWidthArray
  5300         CleanupStack::PopAndDestroy(); // wrapWidthArray
  5318         } ); // TRAP end
  5301         } ); // TRAP end
  5319 
  5302 
  5320     // there is no layout for empty popuplist
  5303     if ( error == KErrNone )
  5321     if ( error != KErrNone || popupList )
  5304         {
       
  5305         n = 0;
       
  5306         for ( i = 0; i < buffer.Length(); i++ )
       
  5307             {
       
  5308             if ( buffer[i] == '\n' )
       
  5309                 {
       
  5310                 n++;
       
  5311                 }
       
  5312             }        
       
  5313         }
       
  5314     
       
  5315     // There is no layout for empty popuplist
       
  5316     // The second layout that 2 lines with big font is used for two lines text.
       
  5317     if ( n < 3 || error != KErrNone || popupList )
  5322         {
  5318         {
  5323         DrawEmptyListImpl_real_DrawUpToTwoLines( aGc, aText, line1, line2,
  5319         DrawEmptyListImpl_real_DrawUpToTwoLines( aGc, aText, line1, line2,
  5324                                                  line1length, line2length,
  5320                                                  line1length, line2length,
  5325                                                  font, color, buffer,
  5321                                                  font, color, buffer,
  5326                                                  popupList, parentRect, aSettingPageList );
  5322                                                  popupList, parentRect, aSettingPageList );
  6545     TRect screen( layoutRect.Rect() );
  6541     TRect screen( layoutRect.Rect() );
  6546     
  6542     
  6547     TInt x = ( screen.Width() - aSize.iWidth ) >> 1;
  6543     TInt x = ( screen.Width() - aSize.iWidth ) >> 1;
  6548     TInt y = screen.Height() - aSize.iHeight;
  6544     TInt y = screen.Height() - aSize.iHeight;
  6549 
  6545 
  6550     // Popups are centered on y-axis if screen orientation is landscape or
  6546     if ( Layout_Meta_Data::IsLandscapeOrientation() )
  6551     // softkeys are not visible.
  6547         {
  6552     if ( !aSoftkeysVisible || Layout_Meta_Data::IsLandscapeOrientation() )
  6548         // popups are centered on y-axis on landscape orientation
  6553         {
  6549         y >>= 1;
  6554         y >>= 1; 
  6550         }
       
  6551     else
       
  6552         {
       
  6553         // On portrait popup is located on top of the control pane if it doesn't
       
  6554         // have softkeys visible and there's enough room i.e. the popup still
       
  6555         // fits to the screen.
       
  6556         if ( !aSoftkeysVisible )
       
  6557             {
       
  6558             TSize controlPane;
       
  6559             AknLayoutUtils::LayoutMetricsSize( AknLayoutUtils::EControlPane,
       
  6560                     controlPane );
       
  6561             y -= controlPane.iHeight;
       
  6562             
       
  6563             if ( y < 0 )
       
  6564                 {
       
  6565                 y = 0;
       
  6566                 }
       
  6567             }
  6555         }
  6568         }
  6556 
  6569 
  6557     return TPoint( x, y );
  6570     return TPoint( x, y );
  6558     }
  6571     }
  6559 
  6572 
  6577             }
  6590             }
  6578         }
  6591         }
  6579     
  6592     
  6580     return Position( aSize, softkeys );
  6593     return Position( aSize, softkeys );
  6581     }
  6594     }
  6582     
  6595 
       
  6596 
       
  6597 // -----------------------------------------------------------------------------
       
  6598 // Draws the separator line between list items.
       
  6599 // -----------------------------------------------------------------------------
       
  6600 //
       
  6601 EXPORT_C void AknListUtils::DrawSeparator( CGraphicsContext& aGc, 
       
  6602                                            const TRect& aRect,
       
  6603                                            const TRgb& aColor,
       
  6604                                            MAknsSkinInstance* aSkin )
       
  6605     {
       
  6606     aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
       
  6607     aGc.SetPenStyle( CGraphicsContext::ESolidPen );
       
  6608     TRgb color( aColor );
       
  6609     
       
  6610     // Get the alpha value from skin.
       
  6611     TRgb colorFromSkin;
       
  6612     TInt err = AknsUtils::GetCachedColor( aSkin ? aSkin : AknsUtils::SkinInstance(),
       
  6613                                           colorFromSkin,
       
  6614                                           KAknsIIDQsnLineColors,
       
  6615                                           EAknsCIQsnLineColorsCG15 );
       
  6616     
       
  6617     color.SetAlpha( !err ? colorFromSkin.Red() : KDefaultSeparatorAlpha );
       
  6618     aGc.SetPenColor( color );
       
  6619     aGc.SetDrawMode( CGraphicsContext::EDrawModePEN );
       
  6620     TRect lineRect( aRect );
       
  6621     
       
  6622     TInt gap = AknLayoutScalable_Avkon::listscroll_gen_pane( 0 ).LayoutLine().it; 
       
  6623     lineRect.Shrink( gap, 0 );
       
  6624     lineRect.Move( 0, -1 );
       
  6625     aGc.DrawLine( TPoint( lineRect.iTl.iX, lineRect.iBr.iY ), 
       
  6626                   TPoint( lineRect.iBr.iX, lineRect.iBr.iY ) );
       
  6627     }
       
  6628 
  6583 // End of file
  6629 // End of file
  6584 
  6630