emailuis/emailui/src/ncssubjectfield.cpp
branchRCL_3
changeset 73 c8382f7b54ef
parent 64 3533d4323edc
child 80 726fba06891a
equal deleted inserted replaced
70:968773a0b6ef 73:c8382f7b54ef
    19 
    19 
    20 #include "emailtrace.h"
    20 #include "emailtrace.h"
    21 #include <AknIconUtils.h>
    21 #include <AknIconUtils.h>
    22 #include <avkon.hrh>
    22 #include <avkon.hrh>
    23 #include <eiklabel.h>
    23 #include <eiklabel.h>
       
    24 #include <aknbutton.h>
    24 #include <eikimage.h>
    25 #include <eikimage.h>
    25 #include <eikenv.h>
    26 #include <eikenv.h>
    26 #include <AknsDrawUtils.h>
    27 #include <AknsDrawUtils.h>
    27 #include <AknUtils.h>
    28 #include <AknUtils.h>
    28 #include <StringLoader.h>
    29 #include <StringLoader.h>
    79     {
    80     {
    80     FUNC_LOG;
    81     FUNC_LOG;
    81     // Create label
    82     // Create label
    82 	HBufC* aTextBuf = StringLoader::LoadLC( aLabelTextId );
    83 	HBufC* aTextBuf = StringLoader::LoadLC( aLabelTextId );
    83     TPtrC captionText = aTextBuf ? aTextBuf->Des() : TPtrC();
    84     TPtrC captionText = aTextBuf ? aTextBuf->Des() : TPtrC();
    84     iLabel = new ( ELeave ) CNcsLabel( *this, NULL );
    85 
    85     iLabel->SetTextL( captionText );
    86     if( AknLayoutUtils::PenEnabled() )
    86 
    87         {
    87     // S60 Skin support
    88         // Create a frameless button that has no observer
    88 	iLabel->SetBrushStyle(CWindowGc::ENullBrush);
    89         // This is done like this to make Subject: field appear similar as
    89 
    90         // other header fields (To:, Cc:), although it doesn't have other
    90     iTextEditor = new ( ELeave ) CNcsEditor( iSizeObserver, ETrue, ENcsEditorSubject, captionText );
    91         // button-like features
       
    92         TRect buttRect( 10, 10, 70, 100 );
       
    93         iButton = CAknButton::NewL( NULL, NULL, NULL, NULL, 
       
    94                                     captionText, TPtrC(), 
       
    95                                     KAknButtonTextLeft | KAknButtonNoFrame ,
       
    96                                     0 );
       
    97         iButton->SetTextColorIds( 
       
    98                 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG63 );
       
    99         iButton->SetContainerWindowL( *iParentControl );
       
   100         iButton->SetRect( buttRect );
       
   101         iButton->EnableFeedback( EFalse );
       
   102         iButton->MakeVisible( ETrue );
       
   103         iButton->ActivateL();
       
   104         }
       
   105     else
       
   106         {
       
   107         iLabel = new ( ELeave ) CNcsLabel( *this, NULL );
       
   108         iLabel->SetTextL( captionText );
       
   109     
       
   110         // S60 Skin support
       
   111         iLabel->SetBrushStyle(CWindowGc::ENullBrush);
       
   112         }
       
   113     
       
   114     iTextEditor = new ( ELeave ) CNcsEditor( 
       
   115             iSizeObserver, ETrue, ENcsEditorSubject, captionText );
    91     CleanupStack::PopAndDestroy( aTextBuf );
   116     CleanupStack::PopAndDestroy( aTextBuf );
    92     }
   117     }
    93 
   118 
    94 // ---------------------------------------------------------------------------
   119 // ---------------------------------------------------------------------------
    95 // Destructor
   120 // Destructor
    98 CNcsSubjectField::~CNcsSubjectField()
   123 CNcsSubjectField::~CNcsSubjectField()
    99     {
   124     {
   100     FUNC_LOG;
   125     FUNC_LOG;
   101     delete iTextEditor;
   126     delete iTextEditor;
   102     delete iLabel;
   127     delete iLabel;
   103     // Platform layout change
   128     delete iButton;
   104     /*if ( iFont )
       
   105         {
       
   106         ControlEnv()->ScreenDevice()->ReleaseFont( iFont );
       
   107         iFont = NULL;
       
   108         }*/
       
   109     }
   129     }
   110 
   130 
   111 // -----------------------------------------------------------------------------
   131 // -----------------------------------------------------------------------------
   112 // CNcsSubjectField::SetContainerWindowL() const
   132 // CNcsSubjectField::SetContainerWindowL() const
   113 // -----------------------------------------------------------------------------
   133 // -----------------------------------------------------------------------------
   114 //
   134 //
   115 void CNcsSubjectField::SetContainerWindowL(const CCoeControl& aContainer)
   135 void CNcsSubjectField::SetContainerWindowL( const CCoeControl& aContainer )
   116 	{
   136 	{
   117     FUNC_LOG;
   137     FUNC_LOG;
   118 	CCoeControl::SetContainerWindowL(aContainer);
   138 	CCoeControl::SetContainerWindowL( aContainer );
   119 
   139 
   120 	// Create the component array
   140 	// Create the component array
   121     InitComponentArrayL();
   141     InitComponentArrayL();
   122 	CCoeControlArray& controls = Components();
   142 	CCoeControlArray& controls = Components();
   123 	controls.SetControlsOwnedExternally(ETrue);
   143 	controls.SetControlsOwnedExternally( ETrue );
   124 	controls.AppendLC(iLabel);
   144 	if ( iButton )
   125 	CleanupStack::Pop(iLabel);
   145 	    {
   126 	controls.AppendLC(iTextEditor);
   146         controls.AppendLC( iButton );
   127     CleanupStack::Pop(iTextEditor);
   147         CleanupStack::Pop( iButton );
       
   148 	    }
       
   149 	else
       
   150 	    {
       
   151         controls.AppendLC( iLabel );
       
   152         CleanupStack::Pop( iLabel );
       
   153 	    }
       
   154 	controls.AppendLC( iTextEditor );
       
   155     CleanupStack::Pop( iTextEditor );
   128 
   156 
   129     // Setup text editor
   157     // Setup text editor
   130     iTextEditor->ConstructL( &aContainer, KMaxAddressFieldLines, 0 );
   158     iTextEditor->ConstructL( &aContainer, KMaxAddressFieldLines, 0 );
   131 	iTextEditor->SetBorder( TGulBorder::ENone );
   159 	iTextEditor->SetBorder( TGulBorder::ENone );
   132     iTextEditor->SetAknEditorInputMode( EAknEditorTextInputMode );
   160     iTextEditor->SetAknEditorInputMode( EAknEditorTextInputMode );
   133 	iTextEditor->CreateScrollBarFrameL()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff );
   161 	iTextEditor->CreateScrollBarFrameL()->SetScrollBarVisibilityL( 
       
   162 	        CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff );
   134     iTextEditor->SetEdwinSizeObserver( this );
   163     iTextEditor->SetEdwinSizeObserver( this );
   135     iTextEditor->SetupEditorL();
   164     iTextEditor->SetupEditorL();
   136     // Setup label
   165     // Setup label
   137     UpdateFontSize();
   166     UpdateFontSize();
   138     UpdateColors();
   167     UpdateColors();
   155 // -----------------------------------------------------------------------------
   184 // -----------------------------------------------------------------------------
   156 //
   185 //
   157 TInt CNcsSubjectField::GetMinLabelLength() const
   186 TInt CNcsSubjectField::GetMinLabelLength() const
   158 	{
   187 	{
   159     FUNC_LOG;
   188     FUNC_LOG;
   160     return iLabel->Font()->TextWidthInPixels( *iLabel->Text() );
   189     return iLabel ? iLabel->Font()->TextWidthInPixels( *iLabel->Text() ) : 0;
   161 	}
   190 	}
   162 
   191 
   163 // -----------------------------------------------------------------------------
   192 // -----------------------------------------------------------------------------
   164 // CNcsSubjectField::SizeChanged()
   193 // CNcsSubjectField::SizeChanged()
   165 // set size
   194 // set size
   168 void CNcsSubjectField::SizeChanged()
   197 void CNcsSubjectField::SizeChanged()
   169     {
   198     {
   170     FUNC_LOG;
   199     FUNC_LOG;
   171 	
   200 	
   172     const TRect rect( Rect() );
   201     const TRect rect( Rect() );
   173     NcsUtility::LayoutCaptionLabel( iLabel, rect );
   202     if ( iButton )
   174     NcsUtility::LayoutDetailEdwinTouch( iTextEditor, rect, iEditorLineCount, EFalse );  
   203         {
       
   204         NcsUtility::LayoutCaptionButton( iButton, rect );
       
   205         }
       
   206     else
       
   207         {
       
   208         NcsUtility::LayoutCaptionLabel( iLabel, rect );
       
   209         }
       
   210 
       
   211     NcsUtility::LayoutDetailEdwinTouch( 
       
   212             iTextEditor, rect, iEditorLineCount, EFalse );  
   175     
   213     
   176     if (iTextEditor->ScrollBarFrame())
   214     if ( iTextEditor->ScrollBarFrame() )
   177         {
   215         {
   178         TRect rc = iTextEditor->Rect();
   216         TRect rc = iTextEditor->Rect();
   179         if (AknLayoutUtils::LayoutMirrored())
   217         if ( AknLayoutUtils::LayoutMirrored() )
   180             {
   218             {
   181             rc.iTl.iX += iTextEditor->ScrollBarFrame()->ScrollBarBreadth(CEikScrollBar::EVertical);
   219             rc.iTl.iX += iTextEditor->ScrollBarFrame()->ScrollBarBreadth( 
       
   220                     CEikScrollBar::EVertical );
   182             }
   221             }
   183         else
   222         else
   184             {
   223             {
   185             rc.iBr.iX -= iTextEditor->ScrollBarFrame()->ScrollBarBreadth(CEikScrollBar::EVertical);
   224             rc.iBr.iX -= iTextEditor->ScrollBarFrame()->ScrollBarBreadth( 
   186             }
   225                     CEikScrollBar::EVertical );
   187         iTextEditor->SetRect(rc);
   226             }
       
   227         iTextEditor->SetRect( rc );
   188         }
   228         }
   189 
   229 
   190     // Setup text alignment according the mirrored/normal layout.
   230     // Setup text alignment according the mirrored/normal layout.
   191     if ( AknLayoutUtils::LayoutMirrored() )
   231     if ( iLabel )
   192         {
   232         {
   193         iLabel->SetAlignment( EHLeftVCenter );
   233         if ( AknLayoutUtils::LayoutMirrored() )
   194         iLabel->SetLabelAlignment( ELayoutAlignLeft );
   234             {
   195         }
   235             iLabel->SetAlignment( EHLeftVCenter );
   196     else
   236             iLabel->SetLabelAlignment( ELayoutAlignLeft );
   197         {
   237             }
   198         iLabel->SetAlignment( EHRightVCenter );
   238         else
   199         iLabel->SetLabelAlignment( ELayoutAlignRight );
   239             {
   200         }
   240             iLabel->SetAlignment( EHRightVCenter );
   201     
   241             iLabel->SetLabelAlignment( ELayoutAlignRight );
       
   242             }
       
   243         }
       
   244 
   202     // this needs to be bidi as in mirrored layout 
   245     // this needs to be bidi as in mirrored layout 
   203     // writing language left to right can be set 
   246     // writing language left to right can be set 
   204     iTextEditor->SetAlignment( EAknEditorAlignBidi );
   247     iTextEditor->SetAlignment( EAknEditorAlignBidi );
   205     
   248     
   206 	UpdateFontSize();
   249 	UpdateFontSize();
   208 	iTextEditor->UpdateCustomDrawer();
   251 	iTextEditor->UpdateCustomDrawer();
   209     }
   252     }
   210 
   253 
   211 // -----------------------------------------------------------------------------
   254 // -----------------------------------------------------------------------------
   212 // CNcsSubjectField::PositionChanged()
   255 // CNcsSubjectField::PositionChanged()
   213 // set size
       
   214 // -----------------------------------------------------------------------------
   256 // -----------------------------------------------------------------------------
   215 //
   257 //
   216 void CNcsSubjectField::PositionChanged()
   258 void CNcsSubjectField::PositionChanged()
   217     {
   259     {
   218     FUNC_LOG;
   260     FUNC_LOG;
   219     //SizeChanged();
   261     // empty
   220     }
   262     }
   221 
   263 
   222 // -----------------------------------------------------------------------------
   264 // -----------------------------------------------------------------------------
   223 // CNcsSubjectField::OfferKeyEventL()
   265 // CNcsSubjectField::OfferKeyEventL()
   224 // Handles key events
   266 // Handles key events
   225 // -----------------------------------------------------------------------------
   267 // -----------------------------------------------------------------------------
   226 //
   268 //
   227 TKeyResponse CNcsSubjectField::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
   269 TKeyResponse CNcsSubjectField::OfferKeyEventL( 
       
   270         const TKeyEvent& aKeyEvent, TEventCode aType )
   228     {
   271     {
   229     FUNC_LOG;
   272     FUNC_LOG;
   230 	TKeyResponse ret( EKeyWasNotConsumed );
   273 	TKeyResponse ret( EKeyWasNotConsumed );
   231 
   274 
   232 	ret = iTextEditor->OfferKeyEventL( aKeyEvent, aType );
   275 	ret = iTextEditor->OfferKeyEventL( aKeyEvent, aType );
   238 // Handles pointer events
   281 // Handles pointer events
   239 // -----------------------------------------------------------------------------
   282 // -----------------------------------------------------------------------------
   240 //
   283 //
   241 void CNcsSubjectField::HandlePointerEventL( const TPointerEvent& aPointerEvent )
   284 void CNcsSubjectField::HandlePointerEventL( const TPointerEvent& aPointerEvent )
   242     {
   285     {
   243 	FUNC_LOG;
   286     FUNC_LOG;
   244     iTextEditor->HandlePointerEventL( aPointerEvent );
   287     CCoeControl::HandlePointerEventL( aPointerEvent );
   245     iTextEditor->HandleTextChangedL();
       
   246     }
   288     }
   247 
   289 
   248 // -----------------------------------------------------------------------------
   290 // -----------------------------------------------------------------------------
   249 // CNcsSubjectField::FocusChanged()
   291 // CNcsSubjectField::FocusChanged()
   250 // -----------------------------------------------------------------------------
   292 // -----------------------------------------------------------------------------
   251 //
   293 //
   252 void CNcsSubjectField::FocusChanged( TDrawNow aDrawNow )
   294 void CNcsSubjectField::FocusChanged( TDrawNow aDrawNow )
   253 	{
   295     {
   254     FUNC_LOG;
   296     FUNC_LOG;
   255 	if ( IsFocused() )
   297     if ( IsFocused() )
   256 		{
   298         {
   257 		iTextEditor->SetFocus( ETrue );
   299         iTextEditor->SetFocus( ETrue, aDrawNow );
   258 		//TRAP_IGNORE( iTextEditor->SetCursorPosL( iTextEditor->TextLength(), EFalse ) ); 
   300         if ( iParentControl )
   259 
   301             {
   260 		// make sure that control is visible on screen
   302             TRAP_IGNORE( iParentControl->SetMskL() );
   261 		if ( Rect().iTl.iY < 0 )
   303             }
   262 			{
   304         }
   263 			TPoint pt = TPoint( 0, 0 );
   305     else
   264 			Reposition( pt, Rect().Width() );
   306         {
   265 			iSizeObserver->UpdateFieldPosition( this );
   307         iTextEditor->SetFocus( EFalse, aDrawNow );
   266 			}
   308         }
   267 		else
   309 
   268 			{
   310     if ( aDrawNow )
   269 			TPoint pos = PositionRelativeToScreen();
   311         {
   270 			pos.iY += Size().iHeight;
   312         DrawNow();
   271 			CWsScreenDevice* screenDev = ControlEnv()->ScreenDevice();
   313         }
   272 			TPixelsAndRotation pix;
   314     }
   273 			screenDev->GetDefaultScreenSizeAndRotation( pix );
       
   274 			const TInt h = pix.iPixelSize.iHeight;
       
   275 			if ( pos.iY >= h - h / 3 )
       
   276 				{
       
   277 				TPoint pt = TPoint( 0, h / 3 );
       
   278 				Reposition( pt, Rect().Width() );
       
   279 				iSizeObserver->UpdateFieldPosition( this );
       
   280 				}
       
   281 			}
       
   282 
       
   283 		if ( iParentControl )
       
   284 			{
       
   285 			TRAP_IGNORE( iParentControl->SetMskL() );
       
   286 			}
       
   287 		}
       
   288 	else
       
   289 		{
       
   290 		iTextEditor->SetFocus( EFalse );
       
   291 		}
       
   292 
       
   293 	if ( aDrawNow )
       
   294 		{
       
   295 		DrawNow();
       
   296 		}
       
   297 	}
       
   298 
   315 
   299 // -----------------------------------------------------------------------------
   316 // -----------------------------------------------------------------------------
   300 // CNcsSubjectField::MinimumHeight()
   317 // CNcsSubjectField::MinimumHeight()
   301 // return height of subject control
   318 // return height of subject control
   302 // -----------------------------------------------------------------------------
   319 // -----------------------------------------------------------------------------
   303 //
   320 //
   304 TInt CNcsSubjectField::MinimumHeight()
   321 TInt CNcsSubjectField::MinimumHeight()
   305     {
   322     {
   306     FUNC_LOG;
   323     FUNC_LOG;
   307     // Platform layout changes
       
   308     /*
       
   309     TNcsMeasures m = NcsUtility::Measures();
       
   310 	TInt height = m.iAifHeight - m.iAifEditorHeight + iEditorMinimumHeight + m.iSubjectExtraHeightBottom;
       
   311 	TInt height2 = m.iAifHeight + m.iSubjectExtraHeightBottom;
       
   312 	// if followup icon and priority icon are both visible increase the subject field height
       
   313 	if ( iFollowUp && iPriority != EMsgPriorityNormal )
       
   314 	    {
       
   315 	    height2 += KIconHeightFollowUp;
       
   316 	    }
       
   317     return Max( height, height2 );
       
   318     */
       
   319     //return NcsUtility::MinimumHeaderSize( Rect(), iEditorLineCount ).iHeight;
       
   320     // Platform layout changes
       
   321     return 0;
   324     return 0;
   322     }
   325     }
   323 
   326 
   324 // -----------------------------------------------------------------------------
   327 // -----------------------------------------------------------------------------
   325 // CNcsSubjectField::SetSubjectL()
   328 // CNcsSubjectField::SetSubjectL()
   339             }
   342             }
   340 
   343 
   341         RMemReadStream inputStream( aSubject.Ptr(), aSubject.Size() );
   344         RMemReadStream inputStream( aSubject.Ptr(), aSubject.Size() );
   342 	    CleanupClosePushL( inputStream );
   345 	    CleanupClosePushL( inputStream );
   343 
   346 
   344 	  	iTextEditor->RichText()->ImportTextL( 0, inputStream, CPlainText::EOrganiseByParagraph );
   347 	  	iTextEditor->RichText()->ImportTextL( 
       
   348 	  	        0, inputStream, CPlainText::EOrganiseByParagraph );
   345 
   349 
   346 		// Activating the field will set the control to the end of the text
   350 		// Activating the field will set the control to the end of the text
   347 	    iTextEditor->ActivateL();
   351 	    iTextEditor->ActivateL();
   348 	    iTextEditor->SetCursorPosL(0,EFalse);
   352 	    iTextEditor->SetCursorPosL( 0, EFalse );
   349 
   353 
   350 	    CleanupStack::PopAndDestroy( &inputStream );
   354 	    CleanupStack::PopAndDestroy( &inputStream );
   351     	}
   355     	}
   352     }
   356     }
   353 
   357 
   357 //
   361 //
   358 TBool CNcsSubjectField::HandleEdwinSizeEventL( CEikEdwin* /*aEdwin*/,
   362 TBool CNcsSubjectField::HandleEdwinSizeEventL( CEikEdwin* /*aEdwin*/,
   359 	TEdwinSizeEvent /*aEventType*/, TSize aDesirableEdwinSize )
   363 	TEdwinSizeEvent /*aEventType*/, TSize aDesirableEdwinSize )
   360     {
   364     {
   361     FUNC_LOG;
   365     FUNC_LOG;
   362     //  Platform layout chage
       
   363     /*
       
   364     TInt ret( EFalse );
   366     TInt ret( EFalse );
   365     TInt htLine = iTextEditor->GetLineHeightL();
   367     TInt htLine = iTextEditor->GetLineHeightL();
   366     TInt numLinesDesired = aDesirableEdwinSize.iHeight / htLine;
   368     TInt numLinesDesired = aDesirableEdwinSize.iHeight / htLine;
   367 
       
   368     if ( numLinesDesired < KMaxAddressFieldLines &&
       
   369          iEditorMinimumHeight != aDesirableEdwinSize.iHeight )
       
   370         {
       
   371         iEditorMinimumHeight = aDesirableEdwinSize.iHeight;
       
   372         iTextEditor->CreateScrollBarFrameL()->SetScjrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff );
       
   373         if ( iSizeObserver )
       
   374             {
       
   375             ret = iSizeObserver->UpdateFieldSizeL();
       
   376             }
       
   377         }
       
   378     else if ( iEditorMinimumHeight != htLine * KMaxAddressFieldLines )
       
   379         {
       
   380         //We may still need to resize the controll.
       
   381         iEditorMinimumHeight = htLine * KMaxAddressFieldLines;
       
   382         iTextEditor->CreateScrollBarFrameL()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOn );
       
   383         if ( iSizeObserver )
       
   384             {
       
   385             ret = iSizeObserver->UpdateFieldSizeL();
       
   386             }
       
   387         }
       
   388     */
       
   389 
       
   390     TInt ret( EFalse );
       
   391     TInt htLine = iTextEditor->GetLineHeightL();
       
   392     TInt numLinesDesired = aDesirableEdwinSize.iHeight / htLine;
       
   393     // commented because of EGWG-83ECSR, no negative feedback after removing
       
   394     //CEikScrollBarFrame& scrollBarFrame( *iTextEditor->CreateScrollBarFrameL() );
       
   395     iEditorLineCount = numLinesDesired;
   369     iEditorLineCount = numLinesDesired;
   396     //scrollBarFrame.SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff );
       
   397     if ( iSizeObserver )
   370     if ( iSizeObserver )
   398         {
   371         {
   399         ret = iSizeObserver->UpdateFieldSizeL();
   372         ret = iSizeObserver->UpdateFieldSizeL();
   400         }
   373         }
   401     return ret;
   374     return ret;
   476 	{
   449 	{
   477     FUNC_LOG;
   450     FUNC_LOG;
   478 	return KNullDesC;
   451 	return KNullDesC;
   479 	}
   452 	}
   480 
   453 
   481 // Platform layout change
       
   482 // ---------------------------------------------------------------------------
   454 // ---------------------------------------------------------------------------
   483 // CNcsSubjectField::LayoutLineCount
   455 // CNcsSubjectField::LayoutLineCount
   484 // ---------------------------------------------------------------------------
   456 // ---------------------------------------------------------------------------
   485 //
   457 //
   486 TInt CNcsSubjectField::LayoutLineCount() const
   458 TInt CNcsSubjectField::LayoutLineCount() const
   493 // CNcsSubjectField::Reposition
   465 // CNcsSubjectField::Reposition
   494 // -----------------------------------------------------------------------------
   466 // -----------------------------------------------------------------------------
   495 void CNcsSubjectField::Reposition(TPoint& aPt, TInt /*aWidth*/)
   467 void CNcsSubjectField::Reposition(TPoint& aPt, TInt /*aWidth*/)
   496 	{
   468 	{
   497     FUNC_LOG;
   469     FUNC_LOG;
   498     /*
       
   499 	const TSize size( aWidth, MinimumHeight() );
       
   500     SetExtent( aPt, size );
       
   501     aPt.iY += size.iHeight;
       
   502     */
       
   503     SetPosition( aPt );
   470     SetPosition( aPt );
   504     // Platform layout changes
       
   505 	}
   471 	}
   506 
   472 
   507 // -----------------------------------------------------------------------------
   473 // -----------------------------------------------------------------------------
   508 // CNcsSubjectField::GetLineRectL
   474 // CNcsSubjectField::GetLineRectL
   509 // -----------------------------------------------------------------------------
   475 // -----------------------------------------------------------------------------
   510 void CNcsSubjectField::GetLineRectL( TRect& aLineRect ) const
   476 void CNcsSubjectField::GetLineRect( TRect& aLineRect ) const
   511 	{
   477     {
   512     FUNC_LOG;
   478     FUNC_LOG;
   513     return iTextEditor->GetLineRectL( aLineRect );
   479     return iTextEditor->GetLineRect( aLineRect );
   514 	}
   480     }
   515 
   481 
   516 // -----------------------------------------------------------------------------
   482 // -----------------------------------------------------------------------------
   517 // CNcsSubjectField::SetMaxLabelLength
   483 // CNcsSubjectField::SetMaxLabelLength
   518 // -----------------------------------------------------------------------------
   484 // -----------------------------------------------------------------------------
   519 void CNcsSubjectField::SetMaxLabelLength( TInt aMaxLength )
   485 void CNcsSubjectField::SetMaxLabelLength( TInt aMaxLength )
   536 // ---------------------------------------------------------------------------
   502 // ---------------------------------------------------------------------------
   537 //
   503 //
   538 void CNcsSubjectField::UpdateColors()
   504 void CNcsSubjectField::UpdateColors()
   539     {
   505     {
   540 	FUNC_LOG;
   506 	FUNC_LOG;
   541     // Platform layout change
   507 
   542     TRgb textColor = KRgbBlack;
   508 	if ( iLabel )
   543     if ( AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), textColor,
   509 	    {
   544         KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ) != KErrNone )
   510         TRgb textColor = KRgbBlack;
   545         {
   511         if ( AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), textColor,
   546         textColor = KRgbBlack;
   512             KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ) != KErrNone )
   547         }
   513             {
   548     TRAP_IGNORE( iLabel->OverrideColorL( EColorLabelText, textColor ) );
   514             textColor = KRgbBlack;
   549     // Platform layout change
   515             }
   550 
   516         TRAP_IGNORE( iLabel->OverrideColorL( EColorLabelText, textColor ) );
   551     CFreestyleEmailUiAppUi* appUi =
   517         }
   552         static_cast<CFreestyleEmailUiAppUi*>( ControlEnv()->AppUi() );
   518     }
   553     iBorderColor = appUi->LayoutHandler()->ComposerFieldBorderColor();
   519 
   554     iBgColor = appUi->LayoutHandler()->ComposerFieldBackgroundColor();
       
   555     }
       
   556 
       
   557 // Platform layout changes
       
   558 // ---------------------------------------------------------------------------
   520 // ---------------------------------------------------------------------------
   559 // CNcsSubjectField::UpdateFontSize()
   521 // CNcsSubjectField::UpdateFontSize()
   560 // ---------------------------------------------------------------------------
   522 // ---------------------------------------------------------------------------
   561 //
   523 //
   562 void CNcsSubjectField::UpdateFontSize()
   524 void CNcsSubjectField::UpdateFontSize()
   563 	{
   525 	{
   564     FUNC_LOG;
   526     FUNC_LOG;
   565     /*if ( iFont )
   527     CCoeControl* control = 
   566         {
   528             iButton ? ( CCoeControl* )iButton : ( CCoeControl* )iLabel;
   567         ControlEnv()->ScreenDevice()->ReleaseFont( iFont );
   529     iFont = NcsUtility::GetLayoutFont( 
   568         iFont = NULL;
   530             control->Rect(), NcsUtility::ENcsHeaderCaptionFont );
   569         }
   531     if( control == iButton )
   570 
   532         {
   571 	TNcsMeasures m = NcsUtility::Measures();
   533         iButton->SetTextFont( iFont );
   572 	if ( !iFont )
   534         }
   573 	    {
   535     else
   574 	    TRAP_IGNORE( iFont = NcsUtility::GetNearestFontL(EAknLogicalFontPrimarySmallFont,
   536         {
   575 	    m.iLabelFontHeightPx) );
   537         iLabel->SetFont( iFont );
   576 	    }*/
   538         }
   577 	iFont = NcsUtility::GetLayoutFont( iLabel->Rect(), NcsUtility::ENcsHeaderCaptionFont );
       
   578 	iLabel->SetFont( iFont );
       
   579 	iTextEditor->UpdateFontSize();
   539 	iTextEditor->UpdateFontSize();
   580 	UpdateColors();
   540 	UpdateColors();
   581 	}
   541 	}
   582 
   542 
   583 // ---------------------------------------------------------------------------
   543 // ---------------------------------------------------------------------------
   591     if ( aType == KAknsMessageSkinChange ||
   551     if ( aType == KAknsMessageSkinChange ||
   592          aType == KEikMessageColorSchemeChange )
   552          aType == KEikMessageColorSchemeChange )
   593         {
   553         {
   594         UpdateFontSize();
   554         UpdateFontSize();
   595         UpdateColors();
   555         UpdateColors();
   596         // Platform layout changes
   556         iTextEditor->HandleResourceChange( aType );
   597         iTextEditor->HandleResourceChange( aType ) ;//CreateScrollBarFrameL()->DrawScrollBarsNow();
   557         }
   598         // Platform layout changes
   558     }
   599         }
   559 
   600     }
   560 // ---------------------------------------------------------------------------
   601 
   561 // CNcsSubjectField::EnableKineticScrollingL()
   602 void CNcsSubjectField::EnableKineticScrollingL(CAknPhysics*  aPhysics)
   562 // ---------------------------------------------------------------------------
   603     {
   563 //
   604     iTextEditor->EnableKineticScrollingL(aPhysics);
   564 void CNcsSubjectField::EnableKineticScrollingL( CAknPhysics*  aPhysics )
       
   565     {
       
   566     iTextEditor->EnableKineticScrollingL( aPhysics );
   605     iTextEditor->TextLayout()->RestrictScrollToTopsOfLines( ETrue );
   567     iTextEditor->TextLayout()->RestrictScrollToTopsOfLines( ETrue );
   606     }
   568     }
   607 
   569 
       
   570 // ---------------------------------------------------------------------------
       
   571 // CNcsSubjectField::SetPhysicsEmulationOngoing()
       
   572 // ---------------------------------------------------------------------------
       
   573 //
   608 void CNcsSubjectField::SetPhysicsEmulationOngoing( TBool aPhysOngoing )
   574 void CNcsSubjectField::SetPhysicsEmulationOngoing( TBool aPhysOngoing )
   609     {
   575     {
   610     iTextEditor->SetPhysicsEmulationOngoing( aPhysOngoing );
   576     iTextEditor->SetPhysicsEmulationOngoing( aPhysOngoing );
   611     }
   577     }