emailuis/emailui/src/ncsaifeditor.cpp
branchRCL_3
changeset 29 6b8f3b30d0ec
parent 16 4ce476e64c59
child 52 efd4f1afd43e
--- a/emailuis/emailui/src/ncsaifeditor.cpp	Tue May 25 12:23:16 2010 +0300
+++ b/emailuis/emailui/src/ncsaifeditor.cpp	Wed Jun 09 09:22:57 2010 +0300
@@ -39,6 +39,7 @@
 const TChar KCharAddressDelimeterSemiColon = ';';
 const TChar KCharAddressDelimeterComma = ',';
 const TChar KCharSpace = ' ';
+const TChar KCharAt = '@';
 
 // ---------------------------------------------------------------------------
 // CNcsAifEntry::NewL
@@ -349,6 +350,11 @@
         iTextSelection = Selection();        
         ret = CNcsEditor::OfferKeyEventL( aKeyEvent, aType );
         }
+    
+    if( ret == EKeyWasNotConsumed  && aType == EEventKeyDown )
+        {
+        HandleTextUpdateDeferred(); // update for lang that don't support CPS
+        }
     return ret;
     }
 
@@ -1362,21 +1368,40 @@
     // start looking for entries separated with semicolon
     TInt start( 0 );
     TInt end( ptr.Length() );
+    TInt lastSentinel = KErrNotFound;
     
     for ( TInt ii = 0; ii < end; ++ii )
         {
         TChar character = ptr[ii];
+        TBool addAddress = EFalse;
         
         if ( IsSentinel( character ) )
             {
-            if ( character == KCharAddressDelimeterComma )
+            if ( character == KCharSpace )
+                {
+                if ( ptr.Mid( start, ii-start ).Locate( KCharAt ) 
+                        != KErrNotFound )
+                    {
+                    ptr[ii] = KCharAddressDelimeterSemiColon;
+                    lastSentinel = ii;
+                    addAddress = ETrue;
+                    }
+                }
+            else if ( character == KCharAddressDelimeterComma )
                 {
                 // Replace comma with semicolon
                 ptr[ii] = KCharAddressDelimeterSemiColon;
+                lastSentinel = ii;
+                addAddress = ETrue;
+                }
+            else if ( character == KCharAddressDelimeterSemiColon )
+                {
+                lastSentinel = ii;
+                addAddress = ETrue;
                 }
 
             // Create new entry.
-            if ( start < end )
+            if ( addAddress && start < end )
                 {
                 // only if longer than 0, if not we'll get 
                 // "empty" email address
@@ -1386,10 +1411,20 @@
                     start = Min( ii + 1, end );
                     entriesFound = ETrue;
                     }
+                addAddress = EFalse;
                 }
             }
         }
     
+    // add email that wasn't ended with semicolon
+    if ( lastSentinel != KErrNotFound )
+        {
+        if ( lastSentinel < end && start < end )
+            {
+            AddAddressL( KNullDesC(), ptr.Mid(start, end-start) );
+            }
+        }
+    
     CleanupStack::PopAndDestroy( text );
         
     return entriesFound;
@@ -1505,7 +1540,7 @@
     {
     FUNC_LOG;
     return ( aCharacter == KCharAddressDelimeterSemiColon || 
-        aCharacter == KCharAddressDelimeterComma );
+        aCharacter == KCharAddressDelimeterComma || aCharacter == KCharSpace );
     }
 
 // ---------------------------------------------------------------------------