73 // ----------------------------------------------------------------------------- |
73 // ----------------------------------------------------------------------------- |
74 // CNcsComposeViewContainer::NewL() |
74 // CNcsComposeViewContainer::NewL() |
75 // Two-phased constructor. |
75 // Two-phased constructor. |
76 // ----------------------------------------------------------------------------- |
76 // ----------------------------------------------------------------------------- |
77 // |
77 // |
78 CNcsComposeViewContainer* CNcsComposeViewContainer::NewL( CNcsComposeView& aView, |
78 CNcsComposeViewContainer* CNcsComposeViewContainer::NewL( |
79 const TRect& aRect, CFSMailBox& aMailBox, CFsAutoSaver& aAutoSaver, |
79 CNcsComposeView& aView, const TRect& aRect, CFSMailBox& aMailBox, |
80 TInt aFlags ) |
80 CFsAutoSaver& aAutoSaver, TInt aFlags ) |
81 { |
81 { |
82 FUNC_LOG; |
82 FUNC_LOG; |
83 |
83 |
84 CNcsComposeViewContainer* self = new ( ELeave ) CNcsComposeViewContainer( |
84 CNcsComposeViewContainer* self = new ( ELeave ) CNcsComposeViewContainer( |
85 aView, aAutoSaver, aMailBox ); |
85 aView, aAutoSaver, aMailBox ); |
146 iReadOnlyQuoteField->AddEdwinObserverL( this ); |
141 iReadOnlyQuoteField->AddEdwinObserverL( this ); |
147 iReadOnlyQuoteField->SetEdwinSizeObserver( this ); |
142 iReadOnlyQuoteField->SetEdwinSizeObserver( this ); |
148 |
143 |
149 // Create the scroll bar |
144 // Create the scroll bar |
150 iScrollBar = new( ELeave ) CAknDoubleSpanScrollBar( this ); |
145 iScrollBar = new( ELeave ) CAknDoubleSpanScrollBar( this ); |
151 iScrollBar->ConstructL( this, this, CEikScrollBar::EVertical, aRect.Height() ); |
146 iScrollBar->ConstructL( |
|
147 this, this, CEikScrollBar::EVertical, aRect.Height() ); |
152 iScrollBar->MakeVisible( ETrue ); |
148 iScrollBar->MakeVisible( ETrue ); |
153 iScrollBar->SetModelL( &iScrollBarModel ); |
149 iScrollBar->SetModelL( &iScrollBarModel ); |
154 |
150 |
155 iMessageField->SetupEditorL(); |
151 iMessageField->SetupEditorL(); |
156 iReadOnlyQuoteField->SetupEditorL(); |
152 iReadOnlyQuoteField->SetupEditorL(); |
157 |
153 |
158 SetRect( aRect ); |
154 SetRect( aRect ); |
159 |
155 |
160 //<cmail> S60 skin support |
|
161 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
156 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
162 KAknsIIDQsnBgAreaMain, Rect(), EFalse ); |
157 KAknsIIDQsnBgAreaMain, Rect(), EFalse ); |
163 // <cmail> |
158 |
164 //iMessageField->SetSkinBackgroundControlContextL( iBgContext ); |
|
165 // </cmail> |
|
166 iLongTapDetector = CAknLongTapDetector::NewL( this ); |
159 iLongTapDetector = CAknLongTapDetector::NewL( this ); |
167 //</cmail> |
|
168 |
160 |
169 UpdateScrollBarL(); |
161 UpdateScrollBarL(); |
170 |
162 |
171 ActivateL(); |
163 ActivateL(); |
172 |
164 |
240 { |
229 { |
241 FUNC_LOG; |
230 FUNC_LOG; |
242 iHeader->SetMskL(); |
231 iHeader->SetMskL(); |
243 } |
232 } |
244 |
233 |
245 //<cmail> |
|
246 |
|
247 // ----------------------------------------------------------------------------- |
234 // ----------------------------------------------------------------------------- |
248 // CNcsComposeViewContainer::HandlePointerEventL() |
235 // CNcsComposeViewContainer::HandlePointerEventL() |
249 // |
236 // |
250 // ----------------------------------------------------------------------------- |
237 // ----------------------------------------------------------------------------- |
251 // |
238 // |
252 void CNcsComposeViewContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
239 void CNcsComposeViewContainer::HandlePointerEventL( |
|
240 const TPointerEvent& aPointerEvent ) |
253 { |
241 { |
254 FUNC_LOG; |
242 FUNC_LOG; |
255 |
243 |
256 CCoeControl::HandlePointerEventL( aPointerEvent ); |
244 CCoeControl::HandlePointerEventL( aPointerEvent ); |
257 |
245 |
258 if ( iHeader->NeedsLongTapL( aPointerEvent.iPosition ) ) |
246 if ( aPointerEvent.iType != TPointerEvent::EButton1Down && |
|
247 iHeader->NeedsLongTapL( aPointerEvent.iPosition ) ) |
259 { |
248 { |
260 iLongTapDetector->PointerEventL( aPointerEvent ); |
249 iLongTapDetector->PointerEventL( aPointerEvent ); |
261 } |
250 } |
262 |
251 |
263 switch( aPointerEvent.iType ) |
252 switch( aPointerEvent.iType ) |
264 { |
253 { |
265 case TPointerEvent::EButton1Down: |
254 case TPointerEvent::EButton1Down: |
266 { |
255 { |
267 // Save current and original position so that those can be used in |
256 // Save current and original position so that those can be used in |
268 // drag/scrolling calculations |
257 // drag/scrolling calculations |
269 iPreviousPosition = iOriginalPosition = aPointerEvent.iParentPosition; |
258 iPreviousPosition = iOriginalPosition = |
|
259 aPointerEvent.iParentPosition; |
270 iIsDragging = EFalse; |
260 iIsDragging = EFalse; |
271 iIsFlicking = EFalse; |
261 iIsFlicking = EFalse; |
272 |
262 |
273 if( iPhysics ) |
263 if( iPhysics ) |
274 { |
264 { |
276 iPhysics->ResetFriction(); |
266 iPhysics->ResetFriction(); |
277 iStartTime.HomeTime(); |
267 iStartTime.HomeTime(); |
278 UpdatePhysicsL(); |
268 UpdatePhysicsL(); |
279 } |
269 } |
280 |
270 |
281 |
271 if ( iHeader->Rect().Contains( aPointerEvent.iPosition ) ) |
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 { |
272 { |
288 if (iFocused == iMessageField) |
273 if ( iFocused == iMessageField ) |
289 { |
274 { |
290 iFocused = iHeader; |
275 iFocused = iHeader; |
291 iHeader->SetFocus( ETrue,EDrawNow ); |
276 iHeader->SetFocus( ETrue,EDrawNow ); |
292 iMessageField->SetFocus( EFalse, EDrawNow ); |
277 iMessageField->SetFocus( EFalse, EDrawNow ); |
293 iHeader->MakeVisible( ETrue ); |
278 iHeader->MakeVisible( ETrue ); |
294 CommitL(EBodyField); |
279 CommitL( EBodyField ); |
295 iView.HandleContainerChangeRequiringToolbarRefresh(); |
280 iView.HandleContainerChangeRequiringToolbarRefresh(); |
296 } |
281 } |
297 else if (iFocused == iReadOnlyQuoteField) |
282 else if ( iFocused == iReadOnlyQuoteField ) |
298 { |
283 { |
299 iFocused = iMessageField; |
284 iFocused = iMessageField; |
300 iReadOnlyQuoteField->SetFocus( EFalse, EDrawNow ); |
285 iReadOnlyQuoteField->SetFocus( EFalse, EDrawNow ); |
301 iHeader->SetFocus( ETrue, EDrawNow ); |
286 iHeader->SetFocus( ETrue, EDrawNow ); |
302 iView.HandleContainerChangeRequiringToolbarRefresh(); |
287 iView.HandleContainerChangeRequiringToolbarRefresh(); |
303 } |
288 } |
304 } |
289 } |
305 else if (iReadOnlyQuoteField->Rect().Contains(aPointerEvent.iPosition)) |
290 else if ( iReadOnlyQuoteField->Rect().Contains( |
|
291 aPointerEvent.iPosition ) ) |
306 { |
292 { |
307 if (iFocused == iMessageField) |
293 if ( iFocused == iMessageField ) |
308 { |
294 { |
309 iFocused = iReadOnlyQuoteField; |
295 iFocused = iReadOnlyQuoteField; |
310 iReadOnlyQuoteField->SetFocus( ETrue, EDrawNow ); |
296 iReadOnlyQuoteField->SetFocus( ETrue, EDrawNow ); |
311 iMessageField->SetFocus( EFalse, EDrawNow ); |
297 iMessageField->SetFocus( EFalse, EDrawNow ); |
312 iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ); |
298 iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ); |
313 iView.HandleContainerChangeRequiringToolbarRefresh(); |
299 iView.HandleContainerChangeRequiringToolbarRefresh(); |
314 } |
300 } |
315 else if (iFocused == iHeader) |
301 else if ( iFocused == iHeader ) |
316 { |
302 { |
317 iFocused = iReadOnlyQuoteField; |
303 iFocused = iReadOnlyQuoteField; |
318 iReadOnlyQuoteField->SetFocus( ETrue, EDrawNow ); |
304 iReadOnlyQuoteField->SetFocus( ETrue, EDrawNow ); |
319 iHeader->SetFocus( EFalse, EDrawNow ); |
305 iHeader->SetFocus( EFalse, EDrawNow ); |
320 iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ); |
306 iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ); |
321 iView.HandleContainerChangeRequiringToolbarRefresh(); |
307 iView.HandleContainerChangeRequiringToolbarRefresh(); |
322 } |
308 } |
323 } |
309 } |
324 else |
310 else |
325 { |
311 { |
326 if (iFocused == iHeader) |
312 if ( iFocused == iHeader ) |
327 { |
313 { |
328 iFocused = iMessageField; |
314 iFocused = iMessageField; |
329 iHeader->SetFocus( EFalse, EDrawNow ); |
315 iHeader->SetFocus( EFalse, EDrawNow ); |
330 iMessageField->SetFocus( ETrue, EDrawNow ); |
316 iMessageField->SetFocus( ETrue, EDrawNow ); |
331 //iMessageField->SetCursorPosL( iMessageField->TextLength(), EFalse ); |
|
332 iView.HandleContainerChangeRequiringToolbarRefresh(); |
317 iView.HandleContainerChangeRequiringToolbarRefresh(); |
333 } |
318 } |
334 else if (iFocused == iReadOnlyQuoteField) |
319 else if ( iFocused == iReadOnlyQuoteField ) |
335 { |
320 { |
336 iFocused = iMessageField; |
321 iFocused = iMessageField; |
337 iReadOnlyQuoteField->SetFocus( EFalse, EDrawNow ); |
322 iReadOnlyQuoteField->SetFocus( EFalse, EDrawNow ); |
338 iMessageField->SetFocus( ETrue, EDrawNow ); |
323 iMessageField->SetFocus( ETrue, EDrawNow ); |
339 iView.HandleContainerChangeRequiringToolbarRefresh(); |
324 iView.HandleContainerChangeRequiringToolbarRefresh(); |
340 } |
325 } |
341 else |
326 else |
342 { |
327 { |
343 //iMessageField->SetCursorPosL( iMessageField->TextLength(), EFalse ); |
328 const TRect messageFieldRect( iMessageField->Rect() ); |
344 const TRect messageFieldRect(iMessageField->Rect()); |
329 if ( !messageFieldRect.Contains( aPointerEvent.iPosition ) && |
345 if (!messageFieldRect.Contains(aPointerEvent.iPosition) && |
330 aPointerEvent.iPosition.iY >= messageFieldRect.iTl.iY ) |
346 aPointerEvent.iPosition.iY >= messageFieldRect.iTl.iY ) |
|
347 { |
331 { |
348 iMessageField->OpenVirtualKeyBoardL(); |
332 iMessageField->OpenVirtualKeyBoardL(); |
349 } |
333 } |
350 } |
334 } |
351 } |
335 } |
387 TInt areaHeight( Rect().Size().iHeight ); |
371 TInt areaHeight( Rect().Size().iHeight ); |
388 TInt scrollOffset( 0 ); |
372 TInt scrollOffset( 0 ); |
389 |
373 |
390 if( totalHeight > areaHeight ) |
374 if( totalHeight > areaHeight ) |
391 { |
375 { |
392 // Calculate new scroll offset based on current and previous Y-positions |
376 // Calculate new scroll offset based on current and |
393 scrollOffset = topPosition + ( iPreviousPosition.iY - position.iY ); |
377 // previous Y-positions |
|
378 scrollOffset = topPosition + |
|
379 ( iPreviousPosition.iY - position.iY ); |
394 // Ensure that thumb position is in correct range |
380 // Ensure that thumb position is in correct range |
395 scrollOffset = Max( scrollOffset, 0 ); |
381 scrollOffset = Max( scrollOffset, 0 ); |
396 scrollOffset = Min( scrollOffset, totalHeight - areaHeight ); |
382 scrollOffset = Min( scrollOffset, |
|
383 totalHeight - areaHeight ); |
397 } |
384 } |
398 |
385 |
399 ScrollL( scrollOffset ); |
386 ScrollL( scrollOffset ); |
400 } |
387 } |
401 |
388 |
578 quotePos.iY += moveY; |
572 quotePos.iY += moveY; |
579 iReadOnlyQuoteField->SetPosition( quotePos ); |
573 iReadOnlyQuoteField->SetPosition( quotePos ); |
580 |
574 |
581 iSeparatorLineYPos += moveY; |
575 iSeparatorLineYPos += moveY; |
582 UpdateScrollBarL(); |
576 UpdateScrollBarL(); |
583 |
|
584 //DrawDeferred(); |
|
585 } |
577 } |
586 } |
578 } |
587 |
579 |
588 // ----------------------------------------------------------------------------- |
580 // ----------------------------------------------------------------------------- |
589 // CNcsComposeViewContainer::UpdateFieldPosition |
581 // CNcsComposeViewContainer::UpdateFieldPosition |
590 // |
582 // |
591 // ----------------------------------------------------------------------------- |
583 // ----------------------------------------------------------------------------- |
592 // |
584 // |
593 void CNcsComposeViewContainer::UpdateFieldPosition(CCoeControl* aAnchor) |
585 void CNcsComposeViewContainer::UpdateFieldPosition( CCoeControl* aAnchor ) |
594 { |
586 { |
595 FUNC_LOG; |
587 FUNC_LOG; |
596 |
588 |
597 // We may not be completely constructed |
589 // We may not be completely constructed |
598 if ( iHeader && iMessageField && iReadOnlyQuoteField ) |
590 if ( iHeader && iMessageField && iReadOnlyQuoteField ) |
599 { |
591 { |
600 // First, move all the controls in the header |
592 // First, move all the controls in the header |
601 iHeader->UpdateFieldPosition(aAnchor); |
593 iHeader->UpdateFieldPosition( aAnchor ); |
602 |
594 |
603 // Then, move the body field below the header |
595 // Then, move the body field below the header |
604 TRect headerRect = iHeader->Rect(); |
596 TRect headerRect = iHeader->Rect(); |
605 |
597 |
606 const TSize separatorSize( NcsUtility::SeparatorSizeInThisResolution() ); |
598 const TSize separatorSize( |
|
599 NcsUtility::SeparatorSizeInThisResolution() ); |
607 iSeparatorLineYPos = headerRect.iBr.iY; |
600 iSeparatorLineYPos = headerRect.iBr.iY; |
608 |
601 |
609 TPoint bodyPos( iMessageField->Position() ); |
602 TPoint bodyPos( iMessageField->Position() ); |
610 bodyPos.iY = iSeparatorLineYPos + separatorSize.iHeight; |
603 bodyPos.iY = iSeparatorLineYPos + separatorSize.iHeight; |
611 iMessageField->SetPosition( bodyPos ); |
604 iMessageField->SetPosition( bodyPos ); |
612 |
605 |
613 TPoint quotePos( iReadOnlyQuoteField->Position() ); |
606 TPoint quotePos( iReadOnlyQuoteField->Position() ); |
614 quotePos.iY = iMessageField->Rect().iBr.iY; |
607 quotePos.iY = iMessageField->Rect().iBr.iY; |
615 iReadOnlyQuoteField->SetPosition( quotePos ); |
608 iReadOnlyQuoteField->SetPosition( quotePos ); |
616 |
609 |
617 TRAP_IGNORE(UpdateScrollBarL()); |
610 TRAP_IGNORE( UpdateScrollBarL() ); |
618 |
611 |
619 DrawDeferred(); |
612 DrawDeferred(); |
620 } |
613 } |
621 |
614 |
622 } |
615 } |
646 { |
640 { |
647 iFocused = iHeader; |
641 iFocused = iHeader; |
648 iHeader->SetFocus( ETrue,EDrawNow ); |
642 iHeader->SetFocus( ETrue,EDrawNow ); |
649 iMessageField->SetFocus( EFalse, EDrawNow ); |
643 iMessageField->SetFocus( EFalse, EDrawNow ); |
650 iHeader->MakeVisible( ETrue ); |
644 iHeader->MakeVisible( ETrue ); |
651 CommitL(EBodyField); |
645 CommitL( EBodyField ); |
652 ret = EKeyWasConsumed; |
646 ret = EKeyWasConsumed; |
653 } |
647 } |
654 else if ( aKeyEvent.iCode == EKeyDownArrow && iReadOnlyQuoteField->TextLength() ) |
648 else if ( aKeyEvent.iCode == EKeyDownArrow && |
|
649 iReadOnlyQuoteField->TextLength() ) |
655 { |
650 { |
656 // Focus move to read-only quote only if there is some text in it. |
651 // Focus move to read-only quote only if there is some text in it. |
657 iFocused = iReadOnlyQuoteField; |
652 iFocused = iReadOnlyQuoteField; |
658 iReadOnlyQuoteField->SetFocus( ETrue, EDrawNow ); |
653 iReadOnlyQuoteField->SetFocus( ETrue, EDrawNow ); |
659 iMessageField->SetFocus( EFalse, EDrawNow ); |
654 iMessageField->SetFocus( EFalse, EDrawNow ); |
710 const TRect rect( Rect() ); |
704 const TRect rect( Rect() ); |
711 iScrollBar->SetRect( NcsUtility::ListCmailScrollbarRect( rect ) ); |
705 iScrollBar->SetRect( NcsUtility::ListCmailScrollbarRect( rect ) ); |
712 TRect cmailPaneRect( NcsUtility::ListCmailPaneRect( rect ) ); |
706 TRect cmailPaneRect( NcsUtility::ListCmailPaneRect( rect ) ); |
713 |
707 |
714 const TInt headerLineCount( iHeader->LayoutLineCount() ); |
708 const TInt headerLineCount( iHeader->LayoutLineCount() ); |
715 const TPoint headerPos( NcsUtility::HeaderControlPosition( cmailPaneRect, 0 ) ); |
709 const TPoint headerPos( |
|
710 NcsUtility::HeaderControlPosition( cmailPaneRect, 0 ) ); |
716 cmailPaneRect.Move( 0, iHeader->Position().iY - headerPos.iY ); |
711 cmailPaneRect.Move( 0, iHeader->Position().iY - headerPos.iY ); |
717 |
712 |
718 NcsUtility::LayoutHeaderControl( iHeader, cmailPaneRect, 0, headerLineCount ); |
713 NcsUtility::LayoutHeaderControl( |
|
714 iHeader, cmailPaneRect, 0, headerLineCount ); |
719 |
715 |
720 // do not used stored headerLineCount, because relayout above may grow or |
716 // do not used stored headerLineCount, because relayout above may grow or |
721 // shrink edit fields |
717 // shrink edit fields |
|
718 NcsUtility::LayoutBodyEdwin( |
|
719 iMessageField, cmailPaneRect, iHeader->LayoutLineCount(), |
|
720 iMessageField->LineCount(), iSeparatorLineYPos ); |
722 TRAP_IGNORE( iMessageField->FormatAllTextNowL() ); |
721 TRAP_IGNORE( iMessageField->FormatAllTextNowL() ); |
723 NcsUtility::LayoutBodyEdwin( iMessageField, cmailPaneRect, iHeader->LayoutLineCount(), iMessageField->LineCount(), |
|
724 iSeparatorLineYPos ); |
|
725 |
722 |
726 iMessageField->UpdateFontSize(); |
723 iMessageField->UpdateFontSize(); |
727 |
724 |
728 TInt readOnlyQuoteFieldHeight( 0 ); |
725 TInt readOnlyQuoteFieldHeight( 0 ); |
729 if ( iReadOnlyQuoteField->TextLength() ) |
726 if ( iReadOnlyQuoteField->TextLength() ) |
730 { |
727 { |
731 TInt dummySeparatorPos; |
728 TInt dummySeparatorPos; |
732 NcsUtility::LayoutBodyEdwin( iReadOnlyQuoteField, cmailPaneRect, headerLineCount + iMessageField->LineCount(), iReadOnlyQuoteField->LineCount(), |
729 NcsUtility::LayoutBodyEdwin( |
733 dummySeparatorPos ); |
730 iReadOnlyQuoteField, cmailPaneRect, |
|
731 iHeader->LayoutLineCount() + iMessageField->LineCount(), |
|
732 iReadOnlyQuoteField->LineCount(), dummySeparatorPos ); |
|
733 TRAP_IGNORE( iReadOnlyQuoteField->FormatAllTextNowL() ); |
734 iReadOnlyQuoteField->UpdateFontSize(); |
734 iReadOnlyQuoteField->UpdateFontSize(); |
735 readOnlyQuoteFieldHeight = iReadOnlyQuoteField->Rect().Height(); |
735 readOnlyQuoteFieldHeight = iReadOnlyQuoteField->Rect().Height(); |
736 } |
736 } |
737 |
737 |
738 if ( iBgContext ) |
738 if ( iBgContext ) |
740 iBgContext->SetRect( Rect() ); |
740 iBgContext->SetRect( Rect() ); |
741 } |
741 } |
742 iMessageField->SetRealRect( Rect() ); |
742 iMessageField->SetRealRect( Rect() ); |
743 iReadOnlyQuoteField->SetRealRect( Rect() ); |
743 iReadOnlyQuoteField->SetRealRect( Rect() ); |
744 |
744 |
745 TInt messageLineHeigth = NcsUtility::HeaderCaptionPaneRect( cmailPaneRect ).Height(); |
745 TInt messageLineHeigth = |
746 iMessageEditorMinHeigth = cmailPaneRect.Height() - iHeader->Size().iHeight - |
746 NcsUtility::HeaderCaptionPaneRect( cmailPaneRect ).Height(); |
747 NcsUtility::SeparatorSizeInThisResolution().iHeight - |
747 iMessageEditorMinHeigth = |
748 readOnlyQuoteFieldHeight; |
748 cmailPaneRect.Height() - iHeader->Size().iHeight - |
|
749 NcsUtility::SeparatorSizeInThisResolution().iHeight - |
|
750 readOnlyQuoteFieldHeight; |
749 |
751 |
750 iMessageEditorMinHeigth -= iMessageEditorMinHeigth % messageLineHeigth; |
752 iMessageEditorMinHeigth -= iMessageEditorMinHeigth % messageLineHeigth; |
751 if ( iMessageEditorMinHeigth > messageLineHeigth ) |
753 if ( iMessageEditorMinHeigth > messageLineHeigth ) |
752 { |
754 { |
753 TSize newSize( iMessageField->Size().iWidth, |
755 TSize newSize( iMessageField->Size().iWidth, |
754 Max( iMessageField->Size().iHeight, iMessageEditorMinHeigth )); |
756 Max( iMessageField->Size().iHeight, |
|
757 iMessageEditorMinHeigth ) ); |
755 |
758 |
756 iMessageField->SetSize( newSize ); |
759 iMessageField->SetSize( newSize ); |
757 } |
760 } |
758 else |
761 else |
759 { |
762 { |
760 iMessageEditorMinHeigth = messageLineHeigth; |
763 iMessageEditorMinHeigth = messageLineHeigth; |
761 } |
764 } |
762 |
765 |
763 UpdateFieldPosition( NULL ); |
|
764 |
|
765 TRAP_IGNORE( UpdateScrollBarL() ); |
766 TRAP_IGNORE( UpdateScrollBarL() ); |
766 DrawNow(); |
767 DrawNow(); |
767 |
768 |
768 } |
769 } |
769 // </cmail> Platform layout changes |
|
770 |
770 |
771 // ----------------------------------------------------------------------------- |
771 // ----------------------------------------------------------------------------- |
772 // CNcsComposeViewContainer::Draw() const |
772 // CNcsComposeViewContainer::Draw() const |
773 // Draws the display |
773 // Draws the display |
774 // ----------------------------------------------------------------------------- |
774 // ----------------------------------------------------------------------------- |
775 // |
775 // |
776 void CNcsComposeViewContainer::Draw( const TRect& /*aRect*/ ) const |
776 void CNcsComposeViewContainer::Draw( const TRect& /*aRect*/ ) const |
777 { |
777 { |
778 FUNC_LOG; |
778 FUNC_LOG; |
779 // <cmail> S60 skin support |
779 |
780 if ( iBgContext ) |
780 if ( iBgContext ) |
781 { |
781 { |
782 CWindowGc& gc = SystemGc(); |
782 CWindowGc& gc = SystemGc(); |
783 |
783 |
784 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
784 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
812 CPlainText::EOrganiseByParagraph ); |
812 CPlainText::EOrganiseByParagraph ); |
813 CleanupStack::PopAndDestroy( &inputStream ); |
813 CleanupStack::PopAndDestroy( &inputStream ); |
814 |
814 |
815 // Activating the field will set the control to the end of the text |
815 // Activating the field will set the control to the end of the text |
816 iMessageField->ActivateL(); |
816 iMessageField->ActivateL(); |
817 iMessageField->SetCursorPosL(0,EFalse); |
817 iMessageField->SetCursorPosL( 0, EFalse ); |
818 |
818 |
819 inputStream.Open( aReadOnlyQuote.Ptr(), aReadOnlyQuote.Size() ); |
819 inputStream.Open( aReadOnlyQuote.Ptr(), aReadOnlyQuote.Size() ); |
820 CleanupClosePushL( inputStream ); |
820 CleanupClosePushL( inputStream ); |
821 iReadOnlyQuoteField->RichText()->ImportTextL( 0, inputStream, |
821 iReadOnlyQuoteField->RichText()->ImportTextL( 0, inputStream, |
822 CPlainText::EOrganiseByParagraph ); |
822 CPlainText::EOrganiseByParagraph ); |
823 CleanupStack::PopAndDestroy( &inputStream ); |
823 CleanupStack::PopAndDestroy( &inputStream ); |
824 |
824 |
825 // Activating the field will set the control to the end of the text |
825 // Activating the field will set the control to the end of the text |
826 iReadOnlyQuoteField->ActivateL(); |
826 iReadOnlyQuoteField->ActivateL(); |
827 iReadOnlyQuoteField->SetCursorPosL(0,EFalse); |
827 iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ); |
828 |
828 |
829 // Recalculate the size of the body field |
829 // Recalculate the size of the body field |
830 SizeChanged(); |
830 SizeChanged(); |
831 } |
831 } |
832 |
832 |
1101 void CNcsComposeViewContainer::AddQuickTextL( const TDesC& aText ) |
1091 void CNcsComposeViewContainer::AddQuickTextL( const TDesC& aText ) |
1102 { |
1092 { |
1103 FUNC_LOG; |
1093 FUNC_LOG; |
1104 |
1094 |
1105 // If in 'To' field, go to msg. field |
1095 // If in 'To' field, go to msg. field |
1106 if(!iMessageField->IsFocused()) |
1096 if( !iMessageField->IsFocused() ) |
1107 { |
1097 { |
1108 SetFocusToMessageFieldL(); |
1098 SetFocusToMessageFieldL(); |
1109 } |
1099 } |
1110 TInt pos = iMessageField->CursorPos(); |
1100 TInt pos = iMessageField->CursorPos(); |
1111 TCursorSelection selIns( pos, pos ); |
1101 TCursorSelection selIns( pos, pos ); |
1112 iMessageField->InsertDeleteCharsL( pos, aText, selIns ); |
1102 iMessageField->InsertDeleteCharsL( pos, aText, selIns ); |
1113 //Fix for error EFTG-7Y63XG, moving cursor to the end of inserted text |
1103 // Fix for error EFTG-7Y63XG, moving cursor to the end of inserted text |
1114 pos += aText.Length(); |
1104 pos += aText.Length(); |
1115 iMessageField->SetCursorPosL(pos,EFalse); |
1105 iMessageField->SetCursorPosL( pos, EFalse ); |
1116 DrawDeferred(); |
1106 DrawDeferred(); |
1117 |
1107 |
1118 } |
1108 } |
1119 |
1109 |
1120 // ----------------------------------------------------------------------------- |
1110 // ----------------------------------------------------------------------------- |
1223 iView.HandleCommandL( EFsEmailUiCmdOpenAttachment ); |
1213 iView.HandleCommandL( EFsEmailUiCmdOpenAttachment ); |
1224 |
1214 |
1225 } |
1215 } |
1226 |
1216 |
1227 // ----------------------------------------------------------------------------- |
1217 // ----------------------------------------------------------------------------- |
1228 // CNcsComposeViewContainer::LaunchAttachmentActionMenuL |
1218 // CNcsComposeViewContainer::LaunchStylusPopupMenu |
1229 // Called when right-click happens in the attahcments field |
1219 // Called when long tap happens in the attachments field |
1230 // ----------------------------------------------------------------------------- |
1220 // ----------------------------------------------------------------------------- |
1231 // |
1221 // |
1232 void CNcsComposeViewContainer::LaunchAttachmentActionMenuL() |
1222 void CNcsComposeViewContainer::LaunchStylusPopupMenu( const TPoint& aPenEventScreenLocation ) |
1233 { |
1223 { |
1234 FUNC_LOG; |
1224 FUNC_LOG; |
1235 iView.LaunchAttachmentActionMenuL(); |
1225 iView.LaunchStylusPopupMenu( aPenEventScreenLocation ); |
1236 } |
1226 } |
1237 |
1227 |
1238 // ----------------------------------------------------------------------------- |
1228 // ----------------------------------------------------------------------------- |
1239 // CNcsComposeViewContainer::GetToFieldAddressesL |
1229 // CNcsComposeViewContainer::GetToFieldAddressesL |
1240 // |
1230 // |
1241 // ----------------------------------------------------------------------------- |
1231 // ----------------------------------------------------------------------------- |
1242 // |
1232 // |
1243 const RPointerArray<CNcsEmailAddressObject>& CNcsComposeViewContainer::GetToFieldAddressesL( TBool aParseNow ) |
1233 const RPointerArray<CNcsEmailAddressObject>& |
|
1234 CNcsComposeViewContainer::GetToFieldAddressesL( TBool aParseNow ) |
1244 { |
1235 { |
1245 return iHeader->GetToFieldAddressesL( aParseNow ); |
1236 return iHeader->GetToFieldAddressesL( aParseNow ); |
1246 } |
1237 } |
1247 |
1238 |
1248 // ----------------------------------------------------------------------------- |
1239 // ----------------------------------------------------------------------------- |
1249 // CNcsComposeViewContainer::GetCcFieldAddressesL |
1240 // CNcsComposeViewContainer::GetCcFieldAddressesL |
1250 // |
1241 // |
1251 // ----------------------------------------------------------------------------- |
1242 // ----------------------------------------------------------------------------- |
1252 // |
1243 // |
1253 const RPointerArray<CNcsEmailAddressObject>& CNcsComposeViewContainer::GetCcFieldAddressesL( TBool aParseNow ) |
1244 const RPointerArray<CNcsEmailAddressObject>& |
|
1245 CNcsComposeViewContainer::GetCcFieldAddressesL( TBool aParseNow ) |
1254 { |
1246 { |
1255 return iHeader->GetCcFieldAddressesL( aParseNow ); |
1247 return iHeader->GetCcFieldAddressesL( aParseNow ); |
1256 } |
1248 } |
1257 |
1249 |
1258 // ----------------------------------------------------------------------------- |
1250 // ----------------------------------------------------------------------------- |
1259 // CNcsComposeViewContainer::GetBccFieldAddressesL |
1251 // CNcsComposeViewContainer::GetBccFieldAddressesL |
1260 // |
1252 // |
1261 // ----------------------------------------------------------------------------- |
1253 // ----------------------------------------------------------------------------- |
1262 // |
1254 // |
1263 const RPointerArray<CNcsEmailAddressObject>& CNcsComposeViewContainer::GetBccFieldAddressesL( TBool aParseNow ) |
1255 const RPointerArray<CNcsEmailAddressObject>& |
|
1256 CNcsComposeViewContainer::GetBccFieldAddressesL( TBool aParseNow ) |
1264 { |
1257 { |
1265 return iHeader->GetBccFieldAddressesL( aParseNow ); |
1258 return iHeader->GetBccFieldAddressesL( aParseNow ); |
1266 } |
1259 } |
1267 |
1260 |
1268 // ----------------------------------------------------------------------------- |
1261 // ----------------------------------------------------------------------------- |
1476 void CNcsComposeViewContainer::SetMenuBar( CEikButtonGroupContainer* aMenuBar ) |
1467 void CNcsComposeViewContainer::SetMenuBar( CEikButtonGroupContainer* aMenuBar ) |
1477 { |
1468 { |
1478 FUNC_LOG; |
1469 FUNC_LOG; |
1479 |
1470 |
1480 iHeader->SetMenuBar(aMenuBar); |
1471 iHeader->SetMenuBar(aMenuBar); |
1481 |
|
1482 } |
1472 } |
1483 |
1473 |
1484 // ----------------------------------------------------------------------------- |
1474 // ----------------------------------------------------------------------------- |
1485 // CNcsComposeViewContainer::SetToFieldAddressesL |
1475 // CNcsComposeViewContainer::SetToFieldAddressesL |
1486 // |
1476 // |
1487 // ----------------------------------------------------------------------------- |
1477 // ----------------------------------------------------------------------------- |
1488 // |
1478 // |
1489 void CNcsComposeViewContainer::SetToFieldAddressesL( RPointerArray<CNcsEmailAddressObject>& aAddress ) |
1479 void CNcsComposeViewContainer::SetToFieldAddressesL( |
|
1480 RPointerArray<CNcsEmailAddressObject>& aAddress ) |
1490 { |
1481 { |
1491 FUNC_LOG; |
1482 FUNC_LOG; |
1492 |
1483 |
1493 iHeader->SetToFieldAddressesL(aAddress); |
1484 iHeader->SetToFieldAddressesL(aAddress); |
1494 |
|
1495 } |
1485 } |
1496 |
1486 |
1497 // ----------------------------------------------------------------------------- |
1487 // ----------------------------------------------------------------------------- |
1498 // CNcsComposeViewContainer::SetCcFieldAddressesL |
1488 // CNcsComposeViewContainer::SetCcFieldAddressesL |
1499 // |
1489 // |
1500 // ----------------------------------------------------------------------------- |
1490 // ----------------------------------------------------------------------------- |
1501 // |
1491 // |
1502 void CNcsComposeViewContainer::SetCcFieldAddressesL( RPointerArray<CNcsEmailAddressObject>& aAddress ) |
1492 void CNcsComposeViewContainer::SetCcFieldAddressesL( |
|
1493 RPointerArray<CNcsEmailAddressObject>& aAddress ) |
1503 { |
1494 { |
1504 FUNC_LOG; |
1495 FUNC_LOG; |
1505 |
1496 |
1506 iHeader->SetCcFieldAddressesL( aAddress ); |
1497 iHeader->SetCcFieldAddressesL( aAddress ); |
1507 |
|
1508 } |
1498 } |
1509 |
1499 |
1510 // ----------------------------------------------------------------------------- |
1500 // ----------------------------------------------------------------------------- |
1511 // CNcsComposeViewContainer::SetBccFieldAddressesL |
1501 // CNcsComposeViewContainer::SetBccFieldAddressesL |
1512 // |
1502 // |
1513 // ----------------------------------------------------------------------------- |
1503 // ----------------------------------------------------------------------------- |
1514 // |
1504 // |
1515 void CNcsComposeViewContainer::SetBccFieldAddressesL( RPointerArray<CNcsEmailAddressObject>& aAddress ) |
1505 void CNcsComposeViewContainer::SetBccFieldAddressesL( |
|
1506 RPointerArray<CNcsEmailAddressObject>& aAddress ) |
1516 { |
1507 { |
1517 FUNC_LOG; |
1508 FUNC_LOG; |
1518 |
1509 |
1519 iHeader->SetBccFieldAddressesL( aAddress ); |
1510 iHeader->SetBccFieldAddressesL( aAddress ); |
1520 |
1511 |
1571 iHeader->SetSubjectL( aSubject ); |
1562 iHeader->SetSubjectL( aSubject ); |
1572 |
1563 |
1573 } |
1564 } |
1574 |
1565 |
1575 // ----------------------------------------------------------------------------- |
1566 // ----------------------------------------------------------------------------- |
1576 // CNcsComposeViewContainer::SetAttachmentLabelTextL |
1567 // CNcsComposeViewContainer::SetAttachmentLabelTextsLD |
1577 // |
1568 // |
1578 // ----------------------------------------------------------------------------- |
1569 // ----------------------------------------------------------------------------- |
1579 // |
1570 // |
1580 void CNcsComposeViewContainer::SetAttachmentLabelTextL( const TDesC& aText ) |
1571 void CNcsComposeViewContainer::SetAttachmentLabelTextsLD( |
1581 { |
1572 CDesCArray* aAttachmentNames, CDesCArray* aAttachmentSizes ) |
1582 FUNC_LOG; |
1573 { |
1583 |
1574 FUNC_LOG; |
1584 iHeader->SetAttachmentLabelTextL( aText ); |
1575 iHeader->SetAttachmentLabelTextsLD( aAttachmentNames, aAttachmentSizes ); |
1585 |
1576 } |
1586 } |
1577 |
1587 |
1578 // ----------------------------------------------------------------------------- |
1588 // ----------------------------------------------------------------------------- |
1579 // CNcsComposeViewContainer::FocusedAttachmentLabelIndex |
1589 // CNcsComposeViewContainer::SetAttachmentLabelTextL |
1580 // |
1590 // |
1581 // ----------------------------------------------------------------------------- |
1591 // ----------------------------------------------------------------------------- |
1582 // |
1592 // |
1583 TInt CNcsComposeViewContainer::FocusedAttachmentLabelIndex() |
1593 void CNcsComposeViewContainer::SetAttachmentLabelTextL( const TDesC& aAttachmentName, |
1584 { |
1594 const TDesC& aAttachmentSizeDesc ) |
1585 FUNC_LOG; |
1595 { |
1586 return iHeader->FocusedAttachmentLabelIndex(); |
1596 FUNC_LOG; |
|
1597 |
|
1598 iHeader->SetAttachmentLabelTextL( aAttachmentName, aAttachmentSizeDesc ); |
|
1599 |
|
1600 } |
1587 } |
1601 |
1588 |
1602 // ----------------------------------------------------------------------------- |
1589 // ----------------------------------------------------------------------------- |
1603 // CNcsComposeViewContainer::HideAttachmentLabel |
1590 // CNcsComposeViewContainer::HideAttachmentLabel |
1604 // |
1591 // |
1835 // ----------------------------------------------------------------------------- |
1818 // ----------------------------------------------------------------------------- |
1836 // |
1819 // |
1837 void CNcsComposeViewContainer::CommitL( TFieldToCommit aFieldToCommit ) |
1820 void CNcsComposeViewContainer::CommitL( TFieldToCommit aFieldToCommit ) |
1838 { |
1821 { |
1839 FUNC_LOG; |
1822 FUNC_LOG; |
1840 iView.CommitL(ETrue,aFieldToCommit); |
1823 iView.CommitL( ETrue, aFieldToCommit ); |
1841 iView.HandleContainerChangeRequiringToolbarRefresh(); |
1824 iView.HandleContainerChangeRequiringToolbarRefresh(); |
1842 } |
1825 } |
1843 |
1826 |
1844 //<cmail> |
|
1845 // ----------------------------------------------------------------------------- |
1827 // ----------------------------------------------------------------------------- |
1846 // CNcsComposeViewContainer::SwitchChangeMskOff |
1828 // CNcsComposeViewContainer::SwitchChangeMskOff |
1847 //sets up iSwitchChangeMskOff falg, which disables changes of MSK label if any popup dialog is open |
1829 // sets up iSwitchChangeMskOff falg, which disables changes of MSK label if |
|
1830 // any popup dialog is open |
1848 // ----------------------------------------------------------------------------- |
1831 // ----------------------------------------------------------------------------- |
1849 void CNcsComposeViewContainer::SwitchChangeMskOff(TBool aTag) |
1832 void CNcsComposeViewContainer::SwitchChangeMskOff(TBool aTag) |
1850 { |
1833 { |
1851 FUNC_LOG; |
1834 FUNC_LOG; |
1852 iHeader->SwitchChangeMskOff(aTag); |
1835 iHeader->SwitchChangeMskOff( aTag ); |
1853 } |
1836 } |
1854 //</cmail> |
1837 |
1855 |
|
1856 //<cmail> |
|
1857 // ----------------------------------------------------------------------------- |
1838 // ----------------------------------------------------------------------------- |
1858 // CNcsHeaderContainer::HandleLongTapEventL() |
1839 // CNcsHeaderContainer::HandleLongTapEventL() |
1859 // Handles key events |
1840 // Handles key events |
1860 // ----------------------------------------------------------------------------- |
1841 // ----------------------------------------------------------------------------- |
1861 void CNcsComposeViewContainer::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /*aPenEventScreenLocation*/ ) |
1842 void CNcsComposeViewContainer::HandleLongTapEventL( |
1862 { |
1843 const TPoint& aPenEventLocation, |
1863 FUNC_LOG; |
1844 const TPoint& aPenEventScreenLocation ) |
1864 iHeader->HandleLongTapL( aPenEventLocation ); |
1845 { |
1865 } |
1846 FUNC_LOG; |
1866 //</cmail> |
1847 iHeader->HandleLongTap( aPenEventLocation, aPenEventScreenLocation ); |
1867 |
1848 } |
1868 |
1849 |
1869 //<cmail> |
1850 |
1870 void CNcsComposeViewContainer::FixSemicolonL() |
1851 void CNcsComposeViewContainer::FixSemicolonL() |
1871 { |
1852 { |
1872 FUNC_LOG; |
1853 FUNC_LOG; |
1873 iHeader->FixSemicolonInAddressFieldsL(); |
1854 iHeader->FixSemicolonInAddressFieldsL(); |
1874 } |
1855 } |
1875 //</cmail> |
|
1876 |
1856 |
1877 // --------------------------------------------------------------------------- |
1857 // --------------------------------------------------------------------------- |
1878 // CNcsComposeViewContainer::UpdatePhysicsL() |
1858 // CNcsComposeViewContainer::UpdatePhysicsL() |
1879 // --------------------------------------------------------------------------- |
1859 // --------------------------------------------------------------------------- |
1880 // |
1860 // |
1942 |
1925 |
1943 TRAP_IGNORE( ScrollL( scrollOffset ) ); |
1926 TRAP_IGNORE( ScrollL( scrollOffset ) ); |
1944 } |
1927 } |
1945 } |
1928 } |
1946 |
1929 |
1947 /** |
1930 // ----------------------------------------------------------------------------- |
1948 * @see MAknPhysicsObserver::PhysicEmulationEnded |
1931 // CNcsComposeViewContainer::PhysicEmulationEnded |
1949 */ |
1932 // From MAknPhysicsObserver |
|
1933 // ----------------------------------------------------------------------------- |
|
1934 // |
1950 void CNcsComposeViewContainer::PhysicEmulationEnded() |
1935 void CNcsComposeViewContainer::PhysicEmulationEnded() |
1951 { |
1936 { |
1952 FUNC_LOG; |
1937 FUNC_LOG; |
1953 iIsFlicking = EFalse; |
1938 iIsFlicking = EFalse; |
1954 } |
1939 } |
1955 |
1940 |
1956 /** |
1941 // ----------------------------------------------------------------------------- |
1957 * @see MAknPhysicsObserver::ViewPosition |
1942 // CNcsComposeViewContainer::ViewPosition |
1958 */ |
1943 // From MAknPhysicsObserver |
|
1944 // ----------------------------------------------------------------------------- |
|
1945 // |
1959 TPoint CNcsComposeViewContainer::ViewPosition() const |
1946 TPoint CNcsComposeViewContainer::ViewPosition() const |
1960 { |
1947 { |
1961 FUNC_LOG; |
1948 FUNC_LOG; |
1962 return TPoint(0, -iHeader->Position().iY + Rect().Size().iHeight / 2 ); |
1949 return TPoint(0, -iHeader->Position().iY + Rect().Size().iHeight / 2 ); |
1963 } |
1950 } |
1964 |
1951 |
1965 |
1952 |
|
1953 // ----------------------------------------------------------------------------- |
|
1954 // CNcsComposeViewContainer::IsRemoteSearchInprogress |
|
1955 // ----------------------------------------------------------------------------- |
|
1956 // |
1966 TBool CNcsComposeViewContainer::IsRemoteSearchInprogress() const |
1957 TBool CNcsComposeViewContainer::IsRemoteSearchInprogress() const |
1967 { |
1958 { |
1968 FUNC_LOG; |
1959 FUNC_LOG; |
1969 return iHeader->IsRemoteSearchInprogress(); |
1960 return iHeader->IsRemoteSearchInprogress(); |
1970 } |
1961 } |