emailuis/emailui/src/ncscomposeviewcontainer.cpp
branchRCL_3
changeset 34 cd2816114bd1
parent 32 a3a1ae9acec6
child 19 b13141f05c3d
equal deleted inserted replaced
33:da5135c61bad 34:cd2816114bd1
   100     FUNC_LOG;
   100     FUNC_LOG;
   101 
   101 
   102     SetMopParent( &iView );
   102     SetMopParent( &iView );
   103     CreateWindowL();
   103     CreateWindowL();
   104 
   104 
       
   105     if ( CAknPhysics::FeatureEnabled() )
       
   106         {
       
   107         iPhysics = CAknPhysics::NewL( *this, this );
       
   108         }
       
   109 
   105     // Setup the control array
   110     // Setup the control array
   106     InitComponentArrayL();
   111     InitComponentArrayL();
   107     CCoeControlArray& controls = Components();
   112     CCoeControlArray& controls = Components();
   108     controls.SetControlsOwnedExternally( ETrue );
   113     controls.SetControlsOwnedExternally( ETrue );
   109 
   114 
   110     // Create the header field
   115     // Create the header field
   111     iHeader = CNcsHeaderContainer::NewL( *this, iMailBox, aFlags );
   116     iHeader = CNcsHeaderContainer::NewL( *this, iMailBox, aFlags, iPhysics );
   112     controls.AppendLC( iHeader );
   117     controls.AppendLC( iHeader );
   113     CleanupStack::Pop( iHeader );
   118     CleanupStack::Pop( iHeader );
   114 
   119 
   115     // Create 'message body' field, default text is empty for that field
   120     // Create 'message body' field, default text is empty for that field
   116     iMessageField = new ( ELeave ) CNcsEditor( this, EFalse, ENcsEditorBody );
   121     iMessageField = new ( ELeave ) CNcsEditor( this, EFalse, ENcsEditorBody );
   117     iMessageField->SetContainerWindowL( *this );
   122     iMessageField->SetContainerWindowL( *this );
   118     iMessageField->ConstructL( this, 0, 0 );
   123     iMessageField->ConstructL( this, 0, 0 );
   119     iMessageField->SetAlignment( EAknEditorAlignBidi );
   124     iMessageField->SetAlignment( EAknEditorAlignBidi );
   120     iMessageField->SetAknEditorInputMode( EAknEditorTextInputMode );
   125     iMessageField->SetAknEditorInputMode( EAknEditorTextInputMode );
       
   126     iMessageField->EnableKineticScrollingL( iPhysics );
   121     controls.AppendLC( iMessageField );
   127     controls.AppendLC( iMessageField );
   122     CleanupStack::Pop( iMessageField );
   128     CleanupStack::Pop( iMessageField );
   123 
   129 
   124     iMessageField->SetNcsFontType( NcsUtility::ENcsBodytextFont );
   130     iMessageField->SetNcsFontType( NcsUtility::ENcsBodytextFont );
   125 
   131 
   138     CleanupStack::Pop( iReadOnlyQuoteField );
   144     CleanupStack::Pop( iReadOnlyQuoteField );
   139 
   145 
   140     // Listen edwin events and size events from smart quote field
   146     // Listen edwin events and size events from smart quote field
   141     iReadOnlyQuoteField->AddEdwinObserverL( this );
   147     iReadOnlyQuoteField->AddEdwinObserverL( this );
   142     iReadOnlyQuoteField->SetEdwinSizeObserver( this );
   148     iReadOnlyQuoteField->SetEdwinSizeObserver( this );
       
   149    iReadOnlyQuoteField->EnableKineticScrollingL( iPhysics );
   143 
   150 
   144     // Create the scroll bar
   151     // Create the scroll bar
   145     iScrollBar = new( ELeave ) CAknDoubleSpanScrollBar( this );
   152     iScrollBar = new( ELeave ) CAknDoubleSpanScrollBar( this );
   146     iScrollBar->ConstructL( 
   153     iScrollBar->ConstructL( ETrue, this, this, CEikScrollBar::EVertical,
   147             this, this, CEikScrollBar::EVertical, aRect.Height() );
   154         aRect.Height() );
   148     iScrollBar->MakeVisible( ETrue );
   155     iScrollBar->MakeVisible( EFalse );
   149     iScrollBar->SetModelL( &iScrollBarModel );
   156     iScrollBar->SetModelL( &iScrollBarModel );
       
   157     controls.AppendLC( iScrollBar );
       
   158     CleanupStack::Pop( iScrollBar );
   150 
   159 
   151     iMessageField->SetupEditorL();
   160     iMessageField->SetupEditorL();
   152     iReadOnlyQuoteField->SetupEditorL();
   161     iReadOnlyQuoteField->SetupEditorL();
   153 
   162 
   154     SetRect( aRect );
   163     SetRect( aRect );
   156     iBgContext = CAknsBasicBackgroundControlContext::NewL(
   165     iBgContext = CAknsBasicBackgroundControlContext::NewL(
   157         KAknsIIDQsnBgAreaMain, Rect(), EFalse );
   166         KAknsIIDQsnBgAreaMain, Rect(), EFalse );
   158 
   167 
   159     iLongTapDetector = CAknLongTapDetector::NewL( this );
   168     iLongTapDetector = CAknLongTapDetector::NewL( this );
   160 
   169 
   161     UpdateScrollBarL();
       
   162 
       
   163     ActivateL();
   170     ActivateL();
       
   171     DrawDeferred();
   164 
   172 
   165     // activate auto save functionality
   173     // activate auto save functionality
   166     iAutoSaver.Enable( ETrue );
   174     iAutoSaver.Enable( ETrue );
   167 
   175 
   168     if ( CAknPhysics::FeatureEnabled() )
       
   169         {
       
   170         iPhysics = CAknPhysics::NewL( *this, this );
       
   171         }
       
   172     }
   176     }
   173 
   177 
   174 // ---------------------------------------------------------------------------
   178 // ---------------------------------------------------------------------------
   175 // CNcsComposeViewContainer::~CNcsComposeViewContainer
   179 // CNcsComposeViewContainer::~CNcsComposeViewContainer
   176 // Destructor
   180 // Destructor
   222         }
   226         }
   223     else 
   227     else 
   224         {
   228         {
   225         iFocused->SetFocus( ETrue, aDrawNow );
   229         iFocused->SetFocus( ETrue, aDrawNow );
   226         }
   230         }
   227 	
   231 
   228 	iView.HandleContainerChangeRequiringToolbarRefresh();
   232     iView.HandleContainerChangeRequiringToolbarRefresh();
   229 
   233 
   230 	if ( aDrawNow )
   234 	if ( aDrawNow )
   231 	    {
   235 	    {
   232 		DrawNow();
   236 		DrawNow();
   233 	    }
   237 	    }
   250 // -----------------------------------------------------------------------------
   254 // -----------------------------------------------------------------------------
   251 //
   255 //
   252 void CNcsComposeViewContainer::HandlePointerEventL( 
   256 void CNcsComposeViewContainer::HandlePointerEventL( 
   253         const TPointerEvent& aPointerEvent )
   257         const TPointerEvent& aPointerEvent )
   254     {
   258     {
   255 	FUNC_LOG;
   259     FUNC_LOG;
   256 
   260 
   257     CCoeControl::HandlePointerEventL( aPointerEvent );
   261     CCoeControl::HandlePointerEventL( aPointerEvent );
   258 
   262 
   259     if ( aPointerEvent.iType != TPointerEvent::EButton1Down &&
   263     if ( aPointerEvent.iType != TPointerEvent::EButton1Down &&
   260          iHeader->NeedsLongTapL( aPointerEvent.iPosition ) )
   264          iHeader->NeedsLongTapL( aPointerEvent.iPosition ) )
   267     	case TPointerEvent::EButton1Down:
   271     	case TPointerEvent::EButton1Down:
   268     		{
   272     		{
   269             // Save current and original position so that those can be used in
   273             // Save current and original position so that those can be used in
   270             // drag/scrolling calculations
   274             // drag/scrolling calculations
   271             iPreviousPosition = iOriginalPosition = 
   275             iPreviousPosition = iOriginalPosition = 
   272                 aPointerEvent.iParentPosition;
   276                 aPointerEvent.iPosition;
   273             iIsDragging = EFalse;
   277             iIsDragging = EFalse;
   274             iIsFlicking = EFalse;
   278             iIsFlicking = EFalse;
   275 
   279 
   276             if( iPhysics )
   280             if( iPhysics )
   277                 {
   281                 {
   287                     {
   291                     {
   288 					if( iMessageField->SelectionLength() )
   292 					if( iMessageField->SelectionLength() )
   289 						{
   293 						{
   290 						iMessageField->ClearSelectionL();
   294 						iMessageField->ClearSelectionL();
   291 						}
   295 						}
   292                     iMessageField->SetFocus( EFalse, EDrawNow );
   296                     iMessageField->SetFocus( EFalse, ENoDrawNow );
   293                     iFocused = iHeader;
   297                     iFocused = iHeader;
   294                     iHeader->SetFocus( ETrue,EDrawNow );
   298                     iHeader->SetFocus( ETrue,ENoDrawNow );
   295                     iHeader->MakeVisible( ETrue );
   299                     iHeader->MakeVisible( ETrue );
   296                     CommitL( EBodyField );
   300                     CommitL( EBodyField );
   297                     iView.HandleContainerChangeRequiringToolbarRefresh();
   301                     iView.HandleContainerChangeRequiringToolbarRefresh();
   298                     }
   302                     }
   299                 else if ( iFocused == iReadOnlyQuoteField )
   303                 else if ( iFocused == iReadOnlyQuoteField )
   300                     {
   304                     {
   301                     iFocused = iMessageField;
   305                     iFocused = iMessageField;
   302                     iReadOnlyQuoteField->SetFocus( EFalse, EDrawNow );
   306                     iReadOnlyQuoteField->SetFocus( EFalse, ENoDrawNow );
   303                     iHeader->SetFocus( ETrue, EDrawNow );
   307                     iHeader->SetFocus( ETrue, ENoDrawNow );
   304                     iView.HandleContainerChangeRequiringToolbarRefresh();
   308                     iView.HandleContainerChangeRequiringToolbarRefresh();
   305                     }
   309                     }
   306                 }
   310                 }
   307             else if ( iReadOnlyQuoteField->Rect().Contains( 
   311             else if ( iReadOnlyQuoteField->Rect().Contains( 
   308                         aPointerEvent.iPosition ) )
   312                         aPointerEvent.iPosition ) )
   309                 {
   313                 {
   310                 if ( iFocused == iMessageField )
   314                 if ( iFocused == iMessageField )
   311                     {
   315                     {
   312                     iFocused = iReadOnlyQuoteField;
   316                     iFocused = iReadOnlyQuoteField;
   313                     iReadOnlyQuoteField->SetFocus( ETrue, EDrawNow );
   317                     iReadOnlyQuoteField->SetFocus( ETrue, ENoDrawNow );
   314                     iMessageField->SetFocus( EFalse, EDrawNow );
   318                     iMessageField->SetFocus( EFalse, ENoDrawNow );
   315                     iReadOnlyQuoteField->SetCursorPosL( 0, EFalse );
   319                     iReadOnlyQuoteField->SetCursorPosL( 0, EFalse );
   316                     iView.HandleContainerChangeRequiringToolbarRefresh();
   320                     iView.HandleContainerChangeRequiringToolbarRefresh();
   317                     }
   321                     }
   318                 else if ( iFocused == iHeader )
   322                 else if ( iFocused == iHeader )
   319                     {
   323                     {
   320                     iFocused = iReadOnlyQuoteField;
   324                     iFocused = iReadOnlyQuoteField;
   321                     iReadOnlyQuoteField->SetFocus( ETrue, EDrawNow );
   325                     iReadOnlyQuoteField->SetFocus( ETrue, ENoDrawNow );
   322                     iHeader->SetFocus( EFalse, EDrawNow );
   326                     iHeader->SetFocus( EFalse, ENoDrawNow );
   323                     iReadOnlyQuoteField->SetCursorPosL( 0, EFalse );
   327                     iReadOnlyQuoteField->SetCursorPosL( 0, EFalse );
   324                     iView.HandleContainerChangeRequiringToolbarRefresh();
   328                     iView.HandleContainerChangeRequiringToolbarRefresh();
   325                     }
   329                     }
   326                 }
   330                 }
   327             else 
   331             else 
   328                 {
   332                 {
   329                 if ( iFocused == iHeader )
   333                 if ( iFocused == iHeader )
   330                     {
   334                     {
   331                     //TRAP_IGNORE( DoUpdateSubjectL() );
   335                     //TRAP_IGNORE( DoUpdateSubjectL() );
   332 
   336 
   333 					iHeader->SetFocus( EFalse, EDrawNow );
   337                     iHeader->SetFocus( EFalse, ENoDrawNow );
   334 					iFocused = iMessageField;
   338                     iFocused = iMessageField;
   335                     iMessageField->SetFocus( ETrue, EDrawNow );
   339                     iMessageField->SetFocus( ETrue, ENoDrawNow );
   336                     iView.HandleContainerChangeRequiringToolbarRefresh();
   340                     iView.HandleContainerChangeRequiringToolbarRefresh();
   337                     }
   341                     }
   338                 else if ( iFocused == iReadOnlyQuoteField )
   342                 else if ( iFocused == iReadOnlyQuoteField )
   339                     {
   343                     {
   340                     iFocused = iMessageField;
   344                     iFocused = iMessageField;
   341                     iReadOnlyQuoteField->SetFocus( EFalse, EDrawNow );
   345                     iReadOnlyQuoteField->SetFocus( EFalse, ENoDrawNow );
   342                     iMessageField->SetFocus( ETrue, EDrawNow );
   346                     iMessageField->SetFocus( ETrue, ENoDrawNow );
   343                     iView.HandleContainerChangeRequiringToolbarRefresh();
   347                     iView.HandleContainerChangeRequiringToolbarRefresh();
   344                     }
   348                     }
   345                 else 
   349                 else 
   346                     {
   350                     {
       
   351 					iMessageField->ClearSelectionL();
       
   352 
   347                     const TRect messageFieldRect( iMessageField->Rect() );
   353                     const TRect messageFieldRect( iMessageField->Rect() );
   348                     if ( !messageFieldRect.Contains( aPointerEvent.iPosition ) && 
   354                     if ( !messageFieldRect.Contains( aPointerEvent.iPosition ) && 
   349                          aPointerEvent.iPosition.iY >= messageFieldRect.iTl.iY )
   355                          aPointerEvent.iPosition.iY >= messageFieldRect.iTl.iY )
   350                         {
   356                         {
   351                         iMessageField->OpenVirtualKeyBoardL();
   357                         iMessageField->OpenVirtualKeyBoardL();
   368     		break;
   374     		break;
   369     		}
   375     		}
   370     	
   376     	
   371     	case TPointerEvent::EDrag:
   377     	case TPointerEvent::EDrag:
   372     		{
   378     		{
   373     		// Get current pointer position
   379             if ( !iIsDragging )
   374     		TPoint position = aPointerEvent.iParentPosition;
   380                 {
   375 
   381                 TInt drag( iOriginalPosition.iY - aPointerEvent.iPosition.iY );
   376     		// If user started dragging, cancel hotspot actions
   382                 if ( Abs( drag ) > iPhysics->DragThreshold() )
   377             iIsDragging = ETrue;
   383                     {
       
   384 					// If user started dragging, cancel hotspot actions
       
   385 					iIsDragging = ETrue;
       
   386                     }
       
   387                 }
       
   388 
       
   389             // Get current pointer position
       
   390             TPoint position = aPointerEvent.iPosition;
       
   391 
   378 
   392 
   379            if( iPhysics )
   393            if( iPhysics )
   380                 {
   394                {
   381                 TPoint delta( 0, iPreviousPosition.iY - position.iY );
   395 			   if ( iIsDragging )
   382                 iPhysics->RegisterPanningPosition( delta );
   396 				   {
       
   397                     TPoint delta( 0, iPreviousPosition.iY - position.iY );
       
   398                     if ( !iMessageField->SelectionLength() )
       
   399                     		iPhysics->RegisterPanningPosition( delta );
       
   400 				   }
   383                 }
   401                 }
   384             else
   402             else
   385                 {
   403                 {
   386     			TInt topPosition( -iHeader->Position().iY );
   404     			TInt topPosition( -iHeader->Position().iY );
   387     						
   405     						
   416     		// unknown event, ignored
   434     		// unknown event, ignored
   417     		break;
   435     		break;
   418     		}
   436     		}
   419     	}
   437     	}
   420     	
   438     	
   421     if( iFocused == iMessageField )
       
   422     	{
       
   423     	iMessageField->HandleTextChangedL();
       
   424     	}
       
   425 
       
   426     if ( aPointerEvent.iType == TPointerEvent::EButton1Down &&
   439     if ( aPointerEvent.iType == TPointerEvent::EButton1Down &&
   427          iHeader->NeedsLongTapL( aPointerEvent.iPosition ) )
   440          iHeader->NeedsLongTapL( aPointerEvent.iPosition ) )
   428         {
   441         {
   429         iLongTapDetector->PointerEventL( aPointerEvent );
   442         iLongTapDetector->PointerEventL( aPointerEvent );
   430         }
   443         }
   493             ret = ChangeFocusL( aKeyEvent );
   506             ret = ChangeFocusL( aKeyEvent );
   494             }
   507             }
   495 
   508 
   496         if ( ret != EKeyWasConsumed )
   509         if ( ret != EKeyWasConsumed )
   497             {
   510             {
   498         	DrawNow();
   511             DrawDeferred();
   499             }
   512             }
   500         }
   513         }
   501 
   514 
   502     if ( ret == EKeyWasNotConsumed )
   515     if ( ret == EKeyWasNotConsumed )
   503         {
   516         {
   504         ret = iFocused->OfferKeyEventL( aKeyEvent, aType );
   517         if ( iFocused )
       
   518             ret = iFocused->OfferKeyEventL( aKeyEvent, aType );
       
   519 
   505         if( aType == EEventKeyUp )
   520         if( aType == EEventKeyUp )
   506         	iView.HandleContainerChangeRequiringToolbarRefresh();
   521         	iView.HandleContainerChangeRequiringToolbarRefresh();
   507         
   522         
   508         // Report user activity to auto saver if editor field handled the
   523         // Report user activity to auto saver if editor field handled the
   509         // event. In case of message field (body text), EKeyWasConsumed
   524         // event. In case of message field (body text), EKeyWasConsumed
   653     TKeyResponse ret( EKeyWasNotConsumed );
   668     TKeyResponse ret( EKeyWasNotConsumed );
   654 
   669 
   655     if ( iFocused == iReadOnlyQuoteField && aKeyEvent.iCode == EKeyUpArrow )
   670     if ( iFocused == iReadOnlyQuoteField && aKeyEvent.iCode == EKeyUpArrow )
   656         {
   671         {
   657         iFocused = iMessageField;
   672         iFocused = iMessageField;
   658         iReadOnlyQuoteField->SetFocus( EFalse, EDrawNow );
   673         iReadOnlyQuoteField->SetFocus( EFalse, ENoDrawNow );
   659         iMessageField->SetFocus( ETrue, EDrawNow );
   674         iMessageField->SetFocus( ETrue, ENoDrawNow );
   660         ret = EKeyWasConsumed;
   675         ret = EKeyWasConsumed;
   661         }
   676         }
   662     else if ( iFocused == iMessageField )
   677     else if ( iFocused == iMessageField )
   663 	    {
   678         {
   664 	    if ( aKeyEvent.iCode == EKeyUpArrow )
   679         if ( aKeyEvent.iCode == EKeyUpArrow )
   665 	        {
   680             {
   666             iFocused = iHeader;
   681             iFocused = iHeader;
   667     		iHeader->SetFocus( ETrue,EDrawNow );
   682             iHeader->SetFocus( ETrue, ENoDrawNow );
   668     		iMessageField->SetFocus( EFalse, EDrawNow );
   683             iMessageField->SetFocus( EFalse, ENoDrawNow );
   669     		iHeader->MakeVisible( ETrue );
   684             iHeader->MakeVisible( ETrue );
       
   685             iHeader->ShowCursor( ETrue );
   670             CommitL( EBodyField );
   686             CommitL( EBodyField );
   671             ret = EKeyWasConsumed;
   687             ret = EKeyWasConsumed;
   672 	        }
   688             }
   673 	    else if ( aKeyEvent.iCode == EKeyDownArrow && 
   689         else if ( aKeyEvent.iCode == EKeyDownArrow && 
   674 	              iReadOnlyQuoteField->TextLength() )
   690                   iReadOnlyQuoteField->TextLength() )
   675 	        {
   691             {
   676 	        // Focus move to read-only quote only if there is some text in it.
   692             // Focus move to read-only quote only if there is some text in it.
   677 	        iFocused = iReadOnlyQuoteField;
   693             iFocused = iReadOnlyQuoteField;
   678 	        iReadOnlyQuoteField->SetFocus( ETrue, EDrawNow );
   694             iReadOnlyQuoteField->SetFocus( ETrue, ENoDrawNow );
   679 	        iMessageField->SetFocus( EFalse, EDrawNow );
   695             iMessageField->SetFocus( EFalse, ENoDrawNow );
   680 	        iReadOnlyQuoteField->SetCursorPosL( 0, EFalse );
   696             iReadOnlyQuoteField->SetCursorPosL( 0, EFalse );
   681 	        ret = EKeyWasConsumed;
   697             ret = EKeyWasConsumed;
   682 	        }
   698             }
   683         }
   699         }
   684 	else if ( iFocused == iHeader && aKeyEvent.iCode == EKeyDownArrow )
   700     else if ( iFocused == iHeader && aKeyEvent.iCode == EKeyDownArrow )
   685         {
   701         {
   686 		iFocused = iMessageField;
   702         iFocused = iMessageField;
   687 		iHeader->SetFocus( EFalse, EDrawNow );
   703         iHeader->SetFocus( EFalse, ENoDrawNow );
   688 		iMessageField->SetFocus( ETrue, EDrawNow );
   704         iMessageField->SetFocus( ETrue, ENoDrawNow );
   689         iMessageField->SetCursorPosL( 0, EFalse );
   705         iMessageField->SetCursorPosL( 0, EFalse );
   690         ret = EKeyWasConsumed;
   706         ret = EKeyWasConsumed;
   691         }
   707         }
   692 
   708 
   693     if ( ret == EKeyWasConsumed )
   709     if ( ret == EKeyWasConsumed )
   800 // -----------------------------------------------------------------------------
   816 // -----------------------------------------------------------------------------
   801 // CNcsComposeViewContainer::Draw() const
   817 // CNcsComposeViewContainer::Draw() const
   802 // Draws the display
   818 // Draws the display
   803 // -----------------------------------------------------------------------------
   819 // -----------------------------------------------------------------------------
   804 //
   820 //
   805 void CNcsComposeViewContainer::Draw( const TRect& /*aRect*/ ) const
   821 void CNcsComposeViewContainer::Draw( const TRect& aRect ) const
   806     {
   822     {
   807     FUNC_LOG;
   823     FUNC_LOG;
   808 
   824 
   809 	if ( iBgContext )
   825     if ( iBgContext )
   810 	    {
   826         {
   811     	CWindowGc& gc = SystemGc();
   827         CWindowGc& gc = SystemGc();
   812 
   828         MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   813     	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   829         if ( skin )
   814 
   830             {
   815     	if ( skin )
   831             AknsDrawUtils::Background( skin, iBgContext, this, gc, aRect );
   816     		{
   832             }
   817     		AknsDrawUtils::Background( skin, iBgContext, this, gc, Rect() );
   833         }
   818     		}
   834     }
   819 	    }
       
   820     }
       
   821 
       
   822 
   835 
   823 // -----------------------------------------------------------------------------
   836 // -----------------------------------------------------------------------------
   824 // CNcsComposeViewContainer::SetBodyContentL()
   837 // CNcsComposeViewContainer::SetBodyContentL()
   825 // -----------------------------------------------------------------------------
   838 // -----------------------------------------------------------------------------
   826 //
   839 //
  1072 // -----------------------------------------------------------------------------
  1085 // -----------------------------------------------------------------------------
  1073 // CNcsComposeViewContainer::UpdateScrollBarL()
  1086 // CNcsComposeViewContainer::UpdateScrollBarL()
  1074 // -----------------------------------------------------------------------------
  1087 // -----------------------------------------------------------------------------
  1075 //
  1088 //
  1076 void CNcsComposeViewContainer::UpdateScrollBarL()
  1089 void CNcsComposeViewContainer::UpdateScrollBarL()
  1077 	{
  1090     {
  1078     FUNC_LOG;
  1091     FUNC_LOG;
  1079 
  1092 
  1080     TRect headerRect = iHeader->Rect();
  1093     TRect headerRect = iHeader->Rect();
  1081     TRect bodyRect = iMessageField->Rect();
  1094     TRect bodyRect = iMessageField->Rect();
  1082     TRect quoteRect = iReadOnlyQuoteField->Rect();
  1095     TRect quoteRect = iReadOnlyQuoteField->Rect();
  1091     iScrollBarModel.SetScrollSpan( totalComposerHeight );
  1104     iScrollBarModel.SetScrollSpan( totalComposerHeight );
  1092     iScrollBarModel.SetWindowSize( visibleAreaHeight );
  1105     iScrollBarModel.SetWindowSize( visibleAreaHeight );
  1093     iScrollBarModel.SetFocusPosition( visiblePosition );
  1106     iScrollBarModel.SetFocusPosition( visiblePosition );
  1094 
  1107 
  1095     iScrollBar->SetModelL( &iScrollBarModel );
  1108     iScrollBar->SetModelL( &iScrollBarModel );
  1096     iScrollBar->DrawNow();
  1109     iScrollBar->MakeVisible( IsVisible() );
  1097 	}
  1110     }
  1098 
  1111 
  1099 // -----------------------------------------------------------------------------
  1112 // -----------------------------------------------------------------------------
  1100 // CNcsComposeViewContainer::SetFocusToMessageFieldL()
  1113 // CNcsComposeViewContainer::SetFocusToMessageFieldL()
  1101 // -----------------------------------------------------------------------------
  1114 // -----------------------------------------------------------------------------
  1102 //
  1115 //
  1106 
  1119 
  1107     if( iFocused != iMessageField )
  1120     if( iFocused != iMessageField )
  1108         {
  1121         {
  1109         iHeader->SetFocus( EFalse, ENoDrawNow );
  1122         iHeader->SetFocus( EFalse, ENoDrawNow );
  1110         iMessageField->SetCursorPosL( 0, EFalse );
  1123         iMessageField->SetCursorPosL( 0, EFalse );
  1111         iMessageField->SetFocus( ETrue, EDrawNow );
  1124         iMessageField->SetFocus( ETrue, ENoDrawNow );
  1112         iFocused = iMessageField;
  1125         iFocused = iMessageField;
  1113         UpdateScreenPositionL();
  1126         UpdateScreenPositionL();
  1114         DrawDeferred();
  1127         DrawDeferred();
  1115         }
  1128         }
  1116 
       
  1117     }
  1129     }
  1118 
  1130 
  1119 // -----------------------------------------------------------------------------
  1131 // -----------------------------------------------------------------------------
  1120 // CNcsComposeViewContainer::AddQuickTextL()
  1132 // CNcsComposeViewContainer::AddQuickTextL()
  1121 // -----------------------------------------------------------------------------
  1133 // -----------------------------------------------------------------------------
  1807 void CNcsComposeViewContainer::HandleSkinChangeL()
  1819 void CNcsComposeViewContainer::HandleSkinChangeL()
  1808     {
  1820     {
  1809     FUNC_LOG;
  1821     FUNC_LOG;
  1810     if ( iHeader )
  1822     if ( iHeader )
  1811         {
  1823         {
  1812         iHeader->HandleDynamicVariantSwitchL();
  1824         iHeader->HandleSkinChangeL();
  1813         }
  1825         }
  1814 
  1826 
  1815     if ( iMessageField )
  1827     if ( iMessageField )
  1816         {
  1828         {
  1817         iMessageField->UpdateFontSize();
  1829         iMessageField->UpdateFontSize();
  1911 //
  1923 //
  1912 void CNcsComposeViewContainer::ScrollL( TInt aTargetPos )
  1924 void CNcsComposeViewContainer::ScrollL( TInt aTargetPos )
  1913 	{
  1925 	{
  1914     FUNC_LOG;
  1926     FUNC_LOG;
  1915 	TPoint headerPos( iHeader->Position() );
  1927 	TPoint headerPos( iHeader->Position() );
  1916 	
       
  1917 	aTargetPos = Max( 0, Min( aTargetPos, 
       
  1918 	                          ContentTotalHeight() - Rect().Height()) );
       
  1919 	
  1928 	
  1920 	TInt moveY = -headerPos.iY - aTargetPos;
  1929 	TInt moveY = -headerPos.iY - aTargetPos;
  1921 	
  1930 	
  1922 	if( moveY )
  1931 	if( moveY )
  1923 		{
  1932 		{
  1936 			}
  1945 			}
  1937 		
  1946 		
  1938 		iSeparatorLineYPos += moveY;
  1947 		iSeparatorLineYPos += moveY;
  1939 	
  1948 	
  1940 		UpdateScrollBarL();
  1949 		UpdateScrollBarL();
  1941 		DrawNow();
  1950 		DrawDeferred();
  1942 		}
  1951 		}
  1943 	}
  1952 	}
  1944 
  1953 
  1945 // -----------------------------------------------------------------------------
  1954 // -----------------------------------------------------------------------------
  1946 // CNcsComposeViewContainer::ViewPositionChanged
  1955 // CNcsComposeViewContainer::ViewPositionChanged
  1951         const TPoint& aNewPosition,
  1960         const TPoint& aNewPosition,
  1952         TBool /*aDrawNow*/,
  1961         TBool /*aDrawNow*/,
  1953         TUint /*aFlags*/ )
  1962         TUint /*aFlags*/ )
  1954     {
  1963     {
  1955     FUNC_LOG;
  1964     FUNC_LOG;
  1956 	if( iIsFlicking )
  1965 	TInt scrollOffset = aNewPosition.iY - Rect().Size().iHeight / 2;
  1957 		{
  1966 
  1958 		TInt scrollOffset = aNewPosition.iY - Rect().Size().iHeight / 2;
  1967 	TRAP_IGNORE( ScrollL( scrollOffset ) );
  1959 
       
  1960 		TRAP_IGNORE( ScrollL( scrollOffset ) );
       
  1961 		}
       
  1962 	}
  1968 	}
  1963 
  1969 
  1964 // -----------------------------------------------------------------------------
  1970 // -----------------------------------------------------------------------------
  1965 // CNcsComposeViewContainer::PhysicEmulationEnded
  1971 // CNcsComposeViewContainer::PhysicEmulationEnded
  1966 // From MAknPhysicsObserver
  1972 // From MAknPhysicsObserver