|
1 /* |
|
2 * Copyright (c) 2007 - 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Manager for keypad and numberentry container. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include <avkon.rsg> |
|
22 #include <apgcli.h> |
|
23 #include <apacmdln.h> |
|
24 #include <eikspane.h> |
|
25 #include <aknenv.h> // AKN_LAF_COLOR |
|
26 #include <AknUtils.h> |
|
27 #include <AknsUtils.h> |
|
28 #include <aknappui.h> |
|
29 #include <aknsoundsystem.h> |
|
30 #include <aknlayoutscalable_apps.cdl.h> |
|
31 #include <layoutmetadata.cdl.h> |
|
32 #include <data_caging_path_literals.hrh> // for KDC_APP_RESOURCE_DIR |
|
33 #include <bautils.h> // for BaflUtils |
|
34 #include <aknedsts.h> |
|
35 #include <spsettings.h> |
|
36 #include <dialingextensioninterface.h> |
|
37 #include <easydialingcommands.hrh> |
|
38 #include <dialer.rsg> |
|
39 #include <phoneui.rsg> |
|
40 #include <featmgr.h> |
|
41 |
|
42 #include "cdialer.h" |
|
43 #include "dialercommon.h" |
|
44 #include "dialer.hrh" |
|
45 #include "cdialerkeypadcontainer.h" |
|
46 #include "cdialernumberentry.h" |
|
47 #include "dialertrace.h" |
|
48 #include "mnumberentry.h" |
|
49 #include "cdialingextensionobserver.h" |
|
50 #include "cdialertoolbarcontainer.h" |
|
51 |
|
52 /// ROM drive. |
|
53 _LIT( KDialerResourceFile, "dialer.rsc" ); |
|
54 |
|
55 |
|
56 // ========================= MEMBER FUNCTIONS ================================ |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // CDialer::NewL |
|
60 // |
|
61 // Symbian OS two phased constructor for telephony phone dialer mode |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 EXPORT_C CDialer* CDialer::NewL( const CCoeControl& aContainer, |
|
65 const TRect& aRect, |
|
66 MPhoneDialerController* aController ) |
|
67 { |
|
68 CDialer* self = new( ELeave )CDialer(); |
|
69 CleanupStack::PushL( self ); |
|
70 self->ConstructL( aContainer, aRect, aController ); |
|
71 CleanupStack::Pop( self ); |
|
72 return self; |
|
73 } |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // CDialer::~CDialer |
|
77 // |
|
78 // Destructor |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 EXPORT_C CDialer::~CDialer() |
|
82 { |
|
83 DIALER_PRINT("CDialer::~CDialer<"); |
|
84 #ifdef RD_SCALABLE_UI_V2 |
|
85 iPeninputServer.RemovePenUiActivationHandler( this ); |
|
86 iPeninputServer.Close(); |
|
87 #endif |
|
88 AknsUtils::DeregisterControlPosition( this ); |
|
89 |
|
90 delete iKeypadArea; |
|
91 delete iNumberEntry; |
|
92 |
|
93 delete iEasyDialer; |
|
94 delete iDialingExtensionObserver; |
|
95 delete iToolbar; |
|
96 |
|
97 iComponentControls.Close(); |
|
98 |
|
99 UnLoadResources(); |
|
100 DIALER_PRINT("CDialer::~CDialer>"); |
|
101 } |
|
102 |
|
103 // --------------------------------------------------------------------------- |
|
104 // CDialer::ConstructL |
|
105 // |
|
106 // Symbian OS two phased constructor for phone dialer more. |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 void CDialer::ConstructL( |
|
110 const CCoeControl& aContainer, |
|
111 const TRect& aRect, |
|
112 MPhoneDialerController* aController ) |
|
113 { |
|
114 DIALER_PRINT("CDialer::ConstructL<"); |
|
115 LoadResourceL(); |
|
116 |
|
117 // set window |
|
118 SetContainerWindowL( aContainer ); |
|
119 SetParent( const_cast<CCoeControl*>(&aContainer) ); |
|
120 |
|
121 iNumberEntry = CDialerNumberEntry::NewL( *this ); |
|
122 iComponentControls.Append( iNumberEntry ); |
|
123 |
|
124 iController = aController; |
|
125 |
|
126 // Keypad and toolbar are not used in small displays. |
|
127 if ( ! FeatureManager::FeatureSupported( KFeatureIdFfSmallScreenTouch ) ) |
|
128 { |
|
129 iKeypadArea = CDialerKeyPadContainer::NewL( *this, EModeEasyDialing ); |
|
130 iComponentControls.Append( iKeypadArea ); |
|
131 |
|
132 iToolbar = CDialerToolbarContainer::NewL( *this, iController ); |
|
133 iComponentControls.Append( iToolbar ); |
|
134 } |
|
135 |
|
136 // try to create easydialing plugin. If plugin is not present, iEasydialer gets value NULL. |
|
137 LoadEasyDialingPlugin(); |
|
138 |
|
139 iNumberEntry->SetEasyDialingPlugin( iEasyDialer ); |
|
140 iNumberEntry->SetObserver( this ); |
|
141 iNumberEntry->SetNumberEntryPromptTextL( iController->NumberEntryPromptTextL() ); |
|
142 |
|
143 UpdateToolbar(); |
|
144 |
|
145 SetRect( aRect ); |
|
146 |
|
147 SetComponentsToInheritVisibility( EFalse ); |
|
148 |
|
149 // By default, numeric keysounds are disabled. |
|
150 DisableNumericKeySounds( ETrue ); |
|
151 |
|
152 ActivateL(); |
|
153 #ifdef RD_SCALABLE_UI_V2 |
|
154 if ( AknLayoutUtils::PenEnabled() ) |
|
155 { |
|
156 User::LeaveIfError( iPeninputServer.Connect() ); |
|
157 iPeninputServer.AddPenUiActivationHandler( this, EPluginInputModeAll ); |
|
158 iVirtualKeyBoardOpen = iPeninputServer.IsVisible(); |
|
159 } |
|
160 #endif |
|
161 DIALER_PRINT("CDialer::ConstructL>"); |
|
162 } |
|
163 |
|
164 // ----------------------------------------------------------------------------- |
|
165 // CDialer::CDialer |
|
166 // |
|
167 // Default constructor |
|
168 // ----------------------------------------------------------------------------- |
|
169 // |
|
170 CDialer::CDialer() |
|
171 { |
|
172 // Empty |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // CDialer::NumberEntry |
|
177 // |
|
178 // Return pointer to MNumberEntry interface. |
|
179 // ----------------------------------------------------------------------------- |
|
180 // |
|
181 EXPORT_C MNumberEntry* CDialer::NumberEntry() |
|
182 { |
|
183 return this; |
|
184 } |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // CDialer::SetNumberEntryObserver |
|
188 // ----------------------------------------------------------------------------- |
|
189 // |
|
190 EXPORT_C void CDialer::SetNumberEntryObserver( MNumberEntryObserver& aObserver ) |
|
191 { |
|
192 iNumberEntry->SetNumberEntryObserver( aObserver ); |
|
193 } |
|
194 |
|
195 // ----------------------------------------------------------------------------- |
|
196 // CDialer::SetControllerL |
|
197 // ----------------------------------------------------------------------------- |
|
198 // |
|
199 EXPORT_C void CDialer::SetControllerL( MPhoneDialerController* aController ) |
|
200 { |
|
201 DIALER_PRINTF( "CDialer::SetControllerL, aController = %x", aController ); |
|
202 __ASSERT_DEBUG( aController, DialerPanic(EDialerPanicNullController) ); |
|
203 if ( aController && iController != aController ) |
|
204 { |
|
205 iController = aController; |
|
206 if ( iToolbar ) |
|
207 { |
|
208 iToolbar->SetContentProviderL( iController ); |
|
209 } |
|
210 iNumberEntry->SetNumberEntryPromptTextL( iController->NumberEntryPromptTextL() ); |
|
211 SizeChanged(); |
|
212 UpdateToolbar(); |
|
213 UpdateNumberEntryConfiguration(); |
|
214 } |
|
215 } |
|
216 |
|
217 // --------------------------------------------------------------------------- |
|
218 // CDialer::Controller |
|
219 // --------------------------------------------------------------------------- |
|
220 // |
|
221 EXPORT_C MPhoneDialerController* CDialer::Controller() |
|
222 { |
|
223 return iController; |
|
224 } |
|
225 |
|
226 // --------------------------------------------------------------------------- |
|
227 // CDialer::GetEasyDialingInterface |
|
228 // --------------------------------------------------------------------------- |
|
229 // |
|
230 EXPORT_C CDialingExtensionInterface* CDialer::GetEasyDialingInterface() const |
|
231 { |
|
232 DIALER_PRINT("CDialer::GetEasyDialingInterface"); |
|
233 return iEasyDialer; |
|
234 } |
|
235 |
|
236 // --------------------------------------------------------------------------- |
|
237 // CDialer::UpdateToolbar |
|
238 // --------------------------------------------------------------------------- |
|
239 // |
|
240 EXPORT_C void CDialer::UpdateToolbar() |
|
241 { |
|
242 if ( iToolbar && iNumberEntry && iController ) |
|
243 { |
|
244 TBool numAvailable = ( iNumberEntry->TextLength() > 0 ); |
|
245 iController->SetNumberEntryIsEmpty( !numAvailable ); |
|
246 iToolbar->UpdateButtonStates(); |
|
247 iToolbar->DrawDeferred(); |
|
248 |
|
249 if ( iKeypadArea ) |
|
250 { |
|
251 iKeypadArea->DrawDeferred(); // needed to remove drawing problem from leftmost button column |
|
252 } |
|
253 } |
|
254 } |
|
255 |
|
256 // --------------------------------------------------------------------------- |
|
257 // CDialer::UpdateNumberEntryConfiguration |
|
258 // --------------------------------------------------------------------------- |
|
259 // |
|
260 void CDialer::UpdateNumberEntryConfiguration() |
|
261 { |
|
262 TEditorType editorType = ENumericEditor; |
|
263 if ( iQwertyMode && iController->EasyDialingAllowed() ) |
|
264 { |
|
265 TBool voipSupported( EFalse ); |
|
266 CSPSettings* serviceProviderSettings = NULL; |
|
267 TRAPD( err, serviceProviderSettings = CSPSettings::NewL() ); |
|
268 if ( !err ) |
|
269 { |
|
270 voipSupported = serviceProviderSettings->IsFeatureSupported( |
|
271 ESupportInternetCallFeature ); |
|
272 delete serviceProviderSettings; |
|
273 } |
|
274 |
|
275 if ( EasyDialingEnabled() || voipSupported ) |
|
276 { |
|
277 editorType = EAlphanumericEditor; |
|
278 } |
|
279 } |
|
280 |
|
281 UpdateEdwinState( editorType ); |
|
282 |
|
283 // Numeric keysound are disabled in if not in alpha mode. |
|
284 // In numeric mode numeric keys should play DTMF only. |
|
285 DisableNumericKeySounds( editorType != EAlphanumericEditor ); |
|
286 } |
|
287 |
|
288 // --------------------------------------------------------------------------- |
|
289 // CDialer::RelayoutAndDraw |
|
290 // --------------------------------------------------------------------------- |
|
291 // |
|
292 EXPORT_C void CDialer::RelayoutAndDraw() |
|
293 { |
|
294 if ( iIsUsed ) |
|
295 { |
|
296 SetSize( Size() ); |
|
297 DrawDeferred(); |
|
298 UpdateToolbar(); |
|
299 } |
|
300 } |
|
301 |
|
302 // Methods from MNumberEntry |
|
303 |
|
304 // --------------------------------------------------------------------------- |
|
305 // CDialer::CreateNumberEntry |
|
306 // |
|
307 // Creates number entry in phone dialer mode. |
|
308 // --------------------------------------------------------------------------- |
|
309 // |
|
310 void CDialer::CreateNumberEntry() |
|
311 { |
|
312 DIALER_PRINT("CDialer::CreateNumberEntry<"); |
|
313 |
|
314 if ( !iIsUsed ) |
|
315 { |
|
316 iIsUsed = ETrue; |
|
317 UpdateNumberEntryConfiguration(); |
|
318 } |
|
319 |
|
320 DIALER_PRINT("CDialer::CreateNumberEntry>"); |
|
321 } |
|
322 |
|
323 // --------------------------------------------------------------------------- |
|
324 // CDialer::GetNumberEntry |
|
325 // |
|
326 // --------------------------------------------------------------------------- |
|
327 // |
|
328 CCoeControl* CDialer::GetNumberEntry() const |
|
329 { |
|
330 CCoeControl* control( NULL ); |
|
331 control = iNumberEntry->GetNumberEntry(); |
|
332 return control; |
|
333 } |
|
334 |
|
335 // --------------------------------------------------------------------------- |
|
336 // CDialer::IsNumberEntryUsed |
|
337 // |
|
338 // --------------------------------------------------------------------------- |
|
339 // |
|
340 TBool CDialer::IsNumberEntryUsed() const |
|
341 { |
|
342 return iIsUsed; |
|
343 } |
|
344 |
|
345 // --------------------------------------------------------------------------- |
|
346 // CDialer::SetNumberEntryVisible |
|
347 // |
|
348 // --------------------------------------------------------------------------- |
|
349 // |
|
350 void CDialer::SetNumberEntryVisible( const TBool& /*aVisibility*/ ) |
|
351 { |
|
352 } |
|
353 |
|
354 // --------------------------------------------------------------------------- |
|
355 // CDialer::SetTextToNumberEntry |
|
356 // |
|
357 // --------------------------------------------------------------------------- |
|
358 // |
|
359 void CDialer::SetTextToNumberEntry( const TDesC& aDesC ) |
|
360 { |
|
361 iNumberEntry->SetTextToNumberEntry( aDesC ); |
|
362 } |
|
363 |
|
364 // --------------------------------------------------------------------------- |
|
365 // CDialer::GetTextFromNumberEntry |
|
366 // |
|
367 // --------------------------------------------------------------------------- |
|
368 // |
|
369 void CDialer::GetTextFromNumberEntry( TDes& aDes ) |
|
370 { |
|
371 iNumberEntry->GetTextFromNumberEntry( aDes ); |
|
372 } |
|
373 |
|
374 // --------------------------------------------------------------------------- |
|
375 // CDialer::RemoveNumberEntry |
|
376 // |
|
377 // --------------------------------------------------------------------------- |
|
378 // |
|
379 void CDialer::RemoveNumberEntry() |
|
380 { |
|
381 ResetEditorToDefaultValues(); |
|
382 |
|
383 iIsUsed = EFalse; |
|
384 |
|
385 // easydialer change begins |
|
386 if (iEasyDialer) |
|
387 { |
|
388 TRAP_IGNORE( iEasyDialer->HandleCommandL( EEasyDialingClosePopup ); ); |
|
389 iEasyDialer->Reset(); |
|
390 } |
|
391 // easydialer change ends |
|
392 } |
|
393 |
|
394 // --------------------------------------------------------------------------- |
|
395 // CDialer::ChangeEditorMode |
|
396 // |
|
397 // --------------------------------------------------------------------------- |
|
398 // |
|
399 TInt CDialer::ChangeEditorMode( TBool aDefaultMode ) |
|
400 { |
|
401 TInt ret( KErrNotSupported ); |
|
402 ret = iNumberEntry->ChangeEditorMode( aDefaultMode ); |
|
403 return ret; |
|
404 } |
|
405 |
|
406 // --------------------------------------------------------------------------- |
|
407 // CDialer::OpenVKBL |
|
408 // |
|
409 // --------------------------------------------------------------------------- |
|
410 // |
|
411 void CDialer::OpenVkbL() |
|
412 { |
|
413 UpdateEdwinState( EVirtualKeyboardEditor ); |
|
414 |
|
415 iNumberEntry->HandleCommandL( EDialerCmdTouchInput ); |
|
416 } |
|
417 |
|
418 // --------------------------------------------------------------------------- |
|
419 // CDialer::GetEditorMode |
|
420 // |
|
421 // --------------------------------------------------------------------------- |
|
422 // |
|
423 TInt CDialer::GetEditorMode() const |
|
424 { |
|
425 return ( iEditorType == ENumericEditor ) ? |
|
426 EAknEditorNumericInputMode : EAknEditorTextInputMode; |
|
427 } |
|
428 |
|
429 // --------------------------------------------------------------------------- |
|
430 // CDialer::ResetEditorToDefaultValues |
|
431 // |
|
432 // --------------------------------------------------------------------------- |
|
433 // |
|
434 void CDialer::ResetEditorToDefaultValues() |
|
435 { |
|
436 iNumberEntry->ResetEditorToDefaultValues(); |
|
437 } |
|
438 |
|
439 // --------------------------------------------------------------------------- |
|
440 // CDialer::SetNumberEntryPromptText |
|
441 // |
|
442 // --------------------------------------------------------------------------- |
|
443 // |
|
444 void CDialer::SetNumberEntryPromptText( const TDesC& aPromptText ) |
|
445 { |
|
446 TRAP_IGNORE( iNumberEntry->SetNumberEntryPromptTextL( aPromptText ) ); |
|
447 } |
|
448 |
|
449 // --------------------------------------------------------------------------- |
|
450 // CDialer::EnableTactileFeedback |
|
451 // |
|
452 // --------------------------------------------------------------------------- |
|
453 // |
|
454 void CDialer::EnableTactileFeedback( const TBool aEnable ) |
|
455 { |
|
456 if ( iKeypadArea ) |
|
457 { |
|
458 iKeypadArea->EnableTactileFeedback( aEnable ); |
|
459 } |
|
460 } |
|
461 |
|
462 // --------------------------------------------------------- |
|
463 // CDialer::HandleQwertyModeChange |
|
464 // --------------------------------------------------------- |
|
465 // |
|
466 EXPORT_C void CDialer::HandleQwertyModeChange( TInt aMode ) |
|
467 { |
|
468 iQwertyMode = aMode; |
|
469 UpdateNumberEntryConfiguration(); |
|
470 } |
|
471 |
|
472 // --------------------------------------------------------- |
|
473 // CDialer::HandleKeyboardLayoutChange |
|
474 // --------------------------------------------------------- |
|
475 // |
|
476 EXPORT_C void CDialer::HandleKeyboardLayoutChange() |
|
477 { |
|
478 } |
|
479 |
|
480 // --------------------------------------------------------------------------- |
|
481 // CDialer::HandleControlEventL |
|
482 // --------------------------------------------------------------------------- |
|
483 // |
|
484 void CDialer::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ) |
|
485 { |
|
486 switch ( aEventType ) |
|
487 { |
|
488 case MCoeControlObserver::EEventRequestFocus: |
|
489 if ( aControl == iNumberEntry ) |
|
490 { |
|
491 if ( iEasyDialer ) |
|
492 { |
|
493 iEasyDialer->SetFocus( EFalse ); |
|
494 } |
|
495 iNumberEntry->SetFocus( ETrue ); |
|
496 } |
|
497 break; |
|
498 |
|
499 default: |
|
500 break; |
|
501 } |
|
502 } |
|
503 |
|
504 // Functions from CCoeControl |
|
505 |
|
506 // --------------------------------------------------------------------------- |
|
507 // CDialer::SizeChanged |
|
508 // |
|
509 // Called by framework when the view size is changed |
|
510 // |
|
511 // --------------------------------------------------------------------------- |
|
512 // |
|
513 void CDialer::SizeChanged() |
|
514 { |
|
515 AknsUtils::RegisterControlPosition( this ); |
|
516 TRect parentRect( Rect() ); |
|
517 |
|
518 TDialerVariety variety = ( Layout_Meta_Data::IsLandscapeOrientation() ? |
|
519 EDialerVarietyLandscape : EDialerVarietyPortrait ); |
|
520 |
|
521 |
|
522 // keypad area |
|
523 if ( iKeypadArea ) |
|
524 { |
|
525 TDialerOperationMode keypadOpMode = |
|
526 ( EasyDialingEnabled() ? EModeEasyDialing : EModeDialer ); |
|
527 |
|
528 iKeypadArea->SetOperationMode( keypadOpMode ); |
|
529 AknLayoutUtils::LayoutControl( |
|
530 iKeypadArea, parentRect, |
|
531 AknLayoutScalable_Apps::dia3_keypad_num_pane( variety ).LayoutLine() ); |
|
532 } |
|
533 |
|
534 |
|
535 // toolbar |
|
536 if ( iToolbar ) |
|
537 { |
|
538 AknLayoutUtils::LayoutControl( |
|
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 |
|
546 // easy dial contacts list |
|
547 if ( iEasyDialer ) |
|
548 { |
|
549 AknLayoutUtils::LayoutControl( |
|
550 iEasyDialer, parentRect, |
|
551 AknLayoutScalable_Apps::dia3_listscroll_pane( variety ).LayoutLine() ); |
|
552 |
|
553 iEasyDialer->SetKeyboardMode( |
|
554 iHybridKeyboardMode ? |
|
555 CDialingExtensionInterface::EHybridQwerty : |
|
556 CDialingExtensionInterface::EDefaultKeyboard ); |
|
557 } |
|
558 |
|
559 // number entry |
|
560 LayoutNumberEntry( parentRect, variety ); |
|
561 } |
|
562 |
|
563 // --------------------------------------------------------------------------- |
|
564 // CDialer::PositionChanged |
|
565 // --------------------------------------------------------------------------- |
|
566 // |
|
567 void CDialer::PositionChanged() |
|
568 { |
|
569 AknsUtils::RegisterControlPosition( this ); |
|
570 } |
|
571 |
|
572 // --------------------------------------------------------------------------- |
|
573 // CDialer::CountComponentControls |
|
574 // |
|
575 // Returns contained controls in phone dialer mode |
|
576 // --------------------------------------------------------------------------- |
|
577 // |
|
578 TInt CDialer::CountComponentControls() const |
|
579 { |
|
580 return iComponentControls.Count(); |
|
581 } |
|
582 |
|
583 // --------------------------------------------------------------------------- |
|
584 // CDialer::ComponentControl(TInt aIndex) const |
|
585 // |
|
586 // Returns contained control by given index. |
|
587 // --------------------------------------------------------------------------- |
|
588 // |
|
589 CCoeControl* CDialer::ComponentControl( TInt aIndex ) const |
|
590 { |
|
591 return iComponentControls[ aIndex ]; |
|
592 } |
|
593 |
|
594 // --------------------------------------------------------------------------- |
|
595 // CDialer::Draw |
|
596 // --------------------------------------------------------------------------- |
|
597 // |
|
598 void CDialer::Draw( const TRect& /*aRect*/ ) const |
|
599 { |
|
600 } |
|
601 |
|
602 // --------------------------------------------------------------------------- |
|
603 // CDialer::FocusChanged |
|
604 // --------------------------------------------------------------------------- |
|
605 // |
|
606 void CDialer::FocusChanged( TDrawNow aDrawNow ) |
|
607 { |
|
608 if ( iEasyDialer ) |
|
609 { |
|
610 // Number entry is set to focus if dialer is in focus and easydialing plugin |
|
611 // is not in focus. |
|
612 TBool numberEntryFocus = IsFocused() && !iEasyDialer->IsFocused(); |
|
613 iNumberEntry->SetFocus( numberEntryFocus, aDrawNow ); |
|
614 } |
|
615 else |
|
616 { |
|
617 iNumberEntry->SetFocus( IsFocused(), aDrawNow ); |
|
618 } |
|
619 } |
|
620 |
|
621 // --------------------------------------------------------------------------- |
|
622 // CDialer::MakeVisible |
|
623 // --------------------------------------------------------------------------- |
|
624 // |
|
625 void CDialer::MakeVisible( TBool aVisible ) |
|
626 { |
|
627 CCoeControl::MakeVisible( aVisible ); |
|
628 |
|
629 // Component control do not inherit visibility automatically as we |
|
630 // want to control their visibility separately. |
|
631 if ( iNumberEntry ) |
|
632 { |
|
633 iNumberEntry->MakeVisible( aVisible ); |
|
634 } |
|
635 |
|
636 if ( iKeypadArea ) |
|
637 { |
|
638 iKeypadArea->MakeVisible( aVisible ); |
|
639 } |
|
640 |
|
641 if ( iEasyDialer ) |
|
642 { |
|
643 TBool edVisible = |
|
644 ( aVisible && EasyDialingEnabled() ); |
|
645 iEasyDialer->MakeVisible( edVisible ); |
|
646 } |
|
647 if ( iToolbar ) |
|
648 { |
|
649 iToolbar->MakeVisible( aVisible ); |
|
650 } |
|
651 } |
|
652 |
|
653 // --------------------------------------------------------------------------- |
|
654 // CDialer::PrepareForFocusGainL |
|
655 // |
|
656 // --------------------------------------------------------------------------- |
|
657 // |
|
658 void CDialer::PrepareForFocusGainL( ) |
|
659 { |
|
660 if ( iVirtualKeyBoardOpen ) |
|
661 { |
|
662 // Clear editor flags and report |
|
663 // edwin state changed. |
|
664 UpdateNumberEntryConfiguration(); |
|
665 } |
|
666 } |
|
667 |
|
668 // --------------------------------------------------------------------------- |
|
669 // CDialer::HandleResourceChange |
|
670 // |
|
671 // --------------------------------------------------------------------------- |
|
672 // |
|
673 void CDialer::HandleResourceChange( TInt aType ) |
|
674 { |
|
675 if ( aType == KEikDynamicLayoutVariantSwitch ) |
|
676 { |
|
677 SizeChanged(); |
|
678 } |
|
679 CCoeControl::HandleResourceChange( aType ); |
|
680 } |
|
681 |
|
682 // ----------------------------------------------------------------------------- |
|
683 // CDialer::HandlePointerEventL |
|
684 // |
|
685 // ----------------------------------------------------------------------------- |
|
686 // |
|
687 void CDialer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
688 { |
|
689 // Calling base class implementation |
|
690 CCoeControl::HandlePointerEventL(aPointerEvent); |
|
691 } |
|
692 |
|
693 // Private methods |
|
694 |
|
695 // ----------------------------------------------------------------------------- |
|
696 // CDialer::LoadResourceL |
|
697 // |
|
698 // ----------------------------------------------------------------------------- |
|
699 // |
|
700 void CDialer::LoadResourceL() |
|
701 { |
|
702 TFileName path( KDriveZ ); |
|
703 path.Append( KDC_RESOURCE_FILES_DIR ); |
|
704 path.Append( KDialerResourceFile ); |
|
705 |
|
706 RFs& fsSession= ControlEnv()->FsSession(); |
|
707 BaflUtils::NearestLanguageFile( fsSession, path ); |
|
708 iResourceOffset = ControlEnv()->AddResourceFileL( path ); |
|
709 } |
|
710 |
|
711 // ----------------------------------------------------------------------------- |
|
712 // CDialer::UnLoadResources |
|
713 // |
|
714 // ----------------------------------------------------------------------------- |
|
715 // |
|
716 void CDialer::UnLoadResources() |
|
717 { |
|
718 if ( iResourceOffset > 0 ) |
|
719 { |
|
720 ControlEnv()->DeleteResourceFile( iResourceOffset ); |
|
721 iResourceOffset = 0; |
|
722 } |
|
723 } |
|
724 |
|
725 // --------------------------------------------------------------------------- |
|
726 // CDialer::EdwinState |
|
727 // |
|
728 // Returns edwin state of the editor. |
|
729 // |
|
730 // --------------------------------------------------------------------------- |
|
731 // |
|
732 CAknEdwinState* CDialer::EdwinState() const |
|
733 { |
|
734 MCoeFepAwareTextEditor_Extension1* extension = |
|
735 static_cast<MCoeFepAwareTextEditor_Extension1*> |
|
736 ( static_cast<CAknPhoneNumberEditor*> (GetNumberEntry()) ); |
|
737 |
|
738 return static_cast< CAknEdwinState* >( extension->State( KNullUid ) ); |
|
739 } |
|
740 |
|
741 // --------------------------------------------------------------------------- |
|
742 // CDialer::UpdateEdwinState |
|
743 // |
|
744 // --------------------------------------------------------------------------- |
|
745 // |
|
746 void CDialer::UpdateEdwinState( TEditorType aType ) |
|
747 { |
|
748 iEditorType = aType; |
|
749 CAknEdwinState* edwinState = EdwinState(); |
|
750 |
|
751 switch ( aType ) |
|
752 { |
|
753 case ENumericEditor: |
|
754 { |
|
755 iNumberEntry->ClearEditorFlags(); |
|
756 } |
|
757 break; |
|
758 |
|
759 case EAlphanumericEditor: |
|
760 case EVirtualKeyboardEditor: |
|
761 // intended fall-through |
|
762 { |
|
763 TBool vkbOpen = edwinState->Flags() & EAknEditorFlagTouchInputModeOpened; |
|
764 TInt flags = EAknEditorFlagNoT9 | |
|
765 EAknEditorFlagLatinInputModesOnly | |
|
766 EAknEditorFlagSelectionVisible; |
|
767 |
|
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 ); |
|
775 |
|
776 if ( EVirtualKeyboardEditor == aType || vkbOpen ) |
|
777 { |
|
778 // Indicators would be shown after closing VKB unless disabled |
|
779 // here. |
|
780 flags = ( flags |= EAknEditorFlagNoEditIndicators ); |
|
781 } |
|
782 |
|
783 edwinState->SetFlags( flags ); |
|
784 edwinState->SetPermittedInputModes( |
|
785 EAknEditorNumericInputMode | EAknEditorTextInputMode ); |
|
786 edwinState->SetPermittedCases( |
|
787 EAknEditorUpperCase | EAknEditorLowerCase ); |
|
788 edwinState->SetDefaultCase( EAknEditorLowerCase ); |
|
789 edwinState->SetCurrentCase( EAknEditorLowerCase ); |
|
790 edwinState->SetSpecialCharacterTableResourceId( |
|
791 R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG ); |
|
792 edwinState->SetNumericKeymap( |
|
793 EAknEditorAlphanumericNumberModeKeymap ); |
|
794 edwinState->SetMenu(); |
|
795 } |
|
796 break; |
|
797 |
|
798 default: |
|
799 DIALER_PRINT( "CDialer::ConfigureEditorSettings, DEFAULT" ) |
|
800 ASSERT( EFalse ); |
|
801 } |
|
802 |
|
803 TRAPD( result, edwinState->ReportAknEdStateEventL( |
|
804 MAknEdStateObserver::EAknEdwinStateEventStateUpdate ) ); |
|
805 |
|
806 if ( KErrNone != result ) |
|
807 { |
|
808 DIALER_PRINTF( "CDialer::ConfigureEditorSettings, RESULT: %d", result ) |
|
809 } |
|
810 } |
|
811 |
|
812 // --------------------------------------------------------------------------- |
|
813 // CDialer::SetNumericKeySounds |
|
814 // --------------------------------------------------------------------------- |
|
815 // |
|
816 void CDialer::DisableNumericKeySounds( TBool aDisable ) |
|
817 { |
|
818 CAknAppUi *appUi = static_cast<CAknAppUi*>( ControlEnv()->AppUi() ); |
|
819 CAknKeySoundSystem* keySounds = appUi->KeySounds(); |
|
820 |
|
821 if ( aDisable && !iNumericKeySoundsDisabled ) |
|
822 { |
|
823 // Disable numeric key sounds. This is done only if key sounds were not disabled previously, |
|
824 // to avoid situation that there were multiple key sound contexts in the stack. |
|
825 TRAP_IGNORE( keySounds->PushContextL( R_PHONEUI_DEFAULT_SKEY_LIST ) ); |
|
826 } |
|
827 else if ( !aDisable && iNumericKeySoundsDisabled ) |
|
828 { |
|
829 // Remove numeric key sound disabling. |
|
830 keySounds->PopContext(); |
|
831 } |
|
832 |
|
833 iNumericKeySoundsDisabled = aDisable; |
|
834 } |
|
835 |
|
836 // --------------------------------------------------------------------------- |
|
837 // CDialer::LoadEasyDialingPlugin |
|
838 // --------------------------------------------------------------------------- |
|
839 // |
|
840 void CDialer::LoadEasyDialingPlugin() |
|
841 { |
|
842 DIALER_PRINT( "CDialer::LoadEasyDialingPlugin" ) |
|
843 |
|
844 if ( FeatureManager::FeatureSupported( KFeatureIdProductIncludesHomeScreenEasyDialing ) ) |
|
845 { |
|
846 TRAPD( error, |
|
847 { |
|
848 iEasyDialer = CDialingExtensionInterface::NewL(); |
|
849 iEasyDialer->InitializeL( *this ); |
|
850 |
|
851 iDialingExtensionObserver = CDialingExtensionObserver::NewL( iEasyDialer, iNumberEntry, this ); |
|
852 iEasyDialer->AddObserverL( iDialingExtensionObserver ); |
|
853 |
|
854 iComponentControls.Append( iEasyDialer ); |
|
855 } ); |
|
856 |
|
857 if ( error ) |
|
858 { |
|
859 DIALER_PRINT( "CDialer::LoadEasyDialingPlugin, load failed" ) |
|
860 |
|
861 delete iEasyDialer; |
|
862 iEasyDialer = NULL; |
|
863 |
|
864 delete iDialingExtensionObserver; |
|
865 iDialingExtensionObserver = NULL; |
|
866 } |
|
867 } |
|
868 } |
|
869 |
|
870 // --------------------------------------------------------------------------- |
|
871 // CDialer::EasyDialingEnabled |
|
872 // --------------------------------------------------------------------------- |
|
873 // |
|
874 TBool CDialer::EasyDialingEnabled() const |
|
875 { |
|
876 TBool easyDialEnabled = ( iEasyDialer && |
|
877 iEasyDialer->IsEnabled() && |
|
878 iController && |
|
879 iController->EasyDialingAllowed() ); |
|
880 return easyDialEnabled; |
|
881 } |
|
882 |
|
883 // --------------------------------------------------------------------------- |
|
884 // CDialer::LayoutNumberEntry |
|
885 // --------------------------------------------------------------------------- |
|
886 // |
|
887 void CDialer::LayoutNumberEntry( const TRect& aParent, TInt aVariety ) |
|
888 { |
|
889 TAknLayoutRect neLayoutRect; |
|
890 neLayoutRect.LayoutRect( aParent, AknLayoutScalable_Apps::dia3_numentry_pane( aVariety ) ); |
|
891 TRect neRect = neLayoutRect.Rect(); |
|
892 |
|
893 if ( EasyDialingEnabled() ) |
|
894 { |
|
895 iNumberEntry->SetOperationMode( EModeEasyDialing ); |
|
896 |
|
897 // Layout doesn't define any margin between number entry and contact list. |
|
898 // Add a small margin here. |
|
899 neRect.iTl.iY += 2; |
|
900 } |
|
901 else |
|
902 { |
|
903 iNumberEntry->SetOperationMode( EModeDialer ); |
|
904 |
|
905 // Use rect which is an union of layout rects for ED and NE |
|
906 TAknLayoutRect edLayoutRect; |
|
907 edLayoutRect.LayoutRect( aParent, AknLayoutScalable_Apps::dia3_listscroll_pane( aVariety ) ); |
|
908 neRect.iTl.iY = edLayoutRect.Rect().iTl.iY; |
|
909 } |
|
910 |
|
911 iNumberEntry->SetRect( neRect ); |
|
912 } |
|
913 |
|
914 // --------------------------------------------------------------------------- |
|
915 // CDialer::OnPeninputUiDeactivated |
|
916 // |
|
917 // Gets called when the virtual keyboard editor is closed. |
|
918 // --------------------------------------------------------------------------- |
|
919 // |
|
920 void CDialer::OnPeninputUiDeactivated() |
|
921 { |
|
922 DIALER_PRINT( "CDialer::OnPeninputUiDeactivated" ) |
|
923 iVirtualKeyBoardOpen = EFalse; |
|
924 FocusChanged( EDrawNow ); |
|
925 if ( iEasyDialer ) |
|
926 { |
|
927 TRAP_IGNORE( iEasyDialer->HandleCommandL( EEasyDialingVkbClosed ) ); |
|
928 } |
|
929 } |
|
930 |
|
931 // --------------------------------------------------------------------------- |
|
932 // CDialer::OnPeninputUiActivated |
|
933 // |
|
934 // Gets called when the virtual keyboard editor is opened. |
|
935 // --------------------------------------------------------------------------- |
|
936 // |
|
937 void CDialer::OnPeninputUiActivated() |
|
938 { |
|
939 DIALER_PRINT( "CDialer::OnPeninputUiActivated" ) |
|
940 iVirtualKeyBoardOpen = ETrue; |
|
941 if ( iEasyDialer ) |
|
942 { |
|
943 TRAP_IGNORE( iEasyDialer->HandleCommandL( EEasyDialingVkbOpened ) ); |
|
944 } |
|
945 } |
|
946 // End of File |