|
1 /* |
|
2 * Copyright (c) 2006 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include <nssvasmadaptationitem.h> |
|
22 |
|
23 #include "vuicstate.h" |
|
24 #include "vuicadaptstate.h" |
|
25 #include "vuicexecutestate.h" |
|
26 #include "vuicabortstate.h" |
|
27 |
|
28 #include "vuicdatastorage.h" |
|
29 |
|
30 #include "vuicvoicerecogdialogimpl.h" |
|
31 |
|
32 #include "rubydebug.h" |
|
33 |
|
34 // ----------------------------------------------------------------------------- |
|
35 // CAdaptState::NewL |
|
36 // Two-phased constructor. |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 CAdaptState* CAdaptState::NewL( CDataStorage& aDataStorage, CUiModel& aUiModel ) |
|
40 { |
|
41 CAdaptState* self = new (ELeave) CAdaptState( aDataStorage, aUiModel ); |
|
42 CleanupStack::PushL( self ); |
|
43 self->ConstructL(); |
|
44 CleanupStack::Pop( self ); |
|
45 return self; |
|
46 } |
|
47 |
|
48 // Destructor |
|
49 CAdaptState::~CAdaptState() |
|
50 { |
|
51 RUBY_DEBUG0( "CAdaptState::~CAdaptState START" ); |
|
52 |
|
53 delete iAdaptationItem; |
|
54 |
|
55 RUBY_DEBUG0( "CAdaptState::~CAdaptState EXIT" ); |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------- |
|
59 // CAdaptState::HandleEventL |
|
60 // --------------------------------------------------------- |
|
61 // |
|
62 void CAdaptState::HandleEventL( TInt aEvent ) |
|
63 { |
|
64 RUBY_DEBUG_BLOCK( "CAdaptState::HandleEventL" ); |
|
65 |
|
66 CState* nextState = NULL; |
|
67 |
|
68 switch( aEvent ) |
|
69 { |
|
70 case EShortKeypress: |
|
71 case ELongKeypress: |
|
72 case EEndCallKeypress: |
|
73 |
|
74 // Do nothing |
|
75 break; |
|
76 |
|
77 default: |
|
78 |
|
79 nextState = CExecuteState::NewL( DataStorage(), UiModel() ); |
|
80 break; |
|
81 } |
|
82 |
|
83 DataStorage().VoiceRecognitionImpl()->ChangeState( nextState ); |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------- |
|
87 // CAdaptState::ExecuteL |
|
88 // --------------------------------------------------------- |
|
89 // |
|
90 void CAdaptState::ExecuteL() |
|
91 { |
|
92 RUBY_DEBUG_BLOCK( "CAdaptState::ExecuteL" ); |
|
93 |
|
94 if ( DataStorage().AdaptationEnabled() ) |
|
95 { |
|
96 iAdaptationItem = DataStorage().RecognitionHandler()->GetAdaptationItemL(); |
|
97 |
|
98 iAdaptationItem->AdaptL( DataStorage().VoiceRecognitionImpl(), |
|
99 *DataStorage().Tag() ); |
|
100 } |
|
101 else |
|
102 { |
|
103 HandleEventL( KErrNone ); |
|
104 } |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------- |
|
108 // CAdaptState::CAdaptState |
|
109 // --------------------------------------------------------- |
|
110 // |
|
111 CAdaptState::CAdaptState( CDataStorage& aDataStorage, CUiModel& aUiModel ) |
|
112 : CState( aDataStorage, aUiModel ) |
|
113 { |
|
114 } |
|
115 |
|
116 // End of File |
|
117 |