--- a/commonuis/CommonUi/src/ItemFinder.cpp Wed Sep 01 12:16:19 2010 +0100
+++ b/commonuis/CommonUi/src/ItemFinder.cpp Tue Sep 14 21:48:24 2010 +0300
@@ -38,6 +38,7 @@
#include <centralrepository.h>
#include <CommonUiInternalCRKeys.h>
+#include <AknSmileyUtils.h>
// CONSTANTS
const TInt KMINTAGLENGTH(5);
@@ -143,7 +144,38 @@
void CItemFinderAsyncParser::RunL()
{
TInt fullLength = Min( iEditor->TextLength(), 0xffff );
- const TDesC& text = iEditor->Text()->Read( 0, fullLength );
+ if ( fullLength <= 0 )
+ {
+ return;
+ }
+ // If editor enables smiley feature, then smiley string shouldn't be included
+ // in the search string. Normally a smiley string comprises 3 parts: a smiley code,
+ // a smiley compensating character to expand smiley icon area, and several invisible
+ // smiley placeholder characters if the length of the smiley string is longer than 2
+ // characters. Since smiley codes are in reserved Unicode range and smiley placeholder
+ // is 0xfff0, they won't be counted in search string, but the compensating character
+ // is a valid english character so it needs to be replaced with smiley placeholder
+ // otherwise it will mess the search string.
+ HBufC* textBuf( iEditor->Text()->Read( 0, fullLength ).Alloc() );
+ if( !textBuf )
+ {
+ return;
+ }
+ CleanupStack::PushL( textBuf );
+ TPtr text( textBuf->Des() );
+ for ( TInt i( 0 ); i < fullLength; i++ )
+ {
+ // Check if current character is a smiley code, if so, the character
+ // following the code is a smiley compensating character and it needs to
+ // be replaced.
+ if ( text[i] >= CAknSmileyManager::KSmileyCodeMin &&
+ text[i] <= CAknSmileyManager::KSmileyCodeMax &&
+ ( i + 1 < fullLength ) )
+ {
+ i++;
+ text[i] = CAknSmileyManager::KPlaceHolder;
+ }
+ }
TInt searchAll = CFindItemEngine::EFindItemSearchURLBin
|CFindItemEngine::EFindItemSearchMailAddressBin
|CFindItemEngine::EFindItemSearchPhoneNumberBin
@@ -156,6 +188,7 @@
{
iFIE->DoNewSearchL( text, (CFindItemEngine::TFindItemSearchCase)searchAll, iMinDigitsToFind );
}
+ CleanupStack::PopAndDestroy( textBuf );
delete iMarkedItems;
iMarkedItems = 0;
iMarkedItems = new ( ELeave ) CArrayPtrFlat<CItemFinder::CFindItemExt>( 10 );