209 void CDialerNumberEntry::SetTextToNumberEntry( const TDesC& aDesC ) |
214 void CDialerNumberEntry::SetTextToNumberEntry( const TDesC& aDesC ) |
210 { |
215 { |
211 DIALER_PRINT("numberentry::SetTextToNumberEntry<"); |
216 DIALER_PRINT("numberentry::SetTextToNumberEntry<"); |
212 |
217 |
213 iEditor->SetText( aDesC ); |
218 iEditor->SetText( aDesC ); |
|
219 |
|
220 if ( iEasyDialer && iOperationMode == EModeEasyDialing ) |
|
221 { |
|
222 TRAP_IGNORE( iEasyDialer->SetInputL( aDesC ) ); |
|
223 } |
|
224 |
214 iEditor->DrawNow(); |
225 iEditor->DrawNow(); |
215 |
226 |
216 DIALER_PRINT("numberentry::SetTextToNumberEntry>"); |
227 DIALER_PRINT("numberentry::SetTextToNumberEntry>"); |
217 } |
228 } |
218 |
229 |
219 // --------------------------------------------------------------------------- |
230 // --------------------------------------------------------------------------- |
220 // CDialerNumberEntry::GetTextFromNumberEntry |
231 // CDialerNumberEntry::GetTextFromNumberEntry |
221 // --------------------------------------------------------------------------- |
232 // --------------------------------------------------------------------------- |
222 // |
233 // |
223 void CDialerNumberEntry::GetTextFromNumberEntry( TDes& aDesC ) |
234 void CDialerNumberEntry::GetTextFromNumberEntry( TDes& aDes ) |
224 { |
235 { |
225 iEditor->GetText( aDesC ); |
236 iEditor->GetText( aDes ); |
|
237 } |
|
238 |
|
239 // --------------------------------------------------------------------------- |
|
240 // CDialerNumberEntry::Text |
|
241 // --------------------------------------------------------------------------- |
|
242 // |
|
243 TPtrC CDialerNumberEntry::Text() const |
|
244 { |
|
245 return iEditor->Text(); |
226 } |
246 } |
227 |
247 |
228 // --------------------------------------------------------------------------- |
248 // --------------------------------------------------------------------------- |
229 // CDialerNumberEntry::ResetEditorToDefaultValues |
249 // CDialerNumberEntry::ResetEditorToDefaultValues |
230 // --------------------------------------------------------------------------- |
250 // --------------------------------------------------------------------------- |
299 void CDialerNumberEntry::HandleControlEventL( CCoeControl* aControl, |
319 void CDialerNumberEntry::HandleControlEventL( CCoeControl* aControl, |
300 TCoeEvent aEventType ) |
320 TCoeEvent aEventType ) |
301 { |
321 { |
302 DIALER_PRINT("numberentry::HandleControlEventL<"); |
322 DIALER_PRINT("numberentry::HandleControlEventL<"); |
303 |
323 |
304 TInt format( KDialerNELayoutLargeFont ); |
|
305 if ( aControl == iEditor && aEventType == EEventStateChanged ) |
324 if ( aControl == iEditor && aEventType == EEventStateChanged ) |
306 { |
325 { |
307 HandleEditorFormatting(); |
326 HandleEditorFormatting(); |
|
327 |
308 InformNumberEntryState(); |
328 InformNumberEntryState(); |
|
329 |
309 iEditor->DrawDeferred(); |
330 iEditor->DrawDeferred(); |
310 |
331 } |
311 } |
332 |
312 |
|
313 DIALER_PRINT("numberentry::HandleControlEventL>"); |
333 DIALER_PRINT("numberentry::HandleControlEventL>"); |
314 } |
334 } |
315 |
335 |
316 // --------------------------------------------------------------------------- |
336 // --------------------------------------------------------------------------- |
317 // CDialerNumberEntry::OfferKeyEventL |
337 // CDialerNumberEntry::OfferKeyEventL |
318 // --------------------------------------------------------------------------- |
338 // --------------------------------------------------------------------------- |
319 // |
339 // |
320 TKeyResponse CDialerNumberEntry::OfferKeyEventL( |
340 TKeyResponse CDialerNumberEntry::OfferKeyEventL( |
321 const TKeyEvent& aKeyEvent, |
341 const TKeyEvent& aKeyEvent, |
322 TEventCode aType ) |
342 TEventCode aType ) |
323 { |
343 { |
324 return iEditor->OfferKeyEventL( aKeyEvent, aType ); |
344 TKeyResponse handled = EKeyWasNotConsumed; |
|
345 |
|
346 // First, offer keyevent to easy dialer. |
|
347 if (iEasyDialer) |
|
348 { |
|
349 handled = iEasyDialer->OfferKeyEventL(aKeyEvent, aType); |
|
350 } |
|
351 |
|
352 // Then to number entry editor. |
|
353 if (handled == EKeyWasNotConsumed) |
|
354 { |
|
355 handled = iEditor->OfferKeyEventL(aKeyEvent, aType); |
|
356 } |
|
357 |
|
358 return handled; |
325 } |
359 } |
326 |
360 |
327 // --------------------------------------------------------------------------- |
361 // --------------------------------------------------------------------------- |
328 // CDialerNumberEntry::CountComponentControls |
362 // CDialerNumberEntry::CountComponentControls |
329 // --------------------------------------------------------------------------- |
363 // --------------------------------------------------------------------------- |
436 // Label layout |
471 // Label layout |
437 |
472 |
438 // Portrait variety is temporarily used also in landscape. |
473 // Portrait variety is temporarily used also in landscape. |
439 // Landscape layout data is now unavailable. |
474 // Landscape layout data is now unavailable. |
440 TAknTextComponentLayout labelLayout = |
475 TAknTextComponentLayout labelLayout = |
441 AknLayoutScalable_Apps::dialer2_ne_pane_t2( |
476 AknLayoutScalable_Apps::dialer2_ne_pane_t2( EDialerVarietyPortrait ); |
442 EDialerVarietyPortrait ); |
|
443 // Temporary solution |
477 // Temporary solution |
444 labelLayout.Setl(neLayout.l()); |
478 labelLayout.Setl( neLayout.l() ); |
445 AknLayoutUtils::LayoutLabel( iLabel, parentRect, labelLayout ); |
479 AknLayoutUtils::LayoutLabel( iLabel, parentRect, labelLayout ); |
446 |
480 |
447 HandleEditorFormatting(); |
481 HandleEditorFormatting(); |
448 iEditor->DrawDeferred(); |
482 iEditor->DrawDeferred(); |
449 |
|
450 } |
483 } |
451 |
484 |
452 // --------------------------------------------------------------------------- |
485 // --------------------------------------------------------------------------- |
453 // CDialerNumberEntry::ConstructEditorFromResourceL |
486 // CDialerNumberEntry::ConstructEditorFromResourceL |
454 // --------------------------------------------------------------------------- |
487 // --------------------------------------------------------------------------- |
500 // --------------------------------------------------------------------------- |
533 // --------------------------------------------------------------------------- |
501 // |
534 // |
502 void CDialerNumberEntry::CalculateLayout( |
535 void CDialerNumberEntry::CalculateLayout( |
503 CAknPhoneNumberEditor::TFormat& aFormat, TInt aNEVariety ) |
536 CAknPhoneNumberEditor::TFormat& aFormat, TInt aNEVariety ) |
504 { |
537 { |
505 TAknLayoutText textsLargeFontLine1Text; |
538 TAknLayoutText textsLine1Text; |
506 TAknLayoutText textsLargeFontLine2Text; |
539 TAknLayoutText textsLine2Text; |
507 TAknLayoutText textsLargeFontLine3Text; |
540 |
508 |
541 if ( iOperationMode == EModeEasyDialing ) |
509 TAknLayoutText textsSmallFontLine1Text; |
542 { |
510 TAknLayoutText textsSmallFontLine2Text; |
543 TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
511 TAknLayoutText textsSmallFontLine3Text; |
544 textsLine1Text.LayoutText( Rect(), AknLayoutScalable_Apps::dia3_numentry_pane_t1(variety) ); |
512 |
545 textsLine2Text = textsLine1Text; |
513 const CAknLayoutFont* layoutFont; |
546 } |
514 |
547 else |
515 switch ( aNEVariety ) |
548 { |
516 { |
549 TInt variety = 0; |
517 case KDialerNELayoutLargeFont: |
550 if ( aNEVariety == KDialerNELayoutLargeFont ) |
518 { |
551 { |
519 TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 2 : 0; |
552 variety = Layout_Meta_Data::IsLandscapeOrientation() ? 2 : 0; |
520 |
553 } |
521 TAknLayoutScalableParameterLimits limits = |
554 else |
522 AknLayoutScalable_Apps::dialer2_ne_pane_t1_ParamLimits( |
555 { |
523 variety ); |
556 variety = Layout_Meta_Data::IsLandscapeOrientation() ? 3 : 1; |
524 //Line 1 |
557 } |
525 textsLargeFontLine1Text.LayoutText( Rect(), |
558 |
526 AknLayoutScalable_Apps::dialer2_ne_pane_t1( |
559 //Line 1 |
527 variety, 0, 0 ) ); |
560 textsLine1Text.LayoutText( Rect(), |
528 //Line 2 |
561 AknLayoutScalable_Apps::dialer2_ne_pane_t1( variety, 0, 0 ) ); |
529 textsLargeFontLine2Text.LayoutText( Rect(), |
562 //Line 2 |
530 AknLayoutScalable_Apps::dialer2_ne_pane_t1( |
563 textsLine2Text.LayoutText( Rect(), |
531 variety, |
564 AknLayoutScalable_Apps::dialer2_ne_pane_t1( variety, 0, 1 ) ); |
532 0, |
565 } |
533 1 ) ); |
566 |
534 //Last row |
567 //take font from line 1 |
535 textsLargeFontLine3Text.LayoutText( Rect(), |
568 aFormat.iFont = textsLine1Text.Font(); |
536 AknLayoutScalable_Apps::dialer2_ne_pane_t1( variety, |
569 const CAknLayoutFont* layoutFont = CAknLayoutFont::AsCAknLayoutFontOrNull( aFormat.iFont ); |
537 0, |
570 aFormat.iBottomBaselineOffset = layoutFont->BaselineToTextPaneBottom(); |
538 limits.LastRow() ) ); |
571 |
539 |
572 // Calculate baselineSeparation from the difference of the second |
540 //Need to add one row because zero is the first line |
573 // line and the first line bottom right Y coordinates. |
541 aFormat.iNumLines = limits.LastRow()+1; |
574 TInt baselineSeparation = |
542 |
575 textsLine2Text.TextRect().iBr.iY - textsLine1Text.TextRect().iBr.iY; |
543 //take font from line 1 |
576 aFormat.iBaselineSeparation = baselineSeparation; |
544 aFormat.iFont = textsLargeFontLine1Text.Font(); |
577 |
545 layoutFont = CAknLayoutFont::AsCAknLayoutFontOrNull( aFormat.iFont); |
578 // Outer rect of the text editor is the inner rect of the whole text box |
546 aFormat.iBottomBaselineOffset = |
579 aFormat.iOuterRect = iInnerRect; |
547 layoutFont->BaselineToTextPaneBottom(); |
580 |
548 //outer rect from last line |
581 aFormat.iNumLines = 1; |
549 aFormat.iOuterRect = textsLargeFontLine3Text.TextRect(); |
582 |
550 // have to add extra gap |
583 // If multiline layout is to be used, the exact number of lines is calculated |
551 aFormat.iOuterRect.iTl.iY -= aFormat.iBottomBaselineOffset; |
584 // based on available area and the row height (i.e. baselineSeparation) |
552 |
585 if ( baselineSeparation > 0 && baselineSeparation < iInnerRect.Height() ) |
553 //calculate baselineSeparation from the difference of the second |
586 { |
554 //line and the first line bottom right Y coordinates |
587 aFormat.iNumLines = ( iInnerRect.Height() / baselineSeparation ); |
555 TInt baselineSeparation = textsLargeFontLine2Text.TextRect().iBr.iY |
588 |
556 - textsLargeFontLine1Text.TextRect().iBr.iY; |
589 // Center editor vertically to the available area. |
557 |
590 TInt editorHeight = aFormat.iNumLines * baselineSeparation; |
558 aFormat.iOuterRect.iTl.iY -= ( (aFormat.iNumLines - 1) |
591 TInt deltaHeight = ( iInnerRect.Height() - editorHeight ) / 2; |
559 * baselineSeparation ); |
592 aFormat.iOuterRect.Shrink( 0, deltaHeight ); |
560 aFormat.iBaselineSeparation = baselineSeparation; |
593 } |
561 } |
|
562 break; |
|
563 case KDialerNELayoutSmallFont: |
|
564 { |
|
565 TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 3 : 1; |
|
566 |
|
567 TAknLayoutScalableParameterLimits limits = |
|
568 AknLayoutScalable_Apps::dialer2_ne_pane_t1_ParamLimits( |
|
569 variety ); |
|
570 //Line 1 |
|
571 textsSmallFontLine1Text.LayoutText( Rect(), |
|
572 AknLayoutScalable_Apps::dialer2_ne_pane_t1( variety,0,0 ) ); |
|
573 //Line 2 |
|
574 textsSmallFontLine2Text.LayoutText( Rect(), |
|
575 AknLayoutScalable_Apps::dialer2_ne_pane_t1( variety,0,1 ) ); |
|
576 //Last row |
|
577 textsSmallFontLine3Text.LayoutText( Rect(), |
|
578 AknLayoutScalable_Apps::dialer2_ne_pane_t1( |
|
579 variety, |
|
580 0, |
|
581 limits.LastRow() ) ); |
|
582 |
|
583 //Need to add one row because zero is the first line |
|
584 aFormat.iNumLines = limits.LastRow()+1; |
|
585 |
|
586 //take font from line 1 |
|
587 aFormat.iFont = textsSmallFontLine1Text.Font(); |
|
588 layoutFont = CAknLayoutFont::AsCAknLayoutFontOrNull( |
|
589 aFormat.iFont); |
|
590 aFormat.iBottomBaselineOffset = |
|
591 layoutFont->BaselineToTextPaneBottom(); |
|
592 //outer rect from line 3 |
|
593 aFormat.iOuterRect = textsSmallFontLine3Text.TextRect(); |
|
594 // have to add extra gap |
|
595 aFormat.iOuterRect.iTl.iY -= aFormat.iBottomBaselineOffset; |
|
596 |
|
597 //calculate baselineSeparation from the difference of the second |
|
598 //line and the first line bottom right Y coordinates |
|
599 TInt baselineSeparation = textsSmallFontLine2Text.TextRect().iBr.iY |
|
600 - textsSmallFontLine1Text.TextRect().iBr.iY; |
|
601 |
|
602 aFormat.iOuterRect.iTl.iY -= ( (aFormat.iNumLines - 1) |
|
603 * baselineSeparation ); |
|
604 aFormat.iBaselineSeparation = baselineSeparation; |
|
605 } |
|
606 break; |
|
607 default: |
|
608 break; |
|
609 } |
|
610 } |
594 } |
611 |
595 |
612 // --------------------------------------------------------------------------- |
596 // --------------------------------------------------------------------------- |
613 // CDialerNumberEntry::HandleResourceChange |
597 // CDialerNumberEntry::HandleResourceChange |
614 // --------------------------------------------------------------------------- |
598 // --------------------------------------------------------------------------- |
677 // |
679 // |
678 void CDialerNumberEntry::RectFrameInnerOuterRects( const TRect& aFrameRect, |
680 void CDialerNumberEntry::RectFrameInnerOuterRects( const TRect& aFrameRect, |
679 TRect& aOuterRect, |
681 TRect& aOuterRect, |
680 TRect& aInnerRect ) |
682 TRect& aInnerRect ) |
681 { |
683 { |
682 if ( Layout_Meta_Data::IsMirrored() ) |
684 if ( iOperationMode == EModeEasyDialing ) |
683 { |
685 { |
684 TAknLayoutRect frameTopRight; |
686 aOuterRect = Rect(); |
685 frameTopRight.LayoutRect( |
687 TAknLayoutRect innerRectLayout; |
686 aFrameRect, |
688 innerRectLayout.LayoutRect( aOuterRect, AknLayoutScalable_Apps::bg_dia3_numentry_pane_g1() ); |
687 AknLayoutScalable_Apps::bg_popup_call2_rect_pane_g3().LayoutLine() ); |
689 aInnerRect = innerRectLayout.Rect(); |
688 |
|
689 TAknLayoutRect frameBottomLeft; |
|
690 frameBottomLeft.LayoutRect( |
|
691 aFrameRect, |
|
692 AknLayoutScalable_Apps::bg_popup_call2_rect_pane_g4().LayoutLine() ); |
|
693 |
|
694 aOuterRect = TRect( frameTopRight.Rect().iTl, |
|
695 frameBottomLeft.Rect().iBr ); |
|
696 |
|
697 aInnerRect = TRect( frameTopRight.Rect().iBr, |
|
698 frameBottomLeft.Rect().iTl ); |
|
699 } |
690 } |
700 else |
691 else |
701 { |
692 { |
702 TAknLayoutRect frameTopLeft; |
693 if ( Layout_Meta_Data::IsMirrored() ) |
703 frameTopLeft.LayoutRect( |
694 { |
704 aFrameRect, |
695 TAknLayoutRect frameTopRight; |
705 AknLayoutScalable_Apps::bg_popup_call2_rect_pane_g2().LayoutLine() ); |
696 frameTopRight.LayoutRect( |
706 |
697 aFrameRect, |
707 TAknLayoutRect frameBottomRight; |
698 AknLayoutScalable_Apps::bg_popup_call2_rect_pane_g3().LayoutLine() ); |
708 frameBottomRight.LayoutRect( |
699 |
709 aFrameRect, |
700 TAknLayoutRect frameBottomLeft; |
710 AknLayoutScalable_Apps::bg_popup_call2_rect_pane_g5().LayoutLine() ); |
701 frameBottomLeft.LayoutRect( |
711 |
702 aFrameRect, |
712 aOuterRect = TRect( frameTopLeft.Rect().iTl, |
703 AknLayoutScalable_Apps::bg_popup_call2_rect_pane_g4().LayoutLine() ); |
713 frameBottomRight.Rect().iBr ); |
704 |
714 aInnerRect = TRect( frameTopLeft.Rect().iBr, |
705 aOuterRect = TRect( frameTopRight.Rect().iTl, |
715 frameBottomRight.Rect().iTl ); |
706 frameBottomLeft.Rect().iBr ); |
716 } |
707 |
|
708 aInnerRect = TRect( frameTopRight.Rect().iBr, |
|
709 frameBottomLeft.Rect().iTl ); |
|
710 } |
|
711 else |
|
712 { |
|
713 TAknLayoutRect frameTopLeft; |
|
714 frameTopLeft.LayoutRect( |
|
715 aFrameRect, |
|
716 AknLayoutScalable_Apps::bg_popup_call2_rect_pane_g2().LayoutLine() ); |
|
717 |
|
718 TAknLayoutRect frameBottomRight; |
|
719 frameBottomRight.LayoutRect( |
|
720 aFrameRect, |
|
721 AknLayoutScalable_Apps::bg_popup_call2_rect_pane_g5().LayoutLine() ); |
|
722 |
|
723 aOuterRect = TRect( frameTopLeft.Rect().iTl, |
|
724 frameBottomRight.Rect().iBr ); |
|
725 aInnerRect = TRect( frameTopLeft.Rect().iBr, |
|
726 frameBottomRight.Rect().iTl ); |
|
727 } |
|
728 } |
717 } |
729 } |
718 |
730 |
719 // ----------------------------------------------------------------------------- |
731 // ----------------------------------------------------------------------------- |
720 // CDialerNumberEntry::InformNumberEntryState() |
732 // CDialerNumberEntry::InformNumberEntryState() |
721 // ----------------------------------------------------------------------------- |
733 // ----------------------------------------------------------------------------- |
769 // Ignore error |
798 // Ignore error |
770 TRAP_IGNORE( iLabel->OverrideColorL( EColorLabelText, skinColor ) ); |
799 TRAP_IGNORE( iLabel->OverrideColorL( EColorLabelText, skinColor ) ); |
771 } |
800 } |
772 } |
801 } |
773 |
802 |
|
803 |
|
804 // CDialerNumberEntry::MakeVisible( TBool aVisible ) |
|
805 // ----------------------------------------------------------------------------- |
|
806 // |
|
807 void CDialerNumberEntry::MakeVisible( TBool aVisible ) |
|
808 { |
|
809 CCoeControl::MakeVisible( aVisible ); |
|
810 iEditor->MakeVisible( aVisible ); |
|
811 } |
|
812 |
|
813 |
|
814 // ----------------------------------------------------------------------------- |
|
815 // CDialerNumberEntry::SetEasyDialingPlugin |
|
816 // ----------------------------------------------------------------------------- |
|
817 // |
|
818 void CDialerNumberEntry::SetEasyDialingPlugin(CDialingExtensionInterface* aEasyDialer) |
|
819 { |
|
820 DIALER_PRINT("numberentry::SetEasyDialingPlugin"); |
|
821 iEasyDialer = aEasyDialer; |
|
822 } |
|
823 |
|
824 // ----------------------------------------------------------------------------- |
|
825 // CDialerNumberEntry::SetOperationMode |
|
826 // ----------------------------------------------------------------------------- |
|
827 // |
|
828 void CDialerNumberEntry::SetOperationMode( TDialerOperationMode aMode ) |
|
829 { |
|
830 iOperationMode = aMode; |
|
831 } |
|
832 |
|
833 // ----------------------------------------------------------------------------- |
|
834 // CDialerNumberEntry::Validate |
|
835 // |
|
836 // Copied from cphonekeys. |
|
837 // ----------------------------------------------------------------------------- |
|
838 // |
|
839 TBool CDialerNumberEntry::Validate( const TDesC& aString ) |
|
840 { |
|
841 DIALER_PRINT("numberentry::Validate"); |
|
842 TLex input( aString ); |
|
843 TPtrC valid( KPhoneValidChars ); |
|
844 |
|
845 while ( valid.Locate( input.Peek() ) != KErrNotFound ) |
|
846 { |
|
847 input.Inc(); |
|
848 } |
|
849 |
|
850 return !input.Remainder().Length(); |
|
851 } |
|
852 |
774 // End of File |
853 // End of File |