messagingappbase/msgeditor/viewsrc/MsgEditorView.cpp
branchRCL_3
changeset 42 1367103c24e2
parent 28 fbb813aef148
equal deleted inserted replaced
33:94cccd85bd25 42:1367103c24e2
    91     iEditorObserver( aObserver ),
    91     iEditorObserver( aObserver ),
    92     iCurrentFocus( EMsgNoneFocused ),
    92     iCurrentFocus( EMsgNoneFocused ),
    93     iEditorModeFlags( aEditorModeFlags ),
    93     iEditorModeFlags( aEditorModeFlags ),
    94     iLineHeight( MsgEditorCommons::MsgBaseLineDelta() ),
    94     iLineHeight( MsgEditorCommons::MsgBaseLineDelta() ),
    95     iBaseLineOffset( MsgEditorCommons::MsgBaseLineOffset() ),
    95     iBaseLineOffset( MsgEditorCommons::MsgBaseLineOffset() ),
    96     iResourceLoader( *iCoeEnv )
    96     iResourceLoader( *iCoeEnv ),
       
    97     iPrevFocus( EMsgNoneFocused ), 
       
    98     iMoveUpDownEvent( EFalse) 
    97     {
    99     {
    98     }
   100     }
    99 
   101 
   100 // ---------------------------------------------------------
   102 // ---------------------------------------------------------
   101 // CMsgEditorView::ConstructL
   103 // CMsgEditorView::ConstructL
   241         iCurrentFocus = EMsgHeaderFocused;
   243         iCurrentFocus = EMsgHeaderFocused;
   242         
   244         
   243         TInt newFocus = iHeader->FirstFocusableControl( 0, EMsgFocusDown );
   245         TInt newFocus = iHeader->FirstFocusableControl( 0, EMsgFocusDown );
   244         if ( newFocus == KErrNotFound )
   246         if ( newFocus == KErrNotFound )
   245             {
   247             {
       
   248             iPrevFocus = EMsgHeaderFocused; 
   246             iCurrentFocus = EMsgBodyFocused;
   249             iCurrentFocus = EMsgBodyFocused;
   247             newFocus = iBody->FirstFocusableControl( 0, EMsgFocusDown );
   250             newFocus = iBody->FirstFocusableControl( 0, EMsgFocusDown );
   248             
   251             
   249             if ( newFocus == KErrNotFound )
   252             if ( newFocus == KErrNotFound )
   250                 {
   253                 {
       
   254 				iPrevFocus = EMsgNoneFocused;
   251                 iCurrentFocus = EMsgNoneFocused;
   255                 iCurrentFocus = EMsgNoneFocused;
   252                 }
   256                 }
   253             else
   257             else
   254                 {
   258                 {
   255                 iBody->ChangeFocusTo( newFocus, ENoDrawNow );
   259                 iBody->ChangeFocusTo( newFocus, ENoDrawNow );
   780             {
   784             {
   781             forceScrollUp = SetAfterFocusL( after );
   785             forceScrollUp = SetAfterFocusL( after );
   782             }
   786             }
   783         }
   787         }
   784     
   788     
       
   789     iMoveUpDownEvent = ETrue; 
   785     EnsureCorrectFormPosition( ( aKeyEvent.iCode == EKeyDownArrow ) && focusRotated, forceScrollUp );
   790     EnsureCorrectFormPosition( ( aKeyEvent.iCode == EKeyDownArrow ) && focusRotated, forceScrollUp );
       
   791     iMoveUpDownEvent = EFalse; 
   786 
   792 
   787     UpdateScrollBarL();
   793     UpdateScrollBarL();
   788 
   794 
   789     return keyResp;
   795     return keyResp;
   790     }
   796     }
  1762                                    iStateFlags & EMsgStateInitialized ? EDrawNow :
  1768                                    iStateFlags & EMsgStateInitialized ? EDrawNow :
  1763                                                                         ENoDrawNow );
  1769                                                                         ENoDrawNow );
  1764                     iHeader->NotifyControlsForEvent( EMsgViewEventPrepareFocusTransitionDown, 0 ); 
  1770                     iHeader->NotifyControlsForEvent( EMsgViewEventPrepareFocusTransitionDown, 0 ); 
  1765                     }
  1771                     }
  1766                 }
  1772                 }
  1767             TMsgFocus previousMsgPart = iCurrentFocus;    
  1773             TMsgFocus previousMsgPart = iCurrentFocus;
       
  1774             iPrevFocus = iCurrentFocus; 
  1768             iCurrentFocus = EMsgBodyFocused;
  1775             iCurrentFocus = EMsgBodyFocused;
  1769             
  1776             
  1770             TInt delta = componentIndex - iBody->CurrentFocus();
  1777             TInt delta = componentIndex - iBody->CurrentFocus();
  1771             
  1778             
  1772             if ( delta != 0 )
  1779             if ( delta != 0 )
  2236     CMsgBaseControl* ctrl = FocusedControl();
  2243     CMsgBaseControl* ctrl = FocusedControl();
  2237     if ( !ctrl )
  2244     if ( !ctrl )
  2238         {
  2245         {
  2239         return EFalse;
  2246         return EFalse;
  2240         }
  2247         }
       
  2248     else 
       
  2249         {
       
  2250         if ( ctrl->ControlType() == EMsgBodyControl 
       
  2251              && ctrl->ItemFinder()
       
  2252              && ctrl->IsReadOnly()
       
  2253              && !iMoveUpDownEvent ) 
       
  2254             {
       
  2255             TInt countHeader = iHeader->CountMsgControls();
       
  2256             for ( TInt i = 0; i < countHeader; i++ )
       
  2257                  {
       
  2258                  CMsgBaseControl* headerCtrl = iHeader->MsgControl( i );
       
  2259                  if ( headerCtrl )
       
  2260                      {
       
  2261                      TInt controlType;
       
  2262                      controlType = headerCtrl->ControlType();
       
  2263                      if ( controlType == EMsgAddressControl ||
       
  2264                           controlType == EMsgExpandableControl ||
       
  2265                           controlType == EMsgAttachmentControl )
       
  2266                          {
       
  2267                          if ( ControlFullyVisible(headerCtrl) || iPrevFocus == EMsgHeaderFocused )
       
  2268                              {
       
  2269                              return EFalse; // Ignoring Scroll Event
       
  2270                              }
       
  2271                          }
       
  2272                       }
       
  2273                  }
       
  2274             }        
       
  2275         }
  2241 
  2276 
  2242     iStateFlags |= EMsgEnsureCorrectFormPositionRequestIssued;
  2277     iStateFlags |= EMsgEnsureCorrectFormPositionRequestIssued;
  2243 
  2278 
  2244     TInt delta = 0;
  2279     TInt delta = 0;
  2245     TBool viewScrolled = ETrue;
  2280     TBool viewScrolled = ETrue;
  2246     TRect lineRect = ctrl->IsReadOnly() ? ctrl->Rect() : 
  2281     TRect lineRect = ctrl->IsReadOnly() ? ctrl->Rect() : 
  2247                                           ctrl->CurrentLineRect();
  2282                                           ctrl->CurrentLineRect();
  2248 
  2283 
  2249     if ( lineRect.Height() )
  2284     if ( lineRect.Height() )
  2250         {
  2285         {
  2251 		if (lineRect.Height() >= iViewRect.Height())
  2286         if ( lineRect.iBr.iY > iViewRect.Height() ) 
  2252             {
  2287            {
  2253             // the view must be scrolled up.
  2288             // the view must be scrolled up.
  2254             delta = iViewRect.Height() - lineRect.iBr.iY;
  2289             delta = iViewRect.Height() - lineRect.iBr.iY;
  2255             }
  2290             }
  2256         else if ( lineRect.iTl.iY < 0 && 
  2291         else if ( lineRect.iTl.iY < 0 && 
  2257                   lineRect.Height() <= iViewRect.Height() )
  2292                   lineRect.Height() <= iViewRect.Height() )