phoneuis/dialer/src/cdialer.cpp
branchRCL_3
changeset 9 8871b09be73b
parent 0 5f000ab63145
child 14 24062c24fe38
equal deleted inserted replaced
4:c84cf270c54f 9:8871b09be73b
     1 /*
     1 /*
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2007 - 2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    29 #include <aknlayoutscalable_apps.cdl.h>
    29 #include <aknlayoutscalable_apps.cdl.h>
    30 #include <layoutmetadata.cdl.h>
    30 #include <layoutmetadata.cdl.h>
    31 #include <data_caging_path_literals.hrh>    // for KDC_APP_RESOURCE_DIR
    31 #include <data_caging_path_literals.hrh>    // for KDC_APP_RESOURCE_DIR
    32 #include <bautils.h>                        // for BaflUtils
    32 #include <bautils.h>                        // for BaflUtils
    33 #include <aknedsts.h>
    33 #include <aknedsts.h>
       
    34 #include <dialingextensioninterface.h>
       
    35 #include <dialer.rsg>
    34 
    36 
    35 #include "cdialer.h"
    37 #include "cdialer.h"
    36 #include "dialercommon.h"
    38 #include "dialercommon.h"
    37 #include <dialer.rsg>
       
    38 #include "dialer.hrh"
    39 #include "dialer.hrh"
    39 #include "cdialerkeypadcontainer.h"
    40 #include "cdialerkeypadcontainer.h"
    40 #include "cdialernumberentry.h"
    41 #include "cdialernumberentry.h"
    41 #include "dialertrace.h"
    42 #include "dialertrace.h"
    42 #include "mnumberentry.h"
    43 #include "mnumberentry.h"
       
    44 #include "cdialingextensionobserver.h"
       
    45 #include "cdialertoolbarcontainer.h"
    43 
    46 
    44 /// ROM drive.
    47 /// ROM drive.
    45 _LIT( KDialerResourceFile, "dialer.rsc" );
    48 _LIT( KDialerResourceFile, "dialer.rsc" );
    46 // number entry, keypad area
    49 
    47 const TInt KContainedControlsInTelephonyMode = 2;  
    50 // number entry, keypad area, easydialing, toolbar
       
    51 const TInt KContainedControlsInTelephonyMode = 4;  
    48 
    52 
    49 // ========================= MEMBER FUNCTIONS ================================
    53 // ========================= MEMBER FUNCTIONS ================================
    50 
    54 
    51 // ---------------------------------------------------------------------------
    55 // ---------------------------------------------------------------------------
    52 // CDialer::NewL
    56 // CDialer::NewL
    53 //
    57 //
    54 // Symbian OS two phased constructor for telephony phone dialer mode
    58 // Symbian OS two phased constructor for telephony phone dialer mode
    55 // ---------------------------------------------------------------------------
    59 // ---------------------------------------------------------------------------
    56 //
    60 //
    57 EXPORT_C CDialer* CDialer::NewL( const CCoeControl& aContainer, 
    61 EXPORT_C CDialer* CDialer::NewL( const CCoeControl& aContainer, 
    58                                  const TRect& aRect )
    62                                  const TRect& aRect,
    59     {
    63                                  MPhoneDialerController* aController )
    60     CDialer* self = new( ELeave )CDialer ( );    
    64     {
       
    65     CDialer* self = new( ELeave )CDialer();
    61     CleanupStack::PushL( self );
    66     CleanupStack::PushL( self );
    62     self->ConstructL( aContainer , aRect );
    67     self->ConstructL( aContainer, aRect, aController );
    63     CleanupStack::Pop();    // self
    68     CleanupStack::Pop( self );
    64     return self;
    69     return self;
    65     }
    70     }
    66 
    71 
    67 // Destructor
    72 // Destructor
    68 EXPORT_C CDialer::~CDialer()
    73 EXPORT_C CDialer::~CDialer()
    71     AknsUtils::DeregisterControlPosition( this );
    76     AknsUtils::DeregisterControlPosition( this );
    72 
    77 
    73     delete iKeypadArea;
    78     delete iKeypadArea;
    74     delete iNumberEntry;
    79     delete iNumberEntry;
    75 
    80 
       
    81     delete iEasyDialer;
       
    82     delete iDialingExtensionObserver;
       
    83     delete iToolbar;
       
    84 
    76     UnLoadResources();
    85     UnLoadResources();
    77     DIALER_PRINT("CDialer::~CDialer>"); 
    86     DIALER_PRINT("CDialer::~CDialer>"); 
    78     }
    87     }
    79 
    88 
    80 // ---------------------------------------------------------------------------
    89 // ---------------------------------------------------------------------------
    83 // Symbian OS two phased constructor for phone dialer more.
    92 // Symbian OS two phased constructor for phone dialer more.
    84 // ---------------------------------------------------------------------------
    93 // ---------------------------------------------------------------------------
    85 //
    94 //
    86 void CDialer::ConstructL( 
    95 void CDialer::ConstructL( 
    87     const CCoeControl& aContainer, 
    96     const CCoeControl& aContainer, 
    88     const TRect& aRect )
    97     const TRect& aRect,
       
    98     MPhoneDialerController* aController )
    89     {    
    99     {    
    90     DIALER_PRINT("CDialer::ConstructL<");	
   100     DIALER_PRINT("CDialer::ConstructL<");	
    91     LoadResourceL();    
   101     LoadResourceL();    
    92     
   102     
    93     // set window
   103     // set window
    94     SetContainerWindowL( aContainer );
   104     SetContainerWindowL( aContainer );
    95     SetParent( const_cast<CCoeControl*>(&aContainer) );
   105     SetParent( const_cast<CCoeControl*>(&aContainer) );
    96     iParentControl = &aContainer;
       
    97 
   106 
    98     iNumberEntry = CDialerNumberEntry::NewL( *this );    
   107     iNumberEntry = CDialerNumberEntry::NewL( *this );    
    99 
   108 
   100     iKeypadArea = CDialerKeyPadContainer::NewL( *this,  EModeDialer );    
   109     iController = aController;
   101     
   110     
       
   111     iKeypadArea = CDialerKeyPadContainer::NewL( *this, EModeEasyDialing );    
       
   112     
       
   113     iToolbar = CDialerToolbarContainer::NewL( *this, iController );
       
   114 
       
   115     // try to create easydialing plugin. If plugin is not present, iEasydialer gets value NULL.
       
   116     LoadEasyDialingPlugin();
       
   117 
       
   118     iNumberEntry->SetEasyDialingPlugin( iEasyDialer );
       
   119     iNumberEntry->SetObserver( this );
       
   120     iNumberEntry->SetNumberEntryPromptTextL( iController->NumberEntryPromptTextL() );
       
   121 
       
   122     UpdateToolbar();
       
   123 
   102     SetRect( aRect );
   124     SetRect( aRect );
   103     
   125     
   104     SetComponentsToInheritVisibility( ETrue );
   126     SetComponentsToInheritVisibility( EFalse );
   105     
   127 
   106     ActivateL();
   128     ActivateL();
   107     DIALER_PRINT("CDialer::ConstructL>");
   129     DIALER_PRINT("CDialer::ConstructL>");
   108     }
   130     }
   109 
   131 
   110 // Constructor
   132 // Constructor
   134 EXPORT_C void CDialer::SetNumberEntryObserver( MNumberEntryObserver& aObserver ) 
   156 EXPORT_C void CDialer::SetNumberEntryObserver( MNumberEntryObserver& aObserver ) 
   135     {
   157     {
   136     iNumberEntry->SetNumberEntryObserver( aObserver );  
   158     iNumberEntry->SetNumberEntryObserver( aObserver );  
   137     }
   159     }
   138 
   160 
       
   161 // -----------------------------------------------------------------------------
       
   162 // CDialer::SetControllerL
       
   163 // -----------------------------------------------------------------------------
       
   164 //
       
   165 EXPORT_C void CDialer::SetControllerL( MPhoneDialerController* aController )
       
   166     {
       
   167     DIALER_PRINTF( "CDialer::SetControllerL, aController = %x", aController );
       
   168     __ASSERT_DEBUG( aController, DialerPanic(EDialerPanicNullController) );
       
   169     if ( aController && iController != aController )
       
   170         {
       
   171         iController = aController;
       
   172         iToolbar->SetContentProviderL( iController );
       
   173         iNumberEntry->SetNumberEntryPromptTextL( iController->NumberEntryPromptTextL() );
       
   174         SizeChanged();
       
   175         UpdateToolbar();
       
   176         }
       
   177     }
       
   178 
       
   179 // ---------------------------------------------------------------------------
       
   180 // CDialer::Controller
       
   181 // ---------------------------------------------------------------------------
       
   182 //
       
   183 EXPORT_C MPhoneDialerController* CDialer::Controller()
       
   184     {
       
   185     return iController;
       
   186     }
       
   187             
       
   188 // ---------------------------------------------------------------------------
       
   189 // CDialer::GetEasyDialingInterface
       
   190 // ---------------------------------------------------------------------------
       
   191 //
       
   192 EXPORT_C CDialingExtensionInterface* CDialer::GetEasyDialingInterface() const
       
   193     {
       
   194     DIALER_PRINT("CDialer::GetEasyDialingInterface");
       
   195     return iEasyDialer;
       
   196     }
       
   197 
       
   198 // ---------------------------------------------------------------------------
       
   199 // CDialer::UpdateToolbar
       
   200 // ---------------------------------------------------------------------------
       
   201 //
       
   202 EXPORT_C void CDialer::UpdateToolbar()
       
   203     {
       
   204     if ( iToolbar && iNumberEntry && iController )
       
   205         {
       
   206         TBool numAvailable = ( iNumberEntry->TextLength() > 0 );
       
   207         iController->SetNumberEntryIsEmpty( !numAvailable );
       
   208         iToolbar->UpdateButtonStates();
       
   209         iToolbar->DrawDeferred();
       
   210         iKeypadArea->DrawDeferred(); // needed to remove drawing problem from leftmost button column
       
   211         }
       
   212     }
       
   213 
   139 // Methods from MNumberEntry
   214 // Methods from MNumberEntry
   140 
   215 
   141 // ---------------------------------------------------------------------------
   216 // ---------------------------------------------------------------------------
   142 // CDialer::CreateNumberEntry
   217 // CDialer::CreateNumberEntry
   143 //  
   218 //  
   147 void CDialer::CreateNumberEntry()
   222 void CDialer::CreateNumberEntry()
   148     {
   223     {
   149     DIALER_PRINT("CDialer::CreateNumberEntry<");
   224     DIALER_PRINT("CDialer::CreateNumberEntry<");
   150     
   225     
   151     iIsUsed = ETrue;    
   226     iIsUsed = ETrue;    
   152     
   227 
   153     DIALER_PRINT("CDialer::CreateNumberEntry>");        
   228     DIALER_PRINT("CDialer::CreateNumberEntry>");        
   154     }
   229     }
   155     
   230     
   156 // ---------------------------------------------------------------------------
   231 // ---------------------------------------------------------------------------
   157 // CDialer::GetNumberEntry
   232 // CDialer::GetNumberEntry
   158 //  
   233 //  
   159 // ---------------------------------------------------------------------------
   234 // ---------------------------------------------------------------------------
   160 //
   235 //
   161 CCoeControl* CDialer::GetNumberEntry( ) const
   236 CCoeControl* CDialer::GetNumberEntry() const
   162     {
   237     {
   163     CCoeControl* control( NULL );
   238     CCoeControl* control( NULL );
   164     control = iNumberEntry->GetNumberEntry();
   239     control = iNumberEntry->GetNumberEntry();
   165     return control;
   240     return control;
   166     }
   241     }
   168 // ---------------------------------------------------------------------------
   243 // ---------------------------------------------------------------------------
   169 // CDialer::IsNumberEntryUsed
   244 // CDialer::IsNumberEntryUsed
   170 //  
   245 //  
   171 // ---------------------------------------------------------------------------
   246 // ---------------------------------------------------------------------------
   172 //
   247 //
   173 TBool CDialer::IsNumberEntryUsed( ) const
   248 TBool CDialer::IsNumberEntryUsed() const
   174     {
   249     {
   175     return iIsUsed;
   250     return iIsUsed;
   176     }
   251     }
   177     
   252     
   178 // ---------------------------------------------------------------------------
   253 // ---------------------------------------------------------------------------
   197 // ---------------------------------------------------------------------------
   272 // ---------------------------------------------------------------------------
   198 // CDialer::GetTextFromNumberEntry
   273 // CDialer::GetTextFromNumberEntry
   199 //  
   274 //  
   200 // ---------------------------------------------------------------------------
   275 // ---------------------------------------------------------------------------
   201 //
   276 //
   202 void CDialer::GetTextFromNumberEntry( TDes& aDesC )
   277 void CDialer::GetTextFromNumberEntry( TDes& aDes )
   203     {
   278     {
   204     iNumberEntry->GetTextFromNumberEntry( aDesC );
   279     iNumberEntry->GetTextFromNumberEntry( aDes );
   205     }
   280     }
   206     
   281     
   207 // ---------------------------------------------------------------------------
   282 // ---------------------------------------------------------------------------
   208 // CDialer::RemoveNumberEntry
   283 // CDialer::RemoveNumberEntry
   209 //  
   284 //  
   210 // ---------------------------------------------------------------------------
   285 // ---------------------------------------------------------------------------
   211 //
   286 //
   212 void CDialer::RemoveNumberEntry( )
   287 void CDialer::RemoveNumberEntry()
   213     {
   288     {
   214     ResetEditorToDefaultValues();
   289     ResetEditorToDefaultValues();
   215     iIsUsed = EFalse;
   290     iIsUsed = EFalse;
       
   291 
       
   292     // easydialer change begins
       
   293     if (iEasyDialer)
       
   294         {
       
   295         TRAP_IGNORE( iEasyDialer->HandleCommandL( EEasyDialingClosePopup ) );
       
   296         iEasyDialer->Reset();
       
   297         }
       
   298     // easydialer change ends
   216     }
   299     }
   217     
   300     
   218 // ---------------------------------------------------------------------------
   301 // ---------------------------------------------------------------------------
   219 // CDialer::ChangeEditorMode
   302 // CDialer::ChangeEditorMode
   220 //  
   303 //  
   279 void CDialer::EnableTactileFeedback( const TBool aEnable )
   362 void CDialer::EnableTactileFeedback( const TBool aEnable )
   280     {
   363     {
   281     iKeypadArea->EnableTactileFeedback( aEnable );
   364     iKeypadArea->EnableTactileFeedback( aEnable );
   282     }
   365     }
   283 
   366 
       
   367 // ---------------------------------------------------------------------------
       
   368 // CDialer::HandleControlEventL
       
   369 // ---------------------------------------------------------------------------
       
   370 //
       
   371 void CDialer::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType )
       
   372     {
       
   373     switch ( aEventType )
       
   374         {
       
   375         case MCoeControlObserver::EEventRequestFocus:
       
   376             if ( aControl == iNumberEntry )
       
   377                 {
       
   378                 if ( iEasyDialer )
       
   379                     {
       
   380                     iEasyDialer->SetFocus( EFalse );
       
   381                     }
       
   382                 iNumberEntry->SetFocus( ETrue );
       
   383                 }
       
   384             break;
       
   385             
       
   386         default:
       
   387             break;
       
   388         }
       
   389     }
       
   390 
   284 // Functions from CCoeControl
   391 // Functions from CCoeControl
   285 
   392 
   286 // ---------------------------------------------------------------------------
   393 // ---------------------------------------------------------------------------
   287 // CDialer::SizeChanged
   394 // CDialer::SizeChanged
   288 // 
   395 // 
   291 // ---------------------------------------------------------------------------
   398 // ---------------------------------------------------------------------------
   292 //
   399 //
   293 void CDialer::SizeChanged()
   400 void CDialer::SizeChanged()
   294     {
   401     {
   295     AknsUtils::RegisterControlPosition( this );
   402     AknsUtils::RegisterControlPosition( this );
   296     TRect parentRect(Rect()); 
   403     TRect parentRect( Rect() );
   297        
   404        
   298     // Method is called before containers are created.
   405     // Method is called before containers are created.
   299     if ( !iKeypadArea )
   406     if ( !iKeypadArea )
   300         {
   407         {
   301         return;
   408         return;
   302         }
   409         }
   303         
   410         
   304     TDialerVariety variety( EDialerVarietyLandscape );
   411     TDialerVariety variety = ( Layout_Meta_Data::IsLandscapeOrientation() ?
   305     if (  !Layout_Meta_Data::IsLandscapeOrientation() )
   412         EDialerVarietyLandscape : EDialerVarietyPortrait );
   306         {
   413     
   307         variety = EDialerVarietyPortrait;
   414     // keypad area
   308         }            
   415     TDialerOperationMode keypadOpMode = 
   309     // number entry
   416             ( EasyDialingEnabled() ? EModeEasyDialing : EModeDialer );
   310     AknLayoutUtils::LayoutControl(
   417     iKeypadArea->SetOperationMode( keypadOpMode );
   311         iNumberEntry, parentRect, 
       
   312         AknLayoutScalable_Apps::dialer2_ne_pane( variety ).LayoutLine() );
       
   313     // keypad area.
       
   314     AknLayoutUtils::LayoutControl(
   418     AknLayoutUtils::LayoutControl(
   315         iKeypadArea, parentRect, 
   419         iKeypadArea, parentRect, 
   316         AknLayoutScalable_Apps::grid_dialer2_keypad_pane( variety ).LayoutLine() );
   420         AknLayoutScalable_Apps::dia3_keypad_num_pane( variety ).LayoutLine() );
       
   421 
       
   422     // toolbar
       
   423     AknLayoutUtils::LayoutControl(
       
   424         iToolbar, parentRect, 
       
   425         AknLayoutScalable_Apps::dia3_keypad_fun_pane( variety ).LayoutLine() );
       
   426 
       
   427     // easy dial contacts list
       
   428     if ( iEasyDialer )
       
   429         {
       
   430         AknLayoutUtils::LayoutControl(
       
   431             iEasyDialer, parentRect, 
       
   432             AknLayoutScalable_Apps::dia3_listscroll_pane( variety ).LayoutLine() );
       
   433         }
       
   434 
       
   435     // number entry
       
   436     LayoutNumberEntry( parentRect, variety );   
   317     }
   437     }
   318 
   438 
   319 // ---------------------------------------------------------------------------
   439 // ---------------------------------------------------------------------------
   320 // CDialer::PositionChanged
   440 // CDialer::PositionChanged
   321 // ---------------------------------------------------------------------------
   441 // ---------------------------------------------------------------------------
   331 // Returns contained controls in phone dialer mode
   451 // Returns contained controls in phone dialer mode
   332 // ---------------------------------------------------------------------------
   452 // ---------------------------------------------------------------------------
   333 //
   453 //
   334 TInt CDialer::CountComponentControls() const
   454 TInt CDialer::CountComponentControls() const
   335     {
   455     {
   336     TInt count(0);
   456     TInt count( KContainedControlsInTelephonyMode );
   337     count = KContainedControlsInTelephonyMode;
   457     
       
   458     if ( !iEasyDialer )
       
   459         {
       
   460         count--;
       
   461         }
   338     return count;
   462     return count;
   339     }
   463     }
   340     
   464     
   341 // ---------------------------------------------------------------------------
   465 // ---------------------------------------------------------------------------
   342 // CDialer::ComponentControl(TInt aIndex) const
   466 // CDialer::ComponentControl(TInt aIndex) const
   345 // ---------------------------------------------------------------------------
   469 // ---------------------------------------------------------------------------
   346 //
   470 //
   347 CCoeControl* CDialer::ComponentControl( TInt aIndex ) const
   471 CCoeControl* CDialer::ComponentControl( TInt aIndex ) const
   348     {
   472     {
   349     CCoeControl* currentControl(NULL);
   473     CCoeControl* currentControl(NULL);
   350     currentControl = ComponentControlForDialerMode( aIndex);
   474     currentControl = ComponentControlForDialerMode( aIndex );
   351     return currentControl;
   475     return currentControl;
   352     } 
   476     } 
   353 
   477 
   354 // ---------------------------------------------------------------------------
   478 // ---------------------------------------------------------------------------
   355 // CDialer::Draw
   479 // CDialer::Draw
   363 // CDialer::FocusChanged
   487 // CDialer::FocusChanged
   364 // ---------------------------------------------------------------------------
   488 // ---------------------------------------------------------------------------
   365 //
   489 //
   366 void CDialer::FocusChanged(TDrawNow aDrawNow)
   490 void CDialer::FocusChanged(TDrawNow aDrawNow)
   367     {
   491     {
   368     iNumberEntry->SetFocus( IsFocused(), aDrawNow );    
   492     if ( iEasyDialer )
       
   493         {           
       
   494         // Number entry is set to focus if dialer is in focus and easydialing plugin
       
   495         // is not in focus.
       
   496         TBool numberEntryFocus = IsFocused() && !iEasyDialer->IsFocused();
       
   497         iNumberEntry->SetFocus( numberEntryFocus, aDrawNow );
       
   498         }
       
   499     else
       
   500         {
       
   501         iNumberEntry->SetFocus( IsFocused(), aDrawNow );    
       
   502         }
   369     }
   503     }
   370     
   504     
   371 // ---------------------------------------------------------------------------
   505 // ---------------------------------------------------------------------------
   372 // CDialer::MakeVisible
   506 // CDialer::MakeVisible
   373 // ---------------------------------------------------------------------------
   507 // ---------------------------------------------------------------------------
   374 //
   508 //
   375 void CDialer::MakeVisible( TBool aVisible )
   509 void CDialer::MakeVisible( TBool aVisible )
   376 	{
   510     {
   377 	CCoeControl::MakeVisible( aVisible );
   511     CCoeControl::MakeVisible( aVisible );
   378 	}
   512 
       
   513     // Component control do not inherit visibility automatically as we
       
   514     // want to control their visibility separately.
       
   515     if ( iNumberEntry )
       
   516         {
       
   517         iNumberEntry->MakeVisible( aVisible );
       
   518         }
       
   519 
       
   520     if ( iKeypadArea )
       
   521         {
       
   522         iKeypadArea->MakeVisible( aVisible );
       
   523         }
       
   524 
       
   525     if ( iEasyDialer )
       
   526         {
       
   527         TBool edVisible = 
       
   528             ( aVisible && EasyDialingEnabled() );
       
   529         iEasyDialer->MakeVisible( edVisible );
       
   530         }
       
   531     if ( iToolbar )
       
   532         {
       
   533         iToolbar->MakeVisible( aVisible );
       
   534         }
       
   535     }
   379 
   536 
   380 // ---------------------------------------------------------------------------
   537 // ---------------------------------------------------------------------------
   381 // CDialer::PrepareForFocusGainL
   538 // CDialer::PrepareForFocusGainL
   382 //  
   539 //  
   383 // ---------------------------------------------------------------------------
   540 // ---------------------------------------------------------------------------
   469             currentControl = iNumberEntry;
   626             currentControl = iNumberEntry;
   470             break;
   627             break;
   471         case 1:
   628         case 1:
   472             currentControl = iKeypadArea;
   629             currentControl = iKeypadArea;
   473             break;
   630             break;
       
   631             
       
   632         case 2:
       
   633             currentControl = iToolbar;
       
   634             break;
       
   635         case 3:
       
   636             currentControl = iEasyDialer;
       
   637             break;
       
   638             
   474         default:
   639         default:
   475             {
   640             {
   476             __ASSERT_DEBUG( EFalse, _L("CDialer::ComponentControl no such component defined"));
   641             __ASSERT_DEBUG( EFalse, _L("CDialer::ComponentControl no such component defined"));
   477             }
   642             }
   478         }
   643         }
   522     // Report state updated
   687     // Report state updated
   523     edwinState->ReportAknEdStateEventL(
   688     edwinState->ReportAknEdStateEventL(
   524                     MAknEdStateObserver::EAknEdwinStateEventStateUpdate );
   689                     MAknEdStateObserver::EAknEdwinStateEventStateUpdate );
   525     }
   690     }
   526 
   691 
       
   692 // ---------------------------------------------------------------------------
       
   693 // CDialer::LoadEasyDialingPlugin
       
   694 // ---------------------------------------------------------------------------
       
   695 //
       
   696 void CDialer::LoadEasyDialingPlugin()
       
   697     {
       
   698     DIALER_PRINT( "CDialer::LoadEasyDialingPlugin" )
       
   699     TRAPD( error, 
       
   700         {
       
   701         iEasyDialer = CDialingExtensionInterface::NewL();
       
   702         iEasyDialer->InitializeL( *this );
       
   703         
       
   704         iDialingExtensionObserver = CDialingExtensionObserver::NewL( iEasyDialer, iNumberEntry, this );
       
   705         iEasyDialer->AddObserverL( iDialingExtensionObserver );
       
   706         } );
       
   707 
       
   708     if ( error )
       
   709         {
       
   710         DIALER_PRINT( "CDialer::LoadEasyDialingPlugin, load failed" )
       
   711                 
       
   712         delete iEasyDialer;        
       
   713         iEasyDialer = NULL;
       
   714         
       
   715         delete iDialingExtensionObserver;
       
   716         iDialingExtensionObserver = NULL;
       
   717         }
       
   718     }
       
   719 
       
   720 // ---------------------------------------------------------------------------
       
   721 // CDialer::EasyDialingEnabled
       
   722 // ---------------------------------------------------------------------------
       
   723 //
       
   724 TBool CDialer::EasyDialingEnabled() const
       
   725     {
       
   726     TBool easyDialEnabled = ( iEasyDialer &&
       
   727                               iEasyDialer->IsEnabled() &&
       
   728                               iController &&
       
   729                               iController->EasyDialingAllowed() );
       
   730     return easyDialEnabled;
       
   731     }
       
   732 
       
   733 // ---------------------------------------------------------------------------
       
   734 // CDialer::LayoutNumberEntry
       
   735 // ---------------------------------------------------------------------------
       
   736 //
       
   737 void CDialer::LayoutNumberEntry( const TRect& aParent, TInt aVariety )
       
   738     {
       
   739     // Use larger number entry if Easy dialing is not currently enabled.
       
   740     if ( EasyDialingEnabled() )
       
   741         {
       
   742         iNumberEntry->SetOperationMode( EModeEasyDialing );
       
   743         AknLayoutUtils::LayoutControl(
       
   744             iNumberEntry, aParent, 
       
   745             AknLayoutScalable_Apps::dia3_numentry_pane( aVariety ).LayoutLine() );
       
   746         }
       
   747     else
       
   748         {
       
   749         iNumberEntry->SetOperationMode( EModeDialer );
       
   750         TAknLayoutRect neLayoutRect;
       
   751         neLayoutRect.LayoutRect( aParent, AknLayoutScalable_Apps::dia3_numentry_pane( aVariety ) );
       
   752         TAknLayoutRect edLayoutRect;
       
   753         edLayoutRect.LayoutRect( aParent, AknLayoutScalable_Apps::dia3_listscroll_pane( aVariety ) );
       
   754 
       
   755         // create rect which is union of layout rects for ED and NE
       
   756         TRect neRect( edLayoutRect.Rect().iTl, neLayoutRect.Rect().iBr );
       
   757 
       
   758         iNumberEntry->SetRect( neRect );
       
   759         }
       
   760     }
       
   761 
   527 // End of File
   762 // End of File