diff -r e30d4a1b8bad -r c26cc2a7c548 phoneuis/dialer/src/cdialer.cpp --- a/phoneuis/dialer/src/cdialer.cpp Wed Sep 15 12:12:21 2010 +0300 +++ b/phoneuis/dialer/src/cdialer.cpp Wed Oct 13 14:31:22 2010 +0300 @@ -52,6 +52,9 @@ /// ROM drive. _LIT( KDialerResourceFile, "dialer.rsc" ); +// number entry, keypad area, easydialing, toolbar +const TInt KContainedControlsInTelephonyMode = 4; + // ========================= MEMBER FUNCTIONS ================================ @@ -93,8 +96,6 @@ delete iEasyDialer; delete iDialingExtensionObserver; delete iToolbar; - - iComponentControls.Close(); UnLoadResources(); DIALER_PRINT("CDialer::~CDialer>"); @@ -119,19 +120,12 @@ SetParent( const_cast(&aContainer) ); iNumberEntry = CDialerNumberEntry::NewL( *this ); - iComponentControls.Append( iNumberEntry ); iController = aController; - // Keypad and toolbar are not used in small displays. - if ( ! FeatureManager::FeatureSupported( KFeatureIdFfSmallScreenTouch ) ) - { - iKeypadArea = CDialerKeyPadContainer::NewL( *this, EModeEasyDialing ); - iComponentControls.Append( iKeypadArea ); - - iToolbar = CDialerToolbarContainer::NewL( *this, iController ); - iComponentControls.Append( iToolbar ); - } + iKeypadArea = CDialerKeyPadContainer::NewL( *this, EModeEasyDialing ); + + iToolbar = CDialerToolbarContainer::NewL( *this, iController ); // try to create easydialing plugin. If plugin is not present, iEasydialer gets value NULL. LoadEasyDialingPlugin(); @@ -155,7 +149,6 @@ { User::LeaveIfError( iPeninputServer.Connect() ); iPeninputServer.AddPenUiActivationHandler( this, EPluginInputModeAll ); - iVirtualKeyBoardOpen = iPeninputServer.IsVisible(); } #endif DIALER_PRINT("CDialer::ConstructL>"); @@ -203,10 +196,7 @@ if ( aController && iController != aController ) { iController = aController; - if ( iToolbar ) - { - iToolbar->SetContentProviderL( iController ); - } + iToolbar->SetContentProviderL( iController ); iNumberEntry->SetNumberEntryPromptTextL( iController->NumberEntryPromptTextL() ); SizeChanged(); UpdateToolbar(); @@ -245,11 +235,7 @@ iController->SetNumberEntryIsEmpty( !numAvailable ); iToolbar->UpdateButtonStates(); iToolbar->DrawDeferred(); - - if ( iKeypadArea ) - { - iKeypadArea->DrawDeferred(); // needed to remove drawing problem from leftmost button column - } + iKeypadArea->DrawDeferred(); // needed to remove drawing problem from leftmost button column } } @@ -379,13 +365,15 @@ void CDialer::RemoveNumberEntry() { ResetEditorToDefaultValues(); + iVirtualKeyBoardOpen = EFalse; iIsUsed = EFalse; // easydialer change begins if (iEasyDialer) { - TRAP_IGNORE( iEasyDialer->HandleCommandL( EEasyDialingClosePopup ); ); + TRAP_IGNORE( iEasyDialer->HandleCommandL( EEasyDialingClosePopup ); + iEasyDialer->HandleCommandL( EEasyDialingVkbClosed ) ); iEasyDialer->Reset(); } // easydialer change ends @@ -410,9 +398,14 @@ // void CDialer::OpenVkbL() { + iVirtualKeyBoardOpen = ETrue; UpdateEdwinState( EVirtualKeyboardEditor ); iNumberEntry->HandleCommandL( EDialerCmdTouchInput ); + if ( iEasyDialer ) + { + iEasyDialer->HandleCommandL( EEasyDialingVkbOpened ); + } } // --------------------------------------------------------------------------- @@ -453,10 +446,7 @@ // void CDialer::EnableTactileFeedback( const TBool aEnable ) { - if ( iKeypadArea ) - { - iKeypadArea->EnableTactileFeedback( aEnable ); - } + iKeypadArea->EnableTactileFeedback( aEnable ); } // --------------------------------------------------------- @@ -467,6 +457,10 @@ { iQwertyMode = aMode; UpdateNumberEntryConfiguration(); + if ( iEasyDialer && aMode ) + { + TRAP_IGNORE( iEasyDialer->HandleCommandL( EEasyDialingVkbClosed ) ); + } } // --------------------------------------------------------- @@ -515,45 +509,34 @@ AknsUtils::RegisterControlPosition( this ); TRect parentRect( Rect() ); + // Method is called before containers are created. + if ( !iKeypadArea ) + { + return; + } + TDialerVariety variety = ( Layout_Meta_Data::IsLandscapeOrientation() ? EDialerVarietyLandscape : EDialerVarietyPortrait ); - // keypad area - if ( iKeypadArea ) - { - TDialerOperationMode keypadOpMode = - ( EasyDialingEnabled() ? EModeEasyDialing : EModeDialer ); - - iKeypadArea->SetOperationMode( keypadOpMode ); - AknLayoutUtils::LayoutControl( - iKeypadArea, parentRect, - AknLayoutScalable_Apps::dia3_keypad_num_pane( variety ).LayoutLine() ); - } + TDialerOperationMode keypadOpMode = + ( EasyDialingEnabled() ? EModeEasyDialing : EModeDialer ); + iKeypadArea->SetOperationMode( keypadOpMode ); + AknLayoutUtils::LayoutControl( + iKeypadArea, parentRect, + AknLayoutScalable_Apps::dia3_keypad_num_pane( variety ).LayoutLine() ); - // toolbar - if ( iToolbar ) - { - AknLayoutUtils::LayoutControl( - iToolbar, parentRect, - AknLayoutScalable_Apps::dia3_keypad_fun_pane( variety ).LayoutLine() ); - } + AknLayoutUtils::LayoutControl( + iToolbar, parentRect, + AknLayoutScalable_Apps::dia3_keypad_fun_pane( variety ).LayoutLine() ); - // Use hybrid keyboard mode if there is no visible virtual keypad. - iHybridKeyboardMode = !iKeypadArea; - // easy dial contacts list if ( iEasyDialer ) { AknLayoutUtils::LayoutControl( iEasyDialer, parentRect, AknLayoutScalable_Apps::dia3_listscroll_pane( variety ).LayoutLine() ); - - iEasyDialer->SetKeyboardMode( - iHybridKeyboardMode ? - CDialingExtensionInterface::EHybridQwerty : - CDialingExtensionInterface::EDefaultKeyboard ); } // number entry @@ -577,7 +560,13 @@ // TInt CDialer::CountComponentControls() const { - return iComponentControls.Count(); + TInt count( KContainedControlsInTelephonyMode ); + + if ( !iEasyDialer ) + { + count--; + } + return count; } // --------------------------------------------------------------------------- @@ -588,7 +577,9 @@ // CCoeControl* CDialer::ComponentControl( TInt aIndex ) const { - return iComponentControls[ aIndex ]; + CCoeControl* currentControl(NULL); + currentControl = ComponentControlForDialerMode( aIndex ); + return currentControl; } // --------------------------------------------------------------------------- @@ -661,7 +652,12 @@ { // Clear editor flags and report // edwin state changed. + iVirtualKeyBoardOpen = EFalse; UpdateNumberEntryConfiguration(); + if ( iEasyDialer ) + { + iEasyDialer->HandleCommandL( EEasyDialingVkbClosed ); + } } } @@ -723,6 +719,42 @@ } // --------------------------------------------------------------------------- +// CDialer::ComponentControlForDialerMode +// +// Returns contained control by given index in ohonedialer mode. +// +// --------------------------------------------------------------------------- +// +CCoeControl* CDialer::ComponentControlForDialerMode( const TInt aIndex ) const + { + CCoeControl* currentControl(NULL); + + switch ( aIndex ) + { + case 0: + currentControl = iNumberEntry; + break; + case 1: + currentControl = iKeypadArea; + break; + + case 2: + currentControl = iToolbar; + break; + case 3: + currentControl = iEasyDialer; + break; + + default: + { + __ASSERT_DEBUG( EFalse, _L("CDialer::ComponentControl no such component defined")); + } + } + + return currentControl; + } + +// --------------------------------------------------------------------------- // CDialer::EdwinState // // Returns edwin state of the editor. @@ -764,14 +796,8 @@ TInt flags = EAknEditorFlagNoT9 | EAknEditorFlagLatinInputModesOnly | EAknEditorFlagSelectionVisible; - - // Use numeric input mode if in hybrid mode and virtual keyboard - // is not open. This signals to AvKON that hybrid mode needs to - // be used. - TInt inputMode = ( iHybridKeyboardMode && !vkbOpen ) ? - EAknEditorNumericInputMode : EAknEditorTextInputMode; - edwinState->SetDefaultInputMode( inputMode ); - edwinState->SetCurrentInputMode( inputMode ); + edwinState->SetDefaultInputMode( EAknEditorTextInputMode ); + edwinState->SetCurrentInputMode( EAknEditorTextInputMode ); if ( EVirtualKeyboardEditor == aType || vkbOpen ) { @@ -779,6 +805,10 @@ // here. flags = ( flags |= EAknEditorFlagNoEditIndicators ); } + else + { + iVirtualKeyBoardOpen = EFalse; + } edwinState->SetFlags( flags ); edwinState->SetPermittedInputModes( @@ -850,8 +880,6 @@ iDialingExtensionObserver = CDialingExtensionObserver::NewL( iEasyDialer, iNumberEntry, this ); iEasyDialer->AddObserverL( iDialingExtensionObserver ); - - iComponentControls.Append( iEasyDialer ); } ); if ( error ) @@ -920,12 +948,7 @@ void CDialer::OnPeninputUiDeactivated() { DIALER_PRINT( "CDialer::OnPeninputUiDeactivated" ) - iVirtualKeyBoardOpen = EFalse; FocusChanged( EDrawNow ); - if ( iEasyDialer ) - { - TRAP_IGNORE( iEasyDialer->HandleCommandL( EEasyDialingVkbClosed ) ); - } } // --------------------------------------------------------------------------- @@ -937,10 +960,5 @@ void CDialer::OnPeninputUiActivated() { DIALER_PRINT( "CDialer::OnPeninputUiActivated" ) - iVirtualKeyBoardOpen = ETrue; - if ( iEasyDialer ) - { - TRAP_IGNORE( iEasyDialer->HandleCommandL( EEasyDialingVkbOpened ) ); - } } // End of File