249 |
249 |
250 // Layouting focus |
250 // Layouting focus |
251 TRect bgRect( 0, 0, 0, 0 ); |
251 TRect bgRect( 0, 0, 0, 0 ); |
252 if( iCalAttendees.Count() > 1 ) |
252 if( iCalAttendees.Count() > 1 ) |
253 { |
253 { |
254 bgRect.SetRect( |
254 bgRect.SetRect( |
255 TPoint( viewerRect.iTl.iX, |
255 TPoint( viewerRect.iTl.iX, |
256 viewerRect.iTl.iY - FocusMargin() ), |
256 viewerRect.iTl.iY - FocusMargin() ), |
257 TPoint( viewerRect.iBr.iX, |
257 TPoint( viewerRect.iBr.iX, |
258 viewerRect.iBr.iY + FocusMargin() ) ); |
258 viewerRect.iBr.iY + FocusMargin() ) ); |
259 } |
259 } |
260 else |
260 else |
261 { |
261 { |
262 TAknLayoutRect bgLayoutRect = |
262 TAknLayoutRect bgLayoutRect = |
266 } |
266 } |
267 |
267 |
268 // Move focus rect so that it's relative to field's position. |
268 // Move focus rect so that it's relative to field's position. |
269 bgRect.Move( -Position() ); |
269 bgRect.Move( -Position() ); |
270 SetFocusRect( bgRect ); |
270 SetFocusRect( bgRect ); |
271 |
271 |
272 iRichTextViewer->SetRect( viewerRect ); |
272 iRichTextViewer->SetRect( viewerRect ); |
273 |
273 |
274 // Failures are ignored. |
274 // Failures are ignored. |
275 TRAP_IGNORE( |
275 TRAP_IGNORE( |
276 iRichTextViewer->SetFontL( viewerLayoutText.Font() ); |
276 iRichTextViewer->SetFontL( viewerLayoutText.Font() ); |
277 if( iCalAttendees.Count() > 0 ) |
277 if( iCalAttendees.Count() > 0 ) |
278 { |
278 { |
279 iRichTextViewer->SetLineSpacingL( LineSpacing() ); |
279 iRichTextViewer->SetLineSpacingL( LineSpacing() ); |
280 } |
280 } |
281 iRichTextViewer->ApplyLayoutChangesL(); |
281 iRichTextViewer->ApplyLayoutChangesL(); |
282 ); |
282 ); |
283 |
283 |
284 // Update AttendeesList only if iRichTextViewer width was changed. |
284 // Update AttendeesList only if iRichTextViewer width was changed. |
285 // This happens when screen orientation changes e.g. This check |
285 // This happens when screen orientation changes e.g. This check |
286 // also prevents recursive calls to UpdateAttendeesListL since |
286 // also prevents recursive calls to UpdateAttendeesListL since |
287 // it causes edwin size changed event. |
287 // it causes edwin size changed event. |
288 if ( iRichTextViewer->Size().iWidth != richTextViewerWidth ) |
288 if ( iRichTextViewer->Size().iWidth != richTextViewerWidth ) |
289 { |
289 { |
290 // Most of this case is screen orientation, in this case we need to |
290 // Most of this case is screen orientation, in this case we need to |
291 // Record the index of focusing link, after updating link array, then |
291 // Record the index of focusing link, after updating link array, then |
292 // reset the focusing to original one. |
292 // reset the focusing to original one. |
293 TInt focusingIndex = iRichTextViewer->GetFocusLink(); |
293 TInt focusingIndex = iRichTextViewer->GetFocusLink(); |
294 // Ignore leave, there's nothing we can do if leave occurs. |
294 // Ignore leave, there's nothing we can do if leave occurs. |
295 TRAP_IGNORE( UpdateAttendeesListL() ); |
295 TRAP_IGNORE( UpdateAttendeesListL() ); |
296 if ( KErrNotFound != focusingIndex ) |
296 if ( KErrNotFound != focusingIndex ) |
358 // |
358 // |
359 TSize CESMRViewerAttendeesField::MinimumSize() |
359 TSize CESMRViewerAttendeesField::MinimumSize() |
360 { |
360 { |
361 // Parent rect will be list area later --> no need to calculate it manually. |
361 // Parent rect will be list area later --> no need to calculate it manually. |
362 TRect parentRect = Parent()->Rect(); |
362 TRect parentRect = Parent()->Rect(); |
363 // TODO: Remove this after new list area is completed. See previous comment. |
|
364 TRect contentRect = NMRLayoutManager::GetLayoutRect( |
363 TRect contentRect = NMRLayoutManager::GetLayoutRect( |
365 parentRect, NMRLayoutManager::EMRLayoutListArea ).Rect(); |
364 parentRect, NMRLayoutManager::EMRLayoutListArea ).Rect(); |
366 // We have two lines; title and richtextviewer. |
365 // We have two lines; title and richtextviewer. |
367 TRect fieldRect = |
366 TRect fieldRect = |
368 NMRLayoutManager::GetFieldLayoutRect( contentRect, 2 ).Rect(); |
367 NMRLayoutManager::GetFieldLayoutRect( contentRect, 2 ).Rect(); |
406 |
405 |
407 return isUsed; |
406 return isUsed; |
408 } |
407 } |
409 |
408 |
410 // ----------------------------------------------------------------------------- |
409 // ----------------------------------------------------------------------------- |
411 // CESMRViewerAttendeesField::HandleLongtapEventL |
|
412 // ----------------------------------------------------------------------------- |
|
413 // |
|
414 void CESMRViewerAttendeesField::HandleLongtapEventL( const TPoint& aPosition ) |
|
415 { |
|
416 FUNC_LOG; |
|
417 |
|
418 if ( iRichTextViewer->Rect().Contains( aPosition ) ) |
|
419 { |
|
420 iRichTextViewer->LinkSelectedL(); |
|
421 HandleTactileFeedbackL(); |
|
422 } |
|
423 } |
|
424 |
|
425 // ----------------------------------------------------------------------------- |
|
426 // CESMRViewerAttendeesField::HandleEdwinSizeEventL |
410 // CESMRViewerAttendeesField::HandleEdwinSizeEventL |
427 // ----------------------------------------------------------------------------- |
411 // ----------------------------------------------------------------------------- |
428 // |
412 // |
429 TBool CESMRViewerAttendeesField::HandleEdwinSizeEventL(CEikEdwin* /*aEdwin*/, |
413 TBool CESMRViewerAttendeesField::HandleEdwinSizeEventL(CEikEdwin* /*aEdwin*/, |
430 TEdwinSizeEvent /*aType*/, TSize aSize ) |
414 TEdwinSizeEvent /*aType*/, TSize aSize ) |
545 TAknLayoutText text = NMRLayoutManager::GetLayoutText( |
529 TAknLayoutText text = NMRLayoutManager::GetLayoutText( |
546 Rect(), |
530 Rect(), |
547 NMRLayoutManager::EMRTextLayoutTextEditor ); |
531 NMRLayoutManager::EMRTextLayoutTextEditor ); |
548 const CFont* font = text.Font(); |
532 const CFont* font = text.Font(); |
549 |
533 |
550 // TODO: correct icon zise to correct one. Ask from UI specifier. |
|
551 TSize iconSize( 20, 20); |
534 TSize iconSize( 20, 20); |
552 |
535 |
553 TInt maxLineWidth = iRichTextViewer->LayoutWidth(); |
536 TInt maxLineWidth = iRichTextViewer->LayoutWidth(); |
554 maxLineWidth -= font->TextWidthInPixels( KAddressDelimeterSemiColon ); |
537 maxLineWidth -= font->TextWidthInPixels( KAddressDelimeterSemiColon ); |
555 maxLineWidth -= iconSize.iWidth; |
538 maxLineWidth -= iconSize.iWidth; |
676 TInt CESMRViewerAttendeesField::LineSpacing() |
659 TInt CESMRViewerAttendeesField::LineSpacing() |
677 { |
660 { |
678 FUNC_LOG; |
661 FUNC_LOG; |
679 // Calculates the line spacing based on default one line layout data |
662 // Calculates the line spacing based on default one line layout data |
680 TInt lineSpacing( 0 ); |
663 TInt lineSpacing( 0 ); |
681 |
664 |
682 TRect rect( Rect() ); |
665 TRect rect( Rect() ); |
683 |
666 |
684 TAknLayoutRect rowLayoutRect = |
667 TAknLayoutRect rowLayoutRect = |
685 NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 ); |
668 NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 ); |
686 TRect rowRect = rowLayoutRect.Rect(); |
669 TRect rowRect = rowLayoutRect.Rect(); |
687 |
670 |
688 TAknLayoutText labelLayout = |
671 TAknLayoutText labelLayout = |
689 NMRLayoutManager::GetLayoutText( |
672 NMRLayoutManager::GetLayoutText( |
690 rect, NMRLayoutManager::EMRTextLayoutTextEditor ); |
673 rect, NMRLayoutManager::EMRTextLayoutTextEditor ); |
691 |
674 |
692 TRect defaultTextRect = labelLayout.TextRect(); |
675 TRect defaultTextRect = labelLayout.TextRect(); |
693 |
676 |
694 TInt difference = rowRect.Height() - defaultTextRect.Height(); |
677 TInt difference = rowRect.Height() - defaultTextRect.Height(); |
695 |
678 |
696 lineSpacing = difference * 2; |
679 lineSpacing = difference * 2; |
697 |
680 |
698 return lineSpacing; |
681 return lineSpacing; |
699 } |
682 } |
700 |
683 |
705 TInt CESMRViewerAttendeesField::FocusMargin() |
688 TInt CESMRViewerAttendeesField::FocusMargin() |
706 { |
689 { |
707 FUNC_LOG; |
690 FUNC_LOG; |
708 // Calculates focus margin based on default one line layout data |
691 // Calculates focus margin based on default one line layout data |
709 TInt focusMagin( 0 ); |
692 TInt focusMagin( 0 ); |
710 |
693 |
711 TRect rect( Rect() ); |
694 TRect rect( Rect() ); |
712 |
695 |
713 TAknLayoutRect rowLayoutRect = |
696 TAknLayoutRect rowLayoutRect = |
714 NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 ); |
697 NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 ); |
715 TRect rowRect = rowLayoutRect.Rect(); |
698 TRect rowRect = rowLayoutRect.Rect(); |
716 |
699 |
717 TAknLayoutText labelLayout = |
700 TAknLayoutText labelLayout = |
718 NMRLayoutManager::GetLayoutText( |
701 NMRLayoutManager::GetLayoutText( |
719 rect, NMRLayoutManager::EMRTextLayoutTextEditor ); |
702 rect, NMRLayoutManager::EMRTextLayoutTextEditor ); |
720 |
703 |
721 TRect defaultTextRect = labelLayout.TextRect(); |
704 TRect defaultTextRect = labelLayout.TextRect(); |
722 |
705 |
723 TAknLayoutRect bgLayoutRect = |
706 TAknLayoutRect bgLayoutRect = |
724 NMRLayoutManager::GetLayoutRect( |
707 NMRLayoutManager::GetLayoutRect( |
725 rect, NMRLayoutManager::EMRLayoutTextEditorBg ); |
708 rect, NMRLayoutManager::EMRLayoutTextEditorBg ); |
726 TRect defaultBgRect( bgLayoutRect.Rect() ); |
709 TRect defaultBgRect( bgLayoutRect.Rect() ); |
727 |
710 |
728 TInt difference = defaultBgRect.Height() - defaultTextRect.Height(); |
711 TInt difference = defaultBgRect.Height() - defaultTextRect.Height(); |
729 |
712 |
730 focusMagin = TReal( difference / 2 ); |
713 focusMagin = TReal( difference / 2 ); |
731 |
714 |
732 return focusMagin; |
715 return focusMagin; |
733 } |
716 } |
734 |
717 |
735 // End of file |
718 // End of file |
736 |
719 |