emailuis/emailui/src/ncscomposeviewcontainer.cpp
branchRCL_3
changeset 16 b5fbb9b25d57
parent 14 b13141f05c3d
child 17 67369d1b217f
equal deleted inserted replaced
14:b13141f05c3d 16:b5fbb9b25d57
    51 #include "FreestyleEmailUiSendAttachmentsListModel.h"
    51 #include "FreestyleEmailUiSendAttachmentsListModel.h"
    52 #include "FreestyleEmailUi.hrh"
    52 #include "FreestyleEmailUi.hrh"
    53 #include "FSAutoSaver.h"
    53 #include "FSAutoSaver.h"
    54 #include "FreestyleEmailUiCLSItem.h"
    54 #include "FreestyleEmailUiCLSItem.h"
    55 
    55 
       
    56 
       
    57 const TInt KHeaderVisibilityThreshold = -100;
    56 
    58 
    57 // ========================= MEMBER FUNCTIONS ==================================
    59 // ========================= MEMBER FUNCTIONS ==================================
    58 
    60 
    59 // ---------------------------------------------------------------------------
    61 // ---------------------------------------------------------------------------
    60 // constructor
    62 // constructor
   360                 TInt drag( iOriginalPosition.iY - aPointerEvent.iPosition.iY );
   362                 TInt drag( iOriginalPosition.iY - aPointerEvent.iPosition.iY );
   361                 if ( Abs( drag ) > iPhysics->DragThreshold() )
   363                 if ( Abs( drag ) > iPhysics->DragThreshold() )
   362                     {
   364                     {
   363 					// If user started dragging, cancel hotspot actions
   365 					// If user started dragging, cancel hotspot actions
   364 					iIsDragging = ETrue;
   366 					iIsDragging = ETrue;
   365 					iMessageField->SetCursorVisible( EFalse );
   367 					iMessageField->SetPhysicsEmulationOngoing( ETrue );
   366 					iReadOnlyQuoteField->SetCursorVisible( EFalse );
   368 					iReadOnlyQuoteField->SetPhysicsEmulationOngoing( ETrue );
   367 					iHeader->SetPhysicsEmulationOngoing( ETrue );
   369 					iHeader->SetPhysicsEmulationOngoing( ETrue );
   368                     }
   370                     }
   369                 }
   371                 }
   370 
   372 
   371             // Get current pointer position
   373             // Get current pointer position
   787         {
   789         {
   788         iMessageEditorMinHeigth = messageLineHeigth;
   790         iMessageEditorMinHeigth = messageLineHeigth;
   789         }
   791         }
   790 
   792 
   791 	// update some layout variables
   793 	// update some layout variables
   792     TRect headerRect = iHeader->Rect();
   794     iHeaderHeight = iHeader->Rect().Height();
   793     TRect bodyRect = iMessageField->Rect();
   795     TRect bodyRect = iMessageField->Rect();
   794     TRect quoteRect = iReadOnlyQuoteField->Rect();
   796     TRect quoteRect = iReadOnlyQuoteField->Rect();
   795 
   797 
   796     iTotalComposerHeight = headerRect.Height() + iSeparatorHeight * 2 + 
   798     iTotalComposerHeight = iHeaderHeight + iSeparatorHeight * 2 + 
   797 							   bodyRect.Height() + quoteRect.Height();
   799 							   bodyRect.Height() + quoteRect.Height();
   798     
   800     
   799     iVisibleAreaHeight = Rect().Height();
   801     iVisibleAreaHeight = Rect().Height();
   800         
   802         
   801     UpdateScrollBar();
   803     UpdateScrollBar();
   996 //
   998 //
   997 void CNcsComposeViewContainer::HandleEdwinEventL( CEikEdwin* aEdwin,
   999 void CNcsComposeViewContainer::HandleEdwinEventL( CEikEdwin* aEdwin,
   998     TEdwinEvent aEventType )
  1000     TEdwinEvent aEventType )
   999     {
  1001     {
  1000     FUNC_LOG;
  1002     FUNC_LOG;
  1001     if ( aEdwin == iMessageField || aEdwin == iReadOnlyQuoteField )
  1003     if (( aEdwin == iMessageField || aEdwin == iReadOnlyQuoteField ) && 
       
  1004          ( !iPhysics || iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionNone ))
  1002         {
  1005         {
  1003         if ( aEventType == MEikEdwinObserver::EEventTextUpdate ||
  1006         if ( aEventType == MEikEdwinObserver::EEventTextUpdate ||
  1004              aEventType == MEikEdwinObserver::EEventNavigation )
  1007              aEventType == MEikEdwinObserver::EEventNavigation )
  1005             {
  1008             {
  1006             iAutoSaver.ReportActivity();
  1009             iAutoSaver.ReportActivity();
  1914 		iTotalMoveY = 0;
  1917 		iTotalMoveY = 0;
  1915 		if ( moveY )
  1918 		if ( moveY )
  1916 			{
  1919 			{
  1917 			headerPos.iY += moveY;
  1920 			headerPos.iY += moveY;
  1918 			iHeader->SetPosition( headerPos );
  1921 			iHeader->SetPosition( headerPos );
  1919 	
  1922 
       
  1923 			// set header invisible if it is not in visible area
       
  1924 			// this is done to prevent drawing of header when it is not necessary
       
  1925             if ( headerPos.iY + iHeaderHeight <= KHeaderVisibilityThreshold && iHeader->IsVisible() )
       
  1926                 {            
       
  1927                 iHeader->MakeVisible( EFalse );
       
  1928                 }
       
  1929             // set header visible if it is in visible area
       
  1930             else if ( headerPos.iY + iHeaderHeight > KHeaderVisibilityThreshold && !iHeader->IsVisible() ) 
       
  1931                 {
       
  1932                 iHeader->MakeVisible( ETrue );
       
  1933                 }
       
  1934     
  1920 			TPoint msgPos( iMessageField->Position() );
  1935 			TPoint msgPos( iMessageField->Position() );
  1921 			msgPos.iY += moveY;
  1936 			msgPos.iY += moveY;
  1922 			iMessageField->SetPosition( msgPos );
  1937 			iMessageField->SetPosition( msgPos );
  1923 	
  1938 	
  1924 			if( iReadOnlyQuoteField->IsVisible() )
  1939 			if( iReadOnlyQuoteField->IsVisible() )
  1929 				}
  1944 				}
  1930 	
  1945 	
  1931 			iSeparatorLineYPos += moveY;
  1946 			iSeparatorLineYPos += moveY;
  1932 
  1947 
  1933 			UpdateScrollBar();
  1948 			UpdateScrollBar();
  1934 			DrawNow();
  1949 			DrawDeferred();
  1935 			}
  1950 			}
  1936     	}
  1951     	}
  1937     else
  1952     else
  1938     	{
  1953     	{
  1939 		iTotalMoveY += moveY;
  1954 		iTotalMoveY += moveY;
  1948 void CNcsComposeViewContainer::ViewPositionChanged(
  1963 void CNcsComposeViewContainer::ViewPositionChanged(
  1949     const TPoint& aNewPosition, TBool aDrawNow, TUint /*aFlags*/ )
  1964     const TPoint& aNewPosition, TBool aDrawNow, TUint /*aFlags*/ )
  1950     {
  1965     {
  1951     FUNC_LOG;
  1966     FUNC_LOG;
  1952     TInt scrollOffset = aNewPosition.iY - iVisibleAreaHeight / 2;
  1967     TInt scrollOffset = aNewPosition.iY - iVisibleAreaHeight / 2;
       
  1968 
       
  1969 	// when the composer view is overlapped by other view for instance task switcher or screensaver
       
  1970 	// physics sends a faulty event to move the composer view down. 
       
  1971 	// This action is ignored here.	
       
  1972 	if (aNewPosition.iY != 0)
       
  1973 		{    	
  1953     Scroll( scrollOffset, aDrawNow );
  1974     Scroll( scrollOffset, aDrawNow );
  1954     }
  1975     }
       
  1976 	}
  1955 
  1977 
  1956 // -----------------------------------------------------------------------------
  1978 // -----------------------------------------------------------------------------
  1957 // CNcsComposeViewContainer::PhysicEmulationEnded
  1979 // CNcsComposeViewContainer::PhysicEmulationEnded
  1958 // From MAknPhysicsObserver
  1980 // From MAknPhysicsObserver
  1959 // -----------------------------------------------------------------------------
  1981 // -----------------------------------------------------------------------------
  1960 //
  1982 //
  1961 void CNcsComposeViewContainer::PhysicEmulationEnded()
  1983 void CNcsComposeViewContainer::PhysicEmulationEnded()
  1962     {
  1984     {
  1963     FUNC_LOG;
  1985     FUNC_LOG;
  1964     iIsFlicking = EFalse;
  1986     iIsFlicking = EFalse;
  1965     iMessageField->SetCursorVisible( ETrue );
  1987     iMessageField->SetPhysicsEmulationOngoing( EFalse );
  1966     iReadOnlyQuoteField->SetCursorVisible( ETrue );
  1988     iReadOnlyQuoteField->SetPhysicsEmulationOngoing( EFalse );
  1967     iHeader->SetPhysicsEmulationOngoing( EFalse );
  1989     iHeader->SetPhysicsEmulationOngoing( EFalse );
  1968     }
  1990     }
  1969 
  1991 
  1970 // -----------------------------------------------------------------------------
  1992 // -----------------------------------------------------------------------------
  1971 // CNcsComposeViewContainer::ViewPosition
  1993 // CNcsComposeViewContainer::ViewPosition