mobilemessaging/mmsui/notviewersrc/NotViewerAppUi.cpp
branchRCL_3
changeset 24 696bfeff199e
parent 0 72b543305e3a
--- a/mobilemessaging/mmsui/notviewersrc/NotViewerAppUi.cpp	Mon Jun 21 15:36:19 2010 +0300
+++ b/mobilemessaging/mmsui/notviewersrc/NotViewerAppUi.cpp	Thu Jul 15 18:34:37 2010 +0300
@@ -614,8 +614,24 @@
     if (    iFlags & ENotViewerIsNotification )
         {   // Notification mode        
         if ( iView  )
-            {
-            if( (FocusedControlId( ) == EMsgComponentIdFrom) && ( ( iMtm->Sender( ) ).Length() ) )
+            {      
+            TInt focusedControl = FocusedControlId();                     
+            TBool senderHighlighted = EFalse;
+            
+            if ( focusedControl == EMsgComponentIdFrom )
+                {
+                CMsgAddressControl* address = static_cast<CMsgAddressControl*>(
+                    iView->ControlById( EMsgComponentIdFrom ) );
+                
+                if ( address && address->Editor().SelectionLength() 
+                        == address->Editor().TextLength() )
+                    {
+                    senderHighlighted = ETrue;
+                    }
+                }
+        
+            if( ( focusedControl == EMsgComponentIdFrom ) && ( ( iMtm->Sender( ) ).Length() )
+                  && senderHighlighted )
                 {
                 iFindItemMenu->SetSenderHighlightStatus( ETrue );
                 iFindItemMenu->SetSenderDisplayText( TMmsGenUtils::PureAddress( iMtm->Sender( ) ) );
@@ -625,10 +641,13 @@
                 iFindItemMenu->SetSenderHighlightStatus( EFalse );
 		        }
 		    iFindItemMenu->AddItemFindMenuL( 
-                ( FocusedControlId() == EMsgComponentIdBody ) ? iView->ItemFinder() : 0,
+		        ( iView->ItemFinder() && 
+		          iView->ItemFinder()->CurrentSelection().Length() ) 
+		        ? iView->ItemFinder() : 0,
     			aMenuPane, 
                 EFindItemMenuPlaceHolder,
-                iMtm->Sender(),
+                senderHighlighted ? 
+                iMtm->Sender( ) : KNullDesC(),
                 iAlias && !iRemoteAlias ? ETrue : EFalse, //"Is sender known"
     			EFalse );
             }
@@ -867,6 +886,42 @@
         case EKeyDevice3:       //Selection key
         case EKeyEnter:         //Enter Key
             {
+            CMsgExpandableControl* ctrl = NULL;
+            TBool checkHighlight = EFalse;
+            
+            if( iView->FocusedControl() )
+                {
+                ctrl = static_cast<CMsgExpandableControl*>( iView->FocusedControl() );
+                if ( ctrl )
+                	{
+                	if ( ctrl->ControlType() == EMsgAddressControl
+                        && !ctrl->Editor().SelectionLength()  ) 
+                    {
+                    checkHighlight = ETrue;
+                    }
+                	else if ( ctrl->ControlType() == EMsgBodyControl )
+                    {       
+                    CItemFinder* itemFinder = iView->ItemFinder();
+                    if ( FocusedControlId() == EMsgComponentIdBody && itemFinder
+                            && !itemFinder->CurrentSelection().Length() )
+                        {                                                              
+                        checkHighlight = ETrue;
+                        }
+                    }
+                  }
+                }
+            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;
+                    }
+                } 
+  
             if ( DoSelectionKeyL( ) )
                 {
                 return EKeyWasConsumed;