100 FUNC_LOG; |
100 FUNC_LOG; |
101 |
101 |
102 SetMopParent( &iView ); |
102 SetMopParent( &iView ); |
103 CreateWindowL(); |
103 CreateWindowL(); |
104 |
104 |
|
105 if ( CAknPhysics::FeatureEnabled() ) |
|
106 { |
|
107 iPhysics = CAknPhysics::NewL( *this, this ); |
|
108 } |
|
109 |
105 // Setup the control array |
110 // Setup the control array |
106 InitComponentArrayL(); |
111 InitComponentArrayL(); |
107 CCoeControlArray& controls = Components(); |
112 CCoeControlArray& controls = Components(); |
108 controls.SetControlsOwnedExternally( ETrue ); |
113 controls.SetControlsOwnedExternally( ETrue ); |
109 |
114 |
110 // Create the header field |
115 // Create the header field |
111 iHeader = CNcsHeaderContainer::NewL( *this, iMailBox, aFlags ); |
116 iHeader = CNcsHeaderContainer::NewL( *this, iMailBox, aFlags, iPhysics ); |
112 controls.AppendLC( iHeader ); |
117 controls.AppendLC( iHeader ); |
113 CleanupStack::Pop( iHeader ); |
118 CleanupStack::Pop( iHeader ); |
114 |
119 |
115 // Create 'message body' field, default text is empty for that field |
120 // Create 'message body' field, default text is empty for that field |
116 iMessageField = new ( ELeave ) CNcsEditor( this, EFalse, ENcsEditorBody ); |
121 iMessageField = new ( ELeave ) CNcsEditor( this, EFalse, ENcsEditorBody ); |
117 iMessageField->SetContainerWindowL( *this ); |
122 iMessageField->SetContainerWindowL( *this ); |
118 iMessageField->ConstructL( this, 0, 0 ); |
123 iMessageField->ConstructL( this, 0, 0 ); |
119 iMessageField->SetAlignment( EAknEditorAlignBidi ); |
124 iMessageField->SetAlignment( EAknEditorAlignBidi ); |
120 iMessageField->SetAknEditorInputMode( EAknEditorTextInputMode ); |
125 iMessageField->SetAknEditorInputMode( EAknEditorTextInputMode ); |
|
126 iMessageField->EnableKineticScrollingL( iPhysics ); |
121 controls.AppendLC( iMessageField ); |
127 controls.AppendLC( iMessageField ); |
122 CleanupStack::Pop( iMessageField ); |
128 CleanupStack::Pop( iMessageField ); |
123 |
129 |
124 iMessageField->SetNcsFontType( NcsUtility::ENcsBodytextFont ); |
130 iMessageField->SetNcsFontType( NcsUtility::ENcsBodytextFont ); |
125 |
131 |
138 CleanupStack::Pop( iReadOnlyQuoteField ); |
144 CleanupStack::Pop( iReadOnlyQuoteField ); |
139 |
145 |
140 // Listen edwin events and size events from smart quote field |
146 // Listen edwin events and size events from smart quote field |
141 iReadOnlyQuoteField->AddEdwinObserverL( this ); |
147 iReadOnlyQuoteField->AddEdwinObserverL( this ); |
142 iReadOnlyQuoteField->SetEdwinSizeObserver( this ); |
148 iReadOnlyQuoteField->SetEdwinSizeObserver( this ); |
|
149 iReadOnlyQuoteField->EnableKineticScrollingL( iPhysics ); |
143 |
150 |
144 // Create the scroll bar |
151 // Create the scroll bar |
145 iScrollBar = new( ELeave ) CAknDoubleSpanScrollBar( this ); |
152 iScrollBar = new( ELeave ) CAknDoubleSpanScrollBar( this ); |
146 iScrollBar->ConstructL( |
153 iScrollBar->ConstructL( ETrue, this, this, CEikScrollBar::EVertical, |
147 this, this, CEikScrollBar::EVertical, aRect.Height() ); |
154 aRect.Height() ); |
148 iScrollBar->MakeVisible( ETrue ); |
155 iScrollBar->MakeVisible( EFalse ); |
149 iScrollBar->SetModelL( &iScrollBarModel ); |
156 iScrollBar->SetModelL( &iScrollBarModel ); |
|
157 controls.AppendLC( iScrollBar ); |
|
158 CleanupStack::Pop( iScrollBar ); |
150 |
159 |
151 iMessageField->SetupEditorL(); |
160 iMessageField->SetupEditorL(); |
152 iReadOnlyQuoteField->SetupEditorL(); |
161 iReadOnlyQuoteField->SetupEditorL(); |
153 |
162 |
154 SetRect( aRect ); |
163 SetRect( aRect ); |
287 { |
291 { |
288 if( iMessageField->SelectionLength() ) |
292 if( iMessageField->SelectionLength() ) |
289 { |
293 { |
290 iMessageField->ClearSelectionL(); |
294 iMessageField->ClearSelectionL(); |
291 } |
295 } |
292 iMessageField->SetFocus( EFalse, EDrawNow ); |
296 iMessageField->SetFocus( EFalse, ENoDrawNow ); |
293 iFocused = iHeader; |
297 iFocused = iHeader; |
294 iHeader->SetFocus( ETrue,EDrawNow ); |
298 iHeader->SetFocus( ETrue,ENoDrawNow ); |
295 iHeader->MakeVisible( ETrue ); |
299 iHeader->MakeVisible( ETrue ); |
296 CommitL( EBodyField ); |
300 CommitL( EBodyField ); |
297 iView.HandleContainerChangeRequiringToolbarRefresh(); |
301 iView.HandleContainerChangeRequiringToolbarRefresh(); |
298 } |
302 } |
299 else if ( iFocused == iReadOnlyQuoteField ) |
303 else if ( iFocused == iReadOnlyQuoteField ) |
300 { |
304 { |
301 iFocused = iMessageField; |
305 iFocused = iMessageField; |
302 iReadOnlyQuoteField->SetFocus( EFalse, EDrawNow ); |
306 iReadOnlyQuoteField->SetFocus( EFalse, ENoDrawNow ); |
303 iHeader->SetFocus( ETrue, EDrawNow ); |
307 iHeader->SetFocus( ETrue, ENoDrawNow ); |
304 iView.HandleContainerChangeRequiringToolbarRefresh(); |
308 iView.HandleContainerChangeRequiringToolbarRefresh(); |
305 } |
309 } |
306 } |
310 } |
307 else if ( iReadOnlyQuoteField->Rect().Contains( |
311 else if ( iReadOnlyQuoteField->Rect().Contains( |
308 aPointerEvent.iPosition ) ) |
312 aPointerEvent.iPosition ) ) |
309 { |
313 { |
310 if ( iFocused == iMessageField ) |
314 if ( iFocused == iMessageField ) |
311 { |
315 { |
312 iFocused = iReadOnlyQuoteField; |
316 iFocused = iReadOnlyQuoteField; |
313 iReadOnlyQuoteField->SetFocus( ETrue, EDrawNow ); |
317 iReadOnlyQuoteField->SetFocus( ETrue, ENoDrawNow ); |
314 iMessageField->SetFocus( EFalse, EDrawNow ); |
318 iMessageField->SetFocus( EFalse, ENoDrawNow ); |
315 iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ); |
319 iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ); |
316 iView.HandleContainerChangeRequiringToolbarRefresh(); |
320 iView.HandleContainerChangeRequiringToolbarRefresh(); |
317 } |
321 } |
318 else if ( iFocused == iHeader ) |
322 else if ( iFocused == iHeader ) |
319 { |
323 { |
320 iFocused = iReadOnlyQuoteField; |
324 iFocused = iReadOnlyQuoteField; |
321 iReadOnlyQuoteField->SetFocus( ETrue, EDrawNow ); |
325 iReadOnlyQuoteField->SetFocus( ETrue, ENoDrawNow ); |
322 iHeader->SetFocus( EFalse, EDrawNow ); |
326 iHeader->SetFocus( EFalse, ENoDrawNow ); |
323 iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ); |
327 iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ); |
324 iView.HandleContainerChangeRequiringToolbarRefresh(); |
328 iView.HandleContainerChangeRequiringToolbarRefresh(); |
325 } |
329 } |
326 } |
330 } |
327 else |
331 else |
328 { |
332 { |
329 if ( iFocused == iHeader ) |
333 if ( iFocused == iHeader ) |
330 { |
334 { |
331 //TRAP_IGNORE( DoUpdateSubjectL() ); |
335 //TRAP_IGNORE( DoUpdateSubjectL() ); |
332 |
336 |
333 iHeader->SetFocus( EFalse, EDrawNow ); |
337 iHeader->SetFocus( EFalse, ENoDrawNow ); |
334 iFocused = iMessageField; |
338 iFocused = iMessageField; |
335 iMessageField->SetFocus( ETrue, EDrawNow ); |
339 iMessageField->SetFocus( ETrue, ENoDrawNow ); |
336 iView.HandleContainerChangeRequiringToolbarRefresh(); |
340 iView.HandleContainerChangeRequiringToolbarRefresh(); |
337 } |
341 } |
338 else if ( iFocused == iReadOnlyQuoteField ) |
342 else if ( iFocused == iReadOnlyQuoteField ) |
339 { |
343 { |
340 iFocused = iMessageField; |
344 iFocused = iMessageField; |
341 iReadOnlyQuoteField->SetFocus( EFalse, EDrawNow ); |
345 iReadOnlyQuoteField->SetFocus( EFalse, ENoDrawNow ); |
342 iMessageField->SetFocus( ETrue, EDrawNow ); |
346 iMessageField->SetFocus( ETrue, ENoDrawNow ); |
343 iView.HandleContainerChangeRequiringToolbarRefresh(); |
347 iView.HandleContainerChangeRequiringToolbarRefresh(); |
344 } |
348 } |
345 else |
349 else |
346 { |
350 { |
|
351 iMessageField->ClearSelectionL(); |
|
352 |
347 const TRect messageFieldRect( iMessageField->Rect() ); |
353 const TRect messageFieldRect( iMessageField->Rect() ); |
348 if ( !messageFieldRect.Contains( aPointerEvent.iPosition ) && |
354 if ( !messageFieldRect.Contains( aPointerEvent.iPosition ) && |
349 aPointerEvent.iPosition.iY >= messageFieldRect.iTl.iY ) |
355 aPointerEvent.iPosition.iY >= messageFieldRect.iTl.iY ) |
350 { |
356 { |
351 iMessageField->OpenVirtualKeyBoardL(); |
357 iMessageField->OpenVirtualKeyBoardL(); |
653 TKeyResponse ret( EKeyWasNotConsumed ); |
668 TKeyResponse ret( EKeyWasNotConsumed ); |
654 |
669 |
655 if ( iFocused == iReadOnlyQuoteField && aKeyEvent.iCode == EKeyUpArrow ) |
670 if ( iFocused == iReadOnlyQuoteField && aKeyEvent.iCode == EKeyUpArrow ) |
656 { |
671 { |
657 iFocused = iMessageField; |
672 iFocused = iMessageField; |
658 iReadOnlyQuoteField->SetFocus( EFalse, EDrawNow ); |
673 iReadOnlyQuoteField->SetFocus( EFalse, ENoDrawNow ); |
659 iMessageField->SetFocus( ETrue, EDrawNow ); |
674 iMessageField->SetFocus( ETrue, ENoDrawNow ); |
660 ret = EKeyWasConsumed; |
675 ret = EKeyWasConsumed; |
661 } |
676 } |
662 else if ( iFocused == iMessageField ) |
677 else if ( iFocused == iMessageField ) |
663 { |
678 { |
664 if ( aKeyEvent.iCode == EKeyUpArrow ) |
679 if ( aKeyEvent.iCode == EKeyUpArrow ) |
665 { |
680 { |
666 iFocused = iHeader; |
681 iFocused = iHeader; |
667 iHeader->SetFocus( ETrue,EDrawNow ); |
682 iHeader->SetFocus( ETrue, ENoDrawNow ); |
668 iMessageField->SetFocus( EFalse, EDrawNow ); |
683 iMessageField->SetFocus( EFalse, ENoDrawNow ); |
669 iHeader->MakeVisible( ETrue ); |
684 iHeader->MakeVisible( ETrue ); |
|
685 iHeader->ShowCursor( ETrue ); |
670 CommitL( EBodyField ); |
686 CommitL( EBodyField ); |
671 ret = EKeyWasConsumed; |
687 ret = EKeyWasConsumed; |
672 } |
688 } |
673 else if ( aKeyEvent.iCode == EKeyDownArrow && |
689 else if ( aKeyEvent.iCode == EKeyDownArrow && |
674 iReadOnlyQuoteField->TextLength() ) |
690 iReadOnlyQuoteField->TextLength() ) |
675 { |
691 { |
676 // Focus move to read-only quote only if there is some text in it. |
692 // Focus move to read-only quote only if there is some text in it. |
677 iFocused = iReadOnlyQuoteField; |
693 iFocused = iReadOnlyQuoteField; |
678 iReadOnlyQuoteField->SetFocus( ETrue, EDrawNow ); |
694 iReadOnlyQuoteField->SetFocus( ETrue, ENoDrawNow ); |
679 iMessageField->SetFocus( EFalse, EDrawNow ); |
695 iMessageField->SetFocus( EFalse, ENoDrawNow ); |
680 iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ); |
696 iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ); |
681 ret = EKeyWasConsumed; |
697 ret = EKeyWasConsumed; |
682 } |
698 } |
683 } |
699 } |
684 else if ( iFocused == iHeader && aKeyEvent.iCode == EKeyDownArrow ) |
700 else if ( iFocused == iHeader && aKeyEvent.iCode == EKeyDownArrow ) |
685 { |
701 { |
686 iFocused = iMessageField; |
702 iFocused = iMessageField; |
687 iHeader->SetFocus( EFalse, EDrawNow ); |
703 iHeader->SetFocus( EFalse, ENoDrawNow ); |
688 iMessageField->SetFocus( ETrue, EDrawNow ); |
704 iMessageField->SetFocus( ETrue, ENoDrawNow ); |
689 iMessageField->SetCursorPosL( 0, EFalse ); |
705 iMessageField->SetCursorPosL( 0, EFalse ); |
690 ret = EKeyWasConsumed; |
706 ret = EKeyWasConsumed; |
691 } |
707 } |
692 |
708 |
693 if ( ret == EKeyWasConsumed ) |
709 if ( ret == EKeyWasConsumed ) |
800 // ----------------------------------------------------------------------------- |
816 // ----------------------------------------------------------------------------- |
801 // CNcsComposeViewContainer::Draw() const |
817 // CNcsComposeViewContainer::Draw() const |
802 // Draws the display |
818 // Draws the display |
803 // ----------------------------------------------------------------------------- |
819 // ----------------------------------------------------------------------------- |
804 // |
820 // |
805 void CNcsComposeViewContainer::Draw( const TRect& /*aRect*/ ) const |
821 void CNcsComposeViewContainer::Draw( const TRect& aRect ) const |
806 { |
822 { |
807 FUNC_LOG; |
823 FUNC_LOG; |
808 |
824 |
809 if ( iBgContext ) |
825 if ( iBgContext ) |
810 { |
826 { |
811 CWindowGc& gc = SystemGc(); |
827 CWindowGc& gc = SystemGc(); |
812 |
828 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
813 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
829 if ( skin ) |
814 |
830 { |
815 if ( skin ) |
831 AknsDrawUtils::Background( skin, iBgContext, this, gc, aRect ); |
816 { |
832 } |
817 AknsDrawUtils::Background( skin, iBgContext, this, gc, Rect() ); |
833 } |
818 } |
834 } |
819 } |
|
820 } |
|
821 |
|
822 |
835 |
823 // ----------------------------------------------------------------------------- |
836 // ----------------------------------------------------------------------------- |
824 // CNcsComposeViewContainer::SetBodyContentL() |
837 // CNcsComposeViewContainer::SetBodyContentL() |
825 // ----------------------------------------------------------------------------- |
838 // ----------------------------------------------------------------------------- |
826 // |
839 // |
1106 |
1119 |
1107 if( iFocused != iMessageField ) |
1120 if( iFocused != iMessageField ) |
1108 { |
1121 { |
1109 iHeader->SetFocus( EFalse, ENoDrawNow ); |
1122 iHeader->SetFocus( EFalse, ENoDrawNow ); |
1110 iMessageField->SetCursorPosL( 0, EFalse ); |
1123 iMessageField->SetCursorPosL( 0, EFalse ); |
1111 iMessageField->SetFocus( ETrue, EDrawNow ); |
1124 iMessageField->SetFocus( ETrue, ENoDrawNow ); |
1112 iFocused = iMessageField; |
1125 iFocused = iMessageField; |
1113 UpdateScreenPositionL(); |
1126 UpdateScreenPositionL(); |
1114 DrawDeferred(); |
1127 DrawDeferred(); |
1115 } |
1128 } |
1116 |
|
1117 } |
1129 } |
1118 |
1130 |
1119 // ----------------------------------------------------------------------------- |
1131 // ----------------------------------------------------------------------------- |
1120 // CNcsComposeViewContainer::AddQuickTextL() |
1132 // CNcsComposeViewContainer::AddQuickTextL() |
1121 // ----------------------------------------------------------------------------- |
1133 // ----------------------------------------------------------------------------- |