25
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: compose view container
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#include "emailtrace.h"
|
|
21 |
#include <AknIconUtils.h>
|
|
22 |
#include <avkon.hrh>
|
|
23 |
#include <eiklabel.h>
|
|
24 |
#include <eikimage.h>
|
|
25 |
#include <eikenv.h>
|
|
26 |
#include <AknsDrawUtils.h>
|
|
27 |
#include <AknUtils.h>
|
|
28 |
#include <StringLoader.h>
|
|
29 |
#include <s32mem.h>
|
|
30 |
#include <txtrich.h>
|
|
31 |
#include <FreestyleEmailUi.rsg>
|
|
32 |
#include <freestyleemailui.mbg>
|
|
33 |
#include "FreestyleEmailUiLayoutData.h"
|
|
34 |
#include "FreestyleEmailUiLayoutHandler.h"
|
|
35 |
#include "FreestyleEmailUiAppui.h"
|
|
36 |
#include "FreestyleEmailUiTextureManager.h"
|
|
37 |
#include "ncssubjectfield.h"
|
|
38 |
#include "ncsconstants.h"
|
|
39 |
#include "ncsfieldsizeobserver.h"
|
|
40 |
#include "ncsutility.h"
|
|
41 |
#include "ncsheadercontainer.h"
|
|
42 |
|
|
43 |
// ---------------------------------------------------------------------------
|
|
44 |
// CNcsSubjectField::CNcsSubjectField()
|
|
45 |
// ---------------------------------------------------------------------------
|
|
46 |
//
|
|
47 |
CNcsSubjectField::CNcsSubjectField( MNcsFieldSizeObserver* aSizeObserver,
|
|
48 |
CNcsHeaderContainer* aParentControl ):
|
|
49 |
MNcsControl( aSizeObserver ),
|
|
50 |
iParentControl( aParentControl )
|
|
51 |
{
|
|
52 |
FUNC_LOG;
|
|
53 |
}
|
|
54 |
|
|
55 |
// -----------------------------------------------------------------------------
|
|
56 |
// CNcsSubjectField::NewL()
|
|
57 |
// Two-phased constructor.
|
|
58 |
// -----------------------------------------------------------------------------
|
|
59 |
//
|
|
60 |
CNcsSubjectField* CNcsSubjectField::NewL( TInt aLabelTextId,
|
|
61 |
MNcsFieldSizeObserver* aSizeObserver, CNcsHeaderContainer* aParentControl )
|
|
62 |
{
|
|
63 |
FUNC_LOG;
|
|
64 |
CNcsSubjectField* self =
|
|
65 |
new ( ELeave ) CNcsSubjectField( aSizeObserver, aParentControl );
|
|
66 |
CleanupStack::PushL( self );
|
|
67 |
self->ConstructL( aLabelTextId );
|
|
68 |
CleanupStack::Pop( self );
|
|
69 |
return self;
|
|
70 |
}
|
|
71 |
|
|
72 |
|
|
73 |
// -----------------------------------------------------------------------------
|
|
74 |
// CNcsSubjectField::ConstructL()
|
|
75 |
// Symbian 2nd phase constructor can leave.
|
|
76 |
// -----------------------------------------------------------------------------
|
|
77 |
//
|
|
78 |
void CNcsSubjectField::ConstructL( TInt aLabelTextId )
|
|
79 |
{
|
|
80 |
FUNC_LOG;
|
|
81 |
// Create label
|
|
82 |
HBufC* aTextBuf = StringLoader::LoadLC( aLabelTextId );
|
|
83 |
TPtrC captionText = aTextBuf ? aTextBuf->Des() : TPtrC();
|
|
84 |
iLabel = new ( ELeave ) CNcsLabel( *this, NULL );
|
|
85 |
iLabel->SetTextL( captionText );
|
|
86 |
|
|
87 |
// S60 Skin support
|
|
88 |
iLabel->SetBrushStyle(CWindowGc::ENullBrush);
|
|
89 |
|
|
90 |
iTextEditor = new ( ELeave ) CNcsEditor( iSizeObserver, ETrue, ENcsEditorSubject, captionText );
|
|
91 |
CleanupStack::PopAndDestroy( aTextBuf );
|
|
92 |
}
|
|
93 |
|
|
94 |
// ---------------------------------------------------------------------------
|
|
95 |
// Destructor
|
|
96 |
// ---------------------------------------------------------------------------
|
|
97 |
//
|
|
98 |
CNcsSubjectField::~CNcsSubjectField()
|
|
99 |
{
|
|
100 |
FUNC_LOG;
|
|
101 |
delete iTextEditor;
|
|
102 |
delete iLabel;
|
|
103 |
// Platform layout change
|
|
104 |
/*if ( iFont )
|
|
105 |
{
|
|
106 |
ControlEnv()->ScreenDevice()->ReleaseFont( iFont );
|
|
107 |
iFont = NULL;
|
|
108 |
}*/
|
|
109 |
}
|
|
110 |
|
|
111 |
// -----------------------------------------------------------------------------
|
|
112 |
// CNcsSubjectField::SetContainerWindowL() const
|
|
113 |
// -----------------------------------------------------------------------------
|
|
114 |
//
|
|
115 |
void CNcsSubjectField::SetContainerWindowL(const CCoeControl& aContainer)
|
|
116 |
{
|
|
117 |
FUNC_LOG;
|
|
118 |
CCoeControl::SetContainerWindowL(aContainer);
|
|
119 |
|
|
120 |
// Create the component array
|
|
121 |
InitComponentArrayL();
|
|
122 |
CCoeControlArray& controls = Components();
|
|
123 |
controls.SetControlsOwnedExternally(ETrue);
|
|
124 |
controls.AppendLC(iLabel);
|
|
125 |
CleanupStack::Pop(iLabel);
|
|
126 |
controls.AppendLC(iTextEditor);
|
|
127 |
CleanupStack::Pop(iTextEditor);
|
|
128 |
|
|
129 |
// Setup text editor
|
|
130 |
iTextEditor->ConstructL( &aContainer, KMaxAddressFieldLines, 0 );
|
|
131 |
iTextEditor->SetBorder( TGulBorder::ENone );
|
|
132 |
iTextEditor->SetAknEditorInputMode( EAknEditorTextInputMode );
|
|
133 |
iTextEditor->CreateScrollBarFrameL()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff );
|
|
134 |
iTextEditor->SetEdwinSizeObserver( this );
|
|
135 |
iTextEditor->SetupEditorL();
|
|
136 |
// Setup label
|
|
137 |
UpdateFontSize();
|
|
138 |
UpdateColors();
|
|
139 |
}
|
|
140 |
|
|
141 |
// -----------------------------------------------------------------------------
|
|
142 |
// CNcsSubjectField::Draw() const
|
|
143 |
// Draws the display
|
|
144 |
// -----------------------------------------------------------------------------
|
|
145 |
//
|
|
146 |
void CNcsSubjectField::Draw( const TRect& /*aRect*/ ) const
|
|
147 |
{
|
|
148 |
FUNC_LOG;
|
|
149 |
CWindowGc& gc = SystemGc();
|
|
150 |
gc.SetBrushStyle( CGraphicsContext::ENullBrush );
|
|
151 |
}
|
|
152 |
|
|
153 |
// -----------------------------------------------------------------------------
|
|
154 |
// CNcsSubjectField::GetMinLabelLength()
|
|
155 |
// -----------------------------------------------------------------------------
|
|
156 |
//
|
|
157 |
TInt CNcsSubjectField::GetMinLabelLength() const
|
|
158 |
{
|
|
159 |
FUNC_LOG;
|
|
160 |
return iLabel->Font()->TextWidthInPixels( *iLabel->Text() );
|
|
161 |
}
|
|
162 |
|
|
163 |
// -----------------------------------------------------------------------------
|
|
164 |
// CNcsSubjectField::SizeChanged()
|
|
165 |
// set size
|
|
166 |
// -----------------------------------------------------------------------------
|
|
167 |
//
|
|
168 |
void CNcsSubjectField::SizeChanged()
|
|
169 |
{
|
|
170 |
FUNC_LOG;
|
|
171 |
|
|
172 |
const TRect rect( Rect() );
|
|
173 |
NcsUtility::LayoutCaptionLabel( iLabel, rect );
|
|
174 |
NcsUtility::LayoutDetailEdwinTouch( iTextEditor, rect, iEditorLineCount, EFalse );
|
|
175 |
|
|
176 |
if (iTextEditor->ScrollBarFrame())
|
|
177 |
{
|
|
178 |
TRect rc = iTextEditor->Rect();
|
|
179 |
if (AknLayoutUtils::LayoutMirrored())
|
|
180 |
{
|
|
181 |
rc.iTl.iX += iTextEditor->ScrollBarFrame()->ScrollBarBreadth(CEikScrollBar::EVertical);
|
|
182 |
}
|
|
183 |
else
|
|
184 |
{
|
|
185 |
rc.iBr.iX -= iTextEditor->ScrollBarFrame()->ScrollBarBreadth(CEikScrollBar::EVertical);
|
|
186 |
}
|
|
187 |
iTextEditor->SetRect(rc);
|
|
188 |
}
|
|
189 |
|
|
190 |
// Setup text alignment according the mirrored/normal layout.
|
|
191 |
if ( AknLayoutUtils::LayoutMirrored() )
|
|
192 |
{
|
|
193 |
iLabel->SetAlignment( EHLeftVCenter );
|
|
194 |
iLabel->SetLabelAlignment( ELayoutAlignLeft );
|
|
195 |
}
|
|
196 |
else
|
|
197 |
{
|
|
198 |
iLabel->SetAlignment( EHRightVCenter );
|
|
199 |
iLabel->SetLabelAlignment( ELayoutAlignRight );
|
|
200 |
}
|
|
201 |
|
|
202 |
// this needs to be bidi as in mirrored layout
|
|
203 |
// writing language left to right can be set
|
|
204 |
iTextEditor->SetAlignment( EAknEditorAlignBidi );
|
|
205 |
|
|
206 |
UpdateFontSize();
|
|
207 |
|
|
208 |
iTextEditor->UpdateCustomDrawer();
|
|
209 |
}
|
|
210 |
|
|
211 |
// -----------------------------------------------------------------------------
|
|
212 |
// CNcsSubjectField::PositionChanged()
|
|
213 |
// set size
|
|
214 |
// -----------------------------------------------------------------------------
|
|
215 |
//
|
|
216 |
void CNcsSubjectField::PositionChanged()
|
|
217 |
{
|
|
218 |
FUNC_LOG;
|
|
219 |
//SizeChanged();
|
|
220 |
}
|
|
221 |
|
|
222 |
// -----------------------------------------------------------------------------
|
|
223 |
// CNcsSubjectField::OfferKeyEventL()
|
|
224 |
// Handles key events
|
|
225 |
// -----------------------------------------------------------------------------
|
|
226 |
//
|
|
227 |
TKeyResponse CNcsSubjectField::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
|
|
228 |
{
|
|
229 |
FUNC_LOG;
|
|
230 |
TKeyResponse ret( EKeyWasNotConsumed );
|
|
231 |
|
|
232 |
ret = iTextEditor->OfferKeyEventL( aKeyEvent, aType );
|
|
233 |
return ret;
|
|
234 |
}
|
|
235 |
|
|
236 |
// -----------------------------------------------------------------------------
|
|
237 |
// CNcsAddressInputField::HandlePointerEventL()
|
|
238 |
// Handles pointer events
|
|
239 |
// -----------------------------------------------------------------------------
|
|
240 |
//
|
|
241 |
void CNcsSubjectField::HandlePointerEventL( const TPointerEvent& aPointerEvent )
|
|
242 |
{
|
|
243 |
FUNC_LOG;
|
|
244 |
iTextEditor->HandlePointerEventL( aPointerEvent );
|
|
245 |
iTextEditor->HandleTextChangedL();
|
|
246 |
}
|
|
247 |
|
|
248 |
// -----------------------------------------------------------------------------
|
|
249 |
// CNcsSubjectField::FocusChanged()
|
|
250 |
// -----------------------------------------------------------------------------
|
|
251 |
//
|
|
252 |
void CNcsSubjectField::FocusChanged( TDrawNow aDrawNow )
|
|
253 |
{
|
|
254 |
FUNC_LOG;
|
|
255 |
if ( IsFocused() )
|
|
256 |
{
|
|
257 |
iTextEditor->SetFocus( ETrue );
|
|
258 |
//TRAP_IGNORE( iTextEditor->SetCursorPosL( iTextEditor->TextLength(), EFalse ) );
|
|
259 |
|
|
260 |
// make sure that control is visible on screen
|
|
261 |
if ( Rect().iTl.iY < 0 )
|
|
262 |
{
|
|
263 |
TPoint pt = TPoint( 0, 0 );
|
|
264 |
Reposition( pt, Rect().Width() );
|
|
265 |
iSizeObserver->UpdateFieldPosition( this );
|
|
266 |
}
|
|
267 |
else
|
|
268 |
{
|
|
269 |
TPoint pos = PositionRelativeToScreen();
|
|
270 |
pos.iY += Size().iHeight;
|
|
271 |
CWsScreenDevice* screenDev = ControlEnv()->ScreenDevice();
|
|
272 |
TPixelsAndRotation pix;
|
|
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 |
|
|
299 |
// -----------------------------------------------------------------------------
|
|
300 |
// CNcsSubjectField::MinimumHeight()
|
|
301 |
// return height of subject control
|
|
302 |
// -----------------------------------------------------------------------------
|
|
303 |
//
|
|
304 |
TInt CNcsSubjectField::MinimumHeight()
|
|
305 |
{
|
|
306 |
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;
|
|
322 |
}
|
|
323 |
|
|
324 |
// -----------------------------------------------------------------------------
|
|
325 |
// CNcsSubjectField::SetSubjectL()
|
|
326 |
// -----------------------------------------------------------------------------
|
|
327 |
//
|
|
328 |
void CNcsSubjectField::SetSubjectL( const TDesC& aSubject )
|
|
329 |
{
|
|
330 |
FUNC_LOG;
|
|
331 |
if ( &aSubject && aSubject.Length() > 0 )
|
|
332 |
{
|
|
333 |
// clear subject if necessary
|
|
334 |
TInt documentLength = iTextEditor->RichText()->DocumentLength();
|
|
335 |
if ( documentLength > 0 )
|
|
336 |
{
|
|
337 |
iTextEditor->RichText()->DeleteL( 0, documentLength );
|
|
338 |
iTextEditor->HandleTextChangedL();
|
|
339 |
}
|
|
340 |
|
|
341 |
RMemReadStream inputStream( aSubject.Ptr(), aSubject.Size() );
|
|
342 |
CleanupClosePushL( inputStream );
|
|
343 |
|
|
344 |
iTextEditor->RichText()->ImportTextL( 0, inputStream, CPlainText::EOrganiseByParagraph );
|
|
345 |
|
|
346 |
// Activating the field will set the control to the end of the text
|
|
347 |
iTextEditor->ActivateL();
|
|
348 |
iTextEditor->SetCursorPosL(0,EFalse);
|
|
349 |
|
|
350 |
CleanupStack::PopAndDestroy( &inputStream );
|
|
351 |
}
|
|
352 |
}
|
|
353 |
|
|
354 |
// -----------------------------------------------------------------------------
|
|
355 |
// CNcsSubjectField::HandleEdwinSizeEventL()
|
|
356 |
// -----------------------------------------------------------------------------
|
|
357 |
//
|
|
358 |
TBool CNcsSubjectField::HandleEdwinSizeEventL( CEikEdwin* /*aEdwin*/,
|
|
359 |
TEdwinSizeEvent /*aEventType*/, TSize aDesirableEdwinSize )
|
|
360 |
{
|
|
361 |
FUNC_LOG;
|
|
362 |
// Platform layout chage
|
|
363 |
/*
|
|
364 |
TInt ret( EFalse );
|
|
365 |
TInt htLine = iTextEditor->GetLineHeightL();
|
|
366 |
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;
|
|
396 |
//scrollBarFrame.SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff );
|
|
397 |
if ( iSizeObserver )
|
|
398 |
{
|
|
399 |
ret = iSizeObserver->UpdateFieldSizeL();
|
|
400 |
}
|
|
401 |
return ret;
|
|
402 |
}
|
|
403 |
|
|
404 |
// -----------------------------------------------------------------------------
|
|
405 |
// CNcsSubjectField::SelectAllTextL()
|
|
406 |
// -----------------------------------------------------------------------------
|
|
407 |
//
|
|
408 |
void CNcsSubjectField::SelectAllTextL()
|
|
409 |
{
|
|
410 |
FUNC_LOG;
|
|
411 |
iTextEditor->SelectAllL();
|
|
412 |
}
|
|
413 |
|
|
414 |
// -----------------------------------------------------------------------------
|
|
415 |
// CNcsSubjectField::Editor
|
|
416 |
// -----------------------------------------------------------------------------
|
|
417 |
CNcsEditor* CNcsSubjectField::Editor() const
|
|
418 |
{
|
|
419 |
FUNC_LOG;
|
|
420 |
return iTextEditor;
|
|
421 |
}
|
|
422 |
|
|
423 |
// -----------------------------------------------------------------------------
|
|
424 |
// CNcsSubjectField::LineCount
|
|
425 |
// -----------------------------------------------------------------------------
|
|
426 |
TInt CNcsSubjectField::LineCount() const
|
|
427 |
{
|
|
428 |
FUNC_LOG;
|
|
429 |
return iTextEditor->LineCount();
|
|
430 |
}
|
|
431 |
|
|
432 |
// -----------------------------------------------------------------------------
|
|
433 |
// CNcsSubjectField::CursorLineNumber
|
|
434 |
// -----------------------------------------------------------------------------
|
|
435 |
TInt CNcsSubjectField::CursorLineNumber() const
|
|
436 |
{
|
|
437 |
FUNC_LOG;
|
|
438 |
return iTextEditor->CursorLineNumber();
|
|
439 |
}
|
|
440 |
|
|
441 |
// -----------------------------------------------------------------------------
|
|
442 |
// CNcsSubjectField::CursorPosition
|
|
443 |
// -----------------------------------------------------------------------------
|
|
444 |
TInt CNcsSubjectField::CursorPosition() const
|
|
445 |
{
|
|
446 |
FUNC_LOG;
|
|
447 |
TInt pos = iTextEditor->CursorPosition();
|
|
448 |
//Add the delta between the top of the edit control
|
|
449 |
//and the top of the parent control
|
|
450 |
pos += iTextEditor->Rect().iTl.iY - Rect().iTl.iY;
|
|
451 |
return pos;
|
|
452 |
}
|
|
453 |
|
|
454 |
// -----------------------------------------------------------------------------
|
|
455 |
// CNcsSubjectField::ScrollableLines
|
|
456 |
// -----------------------------------------------------------------------------
|
|
457 |
TInt CNcsSubjectField::ScrollableLines() const
|
|
458 |
{
|
|
459 |
FUNC_LOG;
|
|
460 |
return iTextEditor->ScrollableLines();
|
|
461 |
}
|
|
462 |
|
|
463 |
// -----------------------------------------------------------------------------
|
|
464 |
// CNcsSubjectField::GetNumChars
|
|
465 |
// -----------------------------------------------------------------------------
|
|
466 |
TInt CNcsSubjectField::GetNumChars() const
|
|
467 |
{
|
|
468 |
FUNC_LOG;
|
|
469 |
return iTextEditor->GetNumChars();
|
|
470 |
}
|
|
471 |
|
|
472 |
// -----------------------------------------------------------------------------
|
|
473 |
// CNcsSubjectField::GetLabelText
|
|
474 |
// -----------------------------------------------------------------------------
|
|
475 |
const TDesC& CNcsSubjectField::GetLabelText() const
|
|
476 |
{
|
|
477 |
FUNC_LOG;
|
|
478 |
return KNullDesC;
|
|
479 |
}
|
|
480 |
|
|
481 |
// Platform layout change
|
|
482 |
// ---------------------------------------------------------------------------
|
|
483 |
// CNcsSubjectField::LayoutLineCount
|
|
484 |
// ---------------------------------------------------------------------------
|
|
485 |
//
|
|
486 |
TInt CNcsSubjectField::LayoutLineCount() const
|
|
487 |
{
|
|
488 |
FUNC_LOG;
|
|
489 |
return ( IsVisible() ? Max( 1, iEditorLineCount ) : 0 );
|
|
490 |
}
|
|
491 |
|
|
492 |
// -----------------------------------------------------------------------------
|
|
493 |
// CNcsSubjectField::Reposition
|
|
494 |
// -----------------------------------------------------------------------------
|
|
495 |
void CNcsSubjectField::Reposition(TPoint& aPt, TInt /*aWidth*/)
|
|
496 |
{
|
|
497 |
FUNC_LOG;
|
|
498 |
/*
|
|
499 |
const TSize size( aWidth, MinimumHeight() );
|
|
500 |
SetExtent( aPt, size );
|
|
501 |
aPt.iY += size.iHeight;
|
|
502 |
*/
|
|
503 |
SetPosition( aPt );
|
|
504 |
// Platform layout changes
|
|
505 |
}
|
|
506 |
|
|
507 |
// -----------------------------------------------------------------------------
|
|
508 |
// CNcsSubjectField::GetLineRectL
|
|
509 |
// -----------------------------------------------------------------------------
|
|
510 |
void CNcsSubjectField::GetLineRectL( TRect& aLineRect ) const
|
|
511 |
{
|
|
512 |
FUNC_LOG;
|
|
513 |
return iTextEditor->GetLineRectL( aLineRect );
|
|
514 |
}
|
|
515 |
|
|
516 |
// -----------------------------------------------------------------------------
|
|
517 |
// CNcsSubjectField::SetMaxLabelLength
|
|
518 |
// -----------------------------------------------------------------------------
|
|
519 |
void CNcsSubjectField::SetMaxLabelLength( TInt aMaxLength )
|
|
520 |
{
|
|
521 |
FUNC_LOG;
|
|
522 |
iMaximumLabelLength = aMaxLength;
|
|
523 |
}
|
|
524 |
|
|
525 |
// -----------------------------------------------------------------------------
|
|
526 |
// CNcsSubjectField::SetTextColorL
|
|
527 |
// -----------------------------------------------------------------------------
|
|
528 |
void CNcsSubjectField::SetTextColorL( TLogicalRgb aColor )
|
|
529 |
{
|
|
530 |
FUNC_LOG;
|
|
531 |
iTextEditor->SetTextColorL( aColor );
|
|
532 |
}
|
|
533 |
|
|
534 |
// ---------------------------------------------------------------------------
|
|
535 |
// CNcsSubjectField::UpdateColors()
|
|
536 |
// ---------------------------------------------------------------------------
|
|
537 |
//
|
|
538 |
void CNcsSubjectField::UpdateColors()
|
|
539 |
{
|
|
540 |
FUNC_LOG;
|
|
541 |
// Platform layout change
|
|
542 |
TRgb textColor = KRgbBlack;
|
|
543 |
if ( AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), textColor,
|
|
544 |
KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ) != KErrNone )
|
|
545 |
{
|
|
546 |
textColor = KRgbBlack;
|
|
547 |
}
|
|
548 |
TRAP_IGNORE( iLabel->OverrideColorL( EColorLabelText, textColor ) );
|
|
549 |
// Platform layout change
|
|
550 |
|
|
551 |
CFreestyleEmailUiAppUi* appUi =
|
|
552 |
static_cast<CFreestyleEmailUiAppUi*>( ControlEnv()->AppUi() );
|
|
553 |
iBorderColor = appUi->LayoutHandler()->ComposerFieldBorderColor();
|
|
554 |
iBgColor = appUi->LayoutHandler()->ComposerFieldBackgroundColor();
|
|
555 |
}
|
|
556 |
|
|
557 |
// Platform layout changes
|
|
558 |
// ---------------------------------------------------------------------------
|
|
559 |
// CNcsSubjectField::UpdateFontSize()
|
|
560 |
// ---------------------------------------------------------------------------
|
|
561 |
//
|
|
562 |
void CNcsSubjectField::UpdateFontSize()
|
|
563 |
{
|
|
564 |
FUNC_LOG;
|
|
565 |
/*if ( iFont )
|
|
566 |
{
|
|
567 |
ControlEnv()->ScreenDevice()->ReleaseFont( iFont );
|
|
568 |
iFont = NULL;
|
|
569 |
}
|
|
570 |
|
|
571 |
TNcsMeasures m = NcsUtility::Measures();
|
|
572 |
if ( !iFont )
|
|
573 |
{
|
|
574 |
TRAP_IGNORE( iFont = NcsUtility::GetNearestFontL(EAknLogicalFontPrimarySmallFont,
|
|
575 |
m.iLabelFontHeightPx) );
|
|
576 |
}*/
|
|
577 |
iFont = NcsUtility::GetLayoutFont( iLabel->Rect(), NcsUtility::ENcsHeaderCaptionFont );
|
|
578 |
iLabel->SetFont( iFont );
|
|
579 |
iTextEditor->UpdateFontSize();
|
|
580 |
UpdateColors();
|
|
581 |
}
|
|
582 |
|
|
583 |
// ---------------------------------------------------------------------------
|
|
584 |
// CNcsSubjectField::HandleResourceChange()
|
|
585 |
// ---------------------------------------------------------------------------
|
|
586 |
//
|
|
587 |
void CNcsSubjectField::HandleResourceChange( TInt aType )
|
|
588 |
{
|
|
589 |
FUNC_LOG;
|
|
590 |
CCoeControl::HandleResourceChange( aType );
|
|
591 |
if ( aType == KAknsMessageSkinChange ||
|
|
592 |
aType == KEikMessageColorSchemeChange )
|
|
593 |
{
|
|
594 |
UpdateFontSize();
|
|
595 |
UpdateColors();
|
|
596 |
// Platform layout changes
|
|
597 |
iTextEditor->HandleResourceChange( aType ) ;//CreateScrollBarFrameL()->DrawScrollBarsNow();
|
|
598 |
// Platform layout changes
|
|
599 |
}
|
|
600 |
}
|
|
601 |
|
|
602 |
void CNcsSubjectField::EnableKineticScrollingL(CAknPhysics* aPhysics)
|
|
603 |
{
|
|
604 |
iTextEditor->EnableKineticScrollingL(aPhysics);
|
|
605 |
iTextEditor->TextLayout()->RestrictScrollToTopsOfLines( ETrue );
|
|
606 |
}
|
|
607 |
|
|
608 |
void CNcsSubjectField::SetPhysicsEmulationOngoing( TBool aPhysOngoing )
|
|
609 |
{
|
|
610 |
iTextEditor->SetPhysicsEmulationOngoing( aPhysOngoing );
|
|
611 |
}
|