messagingappbase/msgeditor/viewsrc/MsgAddressControlEditor.cpp
branchRCL_3
changeset 18 fbb813aef148
parent 14 c6838af47512
child 24 696bfeff199e
equal deleted inserted replaced
16:e00582ce7ecd 18:fbb813aef148
  1665 //
  1665 //
  1666 TKeyResponse CMsgAddressControlEditor::OfferKeyEventL(
  1666 TKeyResponse CMsgAddressControlEditor::OfferKeyEventL(
  1667     const TKeyEvent& aKeyEvent, TEventCode aType )
  1667     const TKeyEvent& aKeyEvent, TEventCode aType )
  1668     {
  1668     {
  1669     if ( IsReadOnly() && 
  1669     if ( IsReadOnly() && 
  1670         aKeyEvent.iCode == EKeyUpArrow &&
  1670         ( aKeyEvent.iCode == EKeyUpArrow ||
       
  1671           aKeyEvent.iCode == EKeyEnter ||
       
  1672           aKeyEvent.iCode == EKeyDevice3 ) &&
  1671         iValidHighlightable )
  1673         iValidHighlightable )
  1672         {
  1674         {
       
  1675         if ( !SelectionLength() )
       
  1676             {
       
  1677             // Enable highlight if hw keys used
       
  1678             CheckHighlightingL();
       
  1679             }
  1673         return EKeyWasConsumed;
  1680         return EKeyWasConsumed;
  1674         }
  1681         }
  1675     return CMsgExpandableControlEditor::OfferKeyEventL( aKeyEvent, aType );
  1682     return CMsgExpandableControlEditor::OfferKeyEventL( aKeyEvent, aType );
  1676     }
  1683     }
  1677 
  1684 
  1721                     iPreviousField = NULL;
  1728                     iPreviousField = NULL;
  1722                     }
  1729                     }
  1723                 else
  1730                 else
  1724                     {
  1731                     {
  1725                     forwardRequest = EFalse;
  1732                     forwardRequest = EFalse;
  1726                     }
  1733                     
       
  1734                     if ( docPos < TextLength() )
       
  1735                         {
       
  1736                         // Enable highlight on pointer down
       
  1737                         CheckHighlightingL();
       
  1738                         } 
       
  1739                     }                
  1727                 }
  1740                 }
  1728             else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
  1741             else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
  1729                 {
  1742                 {
  1730                 if ( currentField &&
  1743                 if ( currentField &&
  1731                      iPreviousField == currentField )
  1744                      iPreviousField == currentField )
  1732                     {
  1745                     {
       
  1746                     // We will send new EMsgFindItemEvent so that we can separate 
       
  1747                     // single click item activation and old key based activation.
       
  1748                     // This is just quick fix for doing it, other implementations should
       
  1749                     // be considered(e.g. storing state in editor or using some flags).
       
  1750                     // This is done because in AppUI::HandleKeyEvent we must separate
       
  1751                     // activation methods for enabling highlight when using keys. 
  1733                     TKeyEvent event;
  1752                     TKeyEvent event;
  1734                     event.iCode = EKeyDevice3;
  1753                     event.iCode = EMsgFindItemKeyEvent;
  1735                     event.iScanCode = EStdKeyDevice3;
  1754                     event.iScanCode = EMsgFindItemKeyEvent;
  1736                     event.iModifiers = 0;
  1755                     event.iModifiers = 0;
  1737                     event.iRepeats = 0;
  1756                     event.iRepeats = 0;
  1738                     
  1757                     
  1739                     iCoeEnv->WsSession().SimulateKeyEvent( event );
  1758                     iCoeEnv->WsSession().SimulateKeyEvent( event );
  1740                     
  1759                     
  1741                     forwardRequest = EFalse;
  1760                     forwardRequest = EFalse;
  1742                     }
  1761                     }
       
  1762                 
       
  1763                 if ( SelectionLength() )
       
  1764                     {
       
  1765                     // Disable highlight on pointer up
       
  1766                     ClearSelectionL();
       
  1767                     }
  1743                 }
  1768                 }
  1744             }
  1769             }
  1745         }
  1770         }
  1746     else
  1771     else
  1747         {
  1772         {
  1770     if ( forwardRequest )
  1795     if ( forwardRequest )
  1771         {
  1796         {
  1772         CMsgExpandableControlEditor::HandlePointerEventL( aPointerEvent );
  1797         CMsgExpandableControlEditor::HandlePointerEventL( aPointerEvent );
  1773         }
  1798         }
  1774 #ifdef RD_TACTILE_FEEDBACK         
  1799 #ifdef RD_TACTILE_FEEDBACK         
  1775     else if(aPointerEvent.iType == TPointerEvent::EButton1Down)
  1800     else if( aPointerEvent.iType == TPointerEvent::EButton1Down 
       
  1801              && SelectionLength() )
  1776         {                                
  1802         {                                
  1777         MTouchFeedback* feedback = MTouchFeedback::Instance();
  1803         MTouchFeedback* feedback = MTouchFeedback::Instance();
  1778         if ( feedback )
  1804         if ( feedback )
  1779             {
  1805             {
  1780             feedback->InstantFeedback( this, ETouchFeedbackBasic );
  1806             feedback->InstantFeedback( this, ETouchFeedbackBasic );
  1975 #ifdef RD_SCALABLE_UI_V2
  2001 #ifdef RD_SCALABLE_UI_V2
  1976         SetHighlightStyleL( EEikEdwinHighlightLink );
  2002         SetHighlightStyleL( EEikEdwinHighlightLink );
  1977 #endif   
  2003 #endif   
  1978         
  2004         
  1979         SetWordWrapL( EFalse );
  2005         SetWordWrapL( EFalse );
  1980         if ( AddressFieldAutoHighlight() )
       
  1981             {
       
  1982             SelectAllL(); // for automatic highlight
       
  1983             }
       
  1984         }
  2006         }
  1985     
  2007     
  1986     CMsgExpandableControlEditor::PrepareForReadOnlyL( aReadOnly );
  2008     CMsgExpandableControlEditor::PrepareForReadOnlyL( aReadOnly );
  1987     }
  2009     }
  1988 
  2010