528 } |
528 } |
529 AknLayoutUtils::LayoutControl(aListBox, aParentControl->Rect(), aListAreaResourceId); |
529 AknLayoutUtils::LayoutControl(aListBox, aParentControl->Rect(), aListAreaResourceId); |
530 _AKNDEBUG( |
530 _AKNDEBUG( |
531 if ( aListBox ) |
531 if ( aListBox ) |
532 { |
532 { |
533 _AKNTRACE( "[%s][%s] ListBox Rect iTl: %d,%d; iBr: %d,%d", |
533 _AKNTRACE( "[%s][%s] ListBox Rect iTl: %d,%d; iBr: %d,%d", |
534 "AknFind", __FUNCTION__, |
534 "AknFind", __FUNCTION__, |
535 aParentControl->Rect().iTl.iX, aParentControl->Rect().iTl.iY, |
535 aParentControl->Rect().iTl.iX, aParentControl->Rect().iTl.iY, |
536 aParentControl->Rect().iBr.iX, aParentControl->Rect().iBr.iY |
536 aParentControl->Rect().iBr.iX, aParentControl->Rect().iBr.iY |
537 ); |
537 ); |
538 } |
538 } |
539 ); |
539 ); |
540 _AKNTRACE_FUNC_EXIT; |
540 _AKNTRACE_FUNC_EXIT; |
541 } |
541 } |
542 |
542 |
619 ); |
619 ); |
620 } |
620 } |
621 |
621 |
622 AknLayoutUtils::LayoutControl(aListBox, aParentControl->Rect(), tempListArea); |
622 AknLayoutUtils::LayoutControl(aListBox, aParentControl->Rect(), tempListArea); |
623 _AKNDEBUG( |
623 _AKNDEBUG( |
624 if ( aListBox ) |
624 if ( aListBox ) |
625 { |
625 { |
626 _AKNTRACE( "[%s][%s] ListBox Rect iTl: %d,%d; iBr: %d,%d", |
626 _AKNTRACE( "[%s][%s] ListBox Rect iTl: %d,%d; iBr: %d,%d", |
627 "AknFind", __FUNCTION__, |
627 "AknFind", __FUNCTION__, |
628 aListBox->Rect().iTl.iX, aListBox->Rect().iTl.iY, |
628 aListBox->Rect().iTl.iX, aListBox->Rect().iTl.iY, |
629 aListBox->Rect().iBr.iX, aListBox->Rect().iBr.iY |
629 aListBox->Rect().iBr.iX, aListBox->Rect().iBr.iY |
630 ); |
630 ); |
631 } |
631 } |
632 ); |
632 ); |
633 if ( aListBox ) |
633 if ( aListBox ) |
634 { |
634 { |
635 aListBox->DrawNow(); |
635 aListBox->DrawNow(); |
636 } |
636 } |
637 _AKNTRACE_FUNC_EXIT; |
637 _AKNTRACE_FUNC_EXIT; |
777 // Checks the current character for special character from Thai language . |
777 // Checks the current character for special character from Thai language . |
778 // --------------------------------------------------------------------------- |
778 // --------------------------------------------------------------------------- |
779 inline TBool IsThaiSpecialCharacter( TChar aCh ) |
779 inline TBool IsThaiSpecialCharacter( TChar aCh ) |
780 { |
780 { |
781 if( ( aCh > 0xE46 && aCh < 0xE4F ) || aCh == 0xE3A ) |
781 if( ( aCh > 0xE46 && aCh < 0xE4F ) || aCh == 0xE3A ) |
782 { |
782 { |
783 return ETrue; |
783 return ETrue; |
784 } |
784 } |
785 return EFalse; |
785 return EFalse; |
786 } |
786 } |
787 |
787 |
788 // --------------------------------------------------------------------------- |
788 // --------------------------------------------------------------------------- |
789 // IsAdaptiveFindMatch |
789 // IsAdaptiveFindMatch |
790 // --------------------------------------------------------------------------- |
790 // --------------------------------------------------------------------------- |
791 // |
791 // |
792 EXPORT_C TBool AknFind::IsAdaptiveFindMatch( const TDesC& aItemText, |
792 EXPORT_C TBool AknFind::IsAdaptiveFindMatch( const TDesC& aItemText, |
793 const TDesC& aSearchText, |
793 const TDesC& aSearchText, |
794 HBufC*& aNextChars ) |
794 HBufC*& aNextChars ) |
795 { |
795 { |
796 HBufC16* searchText( NULL ); |
796 HBufC16* searchText( NULL ); |
797 TRAPD( error, searchText = HBufC16::NewL( KMatchingBufferLength ) ); |
797 TRAPD( error, searchText = HBufC16::NewL( KMatchingBufferLength ) ); |
798 if ( error == KErrNone ) |
798 if ( error == KErrNone ) |
799 { |
799 { |
800 TInt itemStringLength = aItemText.Length(); |
800 TInt itemStringLength = aItemText.Length(); |
801 TInt searchTextLength = aSearchText.Length(); |
801 TInt searchTextLength = aSearchText.Length(); |
802 |
802 |
803 if ( searchTextLength < KMatchingBufferLength ) |
803 if ( searchTextLength < KMatchingBufferLength ) |
804 { |
804 { |
805 searchText->Des().Append( aSearchText ); |
805 searchText->Des().Append( aSearchText ); |
806 } |
806 } |
807 else |
807 else |
808 { |
808 { |
809 searchText->Des().Append( aSearchText.Left(KMatchingBufferLength-1) ); |
809 searchText->Des().Append( aSearchText.Left(KMatchingBufferLength-1) ); |
810 } |
810 } |
811 |
811 |
812 searchText->Des().Append( KLitStar ); |
812 searchText->Des().Append( KLitStar ); |
813 |
813 |
814 TInt all_result = KErrNotFound; |
814 TInt all_result = KErrNotFound; |
815 for( TInt i = 0; i < itemStringLength; i++ ) |
815 for( TInt i = 0; i < itemStringLength; i++ ) |
816 { |
816 { |
819 TInt result = aItemText.Mid(i).MatchC( searchText->Des() ); |
819 TInt result = aItemText.Mid(i).MatchC( searchText->Des() ); |
820 |
820 |
821 if( result != KErrNotFound ) |
821 if( result != KErrNotFound ) |
822 { |
822 { |
823 all_result = result; |
823 all_result = result; |
824 if( i < (itemStringLength-searchTextLength) ) |
824 if( i < (itemStringLength-searchTextLength) ) |
825 { |
825 { |
826 if( !(IsThaiSpecialCharacter(aItemText[i+searchTextLength])) && !(IsVietnameseSpecialCharacter( aItemText[i+searchTextLength]) )) |
826 if( !(IsThaiSpecialCharacter(aItemText[i+searchTextLength])) && !(IsVietnameseSpecialCharacter( aItemText[i+searchTextLength]) )) |
827 { |
827 { |
828 TRAP_IGNORE( UpdateNextCharsL( aNextChars, aItemText[i+searchTextLength]) ); |
828 TRAP_IGNORE( UpdateNextCharsL( aNextChars, aItemText[i+searchTextLength]) ); |
829 } |
829 } |
830 } |
830 } |
831 } |
831 } |
832 } // if (i==0 ..) |
832 } // if (i==0 ..) |
833 } // for |
833 } // for |
834 |
834 |
835 if( all_result != KErrNotFound ) |
835 if( all_result != KErrNotFound ) |
836 { |
836 { |
837 delete searchText; |
837 delete searchText; |
838 return ETrue; |
838 return ETrue; |
839 } |
839 } |
840 else |
840 else |
841 { |
841 { |
842 delete searchText; |
842 delete searchText; |
843 return EFalse; |
843 return EFalse; |
844 } |
844 } |
845 |
845 |
846 } // if (error == KErrNone) |
846 } // if (error == KErrNone) |
847 |
847 |
848 delete searchText; |
848 delete searchText; |
849 return EFalse; |
849 return EFalse; |
850 } |
850 } |
851 |
851 |
852 |
852 |
853 /** |
853 /** |
854 * For Devanagari AS |
854 * For Devanagari AS |
855 * Checks if the passed string denotes one of the four special |
855 * Checks if the passed string denotes one of the four special |
856 * Devanagari ligatures - refer UI specs for the description of special ligatures |
856 * Devanagari ligatures - refer UI specs for the description of special ligatures |
976 inline TBool IsIndicHalantChar(const TChar aCh) |
976 inline TBool IsIndicHalantChar(const TChar aCh) |
977 { |
977 { |
978 return ( aCh == 0x094D ); |
978 return ( aCh == 0x094D ); |
979 } |
979 } |
980 |
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 |
981 // --------------------------------------------------------------------------- |
1018 // --------------------------------------------------------------------------- |
982 // For Devanagari AS |
1019 // For Devanagari AS |
983 // AknFind::UpdateNextCharsL |
1020 // AknFind::UpdateNextCharsL |
984 // --------------------------------------------------------------------------- |
1021 // --------------------------------------------------------------------------- |
985 // |
1022 // |
986 void AknFind::UpdateNextCharsL( HBufC*& aNextChars, const TDesC& aItemString ) |
1023 void AknFind::UpdateNextCharsL( HBufC*& aNextChars, const TDesC& aItemString ) |
987 { |
1024 { |
988 _AKNTRACE_FUNC_ENTER; |
1025 _AKNTRACE_FUNC_ENTER; |
989 TChar searchChar = aItemString[0]; |
1026 TChar searchChar = aItemString[0]; |
990 //Check if this is an Indic special ligature |
1027 //Check if this is an Indic special ligature |
991 if ( IsIndicConsonant(searchChar) && aItemString.Length() > 2 |
1028 if ( IsIndicConsonant(searchChar) && aItemString.Length() > 2 |
992 && IsSpecialIndicLigature(aItemString) |
1029 && IsSpecialIndicLigature(aItemString) |
993 && KErrNotFound == (*aNextChars).Find(aItemString.Mid(0,3)) ) |
1030 && KErrNotFound == (*aNextChars).Find(aItemString.Mid(0,3)) ) |
994 { |
1031 { |
995 //Check if we have enough space for 3 more characters |
1032 //Check if we have enough space for 3 more characters |
996 if( aNextChars->Des().Length() >= aNextChars->Des().MaxLength()-3 ) |
1033 if( aNextChars->Des().Length() >= aNextChars->Des().MaxLength()-3 ) |
997 { |
1034 { |
998 aNextChars = aNextChars->ReAllocL( aNextChars->Des().MaxLength()+10 ); |
1035 aNextChars = aNextChars->ReAllocL( aNextChars->Des().MaxLength()+10 ); |
999 TInt length1 = aNextChars->Des().Length(); |
1036 TInt length1 = aNextChars->Des().Length(); |
1000 TInt maxlength1 = aNextChars->Des().MaxLength(); |
1037 TInt maxlength1 = aNextChars->Des().MaxLength(); |
1001 } |
1038 } |
1002 aNextChars->Des().Append( aItemString.Mid(0,3) ); |
1039 aNextChars->Des().Append( aItemString.Mid(0,3) ); |
1003 } |
1040 } |
1004 else |
1041 else |
1005 { |
1042 { |
1006 if ( !IsValidCharForASGrid(searchChar) ) |
1043 if ( !IsValidCharForASGrid(searchChar) ) |
1007 { |
1044 { |
1008 return; |
1045 return; |
1009 } |
1046 } |
1010 //check if this is an Indic combined Char |
1047 //check if this is an Indic combined Char |
1011 if ( IsIndicCombinedChar(searchChar) ) |
1048 if ( IsIndicCombinedChar(searchChar) ) |
1012 { |
1049 { |
1013 searchChar = RemoveIndicNukta( searchChar ); |
1050 searchChar = RemoveIndicNukta( searchChar ); |
1014 } |
1051 } |
1015 //Now update the nextChars string |
1052 //Now update the nextChars string |
1016 TInt strLength = aNextChars->Length(); |
1053 TInt strLength = aNextChars->Length(); |
1017 for ( TInt i(0); i < strLength ; ++i ) |
1054 for ( TInt i(0); i < strLength ; ++i ) |
1018 { |
1055 { |
1019 if ( IsSpecialIndicLigature( (*aNextChars).Mid(i) ) ) |
1056 if ( IsSpecialIndicLigature( (*aNextChars).Mid(i) ) ) |
1020 { |
1057 { |
1035 if( aNextChars->Des().Length() == aNextChars->Des().MaxLength() ) |
1072 if( aNextChars->Des().Length() == aNextChars->Des().MaxLength() ) |
1036 { |
1073 { |
1037 aNextChars = aNextChars->ReAllocL( aNextChars->Des().MaxLength()+10 ); |
1074 aNextChars = aNextChars->ReAllocL( aNextChars->Des().MaxLength()+10 ); |
1038 } |
1075 } |
1039 aNextChars->Des().Append( searchChar ); |
1076 aNextChars->Des().Append( searchChar ); |
1040 } |
1077 } |
1041 _AKNTRACE_FUNC_EXIT; |
1078 _AKNTRACE_FUNC_EXIT; |
1042 } |
1079 } |
1043 |
1080 |
1044 // ----------------------------------------------------------------------------- |
1081 // ----------------------------------------------------------------------------- |
1045 // AknFind::UpdateNextCharsL |
1082 // AknFind::UpdateNextCharsL |
1046 // (other items were commented in a header). |
1083 // (other items were commented in a header). |
1047 // ----------------------------------------------------------------------------- |
1084 // ----------------------------------------------------------------------------- |
1066 // --------------------------------------------------------------------------- |
1103 // --------------------------------------------------------------------------- |
1067 // UpdateNextCharsFromString |
1104 // UpdateNextCharsFromString |
1068 // --------------------------------------------------------------------------- |
1105 // --------------------------------------------------------------------------- |
1069 // |
1106 // |
1070 EXPORT_C void AknFind::UpdateNextCharsFromString( HBufC*& aNextChars, const TDesC& aItemString ) |
1107 EXPORT_C void AknFind::UpdateNextCharsFromString( HBufC*& aNextChars, const TDesC& aItemString ) |
1071 { |
1108 { |
1072 TInt itemStringLength = aItemString.Length(); |
1109 TInt itemStringLength = aItemString.Length(); |
1073 |
1110 |
1074 for( TInt i = 0; i < itemStringLength; i++ ) |
1111 for( TInt i = 0; i < itemStringLength; i++ ) |
1075 { |
1112 { |
1076 if ( i == 0 || IsFindWordSeparator( aItemString[i-1] ) ) |
1113 if ( i == 0 || IsFindWordSeparator( aItemString[i-1] ) ) |
1077 { |
1114 { |
1078 // If Indic letter |
1115 // If Indic letter |
1079 if ( aItemString[i] >= 0x0900 && aItemString[i] <= 0x0980 ) |
1116 if ( aItemString[i] >= 0x0900 && aItemString[i] <= 0x0980 ) |
1080 { |
1117 { |
1081 TRAP_IGNORE( UpdateNextCharsL( aNextChars, aItemString.Mid(i) ) ); |
1118 TRAP_IGNORE( UpdateNextCharsL( aNextChars, aItemString.Mid(i) ) ); |
1082 } |
1119 } |
1083 else if (!(IsVietnameseSpecialCharacter( aItemString[i]))) |
1120 else if (!(IsVietnameseSpecialCharacter( aItemString[i]))) |
1084 { |
1121 { |
1085 TRAP_IGNORE( UpdateNextCharsL( aNextChars, aItemString[i] ) ); |
1122 TRAP_IGNORE( UpdateNextCharsL( aNextChars, aItemString[i] ) ); |
1086 } |
1123 } |
1087 } |
1124 } |
1088 } |
1125 } |
1089 } |
1126 } |
1090 |
1127 |
1091 // --------------------------------------------------------------------------- |
1128 // --------------------------------------------------------------------------- |
1092 // UpdateItemTextAccordingToFlag |
1129 // UpdateItemTextAccordingToFlag |
1093 // --------------------------------------------------------------------------- |
1130 // --------------------------------------------------------------------------- |
1094 // |
1131 // |
1818 ptr_temptext.Zero(); |
1858 ptr_temptext.Zero(); |
1819 } |
1859 } |
1820 if( aUpdateAS ) |
1860 if( aUpdateAS ) |
1821 { |
1861 { |
1822 TPtr nextChars = iExtension->iNextChars->Des(); |
1862 TPtr nextChars = iExtension->iNextChars->Des(); |
1823 CDesCArray* array = new (ELeave) CDesCArrayFlat(10); |
1863 SortCharsForAdaptiveSearchL( nextChars ); |
1824 CleanupStack::PushL(array); |
|
1825 |
|
1826 TInt length = nextChars.Length(); |
|
1827 TInt count(0); |
|
1828 |
|
1829 for( TInt i = 0; i < length; i++ ) |
|
1830 { |
|
1831 if ( (i < length-2) && IsIndicHalantChar( nextChars[i+1] ) ) |
|
1832 { |
|
1833 array->AppendL( nextChars.Mid(i,3) ); |
|
1834 i+=2; |
|
1835 ++count; |
|
1836 } |
|
1837 else |
|
1838 { |
|
1839 array->AppendL( nextChars.Mid(i,1) ); |
|
1840 ++count; |
|
1841 } |
|
1842 } |
|
1843 |
|
1844 // Alphabetical sort |
|
1845 array->Sort( ECmpCollated ); |
|
1846 nextChars.Delete( 0, nextChars.Length() ); |
|
1847 |
|
1848 for( TInt i = 0; i < count; i++ ) |
|
1849 { |
|
1850 nextChars.Append(array->MdcaPoint(i)); |
|
1851 } |
|
1852 CleanupStack::PopAndDestroy(array); |
|
1853 |
1864 |
1854 iSearchField->SetAdaptiveGridChars( *(iExtension->iNextChars) ); |
1865 iSearchField->SetAdaptiveGridChars( *(iExtension->iNextChars) ); |
1855 } |
1866 } |
1856 CleanupStack::PopAndDestroy( temptext ); |
1867 CleanupStack::PopAndDestroy( temptext ); |
1857 } |
1868 } |
1911 } |
1922 } |
1912 ptr_temptext.Zero(); |
1923 ptr_temptext.Zero(); |
1913 } |
1924 } |
1914 |
1925 |
1915 TPtr nextChars = iExtension->iNextChars->Des(); |
1926 TPtr nextChars = iExtension->iNextChars->Des(); |
1916 CDesCArray* array = new (ELeave) CDesCArrayFlat(10); |
1927 SortCharsForAdaptiveSearchL( nextChars ); |
1917 CleanupStack::PushL(array); |
|
1918 |
|
1919 TInt length = nextChars.Length(); |
|
1920 TInt count(0); |
|
1921 |
|
1922 for( TInt i = 0; i < length; i++ ) |
|
1923 { |
|
1924 if ( (i < length-2) && IsIndicHalantChar( nextChars[i+1] ) ) |
|
1925 { |
|
1926 array->AppendL( nextChars.Mid(i,3) ); |
|
1927 i+=2; |
|
1928 ++count; |
|
1929 } |
|
1930 else |
|
1931 { |
|
1932 array->AppendL( nextChars.Mid(i,1) ); |
|
1933 ++count; |
|
1934 } |
|
1935 } |
|
1936 |
|
1937 // Alphabetical sort |
|
1938 array->Sort( ECmpCollated ); |
|
1939 nextChars.Delete( 0, nextChars.Length() ); |
|
1940 |
|
1941 for( TInt i = 0; i < count; i++ ) |
|
1942 { |
|
1943 nextChars.Append(array->MdcaPoint(i)); |
|
1944 } |
|
1945 CleanupStack::PopAndDestroy(array); |
|
1946 |
1928 |
1947 iSearchField->SetAdaptiveGridChars( *(iExtension->iNextChars) ); |
1929 iSearchField->SetAdaptiveGridChars( *(iExtension->iNextChars) ); |
1948 CleanupStack::PopAndDestroy( temptext ); |
1930 CleanupStack::PopAndDestroy( temptext ); |
1949 } |
1931 } |
1950 else |
1932 else |
4836 |
4823 |
4837 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) |
4838 { |
4825 { |
4839 if ( aControl && aControl->FindBackground() ) |
4826 if ( aControl && aControl->FindBackground() ) |
4840 { |
4827 { |
4841 DrawEmptyListImpl_real( aRect, aGc, text, NULL, ETrue); |
4828 DrawEmptyListImpl_real( aRect, aGc, text, NULL, ETrue); |
4842 return; |
4829 return; |
4843 } |
4830 } |
4844 |
4831 |
4845 DrawEmptyListImpl_real( aRect, aGc, text, aControl, ETrue); |
4832 DrawEmptyListImpl_real( aRect, aGc, text, aControl, ETrue); |
4846 } |
4833 } |