messagingappbase/msgeditor/viewsrc/MsgAddressControlEditor.cpp
branchRCL_3
changeset 28 fbb813aef148
parent 21 c6838af47512
child 53 696bfeff199e
--- a/messagingappbase/msgeditor/viewsrc/MsgAddressControlEditor.cpp	Tue Apr 27 16:33:37 2010 +0300
+++ b/messagingappbase/msgeditor/viewsrc/MsgAddressControlEditor.cpp	Tue May 11 16:10:04 2010 +0300
@@ -1667,9 +1667,16 @@
     const TKeyEvent& aKeyEvent, TEventCode aType )
     {
     if ( IsReadOnly() && 
-        aKeyEvent.iCode == EKeyUpArrow &&
+        ( aKeyEvent.iCode == EKeyUpArrow ||
+          aKeyEvent.iCode == EKeyEnter ||
+          aKeyEvent.iCode == EKeyDevice3 ) &&
         iValidHighlightable )
         {
+        if ( !SelectionLength() )
+            {
+            // Enable highlight if hw keys used
+            CheckHighlightingL();
+            }
         return EKeyWasConsumed;
         }
     return CMsgExpandableControlEditor::OfferKeyEventL( aKeyEvent, aType );
@@ -1723,16 +1730,28 @@
                 else
                     {
                     forwardRequest = EFalse;
-                    }
+                    
+                    if ( docPos < TextLength() )
+                        {
+                        // Enable highlight on pointer down
+                        CheckHighlightingL();
+                        } 
+                    }                
                 }
             else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
                 {
                 if ( currentField &&
                      iPreviousField == currentField )
                     {
+                    // We will send new EMsgFindItemEvent so that we can separate 
+                    // single click item activation and old key based activation.
+                    // This is just quick fix for doing it, other implementations should
+                    // be considered(e.g. storing state in editor or using some flags).
+                    // This is done because in AppUI::HandleKeyEvent we must separate
+                    // activation methods for enabling highlight when using keys. 
                     TKeyEvent event;
-                    event.iCode = EKeyDevice3;
-                    event.iScanCode = EStdKeyDevice3;
+                    event.iCode = EMsgFindItemKeyEvent;
+                    event.iScanCode = EMsgFindItemKeyEvent;
                     event.iModifiers = 0;
                     event.iRepeats = 0;
                     
@@ -1740,6 +1759,12 @@
                     
                     forwardRequest = EFalse;
                     }
+                
+                if ( SelectionLength() )
+                    {
+                    // Disable highlight on pointer up
+                    ClearSelectionL();
+                    }
                 }
             }
         }
@@ -1772,7 +1797,8 @@
         CMsgExpandableControlEditor::HandlePointerEventL( aPointerEvent );
         }
 #ifdef RD_TACTILE_FEEDBACK         
-    else if(aPointerEvent.iType == TPointerEvent::EButton1Down)
+    else if( aPointerEvent.iType == TPointerEvent::EButton1Down 
+             && SelectionLength() )
         {                                
         MTouchFeedback* feedback = MTouchFeedback::Instance();
         if ( feedback )
@@ -1977,10 +2003,6 @@
 #endif   
         
         SetWordWrapL( EFalse );
-        if ( AddressFieldAutoHighlight() )
-            {
-            SelectAllL(); // for automatic highlight
-            }
         }
     
     CMsgExpandableControlEditor::PrepareForReadOnlyL( aReadOnly );