52 CPhoneNumberEntryManager::CPhoneNumberEntryManager( |
50 CPhoneNumberEntryManager::CPhoneNumberEntryManager( |
53 CPhoneState* aState, |
51 CPhoneState* aState, |
54 MPhoneViewCommandHandle& aViewCommandHandle, |
52 MPhoneViewCommandHandle& aViewCommandHandle, |
55 MPhoneStateMachine& aStateMachine, |
53 MPhoneStateMachine& aStateMachine, |
56 MPhoneCustomization* aCustomization, |
54 MPhoneCustomization* aCustomization, |
57 CPhoneCbaManager& aCbaManager ) |
55 CPhoneUiCommandManager& aUiCommandManager ) |
58 : iState ( aState ), |
56 : iState ( aState ), |
59 iViewCommandHandle ( aViewCommandHandle ), |
57 iViewCommandHandle ( aViewCommandHandle ), |
60 iStateMachine ( aStateMachine ), |
58 iStateMachine ( aStateMachine ), |
61 iCustomization ( aCustomization ), |
59 iCustomization ( aCustomization ), |
62 iCbaManager ( aCbaManager ), |
60 iUiCommandManager ( aUiCommandManager ), |
63 iEnv( *CEikonEnv::Static() ) |
61 iEnv( *CEikonEnv::Static() ) |
64 { |
62 { |
65 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::CPhoneNumberEntryManager() "); |
63 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::CPhoneNumberEntryManager() "); |
66 } |
64 } |
67 |
65 |
68 // --------------------------------------------------------------------------- |
66 // --------------------------------------------------------------------------- |
69 // CPhoneNumberEntryManager::NewL |
67 // CPhoneNumberEntryManager::NewL |
70 // --------------------------------------------------------------------------- |
68 // --------------------------------------------------------------------------- |
71 // |
69 // |
72 CPhoneNumberEntryManager* CPhoneNumberEntryManager::NewL( |
70 CPhoneNumberEntryManager* CPhoneNumberEntryManager::NewL( |
73 CPhoneState* aState, |
71 CPhoneState* aState, |
74 MPhoneViewCommandHandle& aViewCommandHandle, |
72 MPhoneViewCommandHandle& aViewCommandHandle, |
75 MPhoneStateMachine& aStateMachine, |
73 MPhoneStateMachine& aStateMachine, |
76 MPhoneCustomization* aCustomization, |
74 MPhoneCustomization* aCustomization, |
77 CPhoneCbaManager& aCbaManager ) |
75 CPhoneUiCommandManager& aUiCommandManager ) |
78 { |
76 { |
79 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::NewL() "); |
77 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::NewL() "); |
80 CPhoneNumberEntryManager* self = new (ELeave) CPhoneNumberEntryManager( |
78 CPhoneNumberEntryManager* self = new (ELeave) CPhoneNumberEntryManager( |
81 aState, |
79 aState, |
82 aViewCommandHandle, |
80 aViewCommandHandle, |
83 aStateMachine, |
81 aStateMachine, |
84 aCustomization, |
82 aCustomization, |
85 aCbaManager ); |
83 aUiCommandManager ); |
86 |
84 |
87 CleanupStack::PushL( self ); |
85 CleanupStack::PushL( self ); |
88 self->ConstructL(); |
86 self->ConstructL(); |
89 CleanupStack::Pop( self ); |
87 CleanupStack::Pop( self ); |
90 |
88 |
145 |
143 |
146 // ----------------------------------------------------------- |
144 // ----------------------------------------------------------- |
147 // CPhoneNumberEntryManager::IsNumberEntryContentStored |
145 // CPhoneNumberEntryManager::IsNumberEntryContentStored |
148 // ----------------------------------------------------------- |
146 // ----------------------------------------------------------- |
149 // |
147 // |
150 TBool CPhoneNumberEntryManager::IsNumberEntryContentStored() |
148 EXPORT_C TBool CPhoneNumberEntryManager::IsNumberEntryContentStored() |
151 { |
149 { |
152 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::IsNumberEntryContentStored( ) "); |
150 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::IsNumberEntryContentStored( ) "); |
153 return iNumberEntryContent ? ETrue : EFalse; |
151 return iNumberEntryContent ? ETrue : EFalse; |
154 } |
152 } |
155 |
153 |
156 // ----------------------------------------------------------- |
154 // ----------------------------------------------------------- |
157 // CPhoneNumberEntryManager::ClearNumberEntryContentCache |
155 // CPhoneNumberEntryManager::ClearNumberEntryContentCache |
158 // ----------------------------------------------------------- |
156 // ----------------------------------------------------------- |
159 // |
157 // |
160 void CPhoneNumberEntryManager::ClearNumberEntryContentCache() |
158 EXPORT_C void CPhoneNumberEntryManager::ClearNumberEntryContentCache() |
161 { |
159 { |
162 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::ClearNumberEntryContentCache( ) "); |
160 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::ClearNumberEntryContentCache( ) "); |
163 delete iNumberEntryContent; |
161 delete iNumberEntryContent; |
164 iNumberEntryContent = NULL; |
162 iNumberEntryContent = NULL; |
165 } |
163 } |
166 |
|
167 |
164 |
168 // ----------------------------------------------------------- |
165 // ----------------------------------------------------------- |
169 // CPhoneNumberEntryManager::SetNumberEntryVisibilityL |
166 // CPhoneNumberEntryManager::SetNumberEntryVisibilityL |
170 // ----------------------------------------------------------- |
167 // ----------------------------------------------------------- |
171 // |
168 // |
172 void CPhoneNumberEntryManager::SetNumberEntryVisibilityL( TPhoneCmdParamBoolean aVisible ) |
169 EXPORT_C void CPhoneNumberEntryManager::SetNumberEntryVisibilityL( TBool aVisible ) |
173 { |
170 { |
174 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneNumberEntryManager::SetNumberEntryVisibilityL( ) "); |
171 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneNumberEntryManager::SetNumberEntryVisibilityL( ) "); |
175 __PHONELOG1( EBasic, EPhoneControl, |
172 __PHONELOG1( EBasic, EPhoneControl, |
176 "CPhoneNumberEntryManager::SetNumberEntryVisibilityL : aVisible =%d", |
173 "CPhoneNumberEntryManager::SetNumberEntryVisibilityL : aVisible =%d", |
177 aVisible.Boolean() ); |
174 aVisible ); |
178 iViewCommandHandle.ExecuteCommandL( EPhoneViewSetNumberEntryVisible, &aVisible ); |
175 TPhoneCmdParamBoolean booleanParam; |
|
176 booleanParam.SetBoolean( ETrue ); |
|
177 if ( !aVisible ) |
|
178 { |
|
179 booleanParam.SetBoolean( EFalse ); |
|
180 } |
|
181 iViewCommandHandle.ExecuteCommandL( EPhoneViewSetNumberEntryVisible, &booleanParam ); |
179 } |
182 } |
180 |
183 |
181 // ----------------------------------------------------------- |
184 // ----------------------------------------------------------- |
182 // CPhoneNumberEntryManager::IsNumberEntryUsedL |
185 // CPhoneNumberEntryManager::IsNumberEntryUsedL |
183 // ----------------------------------------------------------- |
186 // ----------------------------------------------------------- |
184 // |
187 // |
185 TBool CPhoneNumberEntryManager::IsNumberEntryUsedL() const |
188 EXPORT_C TBool CPhoneNumberEntryManager::IsNumberEntryUsedL() const |
186 { |
189 { |
187 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneNumberEntryManager::IsNumberEntryUsedL( ) "); |
190 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneNumberEntryManager::IsNumberEntryUsedL( ) "); |
188 return iViewCommandHandle.HandleCommandL( |
191 return iViewCommandHandle.HandleCommandL( |
189 EPhoneViewGetNumberEntryIsUsedStatus ) == |
192 EPhoneViewGetNumberEntryIsUsedStatus ) == |
190 EPhoneViewResponseSuccess; |
193 EPhoneViewResponseSuccess; |
217 EPhoneViewGetNumberFromEntry, |
220 EPhoneViewGetNumberFromEntry, |
218 &stringParam ); |
221 &stringParam ); |
219 return phoneNumber; |
222 return phoneNumber; |
220 } |
223 } |
221 |
224 |
222 // ----------------------------------------------------------------------------- |
|
223 // CPhoneNumberEntryManager::IsValidAlphaNumericKey |
|
224 // Checks is the key event a number, a special character |
|
225 // or if VoIP is enabled some other character |
|
226 // ----------------------------------------------------------------------------- |
|
227 // |
|
228 TBool CPhoneNumberEntryManager::IsValidAlphaNumericKey( |
|
229 const TKeyEvent& aKeyEvent, |
|
230 TEventCode aEventCode ) |
|
231 { |
|
232 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneNumberEntryManager::IsValidAlphaNumericKey( ) "); |
|
233 TBool ret(EFalse); |
|
234 const TBool numericKeyEntered( |
|
235 CPhoneKeys::IsNumericKey( aKeyEvent, aEventCode ) ); |
|
236 // a numeric key (1,2,3,4,6,7,8,9,0,+,*,p,w ) |
|
237 // or |
|
238 // a letter from fullscreen qwerty, miniqwerty or handwriting |
|
239 // when voip is enabled. |
|
240 if ( numericKeyEntered |
|
241 || IsAlphanumericSupportedAndCharInput( aKeyEvent ) ) |
|
242 { |
|
243 ret= ETrue; |
|
244 } |
|
245 return ret; |
|
246 } |
|
247 |
|
248 // ----------------------------------------------------------------------------- |
|
249 // CPhoneNumberEntryManager::IsAlphanumericSupportedAndCharInput |
|
250 // ----------------------------------------------------------------------------- |
|
251 // |
|
252 TBool CPhoneNumberEntryManager::IsAlphanumericSupportedAndCharInput( |
|
253 const TKeyEvent& aKeyEvent ) const |
|
254 { |
|
255 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneNumberEntryManager::IsAlphanumericSupportedAndCharInput( ) "); |
|
256 TBool ret = ( ( iCustomization && |
|
257 iCustomization->AllowAlphaNumericMode() ) && |
|
258 ( ( aKeyEvent.iScanCode >= KPhoneKeyStart && |
|
259 aKeyEvent.iScanCode <= KPhoneKeyEnd ) || |
|
260 aKeyEvent.iModifiers & EModifierSpecial ) ); |
|
261 __PHONELOG1( EBasic, EPhoneControl, |
|
262 "CPhoneNumberEntryManager::IsAlphanumericSupportedAndCharInput: %d", ret ); |
|
263 return ret; |
|
264 } |
|
265 |
|
266 // ----------------------------------------------------------- |
|
267 // CPhoneNumberEntryManager::HandleNumberEntryClearedL |
|
268 // ----------------------------------------------------------- |
|
269 // |
|
270 void CPhoneNumberEntryManager::HandleNumberEntryClearedL() |
|
271 { |
|
272 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneNumberEntryManager::HandleNumberEntryClearedL( ) "); |
|
273 } |
|
274 |
|
275 // --------------------------------------------------------- |
225 // --------------------------------------------------------- |
276 // CPhoneNumberEntryManager::NumberEntryClearL |
226 // CPhoneNumberEntryManager::NumberEntryClearL |
277 // --------------------------------------------------------- |
227 // --------------------------------------------------------- |
278 // |
228 // |
279 void CPhoneNumberEntryManager::NumberEntryClearL() const |
229 EXPORT_C void CPhoneNumberEntryManager::NumberEntryClearL() const |
280 { |
230 { |
281 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::NumberEntryClearL( ) "); |
231 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::NumberEntryClearL( ) "); |
282 iViewCommandHandle.ExecuteCommandL( EPhoneViewClearNumberEntryContent ); |
232 iViewCommandHandle.ExecuteCommandL( EPhoneViewClearNumberEntryContent ); |
283 } |
233 } |
284 |
234 |
|
235 // ----------------------------------------------------------- |
|
236 // CPhoneNumberEntryManager::SetVisibilityIfNumberEntryUsedL |
|
237 // ----------------------------------------------------------- |
|
238 // |
|
239 EXPORT_C TBool CPhoneNumberEntryManager::SetVisibilityIfNumberEntryUsedL( |
|
240 TBool aVisibility ) |
|
241 { |
|
242 __LOGMETHODSTARTEND(EPhoneControl, |
|
243 "CPhoneGsmInCall::SetVisibilityIfNumberEntryUsedL() "); |
|
244 TBool retValue(EFalse); |
|
245 if ( IsNumberEntryUsedL() ) |
|
246 { |
|
247 TPhoneCmdParamBoolean booleanParam; |
|
248 booleanParam.SetBoolean( EFalse ); |
|
249 if ( aVisibility ) |
|
250 { |
|
251 booleanParam.SetBoolean( ETrue ); |
|
252 } |
|
253 iViewCommandHandle.ExecuteCommandL( EPhoneViewSetNumberEntryVisible, &booleanParam ); |
|
254 __PHONELOG1( EBasic, EPhoneControl, |
|
255 "SetVisibilityIfNumberEntryUsedL: %d", |
|
256 aVisibility ); |
|
257 retValue = ETrue; |
|
258 } |
|
259 return retValue; |
|
260 } |
|
261 |
|
262 // ----------------------------------------------------------- |
|
263 // CPhoneNumberEntryManager::RemoveNumberEntryIfVisibilityIsFalseL |
|
264 // ----------------------------------------------------------- |
|
265 // |
|
266 EXPORT_C void CPhoneNumberEntryManager::RemoveNumberEntryIfVisibilityIsFalseL() |
|
267 { |
|
268 __LOGMETHODSTARTEND(EPhoneControl, |
|
269 "CPhoneNumberEntryManager::RemoveNumberEntryIfVisibilityIsFalseL() "); |
|
270 // Remove the number entry if it isn't DTMF dialer |
|
271 if ( !IsNumberEntryVisibleL() ) |
|
272 { |
|
273 iViewCommandHandle.ExecuteCommandL( EPhoneViewRemoveNumberEntry ); |
|
274 } |
|
275 } |
|
276 |
|
277 // ----------------------------------------------------------- |
|
278 // CPhoneNumberEntryManager::RemoveNumberEntryIfVisibilityIsFalseL |
|
279 // ----------------------------------------------------------- |
|
280 // |
|
281 EXPORT_C void CPhoneNumberEntryManager::ClearNumberEntryContentCacheIfContentStored() |
|
282 { |
|
283 __LOGMETHODSTARTEND(EPhoneControl, |
|
284 "CPhoneNumberEntryManager::ClearNumberEntryContentCacheIfContentStored() "); |
|
285 if ( IsNumberEntryContentStored() ) |
|
286 { |
|
287 ClearNumberEntryContentCache(); |
|
288 } |
|
289 } |
|
290 |
|
291 // --------------------------------------------------------- |
|
292 // CPhoneNumberEntryManager::CallFromNumberEntryL |
|
293 // --------------------------------------------------------- |
|
294 // |
|
295 EXPORT_C void CPhoneNumberEntryManager::CallFromNumberEntryL() |
|
296 { |
|
297 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneNumberEntryManager::CallFromNumberEntryL( ) "); |
|
298 __ASSERT_DEBUG( iStateMachine.PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) ); |
|
299 if ( IsCustomizedDialerVisibleL() ) |
|
300 { |
|
301 return; |
|
302 } |
|
303 HBufC* phoneNumber = PhoneNumberFromEntryLC(); |
|
304 iStateMachine.PhoneEngineInfo()->SetPhoneNumber( *phoneNumber ); |
|
305 if ( phoneNumber->Des().Length() < KPhoneValidPhoneNumberLength ) |
|
306 { |
|
307 iViewCommandHandle.ExecuteCommandL( EPhoneViewRemoveNumberEntry ); |
|
308 iState->HandleNumberEntryClearedL(); |
|
309 } |
|
310 CleanupStack::PopAndDestroy( phoneNumber ); |
|
311 |
|
312 if ( !iCustomization || |
|
313 !iCustomization->HandleCallFromNumberEntryL() ) |
|
314 { |
|
315 // Customization didn't handle call. Dial voice call |
|
316 // as normally |
|
317 iState->DialVoiceCallL(); |
|
318 } |
|
319 } |
|
320 |
|
321 // ----------------------------------------------------------- |
|
322 // CPhoneState::IsCustomizedDialerVisibleL() |
|
323 // ----------------------------------------------------------- |
|
324 // |
|
325 EXPORT_C TBool CPhoneNumberEntryManager::IsCustomizedDialerVisibleL() const |
|
326 { |
|
327 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneNumberEntryManager::IsCustomizedDialerVisibleL( ) "); |
|
328 return iViewCommandHandle.HandleCommandL( |
|
329 EPhoneIsCustomizedDialerVisible ) == EPhoneViewResponseSuccess; |
|
330 } |