phoneuis/dialer/src/cdialernumberentry.cpp
branchRCL_3
changeset 9 8871b09be73b
parent 0 5f000ab63145
child 14 24062c24fe38
equal deleted inserted replaced
4:c84cf270c54f 9:8871b09be73b
    42 #include "cdialernumberentry.h"
    42 #include "cdialernumberentry.h"
    43 #include "dialercommon.h"
    43 #include "dialercommon.h"
    44 #include "dialertrace.h"
    44 #include "dialertrace.h"
    45 #include "dialer.hrh"
    45 #include "dialer.hrh"
    46 #include "mnumberentry.h"
    46 #include "mnumberentry.h"
    47 
    47 #include    <dialingextensioninterface.h>
       
    48 #include    <phoneappcommands.hrh>
    48 
    49 
    49 const TInt KNumberEntryControlCount = 2; //  = number entry, label
    50 const TInt KNumberEntryControlCount = 2; //  = number entry, label
       
    51 
       
    52 _LIT( KPhoneValidChars, "0123456789*#+pwPW" );
    50 
    53 
    51 // ========================= MEMBER FUNCTIONS ================================
    54 // ========================= MEMBER FUNCTIONS ================================
    52 
    55 
    53 // ---------------------------------------------------------------------------
    56 // ---------------------------------------------------------------------------
    54 // NewL
    57 // NewL
    74 // 
    77 // 
    75 // ---------------------------------------------------------------------------
    78 // ---------------------------------------------------------------------------
    76 //
    79 //
    77 void CDialerNumberEntry::ConstructL()
    80 void CDialerNumberEntry::ConstructL()
    78     {   
    81     {   
    79    	DIALER_PRINT("numberentry::ConstructL<");  
    82     DIALER_PRINT("numberentry::ConstructL<");  
    80     BaseConstructL();
    83     BaseConstructL();
    81  
    84  
    82     // Create number entry editor    
    85     // Create number entry editor    
    83     iEditor = new( ELeave ) CAknPhoneNumberEditor;
    86     iEditor = new( ELeave ) CAknPhoneNumberEditor;
    84     iEditor->SetContainerWindowL( *this );
    87     iEditor->SetContainerWindowL( *this );
   104     iLabel->SetParent( this );
   107     iLabel->SetParent( this );
   105     iLabel->SetMopParent( this ); 
   108     iLabel->SetMopParent( this ); 
   106     iLabel->SetTextL( KNullDesC );
   109     iLabel->SetTextL( KNullDesC );
   107     iLabel->MakeVisible( EFalse );    
   110     iLabel->MakeVisible( EFalse );    
   108     CheckLabelSkinningColor();
   111     CheckLabelSkinningColor();
       
   112     
       
   113     iAppUi = iEikonEnv->EikAppUi();
       
   114     __ASSERT_ALWAYS( iAppUi, DialerPanic( EDialerPanicNoApplicationInstance ) );
   109      
   115      
   110     ActivateL();
   116     ActivateL();
   111     DIALER_PRINT("numberentry::ConstructL>");
   117     DIALER_PRINT("numberentry::ConstructL>");
   112     }
   118     }
   113 
   119 
   126     AknsUtils::DeregisterControlPosition( this );
   132     AknsUtils::DeregisterControlPosition( this );
   127     
   133     
   128     delete iEditor;
   134     delete iEditor;
   129     delete iFrameContext;
   135     delete iFrameContext;
   130     delete iLabel;
   136     delete iLabel;
   131     
       
   132     }
   137     }
   133 
   138 
   134 
   139 
   135 // ---------------------------------------------------------------------------
   140 // ---------------------------------------------------------------------------
   136 // CDialerNumberEntry::SetNumberEntryObserver 
   141 // CDialerNumberEntry::SetNumberEntryObserver 
   144         
   149         
   145 // ---------------------------------------------------------------------------
   150 // ---------------------------------------------------------------------------
   146 // CDialerNumberEntry::SetFocus
   151 // CDialerNumberEntry::SetFocus
   147 // ---------------------------------------------------------------------------
   152 // ---------------------------------------------------------------------------
   148 //
   153 //
   149 void CDialerNumberEntry::SetFocus( TBool aFocus, 
   154 void CDialerNumberEntry::SetFocus( TBool aFocus, TDrawNow aDrawNow )
   150                                             TDrawNow /*aDrawNow*/ )
       
   151     {
   155     {
   152     DIALER_PRINT("numberentry::SetFocus<");
   156     DIALER_PRINT("numberentry::SetFocus<");
   153     
   157     
       
   158     CCoeControl::SetFocus( aFocus, aDrawNow );
   154     iEditor->SetFocus( aFocus );
   159     iEditor->SetFocus( aFocus );
   155      
   160      
   156     DIALER_PRINT("numberentry::SetFocus>");    
   161     DIALER_PRINT("numberentry::SetFocus>");    
   157     }
   162     }
   158 
   163 
   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 // ---------------------------------------------------------------------------
   396 void CDialerNumberEntry::SetLayout()
   430 void CDialerNumberEntry::SetLayout()
   397     {
   431     {
   398     AknsUtils::RegisterControlPosition( this );
   432     AknsUtils::RegisterControlPosition( this );
   399 
   433 
   400     TDialerVariety variety( EDialerVarietyLandscape );
   434     TDialerVariety variety( EDialerVarietyLandscape );
   401     if (  !Layout_Meta_Data::IsLandscapeOrientation() )
   435     if ( !Layout_Meta_Data::IsLandscapeOrientation() )
   402         {
   436         {
   403         variety = EDialerVarietyPortrait;
   437         variety = EDialerVarietyPortrait;
   404         }      
   438         }      
   405         
   439         
   406     TRect parentRect( Rect() );
   440     TRect parentRect( Rect() );
   407     TAknTextComponentLayout neLayout = 
   441     TAknTextComponentLayout neLayout = ( iOperationMode == EModeEasyDialing ?
   408                         AknLayoutScalable_Apps::dialer2_ne_pane_t1( variety ); 
   442         AknLayoutScalable_Apps::dia3_numentry_pane_t1( variety ) :
       
   443         AknLayoutScalable_Apps::dialer2_ne_pane_t1( variety ) );
   409 
   444 
   410     AknLayoutUtils::LayoutControl(
   445     AknLayoutUtils::LayoutControl(
   411         iEditor, parentRect, 
   446         iEditor, parentRect, 
   412         neLayout.C(),
   447         neLayout.C(),
   413         neLayout.l(),
   448         neLayout.l(),
   416         neLayout.b(),
   451         neLayout.b(),
   417         neLayout.W(),
   452         neLayout.W(),
   418         neLayout.H()
   453         neLayout.H()
   419         );
   454         );
   420 
   455 
   421     UpdateNumberEntryFormats(); 
       
   422       
       
   423     RectFrameInnerOuterRects(
   456     RectFrameInnerOuterRects(
   424            Rect(),
   457            parentRect,
   425            iOuterRect,
   458            iOuterRect,
   426            iInnerRect );
   459            iInnerRect );
   427 
   460 
       
   461     UpdateNumberEntryFormats();
       
   462       
   428     iFrameContext->SetFrameRects( iOuterRect, iInnerRect );
   463     iFrameContext->SetFrameRects( iOuterRect, iInnerRect );
   429                 
   464                 
   430     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   465     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   431     AknsDrawUtils::PrepareFrame( skin,
   466     AknsDrawUtils::PrepareFrame( skin,
   432                                  iOuterRect,
   467                                  iOuterRect,
   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 // ---------------------------------------------------------------------------
   620     if ( aType == KAknsMessageSkinChange )
   604     if ( aType == KAknsMessageSkinChange )
   621         {
   605         {
   622         CheckLabelSkinningColor(); 
   606         CheckLabelSkinningColor(); 
   623         }
   607         }
   624     }
   608     }
       
   609 
       
   610 // ---------------------------------------------------------------------------
       
   611 // CDialerNumberEntry::HandlePointerEventL  
       
   612 // ---------------------------------------------------------------------------
       
   613 //
       
   614 void CDialerNumberEntry::HandlePointerEventL( const TPointerEvent& aPointerEvent )
       
   615     {
       
   616     // Normal pointer event handling and delegation to editor component 
       
   617     // happens only if we are already in focus. Otherwise we just take the
       
   618     // focus. This is to prevent accidental cursor movements as putting the
       
   619     // cursor back to the end of the text is difficult for right-aligned
       
   620     // text.
       
   621     if ( iEditor->IsFocused() )
       
   622         {
       
   623         CCoeControl::HandlePointerEventL( aPointerEvent );
       
   624         }
       
   625     }
       
   626 
   625 // ---------------------------------------------------------------------------
   627 // ---------------------------------------------------------------------------
   626 // CDialerNumberEntry::HandleEditorFormatting  
   628 // CDialerNumberEntry::HandleEditorFormatting  
   627 // ---------------------------------------------------------------------------
   629 // ---------------------------------------------------------------------------
   628 //
   630 //
   629 void CDialerNumberEntry::HandleEditorFormatting()
   631 void CDialerNumberEntry::HandleEditorFormatting()
   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 // -----------------------------------------------------------------------------
   739             iLabel->MakeVisible( ETrue );     
   751             iLabel->MakeVisible( ETrue );     
   740             } 
   752             } 
   741         iNumberContents = EFalse;
   753         iNumberContents = EFalse;
   742         } 
   754         } 
   743 
   755 
   744     if( iObserver )
   756     if ( iPreviousNumberEntryContent.Compare( iEditor->Text() ) != 0 )
   745         {
   757         {
   746         iObserver->NumberEntryStateChanged( iNumberContents );
   758         iPreviousNumberEntryContent.Zero();
   747         }
   759         iEditor->GetText( iPreviousNumberEntryContent );
   748     
   760 
       
   761         // The following stores the information of validity of the number for normal calls.
       
   762         // This information is needed so that we don't show call items for invalid numbers.
       
   763         TBool validPhoneNumber = Validate( iEditor->Text() );
       
   764         TInt commandId = validPhoneNumber ? EPhoneDialerValidNumber : EPhoneDialerInvalidNumber;
       
   765         
       
   766         TRAP_IGNORE( iAppUi->HandleCommandL( commandId ) );
       
   767     
       
   768         if ( iEasyDialer && iOperationMode == EModeEasyDialing )
       
   769             {
       
   770             TRAP_IGNORE( iEasyDialer->SetInputL( iEditor->Text() ) );
       
   771             }
       
   772 
       
   773         if ( iObserver )
       
   774             {
       
   775             iObserver->NumberEntryStateChanged( iNumberContents );
       
   776             }
       
   777         }
   749     }
   778     }
   750     
   779     
   751 // -----------------------------------------------------------------------------
   780 // -----------------------------------------------------------------------------
   752 // CDialerNumberEntry::CheckLabelSkinningColor()
   781 // CDialerNumberEntry::CheckLabelSkinningColor()
   753 // -----------------------------------------------------------------------------
   782 // -----------------------------------------------------------------------------
   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