mobilemessaging/smsui/viewersrc/MsgSmsViewerAppUi.cpp
branchRCL_3
changeset 24 696bfeff199e
parent 20 94cccd85bd25
child 25 fa1df4b99609
--- a/mobilemessaging/smsui/viewersrc/MsgSmsViewerAppUi.cpp	Mon Jun 21 15:36:19 2010 +0300
+++ b/mobilemessaging/smsui/viewersrc/MsgSmsViewerAppUi.cpp	Thu Jul 15 18:34:37 2010 +0300
@@ -36,6 +36,7 @@
 #include <msgbiocontrol.h>              // CMsgBioControl
 #include <CGmsWrapper.h>                // CGmsWrapper
 #include <MsgNaviPaneControl.h>
+#include <MsgExpandableControlEditor.h>
 // messaging
 #include <smuthdr.h>                    // CSmsHeader
 #include <smsclnt.h>                    // CSmsClientMtm
@@ -979,7 +980,8 @@
                 CMsgAddressControl* address = static_cast<CMsgAddressControl*>(
                     iView->ControlById( EMsgComponentIdFrom ) );
                            
-                if ( address && address->Editor().SelectionLength() )
+                if ( address && address->Editor().SelectionLength() 
+                        == address->Editor().TextLength() )
                     {
                     senderHighlighted = ETrue;
                     }
@@ -1105,7 +1107,8 @@
             CMsgAddressControl* address = static_cast<CMsgAddressControl*>(
                 iView->ControlById( EMsgComponentIdFrom ) );
                        
-            if ( address && address->Editor().SelectionLength() )
+            if ( address && address->Editor().SelectionLength() 
+                    == address->Editor().TextLength() )
                 {
                 senderHighlighted = ETrue;
                 }
@@ -1614,39 +1617,40 @@
                 }
             case EKeyDevice3:
             case EKeyEnter:	
-                {             
-                if( iView->FocusedControl()->ControlType() == EMsgAddressControl )
+                {                                
+                CMsgExpandableControl* ctrl = NULL;
+                TBool checkHighlight = EFalse;
+                
+                if( iView->FocusedControl() )
                     {
-                    CMsgAddressControl* address = static_cast<CMsgAddressControl*>(
-                        iView->FocusedControl() );
-                    if ( address && !address->Editor().SelectionLength() )
+                    ctrl = static_cast<CMsgExpandableControl*>( iView->FocusedControl() );
+                    if ( ctrl->ControlType() == EMsgAddressControl
+                            && !ctrl->Editor().SelectionLength()  ) 
                         {
-                        // restore highlight to address field
-                        return address->Editor().OfferKeyEventL( aKeyEvent, aType );
-                        }               
-                    }
-                else if ( iView->FocusedControl()->ControlType() == EMsgBodyControl )
-                    {       
-                    CItemFinder* itemFinder = iView->ItemFinder();
-                    if ( FocusedControlId() == EMsgComponentIdBody 
-                         && itemFinder )
-                        {                                                                          
-                        if ( !itemFinder->CurrentSelection().Length() )
-                            {
-                            CMsgBodyControl* body = static_cast<CMsgBodyControl*>(
-                                iView->FocusedControl() );
-                            if ( body )
-                                {                     
-                                 // restore highlight to current itemfinder item
-                                return body->Editor().OfferKeyEventL( aKeyEvent, aType );
-                                }
+                        checkHighlight = ETrue;
+                        }
+                    else if ( ctrl->ControlType() == EMsgBodyControl )
+                        {       
+                        CItemFinder* itemFinder = iView->ItemFinder();
+                        if ( FocusedControlId() == EMsgComponentIdBody && itemFinder
+                                && !itemFinder->CurrentSelection().Length() )
+                            {                                                              
+                            checkHighlight = ETrue;
                             }
                         }
                     }
-                // fall through
-                }
-            case EMsgFindItemKeyEvent:
-                {
+                if ( ctrl && checkHighlight )
+                    {
+                    // Check if highlight needs to be restored to editor,
+                    // address/body editor offerkeyevent will handle it
+                    if ( ctrl->Editor().OfferKeyEventL( aKeyEvent, aType ) 
+                            == EKeyWasConsumed )
+                        {
+                        // Highlight was restored, just return, no cs menu needed
+                        return EKeyWasConsumed;
+                        }
+                    }
+
                 // Selection-key checking (Context sensitive menu)
                 // (with Class 0 just show the menu)
                 if ( !iClass0CBA )