phoneuis/dialer/src/cdialer.cpp
branchRCL_3
changeset 6 38529f706030
parent 4 24062c24fe38
child 7 544e34b3255a
equal deleted inserted replaced
5:2a26698d78ba 6:38529f706030
    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 <spsettings.h>
    34 #include <dialingextensioninterface.h>
    35 #include <dialingextensioninterface.h>
    35 #include <easydialingcommands.hrh>
    36 #include <easydialingcommands.hrh>
    36 #include <dialer.rsg>
    37 #include <dialer.rsg>
    37 
    38 
    38 #include "cdialer.h"
    39 #include "cdialer.h"
   210         iToolbar->DrawDeferred();
   211         iToolbar->DrawDeferred();
   211         iKeypadArea->DrawDeferred(); // needed to remove drawing problem from leftmost button column
   212         iKeypadArea->DrawDeferred(); // needed to remove drawing problem from leftmost button column
   212         }
   213         }
   213     }
   214     }
   214 
   215 
       
   216 // ---------------------------------------------------------------------------
       
   217 // CDialer::UpdateNumberEntryConfiguration
       
   218 // ---------------------------------------------------------------------------
       
   219 //
       
   220 void CDialer::UpdateNumberEntryConfiguration()
       
   221     {
       
   222     TEditorType editorType = ENumericEditor;
       
   223     if ( iQwertyMode && iController->EasyDialingAllowed() )
       
   224         {
       
   225         TBool voipSupported( EFalse );
       
   226         CSPSettings* serviceProviderSettings = NULL;
       
   227         TRAPD( err, serviceProviderSettings = CSPSettings::NewL() );
       
   228         if ( !err )
       
   229             {
       
   230             voipSupported = serviceProviderSettings->IsFeatureSupported( 
       
   231                 ESupportInternetCallFeature );            
       
   232             delete serviceProviderSettings;
       
   233             }
       
   234 
       
   235         if ( EasyDialingEnabled() || voipSupported )
       
   236             {
       
   237             editorType = EAlphanumericEditor;
       
   238             }
       
   239         }
       
   240     
       
   241     UpdateEdwinState( editorType );
       
   242     }
       
   243 
       
   244 // ---------------------------------------------------------------------------
       
   245 // CDialer::RelayoutAndDraw
       
   246 // ---------------------------------------------------------------------------
       
   247 //
       
   248 EXPORT_C void CDialer::RelayoutAndDraw()
       
   249 	{
       
   250 	if ( iIsUsed )
       
   251 		{
       
   252 		SetSize( Size() );
       
   253 		DrawDeferred();
       
   254 		UpdateToolbar();
       
   255 		}
       
   256 	}
       
   257 
   215 // Methods from MNumberEntry
   258 // Methods from MNumberEntry
   216 
   259 
   217 // ---------------------------------------------------------------------------
   260 // ---------------------------------------------------------------------------
   218 // CDialer::CreateNumberEntry
   261 // CDialer::CreateNumberEntry
   219 //  
   262 //  
   224     {
   267     {
   225     DIALER_PRINT("CDialer::CreateNumberEntry<");
   268     DIALER_PRINT("CDialer::CreateNumberEntry<");
   226     
   269     
   227     iIsUsed = ETrue;    
   270     iIsUsed = ETrue;    
   228 
   271 
       
   272     UpdateNumberEntryConfiguration();
       
   273     
   229     DIALER_PRINT("CDialer::CreateNumberEntry>");        
   274     DIALER_PRINT("CDialer::CreateNumberEntry>");        
   230     }
   275     }
   231     
   276     
   232 // ---------------------------------------------------------------------------
   277 // ---------------------------------------------------------------------------
   233 // CDialer::GetNumberEntry
   278 // CDialer::GetNumberEntry
   317 // ---------------------------------------------------------------------------
   362 // ---------------------------------------------------------------------------
   318 //
   363 //
   319 void CDialer::OpenVkbL()
   364 void CDialer::OpenVkbL()
   320     {
   365     {
   321     iVirtualKeyBoardOpen = ETrue;
   366     iVirtualKeyBoardOpen = ETrue;
   322     UpdateVkbEditorFlagsL();
   367     UpdateEdwinState( EVirtualKeyboardEditor );
   323     
   368     
   324     iNumberEntry->HandleCommandL( EDialerCmdTouchInput );
   369     iNumberEntry->HandleCommandL( EDialerCmdTouchInput );
   325     }
   370     }
   326 
   371 
   327 // ---------------------------------------------------------------------------
   372 // ---------------------------------------------------------------------------
   329 //  
   374 //  
   330 // ---------------------------------------------------------------------------
   375 // ---------------------------------------------------------------------------
   331 //
   376 //
   332 TInt CDialer::GetEditorMode() const
   377 TInt CDialer::GetEditorMode() const
   333     {
   378     {
   334     return iVirtualKeyBoardOpen ? EAknEditorTextInputMode : 
   379     TBool vkbOpen = EdwinState()->Flags() & EAknEditorFlagTouchInputModeOpened;
       
   380     return ( iQwertyMode || vkbOpen ) ? EAknEditorTextInputMode : 
   335                                   EAknEditorNumericInputMode;
   381                                   EAknEditorNumericInputMode;
   336     }
   382     }
   337     
   383     
   338 // ---------------------------------------------------------------------------
   384 // ---------------------------------------------------------------------------
   339 // CDialer::ResetEditorToDefaultValues
   385 // CDialer::ResetEditorToDefaultValues
   361 // ---------------------------------------------------------------------------
   407 // ---------------------------------------------------------------------------
   362 //    
   408 //    
   363 void CDialer::EnableTactileFeedback( const TBool aEnable )
   409 void CDialer::EnableTactileFeedback( const TBool aEnable )
   364     {
   410     {
   365     iKeypadArea->EnableTactileFeedback( aEnable );
   411     iKeypadArea->EnableTactileFeedback( aEnable );
       
   412     }
       
   413 
       
   414 // ---------------------------------------------------------
       
   415 // CDialer::HandleQwertyModeChange
       
   416 // ---------------------------------------------------------
       
   417 //
       
   418 EXPORT_C void CDialer::HandleQwertyModeChange( TInt aMode )
       
   419     {
       
   420     iQwertyMode = aMode;
       
   421     UpdateNumberEntryConfiguration();
       
   422     }
       
   423 
       
   424 // ---------------------------------------------------------
       
   425 // CDialer::HandleKeyboardLayoutChange
       
   426 // ---------------------------------------------------------
       
   427 // 
       
   428 EXPORT_C void CDialer::HandleKeyboardLayoutChange()
       
   429     {
   366     }
   430     }
   367 
   431 
   368 // ---------------------------------------------------------------------------
   432 // ---------------------------------------------------------------------------
   369 // CDialer::HandleControlEventL
   433 // CDialer::HandleControlEventL
   370 // ---------------------------------------------------------------------------
   434 // ---------------------------------------------------------------------------
   545     if ( iVirtualKeyBoardOpen )
   609     if ( iVirtualKeyBoardOpen )
   546         {
   610         {
   547         // Clear editor flags and report
   611         // Clear editor flags and report
   548         // edwin state changed.
   612         // edwin state changed.
   549         iVirtualKeyBoardOpen = EFalse;
   613         iVirtualKeyBoardOpen = EFalse;
   550         iNumberEntry->ClearEditorFlags();
   614         UpdateNumberEntryConfiguration();
   551         EdwinState()->ReportAknEdStateEventL(
       
   552                 MAknEdStateObserver::EAknEdwinStateEventStateUpdate );
       
   553         }
   615         }
   554     }
   616     }
   555 
   617 
   556 // ---------------------------------------------------------------------------
   618 // ---------------------------------------------------------------------------
   557 // CDialer::HandleResourceChange
   619 // CDialer::HandleResourceChange
   651 // 
   713 // 
   652 // Returns edwin state of the editor.
   714 // Returns edwin state of the editor.
   653 //  
   715 //  
   654 // ---------------------------------------------------------------------------
   716 // ---------------------------------------------------------------------------
   655 //
   717 //
   656 CAknEdwinState* CDialer::EdwinState()
   718 CAknEdwinState* CDialer::EdwinState() const
   657     {
   719     {
   658     MCoeFepAwareTextEditor_Extension1* extension = 
   720     MCoeFepAwareTextEditor_Extension1* extension = 
   659         static_cast<MCoeFepAwareTextEditor_Extension1*>
   721         static_cast<MCoeFepAwareTextEditor_Extension1*>
   660               ( static_cast<CAknPhoneNumberEditor*> (GetNumberEntry()) );
   722               ( static_cast<CAknPhoneNumberEditor*> (GetNumberEntry()) );
   661 
   723 
   662     return static_cast< CAknEdwinState* >( extension->State( KNullUid ) );
   724     return static_cast< CAknEdwinState* >( extension->State( KNullUid ) );
   663     } 
   725     } 
   664 
   726 
   665 // ---------------------------------------------------------------------------
   727 // ---------------------------------------------------------------------------
   666 // CDialer::UpdateVkbEditorFlagsL
   728 // CDialer::UpdateEdwinState
   667 //  
   729 //  
   668 // ---------------------------------------------------------------------------
   730 // ---------------------------------------------------------------------------
   669 //
   731 //
   670 void CDialer::UpdateVkbEditorFlagsL()
   732 void CDialer::UpdateEdwinState( TEditorType aType )
   671     {
   733     {
   672     CAknEdwinState* edwinState = EdwinState();
   734     CAknEdwinState* edwinState = EdwinState();
   673     // Set flags, input mode, SCT, permitted modes,
   735     
   674     // keymapping and menu for alphanumeric virtual
   736     switch ( aType )
   675     // keyboard.
   737         {
   676     edwinState->SetCurrentInputMode( EAknEditorTextInputMode );
   738         case ENumericEditor:
   677     edwinState->SetSpecialCharacterTableResourceId( 
   739             {
   678         R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG );    
   740             iNumberEntry->ClearEditorFlags();
   679     edwinState->SetFlags( EAknEditorFlagNoT9 |
   741             }
   680                           EAknEditorFlagLatinInputModesOnly | 
   742             break;
   681                           EAknEditorFlagNoEditIndicators );            
   743         
   682     edwinState->SetPermittedInputModes( 
   744         case EAlphanumericEditor:
   683                           EAknEditorNumericInputMode |
   745         case EVirtualKeyboardEditor:
   684                           EAknEditorTextInputMode );    
   746             // intended fall-through
   685     edwinState->SetNumericKeymap( EAknEditorAlphanumericNumberModeKeymap );    
   747             {
   686     edwinState->SetMenu();
   748             TBool vkbOpen = edwinState->Flags() & EAknEditorFlagTouchInputModeOpened;
   687     
   749             TInt flags = EAknEditorFlagNoT9 | 
   688     // Report state updated
   750                          EAknEditorFlagLatinInputModesOnly |
   689     edwinState->ReportAknEdStateEventL(
   751                          EAknEditorFlagSelectionVisible;
   690                     MAknEdStateObserver::EAknEdwinStateEventStateUpdate );
   752             edwinState->SetDefaultInputMode( EAknEditorTextInputMode );
       
   753             edwinState->SetCurrentInputMode( EAknEditorTextInputMode );
       
   754             
       
   755             if ( EVirtualKeyboardEditor == aType || vkbOpen )
       
   756                 {
       
   757                 // Indicators would be shown after closing VKB unless disabled
       
   758                 // here.
       
   759                 flags = ( flags |= EAknEditorFlagNoEditIndicators );
       
   760                 }
       
   761             else
       
   762                 {
       
   763                 iVirtualKeyBoardOpen = EFalse;
       
   764                 }
       
   765             
       
   766             edwinState->SetFlags( flags );
       
   767             edwinState->SetPermittedInputModes( 
       
   768                 EAknEditorNumericInputMode | EAknEditorTextInputMode );
       
   769             edwinState->SetPermittedCases( 
       
   770                 EAknEditorUpperCase | EAknEditorLowerCase );
       
   771             edwinState->SetDefaultCase( EAknEditorLowerCase );
       
   772             edwinState->SetCurrentCase( EAknEditorLowerCase );
       
   773             edwinState->SetSpecialCharacterTableResourceId( 
       
   774                 R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG );
       
   775             edwinState->SetNumericKeymap( 
       
   776                 EAknEditorAlphanumericNumberModeKeymap );
       
   777             edwinState->SetMenu();
       
   778             }
       
   779             break;
       
   780         
       
   781         default:
       
   782             DIALER_PRINT( "CDialer::ConfigureEditorSettings, DEFAULT" )
       
   783             ASSERT( EFalse );
       
   784         }
       
   785     
       
   786     TRAPD( result, edwinState->ReportAknEdStateEventL(
       
   787         MAknEdStateObserver::EAknEdwinStateEventStateUpdate ) );
       
   788     
       
   789     if ( KErrNone != result )
       
   790         {
       
   791         DIALER_PRINTF( "CDialer::ConfigureEditorSettings, RESULT: %d", result )
       
   792         }
   691     }
   793     }
   692 
   794 
   693 // ---------------------------------------------------------------------------
   795 // ---------------------------------------------------------------------------
   694 // CDialer::LoadEasyDialingPlugin
   796 // CDialer::LoadEasyDialingPlugin
   695 // ---------------------------------------------------------------------------
   797 // ---------------------------------------------------------------------------