50 #include "cdialertoolbarcontainer.h" |
50 #include "cdialertoolbarcontainer.h" |
51 |
51 |
52 /// ROM drive. |
52 /// ROM drive. |
53 _LIT( KDialerResourceFile, "dialer.rsc" ); |
53 _LIT( KDialerResourceFile, "dialer.rsc" ); |
54 |
54 |
55 // number entry, keypad area, easydialing, toolbar |
|
56 const TInt KContainedControlsInTelephonyMode = 4; |
|
57 |
|
58 |
55 |
59 // ========================= MEMBER FUNCTIONS ================================ |
56 // ========================= MEMBER FUNCTIONS ================================ |
60 |
57 |
61 // --------------------------------------------------------------------------- |
58 // --------------------------------------------------------------------------- |
62 // CDialer::NewL |
59 // CDialer::NewL |
118 // set window |
117 // set window |
119 SetContainerWindowL( aContainer ); |
118 SetContainerWindowL( aContainer ); |
120 SetParent( const_cast<CCoeControl*>(&aContainer) ); |
119 SetParent( const_cast<CCoeControl*>(&aContainer) ); |
121 |
120 |
122 iNumberEntry = CDialerNumberEntry::NewL( *this ); |
121 iNumberEntry = CDialerNumberEntry::NewL( *this ); |
|
122 iComponentControls.Append( iNumberEntry ); |
123 |
123 |
124 iController = aController; |
124 iController = aController; |
125 |
125 |
126 iKeypadArea = CDialerKeyPadContainer::NewL( *this, EModeEasyDialing ); |
126 // Keypad and toolbar are not used in small displays. |
127 |
127 if ( ! FeatureManager::FeatureSupported( KFeatureIdFfSmallScreenTouch ) ) |
128 iToolbar = CDialerToolbarContainer::NewL( *this, iController ); |
128 { |
|
129 iKeypadArea = CDialerKeyPadContainer::NewL( *this, EModeEasyDialing ); |
|
130 iComponentControls.Append( iKeypadArea ); |
|
131 |
|
132 iToolbar = CDialerToolbarContainer::NewL( *this, iController ); |
|
133 iComponentControls.Append( iToolbar ); |
|
134 } |
129 |
135 |
130 // try to create easydialing plugin. If plugin is not present, iEasydialer gets value NULL. |
136 // try to create easydialing plugin. If plugin is not present, iEasydialer gets value NULL. |
131 LoadEasyDialingPlugin(); |
137 LoadEasyDialingPlugin(); |
132 |
138 |
133 iNumberEntry->SetEasyDialingPlugin( iEasyDialer ); |
139 iNumberEntry->SetEasyDialingPlugin( iEasyDialer ); |
147 #ifdef RD_SCALABLE_UI_V2 |
153 #ifdef RD_SCALABLE_UI_V2 |
148 if ( AknLayoutUtils::PenEnabled() ) |
154 if ( AknLayoutUtils::PenEnabled() ) |
149 { |
155 { |
150 User::LeaveIfError( iPeninputServer.Connect() ); |
156 User::LeaveIfError( iPeninputServer.Connect() ); |
151 iPeninputServer.AddPenUiActivationHandler( this, EPluginInputModeAll ); |
157 iPeninputServer.AddPenUiActivationHandler( this, EPluginInputModeAll ); |
|
158 iVirtualKeyBoardOpen = iPeninputServer.IsVisible(); |
152 } |
159 } |
153 #endif |
160 #endif |
154 DIALER_PRINT("CDialer::ConstructL>"); |
161 DIALER_PRINT("CDialer::ConstructL>"); |
155 } |
162 } |
156 |
163 |
194 DIALER_PRINTF( "CDialer::SetControllerL, aController = %x", aController ); |
201 DIALER_PRINTF( "CDialer::SetControllerL, aController = %x", aController ); |
195 __ASSERT_DEBUG( aController, DialerPanic(EDialerPanicNullController) ); |
202 __ASSERT_DEBUG( aController, DialerPanic(EDialerPanicNullController) ); |
196 if ( aController && iController != aController ) |
203 if ( aController && iController != aController ) |
197 { |
204 { |
198 iController = aController; |
205 iController = aController; |
199 iToolbar->SetContentProviderL( iController ); |
206 if ( iToolbar ) |
|
207 { |
|
208 iToolbar->SetContentProviderL( iController ); |
|
209 } |
200 iNumberEntry->SetNumberEntryPromptTextL( iController->NumberEntryPromptTextL() ); |
210 iNumberEntry->SetNumberEntryPromptTextL( iController->NumberEntryPromptTextL() ); |
201 SizeChanged(); |
211 SizeChanged(); |
202 UpdateToolbar(); |
212 UpdateToolbar(); |
203 UpdateNumberEntryConfiguration(); |
213 UpdateNumberEntryConfiguration(); |
204 } |
214 } |
233 { |
243 { |
234 TBool numAvailable = ( iNumberEntry->TextLength() > 0 ); |
244 TBool numAvailable = ( iNumberEntry->TextLength() > 0 ); |
235 iController->SetNumberEntryIsEmpty( !numAvailable ); |
245 iController->SetNumberEntryIsEmpty( !numAvailable ); |
236 iToolbar->UpdateButtonStates(); |
246 iToolbar->UpdateButtonStates(); |
237 iToolbar->DrawDeferred(); |
247 iToolbar->DrawDeferred(); |
238 iKeypadArea->DrawDeferred(); // needed to remove drawing problem from leftmost button column |
248 |
|
249 if ( iKeypadArea ) |
|
250 { |
|
251 iKeypadArea->DrawDeferred(); // needed to remove drawing problem from leftmost button column |
|
252 } |
239 } |
253 } |
240 } |
254 } |
241 |
255 |
242 // --------------------------------------------------------------------------- |
256 // --------------------------------------------------------------------------- |
243 // CDialer::UpdateNumberEntryConfiguration |
257 // CDialer::UpdateNumberEntryConfiguration |
363 // --------------------------------------------------------------------------- |
377 // --------------------------------------------------------------------------- |
364 // |
378 // |
365 void CDialer::RemoveNumberEntry() |
379 void CDialer::RemoveNumberEntry() |
366 { |
380 { |
367 ResetEditorToDefaultValues(); |
381 ResetEditorToDefaultValues(); |
368 iVirtualKeyBoardOpen = EFalse; |
|
369 |
382 |
370 iIsUsed = EFalse; |
383 iIsUsed = EFalse; |
371 |
384 |
372 // easydialer change begins |
385 // easydialer change begins |
373 if (iEasyDialer) |
386 if (iEasyDialer) |
374 { |
387 { |
375 TRAP_IGNORE( iEasyDialer->HandleCommandL( EEasyDialingClosePopup ); |
388 TRAP_IGNORE( iEasyDialer->HandleCommandL( EEasyDialingClosePopup ); ); |
376 iEasyDialer->HandleCommandL( EEasyDialingVkbClosed ) ); |
|
377 iEasyDialer->Reset(); |
389 iEasyDialer->Reset(); |
378 } |
390 } |
379 // easydialer change ends |
391 // easydialer change ends |
380 } |
392 } |
381 |
393 |
396 // |
408 // |
397 // --------------------------------------------------------------------------- |
409 // --------------------------------------------------------------------------- |
398 // |
410 // |
399 void CDialer::OpenVkbL() |
411 void CDialer::OpenVkbL() |
400 { |
412 { |
401 iVirtualKeyBoardOpen = ETrue; |
|
402 UpdateEdwinState( EVirtualKeyboardEditor ); |
413 UpdateEdwinState( EVirtualKeyboardEditor ); |
403 |
414 |
404 iNumberEntry->HandleCommandL( EDialerCmdTouchInput ); |
415 iNumberEntry->HandleCommandL( EDialerCmdTouchInput ); |
405 if ( iEasyDialer ) |
|
406 { |
|
407 iEasyDialer->HandleCommandL( EEasyDialingVkbOpened ); |
|
408 } |
|
409 } |
416 } |
410 |
417 |
411 // --------------------------------------------------------------------------- |
418 // --------------------------------------------------------------------------- |
412 // CDialer::GetEditorMode |
419 // CDialer::GetEditorMode |
413 // |
420 // |
444 // |
451 // |
445 // --------------------------------------------------------------------------- |
452 // --------------------------------------------------------------------------- |
446 // |
453 // |
447 void CDialer::EnableTactileFeedback( const TBool aEnable ) |
454 void CDialer::EnableTactileFeedback( const TBool aEnable ) |
448 { |
455 { |
449 iKeypadArea->EnableTactileFeedback( aEnable ); |
456 if ( iKeypadArea ) |
|
457 { |
|
458 iKeypadArea->EnableTactileFeedback( aEnable ); |
|
459 } |
450 } |
460 } |
451 |
461 |
452 // --------------------------------------------------------- |
462 // --------------------------------------------------------- |
453 // CDialer::HandleQwertyModeChange |
463 // CDialer::HandleQwertyModeChange |
454 // --------------------------------------------------------- |
464 // --------------------------------------------------------- |
455 // |
465 // |
456 EXPORT_C void CDialer::HandleQwertyModeChange( TInt aMode ) |
466 EXPORT_C void CDialer::HandleQwertyModeChange( TInt aMode ) |
457 { |
467 { |
458 iQwertyMode = aMode; |
468 iQwertyMode = aMode; |
459 UpdateNumberEntryConfiguration(); |
469 UpdateNumberEntryConfiguration(); |
460 if ( iEasyDialer && aMode ) |
|
461 { |
|
462 TRAP_IGNORE( iEasyDialer->HandleCommandL( EEasyDialingVkbClosed ) ); |
|
463 } |
|
464 } |
470 } |
465 |
471 |
466 // --------------------------------------------------------- |
472 // --------------------------------------------------------- |
467 // CDialer::HandleKeyboardLayoutChange |
473 // CDialer::HandleKeyboardLayoutChange |
468 // --------------------------------------------------------- |
474 // --------------------------------------------------------- |
507 void CDialer::SizeChanged() |
513 void CDialer::SizeChanged() |
508 { |
514 { |
509 AknsUtils::RegisterControlPosition( this ); |
515 AknsUtils::RegisterControlPosition( this ); |
510 TRect parentRect( Rect() ); |
516 TRect parentRect( Rect() ); |
511 |
517 |
512 // Method is called before containers are created. |
|
513 if ( !iKeypadArea ) |
|
514 { |
|
515 return; |
|
516 } |
|
517 |
|
518 TDialerVariety variety = ( Layout_Meta_Data::IsLandscapeOrientation() ? |
518 TDialerVariety variety = ( Layout_Meta_Data::IsLandscapeOrientation() ? |
519 EDialerVarietyLandscape : EDialerVarietyPortrait ); |
519 EDialerVarietyLandscape : EDialerVarietyPortrait ); |
520 |
520 |
|
521 |
521 // keypad area |
522 // keypad area |
522 TDialerOperationMode keypadOpMode = |
523 if ( iKeypadArea ) |
523 ( EasyDialingEnabled() ? EModeEasyDialing : EModeDialer ); |
524 { |
524 iKeypadArea->SetOperationMode( keypadOpMode ); |
525 TDialerOperationMode keypadOpMode = |
525 AknLayoutUtils::LayoutControl( |
526 ( EasyDialingEnabled() ? EModeEasyDialing : EModeDialer ); |
526 iKeypadArea, parentRect, |
527 |
527 AknLayoutScalable_Apps::dia3_keypad_num_pane( variety ).LayoutLine() ); |
528 iKeypadArea->SetOperationMode( keypadOpMode ); |
528 |
529 AknLayoutUtils::LayoutControl( |
|
530 iKeypadArea, parentRect, |
|
531 AknLayoutScalable_Apps::dia3_keypad_num_pane( variety ).LayoutLine() ); |
|
532 } |
|
533 |
|
534 |
529 // toolbar |
535 // toolbar |
530 AknLayoutUtils::LayoutControl( |
536 if ( iToolbar ) |
531 iToolbar, parentRect, |
537 { |
532 AknLayoutScalable_Apps::dia3_keypad_fun_pane( variety ).LayoutLine() ); |
538 AknLayoutUtils::LayoutControl( |
533 |
539 iToolbar, parentRect, |
|
540 AknLayoutScalable_Apps::dia3_keypad_fun_pane( variety ).LayoutLine() ); |
|
541 } |
|
542 |
|
543 // Use hybrid keyboard mode if there is no visible virtual keypad. |
|
544 iHybridKeyboardMode = !iKeypadArea; |
|
545 |
534 // easy dial contacts list |
546 // easy dial contacts list |
535 if ( iEasyDialer ) |
547 if ( iEasyDialer ) |
536 { |
548 { |
537 AknLayoutUtils::LayoutControl( |
549 AknLayoutUtils::LayoutControl( |
538 iEasyDialer, parentRect, |
550 iEasyDialer, parentRect, |
539 AknLayoutScalable_Apps::dia3_listscroll_pane( variety ).LayoutLine() ); |
551 AknLayoutScalable_Apps::dia3_listscroll_pane( variety ).LayoutLine() ); |
|
552 |
|
553 iEasyDialer->SetKeyboardMode( |
|
554 iHybridKeyboardMode ? |
|
555 CDialingExtensionInterface::EHybridQwerty : |
|
556 CDialingExtensionInterface::EDefaultKeyboard ); |
540 } |
557 } |
541 |
558 |
542 // number entry |
559 // number entry |
543 LayoutNumberEntry( parentRect, variety ); |
560 LayoutNumberEntry( parentRect, variety ); |
544 } |
561 } |
558 // Returns contained controls in phone dialer mode |
575 // Returns contained controls in phone dialer mode |
559 // --------------------------------------------------------------------------- |
576 // --------------------------------------------------------------------------- |
560 // |
577 // |
561 TInt CDialer::CountComponentControls() const |
578 TInt CDialer::CountComponentControls() const |
562 { |
579 { |
563 TInt count( KContainedControlsInTelephonyMode ); |
580 return iComponentControls.Count(); |
564 |
|
565 if ( !iEasyDialer ) |
|
566 { |
|
567 count--; |
|
568 } |
|
569 return count; |
|
570 } |
581 } |
571 |
582 |
572 // --------------------------------------------------------------------------- |
583 // --------------------------------------------------------------------------- |
573 // CDialer::ComponentControl(TInt aIndex) const |
584 // CDialer::ComponentControl(TInt aIndex) const |
574 // |
585 // |
575 // Returns contained control by given index. |
586 // Returns contained control by given index. |
576 // --------------------------------------------------------------------------- |
587 // --------------------------------------------------------------------------- |
577 // |
588 // |
578 CCoeControl* CDialer::ComponentControl( TInt aIndex ) const |
589 CCoeControl* CDialer::ComponentControl( TInt aIndex ) const |
579 { |
590 { |
580 CCoeControl* currentControl(NULL); |
591 return iComponentControls[ aIndex ]; |
581 currentControl = ComponentControlForDialerMode( aIndex ); |
|
582 return currentControl; |
|
583 } |
592 } |
584 |
593 |
585 // --------------------------------------------------------------------------- |
594 // --------------------------------------------------------------------------- |
586 // CDialer::Draw |
595 // CDialer::Draw |
587 // --------------------------------------------------------------------------- |
596 // --------------------------------------------------------------------------- |
650 { |
659 { |
651 if ( iVirtualKeyBoardOpen ) |
660 if ( iVirtualKeyBoardOpen ) |
652 { |
661 { |
653 // Clear editor flags and report |
662 // Clear editor flags and report |
654 // edwin state changed. |
663 // edwin state changed. |
655 iVirtualKeyBoardOpen = EFalse; |
|
656 UpdateNumberEntryConfiguration(); |
664 UpdateNumberEntryConfiguration(); |
657 if ( iEasyDialer ) |
|
658 { |
|
659 iEasyDialer->HandleCommandL( EEasyDialingVkbClosed ); |
|
660 } |
|
661 } |
665 } |
662 } |
666 } |
663 |
667 |
664 // --------------------------------------------------------------------------- |
668 // --------------------------------------------------------------------------- |
665 // CDialer::HandleResourceChange |
669 // CDialer::HandleResourceChange |
715 { |
719 { |
716 ControlEnv()->DeleteResourceFile( iResourceOffset ); |
720 ControlEnv()->DeleteResourceFile( iResourceOffset ); |
717 iResourceOffset = 0; |
721 iResourceOffset = 0; |
718 } |
722 } |
719 } |
723 } |
720 |
|
721 // --------------------------------------------------------------------------- |
|
722 // CDialer::ComponentControlForDialerMode |
|
723 // |
|
724 // Returns contained control by given index in ohonedialer mode. |
|
725 // |
|
726 // --------------------------------------------------------------------------- |
|
727 // |
|
728 CCoeControl* CDialer::ComponentControlForDialerMode( const TInt aIndex ) const |
|
729 { |
|
730 CCoeControl* currentControl(NULL); |
|
731 |
|
732 switch ( aIndex ) |
|
733 { |
|
734 case 0: |
|
735 currentControl = iNumberEntry; |
|
736 break; |
|
737 case 1: |
|
738 currentControl = iKeypadArea; |
|
739 break; |
|
740 |
|
741 case 2: |
|
742 currentControl = iToolbar; |
|
743 break; |
|
744 case 3: |
|
745 currentControl = iEasyDialer; |
|
746 break; |
|
747 |
|
748 default: |
|
749 { |
|
750 __ASSERT_DEBUG( EFalse, _L("CDialer::ComponentControl no such component defined")); |
|
751 } |
|
752 } |
|
753 |
|
754 return currentControl; |
|
755 } |
|
756 |
724 |
757 // --------------------------------------------------------------------------- |
725 // --------------------------------------------------------------------------- |
758 // CDialer::EdwinState |
726 // CDialer::EdwinState |
759 // |
727 // |
760 // Returns edwin state of the editor. |
728 // Returns edwin state of the editor. |
794 { |
762 { |
795 TBool vkbOpen = edwinState->Flags() & EAknEditorFlagTouchInputModeOpened; |
763 TBool vkbOpen = edwinState->Flags() & EAknEditorFlagTouchInputModeOpened; |
796 TInt flags = EAknEditorFlagNoT9 | |
764 TInt flags = EAknEditorFlagNoT9 | |
797 EAknEditorFlagLatinInputModesOnly | |
765 EAknEditorFlagLatinInputModesOnly | |
798 EAknEditorFlagSelectionVisible; |
766 EAknEditorFlagSelectionVisible; |
799 edwinState->SetDefaultInputMode( EAknEditorTextInputMode ); |
767 |
800 edwinState->SetCurrentInputMode( EAknEditorTextInputMode ); |
768 // Use numeric input mode if in hybrid mode and virtual keyboard |
|
769 // is not open. This signals to AvKON that hybrid mode needs to |
|
770 // be used. |
|
771 TInt inputMode = ( iHybridKeyboardMode && !vkbOpen ) ? |
|
772 EAknEditorNumericInputMode : EAknEditorTextInputMode; |
|
773 edwinState->SetDefaultInputMode( inputMode ); |
|
774 edwinState->SetCurrentInputMode( inputMode ); |
801 |
775 |
802 if ( EVirtualKeyboardEditor == aType || vkbOpen ) |
776 if ( EVirtualKeyboardEditor == aType || vkbOpen ) |
803 { |
777 { |
804 // Indicators would be shown after closing VKB unless disabled |
778 // Indicators would be shown after closing VKB unless disabled |
805 // here. |
779 // here. |
806 flags = ( flags |= EAknEditorFlagNoEditIndicators ); |
780 flags = ( flags |= EAknEditorFlagNoEditIndicators ); |
807 } |
|
808 else |
|
809 { |
|
810 iVirtualKeyBoardOpen = EFalse; |
|
811 } |
781 } |
812 |
782 |
813 edwinState->SetFlags( flags ); |
783 edwinState->SetFlags( flags ); |
814 edwinState->SetPermittedInputModes( |
784 edwinState->SetPermittedInputModes( |
815 EAknEditorNumericInputMode | EAknEditorTextInputMode ); |
785 EAknEditorNumericInputMode | EAknEditorTextInputMode ); |
878 iEasyDialer = CDialingExtensionInterface::NewL(); |
848 iEasyDialer = CDialingExtensionInterface::NewL(); |
879 iEasyDialer->InitializeL( *this ); |
849 iEasyDialer->InitializeL( *this ); |
880 |
850 |
881 iDialingExtensionObserver = CDialingExtensionObserver::NewL( iEasyDialer, iNumberEntry, this ); |
851 iDialingExtensionObserver = CDialingExtensionObserver::NewL( iEasyDialer, iNumberEntry, this ); |
882 iEasyDialer->AddObserverL( iDialingExtensionObserver ); |
852 iEasyDialer->AddObserverL( iDialingExtensionObserver ); |
|
853 |
|
854 iComponentControls.Append( iEasyDialer ); |
883 } ); |
855 } ); |
884 |
856 |
885 if ( error ) |
857 if ( error ) |
886 { |
858 { |
887 DIALER_PRINT( "CDialer::LoadEasyDialingPlugin, load failed" ) |
859 DIALER_PRINT( "CDialer::LoadEasyDialingPlugin, load failed" ) |
946 // --------------------------------------------------------------------------- |
918 // --------------------------------------------------------------------------- |
947 // |
919 // |
948 void CDialer::OnPeninputUiDeactivated() |
920 void CDialer::OnPeninputUiDeactivated() |
949 { |
921 { |
950 DIALER_PRINT( "CDialer::OnPeninputUiDeactivated" ) |
922 DIALER_PRINT( "CDialer::OnPeninputUiDeactivated" ) |
|
923 iVirtualKeyBoardOpen = EFalse; |
951 FocusChanged( EDrawNow ); |
924 FocusChanged( EDrawNow ); |
|
925 if ( iEasyDialer ) |
|
926 { |
|
927 TRAP_IGNORE( iEasyDialer->HandleCommandL( EEasyDialingVkbClosed ) ); |
|
928 } |
952 } |
929 } |
953 |
930 |
954 // --------------------------------------------------------------------------- |
931 // --------------------------------------------------------------------------- |
955 // CDialer::OnPeninputUiActivated |
932 // CDialer::OnPeninputUiActivated |
956 // |
933 // |