1 /* |
|
2 * Copyright (c) 2009 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: Implementation of CPhoneNewCallCmdHandler class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <featmgr.h> |
|
19 |
|
20 #include "cphonenewcallcmdhandler.h" |
|
21 #include "cphonelogger.h" |
|
22 #include "mphonestatemachine.h" |
|
23 #include "phonerssvoip.h" |
|
24 #include "phoneappvoipcommands.hrh" |
|
25 #include "cphonestate.h" |
|
26 #include "cphonestateincall.h" |
|
27 #include "tphonecmdparamcustomdialer.h" |
|
28 #include "tphonecmdparaminteger.h" |
|
29 #include "tphonecmdparamstring.h" |
|
30 #include "tphonecmdparamquery.h" |
|
31 #include "tphonecmdparamglobalnote.h" |
|
32 #include "cphonemainresourceresolver.h" |
|
33 #include "cphonestatemachinevoip.h" |
|
34 #include "cphonestateutilsvoip.h" |
|
35 |
|
36 |
|
37 // ======== MEMBER FUNCTIONS ======== |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // CPhoneNewCallCmdHandler::CPhoneNewCallCmdHandler |
|
41 // C++ constructor. |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 CPhoneNewCallCmdHandler::CPhoneNewCallCmdHandler( |
|
45 MPhoneStateMachine& aStateMachine, |
|
46 MPhoneViewCommandHandle& aViewCommandHandle ) |
|
47 : iStateMachine( aStateMachine ), iViewCommandHandle( aViewCommandHandle ) |
|
48 { |
|
49 |
|
50 } |
|
51 |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // CPhoneNewCallCmdHandler::ConstructL |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 void CPhoneNewCallCmdHandler::ConstructL() |
|
58 { |
|
59 } |
|
60 |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // CPhoneNewCallCmdHandler::NewL |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 CPhoneNewCallCmdHandler* CPhoneNewCallCmdHandler::NewL( |
|
67 MPhoneStateMachine& aStateMachine, |
|
68 MPhoneViewCommandHandle& aViewCommandHandle ) |
|
69 { |
|
70 CPhoneNewCallCmdHandler* self = |
|
71 CPhoneNewCallCmdHandler::NewLC( |
|
72 aStateMachine, aViewCommandHandle ); |
|
73 CleanupStack::Pop( self ); |
|
74 return self; |
|
75 } |
|
76 |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // CPhoneNewCallCmdHandler::NewLC |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 CPhoneNewCallCmdHandler* CPhoneNewCallCmdHandler::NewLC( |
|
83 MPhoneStateMachine& aStateMachine, |
|
84 MPhoneViewCommandHandle& aViewCommandHandle ) |
|
85 { |
|
86 CPhoneNewCallCmdHandler* self = |
|
87 new( ELeave ) CPhoneNewCallCmdHandler( |
|
88 aStateMachine, aViewCommandHandle ); |
|
89 CleanupStack::PushL( self ); |
|
90 self->ConstructL(); |
|
91 return self; |
|
92 } |
|
93 |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // CPhoneNewCallCmdHandler::~CPhoneNewCallCmdHandler |
|
97 // Destructor. |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 CPhoneNewCallCmdHandler::~CPhoneNewCallCmdHandler() |
|
101 { |
|
102 } |
|
103 |
|
104 |
|
105 // --------------------------------------------------------------------------- |
|
106 // CPhoneNewCallCmdHandler::HandleCommandL |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 void CPhoneNewCallCmdHandler::HandleCommandL( TInt aCommand ) |
|
110 { |
|
111 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
112 "CPhoneNewCallCmdHandler::HandleCommandL" ) |
|
113 |
|
114 switch ( aCommand ) |
|
115 { |
|
116 case EPhoneInCallCmdNewInternetCall: |
|
117 ShowNewCallQueryL(); |
|
118 break; |
|
119 |
|
120 case EPhoneCmdNewInternetCallOk: |
|
121 DoNewCallL(); |
|
122 break; |
|
123 |
|
124 case EPhoneCmdNewInternetCallSearch: |
|
125 OpenSingleItemContactFetchL( |
|
126 EPhoneCmdNewInternetCallContactFetch ); |
|
127 break; |
|
128 |
|
129 case EPhoneCmdNewInternetCallContactFetch: |
|
130 { |
|
131 TBuf<KPhoneNumberEntryBufferSize> fetchContent; |
|
132 fetchContent = iViewCommandHandle.FetchContent(); |
|
133 |
|
134 StateUtils().SelectServiceAndDialL( fetchContent ); |
|
135 break; |
|
136 } |
|
137 |
|
138 default: |
|
139 __PHONELOG( EOnlyFatal, PhoneUIVoIPExtension, |
|
140 "CPhoneNewCallCmdHandler::HandleCommandL, DEFAULT" ); |
|
141 ASSERT( EFalse ); |
|
142 } |
|
143 } |
|
144 |
|
145 |
|
146 // --------------------------------------------------------------------------- |
|
147 // CPhoneNewCallCmdHandler::ShowNewCallQueryL |
|
148 // --------------------------------------------------------------------------- |
|
149 // |
|
150 void CPhoneNewCallCmdHandler::ShowNewCallQueryL() |
|
151 { |
|
152 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
153 "CPhoneNewCallCmdHandler::ShowNewCallQueryL" ) |
|
154 |
|
155 if ( !FeatureManager::FeatureSupported( KFeatureIdOnScreenDialer ) ) |
|
156 { |
|
157 CPhoneState* phoneState = |
|
158 static_cast<CPhoneState*>( iStateMachine.State() ); |
|
159 |
|
160 HBufC *text = HBufC::NewLC( KPhoneNumberEntryBufferSize ); |
|
161 TPtr ptr( text->Des() ); |
|
162 // Pre-populate the query with the number entry contents, if it exists |
|
163 if ( phoneState->IsNumberEntryUsedL() ) |
|
164 { |
|
165 // get the number entry contents |
|
166 TPhoneCmdParamString stringParam; |
|
167 stringParam.SetString( &ptr ); |
|
168 iViewCommandHandle.ExecuteCommandL( |
|
169 EPhoneViewGetLocalizedNumberFromEntry, |
|
170 &stringParam ); |
|
171 } |
|
172 |
|
173 TPhoneCmdParamQuery queryDialogParam; |
|
174 queryDialogParam.SetQueryType( EPhoneTextQueryDialog ); |
|
175 queryDialogParam.SetQueryResourceId( |
|
176 CPhoneMainResourceResolver::Instance()-> |
|
177 ResolveResourceID( EPhoneVoIPNewCallQuery ) ); |
|
178 |
|
179 queryDialogParam.SetDefaultCba( CPhoneMainResourceResolver::Instance()-> |
|
180 ResolveResourceID( EPhoneVoIPNewCallQueryEmptySoftkeys ) ); |
|
181 |
|
182 queryDialogParam.SetContentCba( CPhoneMainResourceResolver::Instance()-> |
|
183 ResolveResourceID( EPhoneVoIPNewCallQueryNotEmptySoftkeys ) ); |
|
184 |
|
185 queryDialogParam.SetDataText( &ptr ); |
|
186 queryDialogParam.SetSendKeyEnabled( ETrue ); |
|
187 |
|
188 // Display dialog |
|
189 iViewCommandHandle.ExecuteCommandL( |
|
190 EPhoneViewShowQuery, &queryDialogParam ); |
|
191 |
|
192 CleanupStack::PopAndDestroy( text ); |
|
193 } |
|
194 } |
|
195 |
|
196 |
|
197 // --------------------------------------------------------------------------- |
|
198 // CPhoneNewCallCmdHandler::DoNewCallL |
|
199 // --------------------------------------------------------------------------- |
|
200 // |
|
201 void CPhoneNewCallCmdHandler::DoNewCallL() |
|
202 { |
|
203 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
204 "CPhoneNewCallCmdHandler::DoNewCallL" ) |
|
205 |
|
206 // First get the string from dialog |
|
207 TPhoneCmdParamString string; |
|
208 HBufC* content = HBufC::NewLC( KPEPhoneNumberMaxLength ); |
|
209 TPtr ptr( content->Des() ); |
|
210 string.SetString( &ptr ); |
|
211 |
|
212 iViewCommandHandle.ExecuteCommandL( |
|
213 EPhoneViewGetTextQueryContent, &string ); |
|
214 |
|
215 // Dial new voip call |
|
216 StateUtils().SelectServiceAndDialL( ptr ); |
|
217 |
|
218 CleanupStack::PopAndDestroy( content ); |
|
219 } |
|
220 |
|
221 |
|
222 // --------------------------------------------------------------------------- |
|
223 // CPhoneNewCallCmdHandler::OpenSingleItemContactFetchL |
|
224 // --------------------------------------------------------------------------- |
|
225 // |
|
226 void CPhoneNewCallCmdHandler::OpenSingleItemContactFetchL( |
|
227 TInt aFetchType ) |
|
228 { |
|
229 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
230 "CPhoneNewCallCmdHandler::OpenSingleItemContactFetchL" ) |
|
231 |
|
232 TPhoneCmdParamInteger integerParam; |
|
233 integerParam.SetInteger( aFetchType ); |
|
234 |
|
235 iViewCommandHandle.HandleCommandL( |
|
236 EPhoneViewOpenSingleItemFetchDialog, |
|
237 &integerParam ); |
|
238 } |
|
239 |
|
240 |
|
241 // ----------------------------------------------------------- |
|
242 // CPhoneNewCallCmdHandler::StateUtils |
|
243 // ----------------------------------------------------------- |
|
244 // |
|
245 CPhoneStateUtilsVoip& CPhoneNewCallCmdHandler::StateUtils() |
|
246 { |
|
247 return static_cast<CPhoneStateMachineVoIP&>( |
|
248 iStateMachine ).StateUtils(); |
|
249 } |
|
250 |
|
251 // End of File |
|