|
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 FILES |
|
21 #include "emailtrace.h" |
|
22 #include <s32mem.h> |
|
23 #include <txtrich.h> |
|
24 #include <AknIconUtils.h> |
|
25 #include <StringLoader.h> |
|
26 #include <avkon.hrh> |
|
27 #include <AknsDrawUtils.h> |
|
28 #include <aknview.h> |
|
29 #include <AknUtils.h> |
|
30 #include <FreestyleEmailUi.rsg> |
|
31 #include <eikclbd.h> |
|
32 #include <aknViewAppUi.h> |
|
33 #include <aknnotewrappers.h> //CAknInformationNote |
|
34 #include <txtetext.h> |
|
35 #include <aknphysics.h> |
|
36 |
|
37 #include "ncscomposeviewcontainer.h" |
|
38 #include "ncsheadercontainer.h" |
|
39 #include "ncsaddressinputfield.h" |
|
40 #include "ncssubjectfield.h" |
|
41 #include "ncsconstants.h" |
|
42 #include "ncseditor.h" |
|
43 #include "ncspopuplistbox.h" |
|
44 #include "ncscomposeview.h" |
|
45 #include "ncsutility.h" |
|
46 #include "ncsemailaddressobject.h" |
|
47 #include "FreestyleEmailUiUtilities.h" |
|
48 #include "FreestyleEmailUiConstants.h" |
|
49 #include "FreestyleEmailUiSendAttachmentsListControl.h" |
|
50 #include "FreestyleEmailUiSendAttachmentsListVisualiser.h" |
|
51 #include "FreestyleEmailUiSendAttachmentsListModel.h" |
|
52 #include "FreestyleEmailUi.hrh" |
|
53 #include "FSAutoSaver.h" |
|
54 #include "FreestyleEmailUiCLSItem.h" |
|
55 |
|
56 |
|
57 // ========================= MEMBER FUNCTIONS ================================== |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // constructor |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 CNcsComposeViewContainer::CNcsComposeViewContainer( |
|
64 CNcsComposeView& aView, |
|
65 CFsAutoSaver& aAutoSaver, |
|
66 CFSMailBox& aMailBox ): |
|
67 iView( aView ), iAmountMesFieldMovedUp( 0 ), |
|
68 iAutoSaver( aAutoSaver ), iMailBox( aMailBox ) |
|
69 { |
|
70 FUNC_LOG; |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CNcsComposeViewContainer::NewL() |
|
75 // Two-phased constructor. |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 CNcsComposeViewContainer* CNcsComposeViewContainer::NewL( CNcsComposeView& aView, |
|
79 const TRect& aRect, CFSMailBox& aMailBox, CFsAutoSaver& aAutoSaver, |
|
80 TInt aFlags ) |
|
81 { |
|
82 FUNC_LOG; |
|
83 |
|
84 CNcsComposeViewContainer* self = new ( ELeave ) CNcsComposeViewContainer( |
|
85 aView, aAutoSaver, aMailBox ); |
|
86 CleanupStack::PushL( self ); |
|
87 self->ConstructL( aRect, aFlags ); |
|
88 CleanupStack::Pop( self ); |
|
89 |
|
90 return self; |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CNcsComposeViewContainer::ConstructL() |
|
95 // Symbian 2nd phase constructor can leave. |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 void CNcsComposeViewContainer::ConstructL( const TRect& aRect, TInt aFlags ) |
|
99 { |
|
100 FUNC_LOG; |
|
101 |
|
102 SetMopParent( &iView ); |
|
103 CreateWindowL(); |
|
104 // <cmail> |
|
105 // iApplicationRect = aRect; |
|
106 // </cmail> |
|
107 |
|
108 // Setup the control array |
|
109 InitComponentArrayL(); |
|
110 CCoeControlArray& controls = Components(); |
|
111 controls.SetControlsOwnedExternally( ETrue ); |
|
112 |
|
113 // Create the header field |
|
114 iHeader = CNcsHeaderContainer::NewL( *this, iMailBox, aFlags ); |
|
115 controls.AppendLC( iHeader ); |
|
116 CleanupStack::Pop( iHeader ); |
|
117 |
|
118 // Create 'message body' field, default text is empty for that field |
|
119 iMessageField = new ( ELeave ) CNcsEditor( this, EFalse, ENcsEditorBody ); |
|
120 iMessageField->SetContainerWindowL( *this ); |
|
121 iMessageField->ConstructL( this, 0, 0 ); |
|
122 iMessageField->SetAlignment( EAknEditorAlignBidi ); |
|
123 iMessageField->SetAknEditorInputMode( EAknEditorTextInputMode ); |
|
124 controls.AppendLC( iMessageField ); |
|
125 CleanupStack::Pop( iMessageField ); |
|
126 |
|
127 // <cmail> Platform layout change |
|
128 iMessageField->SetNcsFontType( NcsUtility::ENcsBodytextFont ); |
|
129 // </cmail> |
|
130 |
|
131 // Listen edwin events and size events from message body field |
|
132 iMessageField->AddEdwinObserverL( this ); |
|
133 iMessageField->SetEdwinSizeObserver( this ); |
|
134 |
|
135 // Create read-only field to be used for original message quote when |
|
136 // protocol doesn't allow editing the original message |
|
137 iReadOnlyQuoteField = new( ELeave ) CNcsEditor( this, EFalse ); |
|
138 iReadOnlyQuoteField->SetContainerWindowL( *this ); |
|
139 iReadOnlyQuoteField->ConstructL( this, 0, 0 ); |
|
140 iReadOnlyQuoteField->SetAlignment( EAknEditorAlignBidi ); |
|
141 iReadOnlyQuoteField->SetReadOnly( ETrue ); |
|
142 controls.AppendLC( iReadOnlyQuoteField ); |
|
143 CleanupStack::Pop( iReadOnlyQuoteField ); |
|
144 |
|
145 // Listen edwin events and size events from smart quote field |
|
146 iReadOnlyQuoteField->AddEdwinObserverL( this ); |
|
147 iReadOnlyQuoteField->SetEdwinSizeObserver( this ); |
|
148 |
|
149 // Create the scroll bar |
|
150 iScrollBar = new( ELeave ) CAknDoubleSpanScrollBar( this ); |
|
151 iScrollBar->ConstructL( this, this, CEikScrollBar::EVertical, aRect.Height() ); |
|
152 iScrollBar->MakeVisible( ETrue ); |
|
153 iScrollBar->SetModelL( &iScrollBarModel ); |
|
154 |
|
155 iMessageField->SetupEditorL(); |
|
156 iReadOnlyQuoteField->SetupEditorL(); |
|
157 |
|
158 SetRect( aRect ); |
|
159 |
|
160 //<cmail> S60 skin support |
|
161 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
|
162 KAknsIIDQsnBgAreaMain, Rect(), EFalse ); |
|
163 // <cmail> |
|
164 //iMessageField->SetSkinBackgroundControlContextL( iBgContext ); |
|
165 // </cmail> |
|
166 iLongTapDetector = CAknLongTapDetector::NewL( this ); |
|
167 //</cmail> |
|
168 |
|
169 UpdateScrollBarL(); |
|
170 |
|
171 ActivateL(); |
|
172 |
|
173 // activate auto save functionality |
|
174 iAutoSaver.Enable( ETrue ); |
|
175 |
|
176 if ( CAknPhysics::FeatureEnabled() ) |
|
177 { |
|
178 iPhysics = CAknPhysics::NewL( *this, this ); |
|
179 } |
|
180 } |
|
181 |
|
182 // --------------------------------------------------------------------------- |
|
183 // CNcsComposeViewContainer::~CNcsComposeViewContainer |
|
184 // Destructor |
|
185 // --------------------------------------------------------------------------- |
|
186 // |
|
187 CNcsComposeViewContainer::~CNcsComposeViewContainer() |
|
188 { |
|
189 FUNC_LOG; |
|
190 if ( iContactHandler ) |
|
191 { |
|
192 iContactHandler->ClearObservers(); |
|
193 } |
|
194 delete iHeader; |
|
195 delete iScrollBar; |
|
196 delete iMessageField; |
|
197 // <cmail> |
|
198 delete iBgContext; |
|
199 delete iLongTapDetector; |
|
200 // </cmail> |
|
201 delete iReadOnlyQuoteField; |
|
202 delete iReadOnlyQuote; |
|
203 |
|
204 delete iPhysics; |
|
205 iPhysics = NULL; |
|
206 } |
|
207 |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // CNcsComposeViewContainer::FocusChanged |
|
211 // |
|
212 // ----------------------------------------------------------------------------- |
|
213 // |
|
214 void CNcsComposeViewContainer::FocusChanged(TDrawNow aDrawNow) |
|
215 { |
|
216 FUNC_LOG; |
|
217 |
|
218 if ( iFocused != iHeader && |
|
219 iFocused != iMessageField && |
|
220 iFocused != iReadOnlyQuoteField ) |
|
221 { |
|
222 iFocused = iHeader; |
|
223 } |
|
224 iFocused->SetFocus( ETrue, aDrawNow ); |
|
225 // <cmail> |
|
226 iView.HandleContainerChangeRequiringToolbarRefresh(); |
|
227 // </cmail> |
|
228 if ( aDrawNow ) |
|
229 { |
|
230 DrawNow(); |
|
231 } |
|
232 |
|
233 } |
|
234 // ----------------------------------------------------------------------------- |
|
235 // CNcsComposeViewContainer::SetMskL() |
|
236 // |
|
237 // ----------------------------------------------------------------------------- |
|
238 // |
|
239 void CNcsComposeViewContainer::SetMskL() |
|
240 { |
|
241 FUNC_LOG; |
|
242 iHeader->SetMskL(); |
|
243 } |
|
244 |
|
245 //<cmail> |
|
246 |
|
247 // ----------------------------------------------------------------------------- |
|
248 // CNcsComposeViewContainer::HandlePointerEventL() |
|
249 // |
|
250 // ----------------------------------------------------------------------------- |
|
251 // |
|
252 void CNcsComposeViewContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
253 { |
|
254 FUNC_LOG; |
|
255 |
|
256 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
257 |
|
258 if ( iHeader->NeedsLongTapL( aPointerEvent.iPosition ) ) |
|
259 { |
|
260 iLongTapDetector->PointerEventL( aPointerEvent ); |
|
261 } |
|
262 |
|
263 switch( aPointerEvent.iType ) |
|
264 { |
|
265 case TPointerEvent::EButton1Down: |
|
266 { |
|
267 // Save current and original position so that those can be used in |
|
268 // drag/scrolling calculations |
|
269 iPreviousPosition = iOriginalPosition = aPointerEvent.iParentPosition; |
|
270 iIsDragging = EFalse; |
|
271 iIsFlicking = EFalse; |
|
272 |
|
273 if( iPhysics ) |
|
274 { |
|
275 iPhysics->StopPhysics(); |
|
276 iPhysics->ResetFriction(); |
|
277 iStartTime.HomeTime(); |
|
278 UpdatePhysicsL(); |
|
279 } |
|
280 |
|
281 |
|
282 //Closes the attachment action menu, if it is open. |
|
283 //Otherwise does nothing |
|
284 iView.DismissAttachmentActionMenuL(); |
|
285 |
|
286 if ( iHeader->Rect().Contains(aPointerEvent.iPosition) ) |
|
287 { |
|
288 if (iFocused == iMessageField) |
|
289 { |
|
290 iFocused = iHeader; |
|
291 iHeader->SetFocus( ETrue,EDrawNow ); |
|
292 iMessageField->SetFocus( EFalse, EDrawNow ); |
|
293 iHeader->MakeVisible( ETrue ); |
|
294 CommitL(EBodyField); |
|
295 iView.HandleContainerChangeRequiringToolbarRefresh(); |
|
296 } |
|
297 else if (iFocused == iReadOnlyQuoteField) |
|
298 { |
|
299 iFocused = iMessageField; |
|
300 iReadOnlyQuoteField->SetFocus( EFalse, EDrawNow ); |
|
301 iHeader->SetFocus( ETrue, EDrawNow ); |
|
302 iView.HandleContainerChangeRequiringToolbarRefresh(); |
|
303 } |
|
304 } |
|
305 else if (iReadOnlyQuoteField->Rect().Contains(aPointerEvent.iPosition)) |
|
306 { |
|
307 if (iFocused == iMessageField) |
|
308 { |
|
309 iFocused = iReadOnlyQuoteField; |
|
310 iReadOnlyQuoteField->SetFocus( ETrue, EDrawNow ); |
|
311 iMessageField->SetFocus( EFalse, EDrawNow ); |
|
312 iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ); |
|
313 iView.HandleContainerChangeRequiringToolbarRefresh(); |
|
314 } |
|
315 else if (iFocused == iHeader) |
|
316 { |
|
317 iFocused = iReadOnlyQuoteField; |
|
318 iReadOnlyQuoteField->SetFocus( ETrue, EDrawNow ); |
|
319 iHeader->SetFocus( EFalse, EDrawNow ); |
|
320 iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ); |
|
321 iView.HandleContainerChangeRequiringToolbarRefresh(); |
|
322 } |
|
323 } |
|
324 else |
|
325 { |
|
326 if (iFocused == iHeader) |
|
327 { |
|
328 iFocused = iMessageField; |
|
329 iHeader->SetFocus( EFalse, EDrawNow ); |
|
330 iMessageField->SetFocus( ETrue, EDrawNow ); |
|
331 //iMessageField->SetCursorPosL( iMessageField->TextLength(), EFalse ); |
|
332 iView.HandleContainerChangeRequiringToolbarRefresh(); |
|
333 } |
|
334 else if (iFocused == iReadOnlyQuoteField) |
|
335 { |
|
336 iFocused = iMessageField; |
|
337 iReadOnlyQuoteField->SetFocus( EFalse, EDrawNow ); |
|
338 iMessageField->SetFocus( ETrue, EDrawNow ); |
|
339 iView.HandleContainerChangeRequiringToolbarRefresh(); |
|
340 } |
|
341 else |
|
342 { |
|
343 //iMessageField->SetCursorPosL( iMessageField->TextLength(), EFalse ); |
|
344 const TRect messageFieldRect(iMessageField->Rect()); |
|
345 if (!messageFieldRect.Contains(aPointerEvent.iPosition) && |
|
346 aPointerEvent.iPosition.iY >= messageFieldRect.iTl.iY ) |
|
347 { |
|
348 iMessageField->OpenVirtualKeyBoardL(); |
|
349 } |
|
350 } |
|
351 } |
|
352 |
|
353 break; |
|
354 } |
|
355 |
|
356 case TPointerEvent::EButton1Up: |
|
357 { |
|
358 if( iIsDragging && iPhysics ) |
|
359 { |
|
360 TPoint drag(iOriginalPosition - aPointerEvent.iParentPosition); |
|
361 iPhysics->StartPhysics(drag, iStartTime); |
|
362 iIsFlicking = ETrue; |
|
363 iIsDragging = EFalse; |
|
364 } |
|
365 break; |
|
366 } |
|
367 |
|
368 case TPointerEvent::EDrag: |
|
369 { |
|
370 // Get current pointer position |
|
371 TPoint position = aPointerEvent.iParentPosition; |
|
372 |
|
373 // If user started dragging, cancel hotspot actions |
|
374 iIsDragging = ETrue; |
|
375 |
|
376 if( iPhysics ) |
|
377 { |
|
378 TPoint delta( 0, iPreviousPosition.iY - position.iY ); |
|
379 iPhysics->RegisterPanningPosition( delta ); |
|
380 } |
|
381 else |
|
382 { |
|
383 TInt topPosition( -iHeader->Position().iY ); |
|
384 |
|
385 TInt totalHeight( ContentTotalHeight() ); |
|
386 |
|
387 TInt areaHeight( Rect().Size().iHeight ); |
|
388 TInt scrollOffset( 0 ); |
|
389 |
|
390 if( totalHeight > areaHeight ) |
|
391 { |
|
392 // Calculate new scroll offset based on current and previous Y-positions |
|
393 scrollOffset = topPosition + ( iPreviousPosition.iY - position.iY ); |
|
394 // Ensure that thumb position is in correct range |
|
395 scrollOffset = Max( scrollOffset, 0 ); |
|
396 scrollOffset = Min( scrollOffset, totalHeight - areaHeight ); |
|
397 } |
|
398 |
|
399 ScrollL( scrollOffset ); |
|
400 } |
|
401 |
|
402 // Save current position as previous pos for future calculations |
|
403 iPreviousPosition = position; |
|
404 |
|
405 break; |
|
406 } |
|
407 |
|
408 default: |
|
409 { |
|
410 // unknown event, ignored |
|
411 break; |
|
412 } |
|
413 } |
|
414 |
|
415 } |
|
416 |
|
417 //</cmail> |
|
418 |
|
419 // ----------------------------------------------------------------------------- |
|
420 // CNcsComposeViewContainer::OfferKeyEventL() |
|
421 // Handles key events |
|
422 // ----------------------------------------------------------------------------- |
|
423 // |
|
424 TKeyResponse CNcsComposeViewContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
425 { |
|
426 FUNC_LOG; |
|
427 |
|
428 if( iPhysics ) |
|
429 { |
|
430 iPhysics->StopPhysics(); |
|
431 iPhysics->ResetFriction(); |
|
432 } |
|
433 |
|
434 TKeyResponse ret( EKeyWasNotConsumed ); |
|
435 |
|
436 //<cmail> |
|
437 //we are allowing to change MSK label |
|
438 SwitchChangeMskOff(EFalse); |
|
439 //</cmail> |
|
440 |
|
441 if ( aKeyEvent.iCode == EKeyYes ) |
|
442 { |
|
443 // check that at least one of the address fields has an address |
|
444 if ( !iHeader->AreAddressFieldsEmpty() ) |
|
445 { |
|
446 iView.HandleCommandL( ENcsCmdSend ); |
|
447 } |
|
448 else |
|
449 { |
|
450 AppendAddressesL(); |
|
451 } |
|
452 ret = EKeyWasConsumed; |
|
453 } |
|
454 else if ( aKeyEvent.iCode == EKeyOK ) |
|
455 { |
|
456 if ( iHeader->IsPopupActive() ) |
|
457 { |
|
458 DoPopupSelectL(); |
|
459 ret = EKeyWasConsumed; |
|
460 } |
|
461 else if ( AppendAddressesL() ) |
|
462 { |
|
463 ret = EKeyWasConsumed; |
|
464 } |
|
465 } |
|
466 else if ( aKeyEvent.iScanCode == 'S' && |
|
467 aKeyEvent.iModifiers & EModifierCtrl && |
|
468 aType == EEventKey ) |
|
469 { |
|
470 iView.HandleCommandL( ENcsCmdSaveDraft ); |
|
471 ret = EKeyWasConsumed; |
|
472 } |
|
473 else if ( aKeyEvent.iCode == EKeyUpArrow || aKeyEvent.iCode == EKeyDownArrow ) |
|
474 { |
|
475 ret = iFocused->OfferKeyEventL( aKeyEvent, aType ); |
|
476 |
|
477 if ( ret == EKeyWasNotConsumed ) |
|
478 { |
|
479 ret = ChangeFocusL( aKeyEvent ); |
|
480 } |
|
481 |
|
482 if ( ret != EKeyWasConsumed ) |
|
483 { |
|
484 DrawNow(); |
|
485 } |
|
486 } |
|
487 |
|
488 if ( ret == EKeyWasNotConsumed ) |
|
489 { |
|
490 ret = iFocused->OfferKeyEventL( aKeyEvent, aType ); |
|
491 |
|
492 // Report user activity to auto saver if editor field handled the |
|
493 // event. In case of message field (body text), EKeyWasConsumed |
|
494 // condition does not come true because AknFep consumes EKeyEvent |
|
495 // and calls HandleEdwinEventL. This OfferKeyEventL gets only |
|
496 // EEventKeyUp and EEventKeyDown events. Thus, when typing body text, |
|
497 // autosaver is notified in HandleEdwinEventL() |
|
498 if ( ( ret == EKeyWasConsumed ) && ( iFocused != iMessageField ) ) |
|
499 { |
|
500 iView.HandleContainerChangeRequiringToolbarRefresh(); |
|
501 iAutoSaver.ReportActivity(); |
|
502 } |
|
503 } |
|
504 |
|
505 return ret; |
|
506 } |
|
507 |
|
508 // ----------------------------------------------------------------------------- |
|
509 // CNcsComposeViewContainer::UpdateScreenPositionL() |
|
510 // If the user scrolled down in the message field |
|
511 // we want to scroll up the header and grow the message field. |
|
512 // ----------------------------------------------------------------------------- |
|
513 // |
|
514 void CNcsComposeViewContainer::UpdateScreenPositionL( const TUint& /*aKeyCode*/ ) |
|
515 { |
|
516 FUNC_LOG; |
|
517 |
|
518 // get screen rectangle |
|
519 const TRect screenRect( Rect() ); |
|
520 |
|
521 TPoint msgPos( iMessageField->Position() ); |
|
522 TPoint quotePos( iReadOnlyQuoteField->Position() ); |
|
523 |
|
524 // find out cursor position in absolute coordinates |
|
525 TRect lineRect; |
|
526 if ( iFocused == iMessageField ) |
|
527 { |
|
528 iMessageField->GetLineRectL( lineRect ); |
|
529 lineRect.Move( msgPos ); |
|
530 } |
|
531 else if ( iFocused == iReadOnlyQuoteField ) |
|
532 { |
|
533 iReadOnlyQuoteField->GetLineRectL( lineRect ); |
|
534 lineRect.Move( quotePos ); |
|
535 } |
|
536 else |
|
537 { |
|
538 // This function should be used only when focus is in body or read-only quote |
|
539 return; |
|
540 } |
|
541 TPoint linePos = lineRect.iTl; |
|
542 |
|
543 TInt minTargetY = lineRect.Height(); |
|
544 TInt maxTargetY = screenRect.Height() - lineRect.Height() * 2; |
|
545 |
|
546 TInt moveY = 0; |
|
547 // if cursor goes out of screen then move the controls |
|
548 if ( linePos.iY > maxTargetY ) |
|
549 { |
|
550 moveY = maxTargetY - linePos.iY; |
|
551 } |
|
552 else if ( linePos.iY < minTargetY ) |
|
553 { |
|
554 moveY = minTargetY - linePos.iY; |
|
555 } |
|
556 |
|
557 // Check we don't scroll too low |
|
558 if ( quotePos.iY + moveY + iReadOnlyQuoteField->Size().iHeight < screenRect.Height() ) |
|
559 { |
|
560 moveY = screenRect.Height() - quotePos.iY - iReadOnlyQuoteField->Size().iHeight; |
|
561 } |
|
562 |
|
563 // Check we don't scroll too high |
|
564 TPoint headerPos = iHeader->Position(); |
|
565 if ( headerPos.iY + moveY > 0 ) |
|
566 { |
|
567 moveY = -headerPos.iY; |
|
568 } |
|
569 |
|
570 if ( moveY ) |
|
571 { |
|
572 headerPos.iY += moveY; |
|
573 iHeader->SetPosition( headerPos ); |
|
574 |
|
575 msgPos.iY += moveY; |
|
576 iMessageField->SetPosition( msgPos ); |
|
577 |
|
578 quotePos.iY += moveY; |
|
579 iReadOnlyQuoteField->SetPosition( quotePos ); |
|
580 |
|
581 iSeparatorLineYPos += moveY; |
|
582 UpdateScrollBarL(); |
|
583 |
|
584 //DrawDeferred(); |
|
585 } |
|
586 } |
|
587 |
|
588 // ----------------------------------------------------------------------------- |
|
589 // CNcsComposeViewContainer::UpdateFieldPosition |
|
590 // |
|
591 // ----------------------------------------------------------------------------- |
|
592 // |
|
593 void CNcsComposeViewContainer::UpdateFieldPosition(CCoeControl* aAnchor) |
|
594 { |
|
595 FUNC_LOG; |
|
596 |
|
597 // We may not be completely constructed |
|
598 if ( iHeader && iMessageField && iReadOnlyQuoteField ) |
|
599 { |
|
600 // First, move all the controls in the header |
|
601 iHeader->UpdateFieldPosition(aAnchor); |
|
602 |
|
603 // Then, move the body field below the header |
|
604 TRect headerRect = iHeader->Rect(); |
|
605 |
|
606 const TSize separatorSize( NcsUtility::SeparatorSizeInThisResolution() ); |
|
607 iSeparatorLineYPos = headerRect.iBr.iY; |
|
608 |
|
609 TPoint bodyPos( iMessageField->Position() ); |
|
610 bodyPos.iY = iSeparatorLineYPos + separatorSize.iHeight; |
|
611 iMessageField->SetPosition( bodyPos ); |
|
612 |
|
613 TPoint quotePos( iReadOnlyQuoteField->Position() ); |
|
614 quotePos.iY = iMessageField->Rect().iBr.iY; |
|
615 iReadOnlyQuoteField->SetPosition( quotePos ); |
|
616 |
|
617 TRAP_IGNORE(UpdateScrollBarL()); |
|
618 |
|
619 DrawDeferred(); |
|
620 } |
|
621 |
|
622 } |
|
623 |
|
624 // ----------------------------------------------------------------------------- |
|
625 // CNcsComposeViewContainer::ChangeFocusL() |
|
626 // Handles key events |
|
627 // ----------------------------------------------------------------------------- |
|
628 // |
|
629 |
|
630 TKeyResponse CNcsComposeViewContainer::ChangeFocusL( const TKeyEvent& aKeyEvent ) |
|
631 { |
|
632 FUNC_LOG; |
|
633 |
|
634 TKeyResponse ret( EKeyWasNotConsumed ); |
|
635 |
|
636 if ( iFocused == iReadOnlyQuoteField && aKeyEvent.iCode == EKeyUpArrow ) |
|
637 { |
|
638 iFocused = iMessageField; |
|
639 iReadOnlyQuoteField->SetFocus( EFalse, EDrawNow ); |
|
640 iMessageField->SetFocus( ETrue, EDrawNow ); |
|
641 ret = EKeyWasConsumed; |
|
642 } |
|
643 else if ( iFocused == iMessageField ) |
|
644 { |
|
645 if ( aKeyEvent.iCode == EKeyUpArrow ) |
|
646 { |
|
647 iFocused = iHeader; |
|
648 iHeader->SetFocus( ETrue,EDrawNow ); |
|
649 iMessageField->SetFocus( EFalse, EDrawNow ); |
|
650 iHeader->MakeVisible( ETrue ); |
|
651 CommitL(EBodyField); |
|
652 ret = EKeyWasConsumed; |
|
653 } |
|
654 else if ( aKeyEvent.iCode == EKeyDownArrow && iReadOnlyQuoteField->TextLength() ) |
|
655 { |
|
656 // Focus move to read-only quote only if there is some text in it. |
|
657 iFocused = iReadOnlyQuoteField; |
|
658 iReadOnlyQuoteField->SetFocus( ETrue, EDrawNow ); |
|
659 iMessageField->SetFocus( EFalse, EDrawNow ); |
|
660 iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ); |
|
661 ret = EKeyWasConsumed; |
|
662 } |
|
663 } |
|
664 else if ( iFocused == iHeader && aKeyEvent.iCode == EKeyDownArrow ) |
|
665 { |
|
666 iFocused = iMessageField; |
|
667 iHeader->SetFocus( EFalse, EDrawNow ); |
|
668 iMessageField->SetFocus( ETrue, EDrawNow ); |
|
669 iMessageField->SetCursorPosL( 0, EFalse ); |
|
670 ret = EKeyWasConsumed; |
|
671 } |
|
672 |
|
673 if ( ret == EKeyWasConsumed ) |
|
674 { |
|
675 UpdateScreenPositionL( aKeyEvent.iCode ); |
|
676 } |
|
677 |
|
678 return ret; |
|
679 } |
|
680 |
|
681 // ----------------------------------------------------------------------------- |
|
682 // CNcsComposeViewContainer::UpdateFieldSizeL() |
|
683 // This is called through MNcsFieldSizeObserver when the rects have changed |
|
684 // ----------------------------------------------------------------------------- |
|
685 // |
|
686 TBool CNcsComposeViewContainer::UpdateFieldSizeL() |
|
687 { |
|
688 FUNC_LOG; |
|
689 |
|
690 // We may not have finished construction |
|
691 if ( iHeader && iMessageField && iReadOnlyQuoteField ) |
|
692 { |
|
693 SizeChanged(); |
|
694 DrawDeferred(); |
|
695 } |
|
696 |
|
697 return EFalse; |
|
698 } |
|
699 |
|
700 // <cmail> Platform layout changes |
|
701 // ----------------------------------------------------------------------------- |
|
702 // CNcsComposeViewContainer::SizeChanged() |
|
703 // set size |
|
704 // ----------------------------------------------------------------------------- |
|
705 // |
|
706 void CNcsComposeViewContainer::SizeChanged() |
|
707 { |
|
708 FUNC_LOG; |
|
709 |
|
710 const TRect rect( Rect() ); |
|
711 iScrollBar->SetRect( NcsUtility::ListCmailScrollbarRect( rect ) ); |
|
712 TRect cmailPaneRect( NcsUtility::ListCmailPaneRect( rect ) ); |
|
713 |
|
714 const TInt headerLineCount( iHeader->LayoutLineCount() ); |
|
715 const TPoint headerPos( NcsUtility::HeaderControlPosition( cmailPaneRect, 0 ) ); |
|
716 cmailPaneRect.Move( 0, iHeader->Position().iY - headerPos.iY ); |
|
717 |
|
718 NcsUtility::LayoutHeaderControl( iHeader, cmailPaneRect, 0, headerLineCount ); |
|
719 |
|
720 // do not used stored headerLineCount, because relayout above may grow or |
|
721 // shrink edit fields |
|
722 TRAP_IGNORE( iMessageField->FormatAllTextNowL() ); |
|
723 NcsUtility::LayoutBodyEdwin( iMessageField, cmailPaneRect, iHeader->LayoutLineCount(), iMessageField->LineCount(), |
|
724 iSeparatorLineYPos ); |
|
725 |
|
726 iMessageField->UpdateFontSize(); |
|
727 |
|
728 TInt readOnlyQuoteFieldHeight( 0 ); |
|
729 if ( iReadOnlyQuoteField->TextLength() ) |
|
730 { |
|
731 TInt dummySeparatorPos; |
|
732 NcsUtility::LayoutBodyEdwin( iReadOnlyQuoteField, cmailPaneRect, headerLineCount + iMessageField->LineCount(), iReadOnlyQuoteField->LineCount(), |
|
733 dummySeparatorPos ); |
|
734 iReadOnlyQuoteField->UpdateFontSize(); |
|
735 readOnlyQuoteFieldHeight = iReadOnlyQuoteField->Rect().Height(); |
|
736 } |
|
737 |
|
738 if ( iBgContext ) |
|
739 { |
|
740 iBgContext->SetRect( Rect() ); |
|
741 } |
|
742 iMessageField->SetRealRect( Rect() ); |
|
743 iReadOnlyQuoteField->SetRealRect( Rect() ); |
|
744 |
|
745 TInt messageLineHeigth = NcsUtility::HeaderCaptionPaneRect( cmailPaneRect ).Height(); |
|
746 iMessageEditorMinHeigth = cmailPaneRect.Height() - iHeader->Size().iHeight - |
|
747 NcsUtility::SeparatorSizeInThisResolution().iHeight - |
|
748 readOnlyQuoteFieldHeight; |
|
749 |
|
750 iMessageEditorMinHeigth -= iMessageEditorMinHeigth % messageLineHeigth; |
|
751 if ( iMessageEditorMinHeigth > messageLineHeigth ) |
|
752 { |
|
753 TSize newSize( iMessageField->Size().iWidth, |
|
754 Max( iMessageField->Size().iHeight, iMessageEditorMinHeigth )); |
|
755 |
|
756 iMessageField->SetSize( newSize ); |
|
757 } |
|
758 else |
|
759 { |
|
760 iMessageEditorMinHeigth = messageLineHeigth; |
|
761 } |
|
762 |
|
763 TRAP_IGNORE( UpdateScrollBarL() ); |
|
764 DrawNow(); |
|
765 |
|
766 } |
|
767 // </cmail> Platform layout changes |
|
768 |
|
769 // ----------------------------------------------------------------------------- |
|
770 // CNcsComposeViewContainer::Draw() const |
|
771 // Draws the display |
|
772 // ----------------------------------------------------------------------------- |
|
773 // |
|
774 void CNcsComposeViewContainer::Draw( const TRect& /*aRect*/ ) const |
|
775 { |
|
776 FUNC_LOG; |
|
777 // <cmail> S60 skin support |
|
778 if ( iBgContext ) |
|
779 { |
|
780 CWindowGc& gc = SystemGc(); |
|
781 |
|
782 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
783 |
|
784 if ( skin ) |
|
785 { |
|
786 AknsDrawUtils::Background( skin, iBgContext, this, gc, Rect() ); |
|
787 } |
|
788 } |
|
789 } |
|
790 |
|
791 |
|
792 // ----------------------------------------------------------------------------- |
|
793 // CNcsComposeViewContainer::SetBodyContentL() |
|
794 // ----------------------------------------------------------------------------- |
|
795 // |
|
796 void CNcsComposeViewContainer::SetBodyContentL( const TDesC& aMessage, |
|
797 const TDesC& aReadOnlyQuote ) |
|
798 { |
|
799 FUNC_LOG; |
|
800 delete iReadOnlyQuote; |
|
801 iReadOnlyQuote = NULL; |
|
802 if ( aReadOnlyQuote.Length() ) |
|
803 { |
|
804 iReadOnlyQuote = aReadOnlyQuote.AllocL(); |
|
805 } |
|
806 |
|
807 RMemReadStream inputStream( aMessage.Ptr(), aMessage.Size() ); |
|
808 CleanupClosePushL( inputStream ); |
|
809 iMessageField->RichText()->ImportTextL( 0, inputStream, |
|
810 CPlainText::EOrganiseByParagraph ); |
|
811 CleanupStack::PopAndDestroy( &inputStream ); |
|
812 |
|
813 // Activating the field will set the control to the end of the text |
|
814 iMessageField->ActivateL(); |
|
815 iMessageField->SetCursorPosL(0,EFalse); |
|
816 |
|
817 inputStream.Open( aReadOnlyQuote.Ptr(), aReadOnlyQuote.Size() ); |
|
818 CleanupClosePushL( inputStream ); |
|
819 iReadOnlyQuoteField->RichText()->ImportTextL( 0, inputStream, |
|
820 CPlainText::EOrganiseByParagraph ); |
|
821 CleanupStack::PopAndDestroy( &inputStream ); |
|
822 |
|
823 // Activating the field will set the control to the end of the text |
|
824 iReadOnlyQuoteField->ActivateL(); |
|
825 iReadOnlyQuoteField->SetCursorPosL(0,EFalse); |
|
826 |
|
827 // Recalculate the size of the body field |
|
828 SizeChanged(); |
|
829 } |
|
830 |
|
831 // ----------------------------------------------------------------------------- |
|
832 // CNcsComposeViewContainer::GetBodyContentLC() |
|
833 // ----------------------------------------------------------------------------- |
|
834 // |
|
835 HBufC* CNcsComposeViewContainer::GetBodyContentLC() |
|
836 { |
|
837 FUNC_LOG; |
|
838 HBufC* body = NULL; |
|
839 |
|
840 TInt messageLength = iMessageField->TextLength(); |
|
841 HBufC* message = HBufC::NewLC( messageLength ); |
|
842 TPtr messagePtr = message->Des(); |
|
843 iMessageField->GetText( messagePtr ); |
|
844 NcsUtility::ConvertLineEndingsL( message ); |
|
845 CleanupStack::Pop(); |
|
846 CleanupStack::PushL( message ); |
|
847 messageLength = message->Length(); |
|
848 |
|
849 // Append read-only quote if present |
|
850 if ( iReadOnlyQuote ) |
|
851 { |
|
852 TInt quoteLength = iReadOnlyQuote->Length(); |
|
853 TInt length = messageLength + KIMSLineFeed().Length() + quoteLength; |
|
854 body = message->ReAllocL( length ); |
|
855 CleanupStack::Pop( message ); |
|
856 CleanupStack::PushL( body ); |
|
857 |
|
858 TPtr bodyPtr = body->Des(); |
|
859 bodyPtr.Append( KIMSLineFeed() ); |
|
860 bodyPtr.Append( *iReadOnlyQuote ); |
|
861 } |
|
862 else |
|
863 { |
|
864 body = message; |
|
865 } |
|
866 |
|
867 return body; |
|
868 } |
|
869 |
|
870 // ----------------------------------------------------------------------------- |
|
871 // CNcsComposeViewContainer::BodyText() |
|
872 // ----------------------------------------------------------------------------- |
|
873 // |
|
874 CRichText& CNcsComposeViewContainer::BodyText() |
|
875 { |
|
876 FUNC_LOG; |
|
877 return *iMessageField->RichText(); |
|
878 } |
|
879 |
|
880 // ----------------------------------------------------------------------------- |
|
881 // CNcsComposeViewContainer::HandleScrollEventL() |
|
882 // ----------------------------------------------------------------------------- |
|
883 // |
|
884 void CNcsComposeViewContainer::HandleScrollEventL( CEikScrollBar* aScrollBar, TEikScrollEvent /*aEventType*/ ) |
|
885 { |
|
886 // <cmail> Platform layout change |
|
887 FUNC_LOG; |
|
888 |
|
889 if( iPhysics ) |
|
890 { |
|
891 iPhysics->StopPhysics(); |
|
892 iPhysics->ResetFriction(); |
|
893 } |
|
894 |
|
895 ScrollL( aScrollBar->ThumbPosition() ); |
|
896 } |
|
897 |
|
898 // ----------------------------------------------------------------------------- |
|
899 // CNcsComposeViewContainer::OperationCompleteL |
|
900 // ----------------------------------------------------------------------------- |
|
901 // |
|
902 void CNcsComposeViewContainer::OperationCompleteL( TContactHandlerCmd /*aCmd*/, |
|
903 const RPointerArray<CFSEmailUiClsItem>& aContacts ) |
|
904 { |
|
905 FUNC_LOG; |
|
906 if ( aContacts.Count() ) |
|
907 { |
|
908 RPointerArray<CNcsEmailAddressObject> ncsObjects; |
|
909 CleanupResetAndDestroyClosePushL( ncsObjects ); |
|
910 |
|
911 for ( TInt i = 0 ; i < aContacts.Count() ; i++ ) |
|
912 { |
|
913 CNcsEmailAddressObject* object = CNcsEmailAddressObject::NewL( aContacts[i]->DisplayName(), |
|
914 aContacts[i]->EmailAddress() ); |
|
915 if ( aContacts[i]->MultipleEmails() ) |
|
916 { |
|
917 |
|
918 object->SetDisplayFull( ETrue ); |
|
919 } |
|
920 CleanupStack::PushL( object ); |
|
921 ncsObjects.AppendL( object ); |
|
922 CleanupStack::Pop( object ); |
|
923 } |
|
924 |
|
925 if ( iAppendAddresses == EAppendTo ) |
|
926 { |
|
927 AppendToFieldAddressesL( ncsObjects ); |
|
928 } |
|
929 // if Cc field is focused insert addresses in there |
|
930 else if ( iAppendAddresses == EAppendCc ) |
|
931 { |
|
932 AppendCcFieldAddressesL( ncsObjects ); |
|
933 } |
|
934 // if Bcc field is focused insert addresses in there |
|
935 else if ( iAppendAddresses == EAppendBcc ) |
|
936 { |
|
937 AppendBccFieldAddressesL( ncsObjects ); |
|
938 } |
|
939 |
|
940 CleanupStack::PopAndDestroy( &ncsObjects ); |
|
941 } |
|
942 iView.HandleContainerChangeRequiringToolbarRefresh(); |
|
943 } |
|
944 |
|
945 void CNcsComposeViewContainer::OperationErrorL( TContactHandlerCmd, TInt /*aError*/ ) |
|
946 { |
|
947 FUNC_LOG; |
|
948 //Nothing to do |
|
949 } |
|
950 |
|
951 // ----------------------------------------------------------------------------- |
|
952 // CNcsComposeViewContainer::HandleEdwinEventL |
|
953 // ----------------------------------------------------------------------------- |
|
954 // |
|
955 void CNcsComposeViewContainer::HandleEdwinEventL( CEikEdwin* aEdwin, |
|
956 TEdwinEvent aEventType ) |
|
957 { |
|
958 FUNC_LOG; |
|
959 if ( aEdwin == iMessageField || aEdwin == iReadOnlyQuoteField ) |
|
960 { |
|
961 if ( aEventType == MEikEdwinObserver::EEventTextUpdate || |
|
962 aEventType == MEikEdwinObserver::EEventNavigation ) |
|
963 { |
|
964 iAutoSaver.ReportActivity(); |
|
965 |
|
966 // Update screen position and scroll bar when text changed or cursor moved |
|
967 UpdateScreenPositionL(); |
|
968 UpdateScrollBarL(); |
|
969 DrawDeferred(); |
|
970 } |
|
971 } |
|
972 } |
|
973 |
|
974 // ----------------------------------------------------------------------------- |
|
975 // CNcsComposeViewContainer::HandleEdwinSizeEventL |
|
976 // ----------------------------------------------------------------------------- |
|
977 // |
|
978 TBool CNcsComposeViewContainer::HandleEdwinSizeEventL( CEikEdwin* aEdwin, |
|
979 TEdwinSizeEvent /*aEventType*/, TSize aDesirableEdwinSize ) |
|
980 { |
|
981 FUNC_LOG; |
|
982 TBool ret = ETrue; |
|
983 |
|
984 const TRect rect( Rect() ); |
|
985 TRect cmailPaneRect( NcsUtility::ListCmailPaneRect( rect ) ); |
|
986 |
|
987 if ( aDesirableEdwinSize.iHeight < iPrevDesiredHeigth ) |
|
988 { |
|
989 if ( aDesirableEdwinSize.iHeight < iMessageEditorMinHeigth ) |
|
990 { |
|
991 ScrollL( 0 ); |
|
992 } |
|
993 } |
|
994 |
|
995 if ( aEdwin == iMessageField ) |
|
996 { |
|
997 if ( aDesirableEdwinSize.iHeight >= iMessageEditorMinHeigth ) |
|
998 { |
|
999 aEdwin->SetSize( aDesirableEdwinSize ); |
|
1000 } |
|
1001 } |
|
1002 else |
|
1003 { |
|
1004 aEdwin->SetSize( aDesirableEdwinSize ); |
|
1005 } |
|
1006 if ( aEdwin == iMessageField ) |
|
1007 { |
|
1008 // move the quote field below the body field |
|
1009 TPoint quotePos = iMessageField->Position(); |
|
1010 quotePos.iY += iMessageField->Size().iHeight; |
|
1011 iReadOnlyQuoteField->SetPosition( quotePos ); |
|
1012 UpdateScreenPositionL(); |
|
1013 } |
|
1014 |
|
1015 iPrevDesiredHeigth = aDesirableEdwinSize.iHeight; |
|
1016 |
|
1017 return ret; |
|
1018 } |
|
1019 |
|
1020 // ----------------------------------------------------------------------------- |
|
1021 // CNcsComposeViewContainer::MopSupplyObject |
|
1022 // From CCoeControl. |
|
1023 // ----------------------------------------------------------------------------- |
|
1024 // |
|
1025 TTypeUid::Ptr CNcsComposeViewContainer::MopSupplyObject( TTypeUid aId ) |
|
1026 { |
|
1027 FUNC_LOG; |
|
1028 return CCoeControl::MopSupplyObject( aId ); |
|
1029 } |
|
1030 |
|
1031 // ----------------------------------------------------------------------------- |
|
1032 // CNcsComposeViewContainer::UpdateScrollBarL() |
|
1033 // ----------------------------------------------------------------------------- |
|
1034 // |
|
1035 void CNcsComposeViewContainer::UpdateScrollBarL() |
|
1036 { |
|
1037 FUNC_LOG; |
|
1038 |
|
1039 TRect headerRect = iHeader->Rect(); |
|
1040 TRect bodyRect = iMessageField->Rect(); |
|
1041 TRect quoteRect = iReadOnlyQuoteField->Rect(); |
|
1042 const TSize separatorSize( NcsUtility::SeparatorSizeInThisResolution() ); |
|
1043 |
|
1044 TInt totalComposerHeight = headerRect.Height() + separatorSize.iHeight*2 + |
|
1045 bodyRect.Height() + quoteRect.Height(); |
|
1046 |
|
1047 TInt visibleAreaHeight = Rect().Height(); |
|
1048 TInt visiblePosition = -headerRect.iTl.iY; |
|
1049 |
|
1050 iScrollBarModel.SetScrollSpan( totalComposerHeight ); |
|
1051 iScrollBarModel.SetWindowSize( visibleAreaHeight ); |
|
1052 iScrollBarModel.SetFocusPosition( visiblePosition ); |
|
1053 |
|
1054 iScrollBar->SetModelL( &iScrollBarModel ); |
|
1055 iScrollBar->DrawNow(); |
|
1056 } |
|
1057 |
|
1058 // ----------------------------------------------------------------------------- |
|
1059 // CNcsComposeViewContainer::SetApplicationRect() |
|
1060 // ----------------------------------------------------------------------------- |
|
1061 // |
|
1062 // <cmail> |
|
1063 /* |
|
1064 void CNcsComposeViewContainer::SetApplicationRect( TRect aRect ) |
|
1065 { |
|
1066 FUNC_LOG; |
|
1067 |
|
1068 iApplicationRect = aRect; |
|
1069 |
|
1070 } |
|
1071 */ |
|
1072 // </cmail> |
|
1073 |
|
1074 |
|
1075 // ----------------------------------------------------------------------------- |
|
1076 // CNcsComposeViewContainer::SetFocusToMessageFieldL() |
|
1077 // ----------------------------------------------------------------------------- |
|
1078 // |
|
1079 void CNcsComposeViewContainer::SetFocusToMessageFieldL() |
|
1080 { |
|
1081 FUNC_LOG; |
|
1082 |
|
1083 if( iFocused != iMessageField ) |
|
1084 { |
|
1085 iHeader->SetFocus( EFalse, ENoDrawNow ); |
|
1086 iMessageField->SetCursorPosL( 0, EFalse ); |
|
1087 iMessageField->SetFocus( ETrue, EDrawNow ); |
|
1088 iFocused = iMessageField; |
|
1089 UpdateScreenPositionL(); |
|
1090 DrawDeferred(); |
|
1091 } |
|
1092 |
|
1093 } |
|
1094 |
|
1095 // ----------------------------------------------------------------------------- |
|
1096 // CNcsComposeViewContainer::AddQuickTextL() |
|
1097 // ----------------------------------------------------------------------------- |
|
1098 // |
|
1099 void CNcsComposeViewContainer::AddQuickTextL( const TDesC& aText ) |
|
1100 { |
|
1101 FUNC_LOG; |
|
1102 |
|
1103 TInt pos = iMessageField->CursorPos(); |
|
1104 TCursorSelection selIns( pos, pos ); |
|
1105 iMessageField->InsertDeleteCharsL( pos, aText, selIns ); |
|
1106 DrawDeferred(); |
|
1107 |
|
1108 } |
|
1109 |
|
1110 // ----------------------------------------------------------------------------- |
|
1111 // CNcsComposeViewContainer::SelectAllToFieldTextL |
|
1112 // |
|
1113 // ----------------------------------------------------------------------------- |
|
1114 // |
|
1115 void CNcsComposeViewContainer::SelectAllToFieldTextL() |
|
1116 { |
|
1117 FUNC_LOG; |
|
1118 |
|
1119 iHeader->SelectAllToFieldTextL(); |
|
1120 |
|
1121 } |
|
1122 |
|
1123 // ----------------------------------------------------------------------------- |
|
1124 // CNcsComposeViewContainer::SelectAllCcFieldTextL |
|
1125 // |
|
1126 // ----------------------------------------------------------------------------- |
|
1127 // |
|
1128 void CNcsComposeViewContainer::SelectAllCcFieldTextL() |
|
1129 { |
|
1130 FUNC_LOG; |
|
1131 |
|
1132 iHeader->SelectAllCcFieldTextL(); |
|
1133 |
|
1134 } |
|
1135 |
|
1136 // ----------------------------------------------------------------------------- |
|
1137 // CNcsComposeViewContainer::SelectAllBccFieldTextL |
|
1138 // |
|
1139 // ----------------------------------------------------------------------------- |
|
1140 // |
|
1141 void CNcsComposeViewContainer::SelectAllBccFieldTextL() |
|
1142 { |
|
1143 FUNC_LOG; |
|
1144 |
|
1145 iHeader->SelectAllBccFieldTextL(); |
|
1146 |
|
1147 } |
|
1148 |
|
1149 // ----------------------------------------------------------------------------- |
|
1150 // CNcsComposeViewContainer::SelectAllSubjectFieldTextL |
|
1151 // |
|
1152 // ----------------------------------------------------------------------------- |
|
1153 // |
|
1154 void CNcsComposeViewContainer::SelectAllSubjectFieldTextL() |
|
1155 { |
|
1156 FUNC_LOG; |
|
1157 |
|
1158 iHeader->SelectAllSubjectFieldTextL(); |
|
1159 |
|
1160 } |
|
1161 |
|
1162 // ----------------------------------------------------------------------------- |
|
1163 // CNcsComposeViewContainer::IsSubjectFieldEmpty |
|
1164 // |
|
1165 // ----------------------------------------------------------------------------- |
|
1166 // |
|
1167 TBool CNcsComposeViewContainer::IsSubjectFieldEmpty() |
|
1168 { |
|
1169 FUNC_LOG; |
|
1170 return iHeader->IsSubjectFieldEmpty(); |
|
1171 } |
|
1172 |
|
1173 // ----------------------------------------------------------------------------- |
|
1174 // CNcsComposeViewContainer::AppendAddressesL |
|
1175 // |
|
1176 // ----------------------------------------------------------------------------- |
|
1177 // |
|
1178 TBool CNcsComposeViewContainer::AppendAddressesL() |
|
1179 { |
|
1180 FUNC_LOG; |
|
1181 |
|
1182 iContactHandler = CFsDelayedLoader::InstanceL()->GetContactHandlerL(); |
|
1183 if ( iContactHandler ) |
|
1184 { |
|
1185 iContactHandler->GetAddressesFromPhonebookL( this ); |
|
1186 } |
|
1187 |
|
1188 if ( IsFocusCc() ) |
|
1189 { |
|
1190 iAppendAddresses = EAppendCc; |
|
1191 } |
|
1192 else if ( IsFocusBcc() ) |
|
1193 { |
|
1194 iAppendAddresses = EAppendBcc; |
|
1195 } |
|
1196 else |
|
1197 { |
|
1198 iAppendAddresses = EAppendTo; |
|
1199 } |
|
1200 |
|
1201 return ETrue; |
|
1202 } |
|
1203 |
|
1204 // ----------------------------------------------------------------------------- |
|
1205 // CNcsComposeViewContainer::HandleAttachmentsOpenCommand |
|
1206 // If attachment header field is focused and open key is pressed |
|
1207 // ----------------------------------------------------------------------------- |
|
1208 // |
|
1209 void CNcsComposeViewContainer::HandleAttachmentsOpenCommandL() |
|
1210 { |
|
1211 FUNC_LOG; |
|
1212 |
|
1213 iView.HandleCommandL( EFsEmailUiCmdOpenAttachment ); |
|
1214 |
|
1215 } |
|
1216 |
|
1217 // ----------------------------------------------------------------------------- |
|
1218 // CNcsComposeViewContainer::LaunchAttachmentActionMenuL |
|
1219 // Called when right-click happens in the attahcments field |
|
1220 // ----------------------------------------------------------------------------- |
|
1221 // |
|
1222 void CNcsComposeViewContainer::LaunchAttachmentActionMenuL() |
|
1223 { |
|
1224 FUNC_LOG; |
|
1225 iView.LaunchAttachmentActionMenuL(); |
|
1226 } |
|
1227 |
|
1228 // ----------------------------------------------------------------------------- |
|
1229 // CNcsComposeViewContainer::GetToFieldAddressesL |
|
1230 // |
|
1231 // ----------------------------------------------------------------------------- |
|
1232 // |
|
1233 const RPointerArray<CNcsEmailAddressObject>& CNcsComposeViewContainer::GetToFieldAddressesL( TBool aParseNow ) |
|
1234 { |
|
1235 return iHeader->GetToFieldAddressesL( aParseNow ); |
|
1236 } |
|
1237 |
|
1238 // ----------------------------------------------------------------------------- |
|
1239 // CNcsComposeViewContainer::GetCcFieldAddressesL |
|
1240 // |
|
1241 // ----------------------------------------------------------------------------- |
|
1242 // |
|
1243 const RPointerArray<CNcsEmailAddressObject>& CNcsComposeViewContainer::GetCcFieldAddressesL( TBool aParseNow ) |
|
1244 { |
|
1245 return iHeader->GetCcFieldAddressesL( aParseNow ); |
|
1246 } |
|
1247 |
|
1248 // ----------------------------------------------------------------------------- |
|
1249 // CNcsComposeViewContainer::GetBccFieldAddressesL |
|
1250 // |
|
1251 // ----------------------------------------------------------------------------- |
|
1252 // |
|
1253 const RPointerArray<CNcsEmailAddressObject>& CNcsComposeViewContainer::GetBccFieldAddressesL( TBool aParseNow ) |
|
1254 { |
|
1255 return iHeader->GetBccFieldAddressesL( aParseNow ); |
|
1256 } |
|
1257 |
|
1258 // ----------------------------------------------------------------------------- |
|
1259 // CNcsComposeViewContainer::GetSubjectLC |
|
1260 // |
|
1261 // ----------------------------------------------------------------------------- |
|
1262 // |
|
1263 HBufC* CNcsComposeViewContainer::GetSubjectLC() const |
|
1264 { |
|
1265 FUNC_LOG; |
|
1266 return iHeader->GetSubjectLC(); |
|
1267 } |
|
1268 |
|
1269 // ----------------------------------------------------------------------------- |
|
1270 // CNcsComposeViewContainer::IsBccFieldVisible |
|
1271 // |
|
1272 // ----------------------------------------------------------------------------- |
|
1273 // |
|
1274 TBool CNcsComposeViewContainer::IsBccFieldVisible() const |
|
1275 { |
|
1276 FUNC_LOG; |
|
1277 return iHeader->IsBccFieldVisible(); |
|
1278 } |
|
1279 |
|
1280 // ----------------------------------------------------------------------------- |
|
1281 // CNcsComposeViewContainer::IsCcFieldVisible |
|
1282 // |
|
1283 // ----------------------------------------------------------------------------- |
|
1284 // |
|
1285 TBool CNcsComposeViewContainer::IsCcFieldVisible() const |
|
1286 { |
|
1287 FUNC_LOG; |
|
1288 return iHeader->IsCcFieldVisible(); |
|
1289 } |
|
1290 |
|
1291 // <cmail> Removed unneeded IsFocusAif |
|
1292 // </cmail> |
|
1293 |
|
1294 // ----------------------------------------------------------------------------- |
|
1295 // CNcsComposeViewContainer::IsFocusAttachments |
|
1296 // |
|
1297 // ----------------------------------------------------------------------------- |
|
1298 // |
|
1299 TBool CNcsComposeViewContainer::IsFocusAttachments() const |
|
1300 { |
|
1301 FUNC_LOG; |
|
1302 return iHeader->IsFocusAttachments(); |
|
1303 } |
|
1304 |
|
1305 // ----------------------------------------------------------------------------- |
|
1306 // CNcsComposeViewContainer::IsFocusTo |
|
1307 // |
|
1308 // ----------------------------------------------------------------------------- |
|
1309 // |
|
1310 TBool CNcsComposeViewContainer::IsFocusTo() const |
|
1311 { |
|
1312 FUNC_LOG; |
|
1313 return iHeader->IsFocusTo(); |
|
1314 } |
|
1315 |
|
1316 // ----------------------------------------------------------------------------- |
|
1317 // CNcsComposeViewContainer::IsFocusCc |
|
1318 // |
|
1319 // ----------------------------------------------------------------------------- |
|
1320 // |
|
1321 TBool CNcsComposeViewContainer::IsFocusCc() const |
|
1322 { |
|
1323 FUNC_LOG; |
|
1324 return iHeader->IsFocusCc(); |
|
1325 } |
|
1326 |
|
1327 // ----------------------------------------------------------------------------- |
|
1328 // CNcsComposeViewContainer::IsFocusBcc |
|
1329 // |
|
1330 // ----------------------------------------------------------------------------- |
|
1331 // |
|
1332 TBool CNcsComposeViewContainer::IsFocusBcc() const |
|
1333 { |
|
1334 FUNC_LOG; |
|
1335 return iHeader->IsFocusBcc(); |
|
1336 } |
|
1337 |
|
1338 // ----------------------------------------------------------------------------- |
|
1339 // CNcsComposeViewContainer::GetCcFieldLength |
|
1340 // |
|
1341 // ----------------------------------------------------------------------------- |
|
1342 // |
|
1343 TInt CNcsComposeViewContainer::GetCcFieldLength() const |
|
1344 { |
|
1345 FUNC_LOG; |
|
1346 return iHeader->GetCcFieldLength(); |
|
1347 } |
|
1348 |
|
1349 // ----------------------------------------------------------------------------- |
|
1350 // CNcsComposeViewContainer::GetBccFieldLength |
|
1351 // |
|
1352 // ----------------------------------------------------------------------------- |
|
1353 // |
|
1354 TInt CNcsComposeViewContainer::GetBccFieldLength() const |
|
1355 { |
|
1356 FUNC_LOG; |
|
1357 return iHeader->GetBccFieldLength(); |
|
1358 } |
|
1359 |
|
1360 // ----------------------------------------------------------------------------- |
|
1361 // CNcsComposeViewContainer::GetToFieldLength |
|
1362 // |
|
1363 // ----------------------------------------------------------------------------- |
|
1364 // |
|
1365 TInt CNcsComposeViewContainer::GetToFieldLength() const |
|
1366 { |
|
1367 FUNC_LOG; |
|
1368 return iHeader->GetToFieldLength(); |
|
1369 } |
|
1370 |
|
1371 // ----------------------------------------------------------------------------- |
|
1372 // CNcsComposeViewContainer::GetSubjectFieldLength |
|
1373 // |
|
1374 // ----------------------------------------------------------------------------- |
|
1375 // |
|
1376 TInt CNcsComposeViewContainer::GetSubjectFieldLength() const |
|
1377 { |
|
1378 FUNC_LOG; |
|
1379 return iHeader->GetSubjectFieldLength(); |
|
1380 } |
|
1381 |
|
1382 // ----------------------------------------------------------------------------- |
|
1383 // CNcsComposeViewContainer::GetMessageFieldLength |
|
1384 // |
|
1385 // ----------------------------------------------------------------------------- |
|
1386 // |
|
1387 TInt CNcsComposeViewContainer::GetMessageFieldLength() const |
|
1388 { |
|
1389 FUNC_LOG; |
|
1390 return iMessageField->TextLength(); |
|
1391 } |
|
1392 |
|
1393 // ----------------------------------------------------------------------------- |
|
1394 // CNcsComposeViewContainer::GetAttachmentCount |
|
1395 // |
|
1396 // ----------------------------------------------------------------------------- |
|
1397 // |
|
1398 TInt CNcsComposeViewContainer::GetAttachmentCount() const |
|
1399 { |
|
1400 FUNC_LOG; |
|
1401 TInt count = iView.AttachmentsListControl()->Model()->Count(); |
|
1402 return count; |
|
1403 } |
|
1404 |
|
1405 // ----------------------------------------------------------------------------- |
|
1406 // CNcsComposeViewContainer::HasRemoteAttachments |
|
1407 // |
|
1408 // ----------------------------------------------------------------------------- |
|
1409 // |
|
1410 TBool CNcsComposeViewContainer::HasRemoteAttachments() const |
|
1411 { |
|
1412 FUNC_LOG; |
|
1413 TBool ret = iView.AttachmentsListControl()->Model()->HasRemoteAttachments(); |
|
1414 return ret; |
|
1415 } |
|
1416 |
|
1417 // ----------------------------------------------------------------------------- |
|
1418 // CNcsComposeViewContainer::GetLookupTextLC |
|
1419 // |
|
1420 // ----------------------------------------------------------------------------- |
|
1421 // |
|
1422 HBufC* CNcsComposeViewContainer::GetLookupTextLC() const |
|
1423 { |
|
1424 FUNC_LOG; |
|
1425 return iHeader->GetLookupTextLC(); |
|
1426 } |
|
1427 |
|
1428 // ----------------------------------------------------------------------------- |
|
1429 // CNcsComposeViewContainer::GetToFieldSelectionLength |
|
1430 // |
|
1431 // ----------------------------------------------------------------------------- |
|
1432 // |
|
1433 TInt CNcsComposeViewContainer::GetToFieldSelectionLength() const |
|
1434 { |
|
1435 FUNC_LOG; |
|
1436 return iHeader->GetToFieldSelectionLength(); |
|
1437 } |
|
1438 |
|
1439 // ----------------------------------------------------------------------------- |
|
1440 // CNcsComposeViewContainer::GetCcFieldSelectionLength |
|
1441 // |
|
1442 // ----------------------------------------------------------------------------- |
|
1443 // |
|
1444 TInt CNcsComposeViewContainer::GetCcFieldSelectionLength() const |
|
1445 { |
|
1446 FUNC_LOG; |
|
1447 return iHeader->GetCcFieldSelectionLength(); |
|
1448 } |
|
1449 |
|
1450 // ----------------------------------------------------------------------------- |
|
1451 // CNcsComposeViewContainer::GetBccFieldSelectionLength |
|
1452 // |
|
1453 // ----------------------------------------------------------------------------- |
|
1454 // |
|
1455 TInt CNcsComposeViewContainer::GetBccFieldSelectionLength() const |
|
1456 { |
|
1457 FUNC_LOG; |
|
1458 return iHeader->GetBccFieldSelectionLength(); |
|
1459 } |
|
1460 |
|
1461 // ----------------------------------------------------------------------------- |
|
1462 // CNcsComposeViewContainer::SetMenuBar |
|
1463 // |
|
1464 // ----------------------------------------------------------------------------- |
|
1465 // |
|
1466 void CNcsComposeViewContainer::SetMenuBar( CEikButtonGroupContainer* aMenuBar ) |
|
1467 { |
|
1468 FUNC_LOG; |
|
1469 |
|
1470 iHeader->SetMenuBar(aMenuBar); |
|
1471 |
|
1472 } |
|
1473 |
|
1474 // ----------------------------------------------------------------------------- |
|
1475 // CNcsComposeViewContainer::SetToFieldAddressesL |
|
1476 // |
|
1477 // ----------------------------------------------------------------------------- |
|
1478 // |
|
1479 void CNcsComposeViewContainer::SetToFieldAddressesL( RPointerArray<CNcsEmailAddressObject>& aAddress ) |
|
1480 { |
|
1481 FUNC_LOG; |
|
1482 |
|
1483 iHeader->SetToFieldAddressesL(aAddress); |
|
1484 |
|
1485 } |
|
1486 |
|
1487 // ----------------------------------------------------------------------------- |
|
1488 // CNcsComposeViewContainer::SetCcFieldAddressesL |
|
1489 // |
|
1490 // ----------------------------------------------------------------------------- |
|
1491 // |
|
1492 void CNcsComposeViewContainer::SetCcFieldAddressesL( RPointerArray<CNcsEmailAddressObject>& aAddress ) |
|
1493 { |
|
1494 FUNC_LOG; |
|
1495 |
|
1496 iHeader->SetCcFieldAddressesL( aAddress ); |
|
1497 |
|
1498 } |
|
1499 |
|
1500 // ----------------------------------------------------------------------------- |
|
1501 // CNcsComposeViewContainer::SetBccFieldAddressesL |
|
1502 // |
|
1503 // ----------------------------------------------------------------------------- |
|
1504 // |
|
1505 void CNcsComposeViewContainer::SetBccFieldAddressesL( RPointerArray<CNcsEmailAddressObject>& aAddress ) |
|
1506 { |
|
1507 FUNC_LOG; |
|
1508 |
|
1509 iHeader->SetBccFieldAddressesL( aAddress ); |
|
1510 |
|
1511 } |
|
1512 |
|
1513 // ----------------------------------------------------------------------------- |
|
1514 // CNcsComposeViewContainer::AppendToFieldAddressesL |
|
1515 // |
|
1516 // ----------------------------------------------------------------------------- |
|
1517 // |
|
1518 void CNcsComposeViewContainer::AppendToFieldAddressesL( RPointerArray<CNcsEmailAddressObject>& aAddresses ) |
|
1519 { |
|
1520 FUNC_LOG; |
|
1521 |
|
1522 iHeader->AppendToFieldAddressesL(aAddresses); |
|
1523 |
|
1524 } |
|
1525 |
|
1526 // ----------------------------------------------------------------------------- |
|
1527 // CNcsComposeViewContainer::AppendCcFieldAddressesL |
|
1528 // |
|
1529 // ----------------------------------------------------------------------------- |
|
1530 // |
|
1531 void CNcsComposeViewContainer::AppendCcFieldAddressesL( RPointerArray<CNcsEmailAddressObject>& aAddress ) |
|
1532 { |
|
1533 FUNC_LOG; |
|
1534 |
|
1535 iHeader->AppendCcFieldAddressesL( aAddress ); |
|
1536 |
|
1537 } |
|
1538 |
|
1539 // ----------------------------------------------------------------------------- |
|
1540 // CNcsComposeViewContainer::AppendBccFieldAddressesL |
|
1541 // |
|
1542 // ----------------------------------------------------------------------------- |
|
1543 // |
|
1544 void CNcsComposeViewContainer::AppendBccFieldAddressesL( RPointerArray<CNcsEmailAddressObject>& aAddress ) |
|
1545 { |
|
1546 FUNC_LOG; |
|
1547 |
|
1548 iHeader->AppendBccFieldAddressesL( aAddress ); |
|
1549 |
|
1550 } |
|
1551 |
|
1552 // ----------------------------------------------------------------------------- |
|
1553 // CNcsComposeViewContainer::SetSubjectL |
|
1554 // |
|
1555 // ----------------------------------------------------------------------------- |
|
1556 // |
|
1557 void CNcsComposeViewContainer::SetSubjectL( const TDesC& aSubject ) |
|
1558 { |
|
1559 FUNC_LOG; |
|
1560 |
|
1561 iHeader->SetSubjectL( aSubject ); |
|
1562 |
|
1563 } |
|
1564 |
|
1565 // ----------------------------------------------------------------------------- |
|
1566 // CNcsComposeViewContainer::SetAttachmentLabelTextL |
|
1567 // |
|
1568 // ----------------------------------------------------------------------------- |
|
1569 // |
|
1570 void CNcsComposeViewContainer::SetAttachmentLabelTextL( const TDesC& aText ) |
|
1571 { |
|
1572 FUNC_LOG; |
|
1573 |
|
1574 iHeader->SetAttachmentLabelTextL( aText ); |
|
1575 |
|
1576 } |
|
1577 |
|
1578 // ----------------------------------------------------------------------------- |
|
1579 // CNcsComposeViewContainer::SetAttachmentLabelTextL |
|
1580 // |
|
1581 // ----------------------------------------------------------------------------- |
|
1582 // |
|
1583 void CNcsComposeViewContainer::SetAttachmentLabelTextL( const TDesC& aAttachmentName, |
|
1584 const TDesC& aAttachmentSizeDesc ) |
|
1585 { |
|
1586 FUNC_LOG; |
|
1587 |
|
1588 iHeader->SetAttachmentLabelTextL( aAttachmentName, aAttachmentSizeDesc ); |
|
1589 |
|
1590 } |
|
1591 |
|
1592 // ----------------------------------------------------------------------------- |
|
1593 // CNcsComposeViewContainer::HideAttachmentLabel |
|
1594 // |
|
1595 // ----------------------------------------------------------------------------- |
|
1596 // |
|
1597 void CNcsComposeViewContainer::HideAttachmentLabel() |
|
1598 { |
|
1599 FUNC_LOG; |
|
1600 |
|
1601 iHeader->HideAttachmentLabel(); |
|
1602 |
|
1603 } |
|
1604 |
|
1605 // ----------------------------------------------------------------------------- |
|
1606 // CNcsComposeViewContainer::SetCcFieldVisibleL |
|
1607 // |
|
1608 // ----------------------------------------------------------------------------- |
|
1609 // |
|
1610 void CNcsComposeViewContainer::SetCcFieldVisibleL( TBool aVisible, TBool aFocus ) |
|
1611 { |
|
1612 FUNC_LOG; |
|
1613 |
|
1614 if ( aFocus ) |
|
1615 { |
|
1616 iMessageField->SetCursorPosL( 0,EFalse ); |
|
1617 iMessageField->SetFocus( EFalse ); |
|
1618 iHeader->MakeVisible( ETrue ); |
|
1619 iHeader->SetFocus( ETrue ); |
|
1620 iFocused = iHeader; |
|
1621 } |
|
1622 iHeader->SetCcFieldVisibleL( aVisible, EDrawNow, aFocus ); |
|
1623 |
|
1624 } |
|
1625 |
|
1626 // ----------------------------------------------------------------------------- |
|
1627 // CNcsComposeViewContainer::SetBccFieldVisibleL |
|
1628 // |
|
1629 // ----------------------------------------------------------------------------- |
|
1630 // |
|
1631 void CNcsComposeViewContainer::SetBccFieldVisibleL( TBool aVisible, TBool aFocus ) |
|
1632 { |
|
1633 FUNC_LOG; |
|
1634 |
|
1635 if ( aFocus ) |
|
1636 { |
|
1637 iMessageField->SetCursorPosL( 0, EFalse ); |
|
1638 iMessageField->SetFocus( EFalse ); |
|
1639 iHeader->MakeVisible( ETrue ); |
|
1640 iHeader->SetFocus( ETrue ); |
|
1641 iFocused = iHeader; |
|
1642 } |
|
1643 iHeader->SetBccFieldVisibleL( aVisible, EDrawNow, aFocus ); |
|
1644 |
|
1645 } |
|
1646 |
|
1647 // ----------------------------------------------------------------------------- |
|
1648 // CNcsComposeViewContainer::IncludeAddressL |
|
1649 // |
|
1650 // ----------------------------------------------------------------------------- |
|
1651 // |
|
1652 void CNcsComposeViewContainer::IncludeAddressL(const CNcsEmailAddressObject& eml) |
|
1653 { |
|
1654 FUNC_LOG; |
|
1655 |
|
1656 iHeader->IncludeAddressL(eml); |
|
1657 |
|
1658 } |
|
1659 |
|
1660 // ----------------------------------------------------------------------------- |
|
1661 // CNcsComposeViewContainer::IncludeAddressL |
|
1662 // |
|
1663 // ----------------------------------------------------------------------------- |
|
1664 // |
|
1665 void CNcsComposeViewContainer::IncludeAddressL() |
|
1666 { |
|
1667 FUNC_LOG; |
|
1668 |
|
1669 iHeader->IncludeAddressL(); |
|
1670 |
|
1671 } |
|
1672 |
|
1673 // ----------------------------------------------------------------------------- |
|
1674 // CNcsComposeViewContainer::ClosePopupContactListL |
|
1675 // |
|
1676 // ----------------------------------------------------------------------------- |
|
1677 // |
|
1678 void CNcsComposeViewContainer::ClosePopupContactListL() |
|
1679 { |
|
1680 FUNC_LOG; |
|
1681 |
|
1682 iHeader->ClosePopupContactListL(); |
|
1683 |
|
1684 } |
|
1685 |
|
1686 // ----------------------------------------------------------------------------- |
|
1687 // CNcsComposeViewContainer::DeleteSelectionL |
|
1688 // |
|
1689 // ----------------------------------------------------------------------------- |
|
1690 // |
|
1691 void CNcsComposeViewContainer::DeleteSelectionL() |
|
1692 { |
|
1693 FUNC_LOG; |
|
1694 |
|
1695 iHeader->DeleteSelectionL(); |
|
1696 |
|
1697 } |
|
1698 |
|
1699 // ----------------------------------------------------------------------------- |
|
1700 // CNcsComposeViewContainer::SetFocusToToField |
|
1701 // |
|
1702 // ----------------------------------------------------------------------------- |
|
1703 // |
|
1704 void CNcsComposeViewContainer::SetFocusToToField() |
|
1705 { |
|
1706 FUNC_LOG; |
|
1707 |
|
1708 iHeader->FocusToField(); |
|
1709 |
|
1710 } |
|
1711 |
|
1712 // ----------------------------------------------------------------------------- |
|
1713 // CNcsComposeViewContainer::SetFocusToAttachmentField |
|
1714 // |
|
1715 // ----------------------------------------------------------------------------- |
|
1716 // |
|
1717 void CNcsComposeViewContainer::SetFocusToAttachmentField() |
|
1718 { |
|
1719 FUNC_LOG; |
|
1720 |
|
1721 if ( iFocused == iMessageField ) |
|
1722 { |
|
1723 iFocused = iHeader; |
|
1724 iHeader->SetFocus( ETrue, EDrawNow ); |
|
1725 iMessageField->SetFocus( EFalse, EDrawNow ); |
|
1726 iHeader->MakeVisible( ETrue ); |
|
1727 } |
|
1728 |
|
1729 iHeader->FocusAttachmentField(); |
|
1730 |
|
1731 } |
|
1732 |
|
1733 // ----------------------------------------------------------------------------- |
|
1734 // CNcsComposeViewContainer::AreAddressFieldsEmpty |
|
1735 // |
|
1736 // ----------------------------------------------------------------------------- |
|
1737 // |
|
1738 TBool CNcsComposeViewContainer::AreAddressFieldsEmpty() |
|
1739 { |
|
1740 FUNC_LOG; |
|
1741 return iHeader->AreAddressFieldsEmpty(); |
|
1742 } |
|
1743 |
|
1744 // ----------------------------------------------------------------------------- |
|
1745 // CNcsComposeViewContainer::DoPopupSelectL |
|
1746 // |
|
1747 // ----------------------------------------------------------------------------- |
|
1748 // |
|
1749 void CNcsComposeViewContainer::DoPopupSelectL() |
|
1750 { |
|
1751 FUNC_LOG; |
|
1752 |
|
1753 iHeader->DoPopupSelectL(); |
|
1754 |
|
1755 } |
|
1756 |
|
1757 // ----------------------------------------------------------------------------- |
|
1758 // CNcsComposeViewContainer::HandleLayoutChangeL |
|
1759 // |
|
1760 // ----------------------------------------------------------------------------- |
|
1761 // |
|
1762 void CNcsComposeViewContainer::HandleLayoutChangeL() |
|
1763 { |
|
1764 FUNC_LOG; |
|
1765 // <cmail> Platform layout change |
|
1766 const TRect rect( NcsUtility::ListscrollPaneRect() ); |
|
1767 SetRect( rect ); |
|
1768 // </cmail> Platform layout change |
|
1769 if ( iHeader ) |
|
1770 { |
|
1771 iHeader->HandleDynamicVariantSwitchL(); |
|
1772 } |
|
1773 // <cmail> Platform layout change |
|
1774 //TRect rect = iView.ClientRect(); |
|
1775 //SetApplicationRect( rect ); |
|
1776 //SetRect( rect ); |
|
1777 //UpdateScreenPositionL(); |
|
1778 // </cmail> Platform layout change |
|
1779 UpdateScrollBarL(); |
|
1780 } |
|
1781 |
|
1782 // ----------------------------------------------------------------------------- |
|
1783 // CNcsComposeViewContainer::HandleSkinChangeL |
|
1784 // |
|
1785 // ----------------------------------------------------------------------------- |
|
1786 // |
|
1787 void CNcsComposeViewContainer::HandleSkinChangeL() |
|
1788 { |
|
1789 FUNC_LOG; |
|
1790 if ( iHeader ) |
|
1791 { |
|
1792 iHeader->HandleDynamicVariantSwitchL(); |
|
1793 } |
|
1794 |
|
1795 // <cmail> |
|
1796 if ( iMessageField ) |
|
1797 { |
|
1798 iMessageField->UpdateFontSize(); |
|
1799 } |
|
1800 |
|
1801 if ( iScrollBar ) |
|
1802 { |
|
1803 iScrollBar->HandleResourceChange( KAknsMessageSkinChange ); |
|
1804 iScrollBar->DrawNow(); |
|
1805 } |
|
1806 // </cmail> |
|
1807 } |
|
1808 |
|
1809 // ----------------------------------------------------------------------------- |
|
1810 // CNcsComposeViewContainer::ContentTotalHeight |
|
1811 // Return the total height of the components shown in the view |
|
1812 // ----------------------------------------------------------------------------- |
|
1813 // |
|
1814 TInt CNcsComposeViewContainer::ContentTotalHeight() |
|
1815 { |
|
1816 FUNC_LOG; |
|
1817 const TSize separatorSize( NcsUtility::SeparatorSizeInThisResolution() ); |
|
1818 |
|
1819 TInt totalHeight( iHeader->Size().iHeight + |
|
1820 separatorSize.iHeight*2 + iMessageField->Size().iHeight ); |
|
1821 |
|
1822 if( iReadOnlyQuoteField->IsVisible() ) |
|
1823 { |
|
1824 totalHeight += iReadOnlyQuoteField->Size().iHeight; |
|
1825 } |
|
1826 |
|
1827 return totalHeight; |
|
1828 } |
|
1829 |
|
1830 // ----------------------------------------------------------------------------- |
|
1831 // CNcsComposeViewContainer::CommitL() |
|
1832 // |
|
1833 // ----------------------------------------------------------------------------- |
|
1834 // |
|
1835 void CNcsComposeViewContainer::CommitL( TFieldToCommit aFieldToCommit ) |
|
1836 { |
|
1837 FUNC_LOG; |
|
1838 iView.CommitL(ETrue,aFieldToCommit); |
|
1839 iView.HandleContainerChangeRequiringToolbarRefresh(); |
|
1840 } |
|
1841 |
|
1842 //<cmail> |
|
1843 // ----------------------------------------------------------------------------- |
|
1844 // CNcsComposeViewContainer::SwitchChangeMskOff |
|
1845 //sets up iSwitchChangeMskOff falg, which disables changes of MSK label if any popup dialog is open |
|
1846 // ----------------------------------------------------------------------------- |
|
1847 void CNcsComposeViewContainer::SwitchChangeMskOff(TBool aTag) |
|
1848 { |
|
1849 FUNC_LOG; |
|
1850 iHeader->SwitchChangeMskOff(aTag); |
|
1851 } |
|
1852 //</cmail> |
|
1853 |
|
1854 //<cmail> |
|
1855 // ----------------------------------------------------------------------------- |
|
1856 // CNcsHeaderContainer::HandleLongTapEventL() |
|
1857 // Handles key events |
|
1858 // ----------------------------------------------------------------------------- |
|
1859 void CNcsComposeViewContainer::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /*aPenEventScreenLocation*/ ) |
|
1860 { |
|
1861 FUNC_LOG; |
|
1862 iHeader->HandleLongTapL( aPenEventLocation ); |
|
1863 } |
|
1864 //</cmail> |
|
1865 |
|
1866 |
|
1867 //<cmail> |
|
1868 void CNcsComposeViewContainer::FixSemicolonL() |
|
1869 { |
|
1870 FUNC_LOG; |
|
1871 iHeader->FixSemicolonInAddressFieldsL(); |
|
1872 } |
|
1873 //</cmail> |
|
1874 |
|
1875 // --------------------------------------------------------------------------- |
|
1876 // CNcsComposeViewContainer::UpdatePhysicsL() |
|
1877 // --------------------------------------------------------------------------- |
|
1878 // |
|
1879 void CNcsComposeViewContainer::UpdatePhysicsL() |
|
1880 { |
|
1881 FUNC_LOG; |
|
1882 if ( iPhysics ) |
|
1883 { |
|
1884 const TSize viewSize( Rect().Size() ); |
|
1885 // We must ensure that world size is at least the size of the view |
|
1886 const TSize worldSize( viewSize.iWidth, |
|
1887 Max(ContentTotalHeight(), viewSize.iHeight) ); |
|
1888 iPhysics->InitPhysicsL( worldSize, viewSize, EFalse ); |
|
1889 } |
|
1890 } |
|
1891 |
|
1892 // ----------------------------------------------------------------------------- |
|
1893 // CNcsComposeViewContainer::ScrollL() |
|
1894 // ----------------------------------------------------------------------------- |
|
1895 // |
|
1896 void CNcsComposeViewContainer::ScrollL( TInt aTargetPos ) |
|
1897 { |
|
1898 FUNC_LOG; |
|
1899 TPoint headerPos( iHeader->Position() ); |
|
1900 |
|
1901 aTargetPos = Max( 0, Min(aTargetPos, ContentTotalHeight() - Rect().Height()) ); |
|
1902 |
|
1903 TInt moveY = -headerPos.iY - aTargetPos; |
|
1904 |
|
1905 if( moveY ) |
|
1906 { |
|
1907 headerPos.iY += moveY; |
|
1908 iHeader->SetPosition( headerPos ); |
|
1909 |
|
1910 TPoint msgPos( iMessageField->Position() ); |
|
1911 msgPos.iY += moveY; |
|
1912 iMessageField->SetPosition( msgPos ); |
|
1913 |
|
1914 if( iReadOnlyQuoteField->IsVisible() ) |
|
1915 { |
|
1916 TPoint readOnlyPos( iReadOnlyQuoteField->Position() ); |
|
1917 readOnlyPos.iY += moveY; |
|
1918 iReadOnlyQuoteField->SetPosition( readOnlyPos ); |
|
1919 } |
|
1920 |
|
1921 iSeparatorLineYPos += moveY; |
|
1922 |
|
1923 UpdateScrollBarL(); |
|
1924 DrawNow(); |
|
1925 } |
|
1926 } |
|
1927 |
|
1928 /** |
|
1929 * @see MAknPhysicsObserver::ViewPositionChanged |
|
1930 */ |
|
1931 void CNcsComposeViewContainer::ViewPositionChanged( |
|
1932 const TPoint& aNewPosition, |
|
1933 TBool /*aDrawNow*/, |
|
1934 TUint /*aFlags*/ ) |
|
1935 { |
|
1936 FUNC_LOG; |
|
1937 if( iIsFlicking ) |
|
1938 { |
|
1939 TInt scrollOffset = aNewPosition.iY - Rect().Size().iHeight / 2; |
|
1940 |
|
1941 TRAP_IGNORE( ScrollL( scrollOffset ) ); |
|
1942 } |
|
1943 } |
|
1944 |
|
1945 /** |
|
1946 * @see MAknPhysicsObserver::PhysicEmulationEnded |
|
1947 */ |
|
1948 void CNcsComposeViewContainer::PhysicEmulationEnded() |
|
1949 { |
|
1950 FUNC_LOG; |
|
1951 iIsFlicking = EFalse; |
|
1952 } |
|
1953 |
|
1954 /** |
|
1955 * @see MAknPhysicsObserver::ViewPosition |
|
1956 */ |
|
1957 TPoint CNcsComposeViewContainer::ViewPosition() const |
|
1958 { |
|
1959 FUNC_LOG; |
|
1960 return TPoint(0, -iHeader->Position().iY + Rect().Size().iHeight / 2 ); |
|
1961 } |
|
1962 |
|
1963 |
|
1964 TBool CNcsComposeViewContainer::IsRemoteSearchInprogress() const |
|
1965 { |
|
1966 FUNC_LOG; |
|
1967 return iHeader->IsRemoteSearchInprogress(); |
|
1968 } |