|
1 /* |
|
2 * Copyright (c) 2002 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 the License "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 #include <BrowserTelService.rsg> |
|
21 #include <coemain.h> |
|
22 #include <data_caging_path_literals.hrh> |
|
23 |
|
24 // For phonebook API |
|
25 #include <CPbkContactItem.h> // Phonebook Contact |
|
26 #include <CPbkContactEngine.h> // Phonebook Engine |
|
27 #include <CPbkFieldsInfo.h> // Phonebook field types |
|
28 #include <RPbkViewResourceFile.h> |
|
29 #include <CPbkContactEditorDlg.h> // Phonebook editor |
|
30 // For searching a matching number from contact's db |
|
31 #include <TPbkContactItemField.h> |
|
32 #include <CNTFLDST.H> |
|
33 |
|
34 #include <FeatMgr.h> |
|
35 // |
|
36 #include <txtrich.h> |
|
37 #include <badesca.h> |
|
38 #include <miutset.h> |
|
39 #include <s32strm.h> |
|
40 |
|
41 // For email API |
|
42 #include <sendui.h> |
|
43 #include <CMessageData.h> |
|
44 #include <TSendingCapabilities.h> |
|
45 #include <SenduiMtmUids.h> |
|
46 |
|
47 // For BaflUtils |
|
48 #include <bautils.h> |
|
49 |
|
50 // Stringloader |
|
51 #include <StringLoader.h> |
|
52 |
|
53 // TApaTask, TApaTaskList |
|
54 #include <apgtask.h> |
|
55 |
|
56 // Connection management |
|
57 #include <in_sock.h> |
|
58 #include <es_enum.h> |
|
59 |
|
60 #include <ApUtils.h> |
|
61 #include <APDataHandler.h> |
|
62 #include <ApAccessPointItem.h> |
|
63 #include <commdb.h> |
|
64 |
|
65 #include <f32file.h> |
|
66 // Const file name for make call |
|
67 #include <mmtsy_names.h> |
|
68 |
|
69 #include <BrowserUiSDKCRKeys.h> |
|
70 #include <centralrepository.h> |
|
71 |
|
72 #include <nwx_status.h> |
|
73 |
|
74 #include <DialUtils.h> |
|
75 |
|
76 #include "BrowserTelService.h" |
|
77 #include "BrowserTelServiceDlgs.h" |
|
78 #include "TelServiceLogger.h" |
|
79 |
|
80 #include "BrowserUtilitiesVariant.hrh" // KBrowserUtilitiesMailtoSchemeToMmsEditor |
|
81 |
|
82 const TInt KParseArrayAllocation = 10; |
|
83 const TInt KTimerDelay = 2500000; |
|
84 |
|
85 _LIT( KValidDTMFChars,"w/p*#0123456789ABCDabcd," ); |
|
86 _LIT( KDTMFWaitChars, "/wp,*#" ); |
|
87 #ifdef __BROWSER_TEL_SERVICES_CALLUI__ |
|
88 _LIT( KDTMFInvalidWaitChars, "/," ); |
|
89 _LIT( KDTMFValidPause, "p" ); |
|
90 #endif // __BROWSER_TEL_SERVICES_CALLUI__ |
|
91 // load resource file |
|
92 _LIT( KResourceFileName, "Z:browsertelservice.RSC" ); |
|
93 |
|
94 // Path of the temp file |
|
95 _LIT(KTempDrive, "d:"); |
|
96 _LIT( KTempPath, "\\system\\temp\\" ); |
|
97 |
|
98 // The library to be loaded. |
|
99 _LIT( KDialUtilsLoadLib, "DialUtils.dll" ); |
|
100 |
|
101 const TInt KKimonoBase = 26000; |
|
102 |
|
103 /* |
|
104 This is a conversion table from browsertelservice internal |
|
105 error codes to global and localized error ids. |
|
106 {local error code, global error id} |
|
107 Exception is KErrArgument-NW_STAT_WTAI_INVALID_ARGUMENT pair, because |
|
108 case of wrong dtmf sequence has no WTAI correspondent error code. |
|
109 */ |
|
110 const TInt KErrorConvTable[][2] = |
|
111 { |
|
112 {KErrInvocationError, NW_STAT_WTAI_INVOCATIONERROR}, |
|
113 {KErrNoCallActive, NW_STAT_WTAI_NOCALLACTIVE}, |
|
114 {KErrUserNoAnswer, NW_STAT_WTAI_NOANSWER}, |
|
115 {KErrNoService, NW_STAT_WTAI_NOSERVICE}, |
|
116 {KErrUserBusy, NW_STAT_WTAI_USERBUSY}, |
|
117 {KErrPBPhoneBookFull, NW_STAT_WTAI_PHONEBOOKFULL}, |
|
118 {KErrPBWriteError, NW_STAT_WTAI_PBWRITEERROR}, |
|
119 {KErrPBNumberTooLong, NW_STAT_WTAI_PBNUMBERTOOLONG}, |
|
120 {KErrPBNameTooLong, NW_STAT_WTAI_PBNAMETOOLONG}, |
|
121 {KErrUnspecified, NW_STAT_WTAI_UNSPECIFIED_ERROR}, |
|
122 {KErrArgument,NW_STAT_WTAI_INVALID_ARGUMENT}, |
|
123 {KErrEtelBusyDetected, NW_STAT_WTAI_USERBUSY}, |
|
124 {KErrEtelNoAnswer, NW_STAT_WTAI_NOANSWER}, |
|
125 {0,0} |
|
126 }; |
|
127 |
|
128 // ================= MEMBER FUNCTIONS ======================= |
|
129 |
|
130 //----------------------------------------------------------------------------- |
|
131 // CBrowserTelService::NewLC() |
|
132 //----------------------------------------------------------------------------- |
|
133 // |
|
134 EXPORT_C CBrowserTelService* CBrowserTelService::NewLC( |
|
135 MBrowserTelServiceObserver* aObserver ) |
|
136 { |
|
137 CBrowserTelService* self = new( ELeave ) CBrowserTelService; |
|
138 CleanupStack::PushL( self ); |
|
139 self->ConstructL( aObserver ); |
|
140 return self; |
|
141 } |
|
142 |
|
143 //--------------------------------------------------------------------------------------- |
|
144 // CBrowserTelService::NewL() |
|
145 //--------------------------------------------------------------------------------------- |
|
146 // |
|
147 EXPORT_C CBrowserTelService* CBrowserTelService::NewL( |
|
148 MBrowserTelServiceObserver* aObserver ) |
|
149 { |
|
150 CBrowserTelService* self = CBrowserTelService::NewLC( aObserver ); |
|
151 CleanupStack::Pop(); |
|
152 return self; |
|
153 } |
|
154 |
|
155 //--------------------------------------------------------------------------------------- |
|
156 // CBrowserTelService::ConstructL() |
|
157 //--------------------------------------------------------------------------------------- |
|
158 // |
|
159 void CBrowserTelService::ConstructL( MBrowserTelServiceObserver* aObserver ) |
|
160 { |
|
161 TELSERVICE_CREATE; |
|
162 |
|
163 iServiceHandler = NULL; |
|
164 |
|
165 SetState( EIdle ); |
|
166 |
|
167 if( aObserver ) |
|
168 { |
|
169 iObserverList.Append( aObserver ); |
|
170 } |
|
171 |
|
172 iSynch = EFalse; |
|
173 iIdle = CIdle::NewL( CActive::EPriorityIdle ); |
|
174 |
|
175 // Prepare telservice logger. |
|
176 TELSERVICE_CREATE; |
|
177 |
|
178 // Resouce file loading |
|
179 TParse* fileParser = new (ELeave) TParse; |
|
180 CleanupStack::PushL( fileParser ); |
|
181 |
|
182 fileParser->Set( KResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL ); |
|
183 iResourceFileName = fileParser->FullName(); |
|
184 iResourceLoader.OpenL( iResourceFileName ); |
|
185 iResourceOpened = ETrue; |
|
186 |
|
187 CleanupStack::PopAndDestroy( fileParser ); // fileParser |
|
188 |
|
189 iErrorUi = CErrorUI::NewL(); |
|
190 |
|
191 #ifdef __BROWSER_TEL_SERVICES_CALLUI__ |
|
192 iDialData = CAiwDialData::NewL(); |
|
193 #endif // __BROWSER_TEL_SERVICES_CALLUI__ |
|
194 |
|
195 CActiveScheduler::Add( this ); |
|
196 } |
|
197 |
|
198 //--------------------------------------------------------------------------------------- |
|
199 // Default C++ constructor |
|
200 //--------------------------------------------------------------------------------------- |
|
201 // |
|
202 CBrowserTelService::CBrowserTelService() |
|
203 : CActive( EPriorityNormal ), |
|
204 iResourceFileName( KNullDesC ), |
|
205 iResourceLoader( *CCoeEnv::Static() ), |
|
206 iResourceOpened( EFalse ) |
|
207 { |
|
208 } |
|
209 |
|
210 //--------------------------------------------------------------------------------------- |
|
211 // Destructor |
|
212 //--------------------------------------------------------------------------------------- |
|
213 // |
|
214 EXPORT_C CBrowserTelService::~CBrowserTelService() |
|
215 { |
|
216 TELSERVICE_ENTERFN( "~CBrowserTelService()" ) |
|
217 |
|
218 delete iServiceHandler; |
|
219 iServiceHandler = NULL; |
|
220 |
|
221 // Cancel all current activity |
|
222 Cancel(); |
|
223 |
|
224 // Close all open sessions |
|
225 CloseAllSessions(); |
|
226 |
|
227 #ifdef __BROWSER_TEL_SERVICES_CALLUI__ |
|
228 if (iDialData) |
|
229 { |
|
230 delete iDialData; |
|
231 } |
|
232 #endif // __BROWSER_TEL_SERVICES_CALLUI__ |
|
233 |
|
234 if( iSendableDTMFNumbers ) |
|
235 { |
|
236 iSendableDTMFNumbers->ResetAndDestroy(); |
|
237 delete iSendableDTMFNumbers; |
|
238 } |
|
239 |
|
240 if( iDlgDTMFNumbers ) |
|
241 { |
|
242 iDlgDTMFNumbers->ResetAndDestroy(); |
|
243 delete iDlgDTMFNumbers; |
|
244 } |
|
245 |
|
246 // Empty the observer list |
|
247 iObserverList.Reset(); |
|
248 /* |
|
249 if ( iResourceFileOffset ) |
|
250 { |
|
251 CCoeEnv::Static()->DeleteResourceFile( iResourceFileOffset ); |
|
252 } |
|
253 */ |
|
254 if ( iResourceOpened ) |
|
255 { |
|
256 iResourceLoader.Close(); |
|
257 iResourceOpened = EFalse; |
|
258 } |
|
259 |
|
260 #ifdef __BROWSER_TEL_SERVICES_CALLUI__ |
|
261 |
|
262 if( iDTMFNumber ) |
|
263 { |
|
264 delete iDTMFNumber; |
|
265 iDTMFNumber = NULL; |
|
266 } |
|
267 |
|
268 #endif // __BROWSER_TEL_SERVICES_CALLUI__ |
|
269 |
|
270 delete iIdle; |
|
271 delete iErrorUi; |
|
272 |
|
273 TELSERVICE_LEAVEFN( "~CBrowserTelService()" ) |
|
274 TELSERVICE_DELETE |
|
275 } |
|
276 |
|
277 //--------------------------------------------------------------------------------------- |
|
278 // CBrowserTelService::InitializeL() |
|
279 //--------------------------------------------------------------------------------------- |
|
280 // |
|
281 EXPORT_C HBufC* CBrowserTelService::ParsePhoneNumberL( TDes* aNumber ) |
|
282 { |
|
283 TELSERVICE_WRITE( "ParsePhoneNumberL()" ) |
|
284 return FindAndRipDTMFSequenceL( aNumber ); |
|
285 } |
|
286 |
|
287 //--------------------------------------------------------------------------------------- |
|
288 // CBrowserTelService::MakeCall() |
|
289 //--------------------------------------------------------------------------------------- |
|
290 // |
|
291 EXPORT_C TInt CBrowserTelService::MakeCall( TDesC& aNumber, |
|
292 TBool aSendDTMFAlwaysConfirm ) |
|
293 { |
|
294 TELSERVICE_ENTERFN( "MakeCall() synchronous" ) |
|
295 |
|
296 TInt retVal( KErrNone ); |
|
297 |
|
298 iRetVal = KErrNone; |
|
299 |
|
300 // Flag to indicate that synchronous method was called |
|
301 iSynch = ETrue; |
|
302 TRAP( retVal, MakeCallL( aNumber, aSendDTMFAlwaysConfirm ) ); |
|
303 |
|
304 if( retVal != KErrNone ) |
|
305 { |
|
306 ErrorHandler( retVal ); |
|
307 |
|
308 retVal = KErrCancel; |
|
309 } |
|
310 iSynch = EFalse; |
|
311 |
|
312 TELSERVICE_LEAVEFN( "MakeCall() synchronous" ) |
|
313 return retVal; |
|
314 } |
|
315 |
|
316 //--------------------------------------------------------------------------------------- |
|
317 // CBrowserTelService::MakeCall() |
|
318 //--------------------------------------------------------------------------------------- |
|
319 // |
|
320 EXPORT_C void CBrowserTelService::MakeCall( TRequestStatus& aStatus, |
|
321 TDesC& aNumber, |
|
322 TBool aSendDTMFAlwaysConfirm ) |
|
323 { |
|
324 TELSERVICE_ENTERFN( "MakeCall() asynchronous" ) |
|
325 |
|
326 iRetVal = KErrNone; |
|
327 |
|
328 aStatus = KRequestPending; |
|
329 iUserRequestStatus = &aStatus; |
|
330 iSynch = EFalse; |
|
331 |
|
332 TRAPD( err, MakeCall( aNumber, aSendDTMFAlwaysConfirm ) ); |
|
333 |
|
334 TELSERVICE_WRITE_FORMAT( "Asynch makecall start: %d", err ) |
|
335 |
|
336 if( err ) |
|
337 { |
|
338 ErrorHandler( err ); |
|
339 |
|
340 User::RequestComplete( iUserRequestStatus, err ); |
|
341 |
|
342 CleanupBuffers(); |
|
343 } |
|
344 |
|
345 TELSERVICE_LEAVEFN( "MakeCall() asynchronous" ) |
|
346 } |
|
347 |
|
348 //--------------------------------------------------------------------------------------- |
|
349 // CBrowserTelService::CancelMakeCall() |
|
350 //--------------------------------------------------------------------------------------- |
|
351 // |
|
352 EXPORT_C void CBrowserTelService::CancelMakeCall() |
|
353 { |
|
354 TELSERVICE_ENTERFN( "CancelMakeCall()" ) |
|
355 |
|
356 #ifdef __BROWSER_TEL_SERVICES_CALLUI__ |
|
357 |
|
358 // There is no ongoing request |
|
359 |
|
360 #else // __BROWSER_TEL_SERVICES_CALLUI__ |
|
361 |
|
362 Cancel(); |
|
363 SetStateIdleAndNotifyObservers(); |
|
364 |
|
365 #endif // __BROWSER_TEL_SERVICES_CALLUI__ |
|
366 |
|
367 TELSERVICE_LEAVEFN( "CancelMakeCall()" ) |
|
368 } |
|
369 |
|
370 //--------------------------------------------------------------------------------------- |
|
371 // CBrowserTelService::MakeCallL() |
|
372 //--------------------------------------------------------------------------------------- |
|
373 // |
|
374 void CBrowserTelService::MakeCallL( TDesC& aNumber, TBool aSendDTMFAlwaysConfirm, TBool voipCall ) |
|
375 { |
|
376 iDTMFAlwaysConfirm = aSendDTMFAlwaysConfirm; |
|
377 iRetVal = KErrNone; |
|
378 |
|
379 if( State() != EIdle ) |
|
380 { |
|
381 return; |
|
382 } |
|
383 |
|
384 if( aNumber.Length() == 0 ) |
|
385 { |
|
386 User::Leave( KErrInvocationError ); |
|
387 } |
|
388 |
|
389 |
|
390 #ifdef __BROWSER_TEL_SERVICES_CALLUI__ |
|
391 if( aNumber.Length() > AIWDialDataExt::KMaximumPhoneNumberLength ) |
|
392 { |
|
393 User::Leave( KErrPBNumberTooLong ); |
|
394 } |
|
395 |
|
396 HBufC* orgNumber = HBufC::NewLC( AIWDialDataExt::KMaximumPhoneNumberLength ); |
|
397 #else // __BROWSER_TEL_SERVICES_CALLUI__ |
|
398 |
|
399 if( aNumber.Length() > RMobilePhone::KMaxMobileTelNumberSize ) |
|
400 { |
|
401 User::Leave( KErrPBNumberTooLong ); |
|
402 } |
|
403 |
|
404 HBufC* orgNumber = HBufC::NewLC( RMobilePhone::KMaxMobileTelNumberSize ); |
|
405 |
|
406 #endif // __BROWSER_TEL_SERVICES_CALLUI__ |
|
407 |
|
408 orgNumber->Des().Copy( aNumber ); |
|
409 |
|
410 if( FeatureManager::FeatureSupported( KFeatureIdJapanPrefixChange ) ) |
|
411 { |
|
412 RLibrary dialUtils; |
|
413 if( dialUtils.Load( KDialUtilsLoadLib ) == KErrNone ) |
|
414 { |
|
415 CleanupClosePushL( dialUtils ); |
|
416 |
|
417 // Call function CreateDialUtilsFactoryL() |
|
418 TInt res = dialUtils.Lookup( 1 )(); |
|
419 CDialUtilsFactory * dialUtilsFactory = |
|
420 reinterpret_cast< CDialUtilsFactory * >( res ); |
|
421 |
|
422 // This way the library is not needed at the linking time. |
|
423 // Create Dial Utils (see that the function deletes the factory |
|
424 // instance): |
|
425 CDialUtilsApi* dialUtilsApi = dialUtilsFactory->CDialUtilsApiLD(); |
|
426 dialUtilsFactory = NULL; |
|
427 |
|
428 // Then use the Dial Utils API, for example: |
|
429 if( dialUtilsApi->CheckNumber( *orgNumber ) == KErrOverflow ) |
|
430 // no we have the converted number |
|
431 { |
|
432 User::Leave( KErrPBNumberTooLong ); |
|
433 } |
|
434 |
|
435 delete dialUtilsApi; |
|
436 CleanupStack::PopAndDestroy( &dialUtils ); |
|
437 } |
|
438 } |
|
439 |
|
440 // Handle postd format |
|
441 TPtr orgNumberPtr( orgNumber->Des() ); |
|
442 HBufC* postdParm = FindPostdParmL( orgNumberPtr ); |
|
443 |
|
444 if(voipCall) |
|
445 { |
|
446 FindAndRipVoipParametersL( orgNumberPtr ); |
|
447 } |
|
448 |
|
449 |
|
450 // Rip URI parameters from Tel URI, in order to that |
|
451 // number validation and DTMF works as earlier |
|
452 // Parameters will be added back in later phase |
|
453 HBufC* params = FindAndRipURIParametersL( orgNumberPtr ); |
|
454 CleanupStack::PushL( params ); |
|
455 |
|
456 HBufC* number = ValidateNumberL( *orgNumber ); |
|
457 CleanupStack::PushL( number ); |
|
458 |
|
459 TPtr numberPtr = number->Des(); |
|
460 iDTMFNumber= FindAndRipDTMFSequenceL( &numberPtr ); |
|
461 |
|
462 TBool isPostd(EFalse); |
|
463 if ( ! iDTMFNumber ) |
|
464 { |
|
465 iDTMFNumber = postdParm; |
|
466 if ( iDTMFNumber ) |
|
467 { |
|
468 isPostd = ETrue; |
|
469 } |
|
470 } |
|
471 else |
|
472 { |
|
473 delete postdParm; |
|
474 } |
|
475 #ifndef __BROWSER_TEL_SERVICES_CALLUI__ |
|
476 |
|
477 iSendableDTMFNumbers = ParseDTMFSequencesL( iDTMFNumber ); |
|
478 iDlgDTMFNumbers = ParseDTMFSequencesForDlgL( iDTMFNumber ); |
|
479 |
|
480 #endif // __BROWSER_TEL_SERVICES_CALLUI__ |
|
481 |
|
482 if( ShowDialogL( *number, EConfirmMakeCall ) ) |
|
483 { |
|
484 |
|
485 #ifndef __WINS__ |
|
486 DisconnectActiveCSDConnectionL(); |
|
487 #endif |
|
488 |
|
489 #ifdef __BROWSER_TEL_SERVICES_CALLUI__ |
|
490 |
|
491 HBufC* temp = NULL; |
|
492 if( iDTMFNumber ) |
|
493 { |
|
494 // Confirm the user (s)he wants to send the DTMF |
|
495 if( SendDMFConfQueryL( iDTMFNumber->Des() ) ) |
|
496 { |
|
497 if ( !isPostd ) |
|
498 { |
|
499 // Add iDTMFNumber to number |
|
500 temp = HBufC::NewLC( number->Length() + iDTMFNumber->Length() ); |
|
501 temp->Des().Copy( number->Des() ); |
|
502 temp->Des().Append( iDTMFNumber->Des() ); |
|
503 } |
|
504 else |
|
505 { |
|
506 // Add p+iDTMFNumber to number for postd |
|
507 temp = HBufC::NewLC( number->Length() + iDTMFNumber->Length() + 1 /*for the 'p' character*/ ); |
|
508 temp->Des().Copy( number->Des() ); |
|
509 temp->Des().Append( 'p' ); |
|
510 temp->Des().Append( iDTMFNumber->Des() ); |
|
511 } |
|
512 } |
|
513 else |
|
514 { |
|
515 // Call number without dtmf |
|
516 temp = number->AllocLC(); |
|
517 } |
|
518 } |
|
519 else |
|
520 { |
|
521 temp = number->AllocLC(); |
|
522 } |
|
523 |
|
524 temp = temp->ReAllocL( temp->Length() + params->Length() ); |
|
525 CleanupStack::Pop( temp ); // location may have changed, update cleanupstack |
|
526 CleanupStack::PushL( temp ); |
|
527 temp->Des().Append( *params ); |
|
528 |
|
529 // ... and make the call |
|
530 DoMakeCallL( *temp, voipCall ); |
|
531 |
|
532 CleanupStack::PopAndDestroy( temp ); // temp |
|
533 |
|
534 #else // __BROWSER_TEL_SERVICES_CALLUI__ |
|
535 |
|
536 // ... and make the call |
|
537 DoMakeCallL( *number, voipCall ); |
|
538 |
|
539 #endif // __BROWSER_TEL_SERVICES_CALLUI__ |
|
540 } |
|
541 else |
|
542 { |
|
543 User::Leave( KErrCancel ); |
|
544 } |
|
545 |
|
546 CleanupStack::PopAndDestroy( 3 ); // orgNumber, params, number |
|
547 } |
|
548 |
|
549 #ifdef __BROWSER_TEL_SERVICES_CALLUI__ |
|
550 |
|
551 //--------------------------------------------------------------------------------------- |
|
552 // CBrowserTelService::SendDMFConfQueryL() |
|
553 //--------------------------------------------------------------------------------------- |
|
554 // |
|
555 TBool CBrowserTelService::SendDMFConfQueryL( const TDesC& aDTMF ) |
|
556 { |
|
557 TBool retVal( EFalse ); |
|
558 |
|
559 |
|
560 TELSERVICE_ENTERFN( "SendDMFConfQueryL()" ) |
|
561 |
|
562 if( 0 == aDTMF.Length() ) |
|
563 { |
|
564 return retVal; |
|
565 } |
|
566 |
|
567 CRepository* repository = CRepository::NewL( KCRUidBrowser ); |
|
568 CleanupStack::PushL (repository ); |
|
569 repository->Get( KBrowserConfirmedDTMFOnce, iConfirmedOnce ); |
|
570 |
|
571 TELSERVICE_WRITE( "display send dtmf dialog" ) |
|
572 |
|
573 if( iDTMFAlwaysConfirm ) |
|
574 { |
|
575 retVal = ShowDialogL( aDTMF, EConfirmSendDTMF ); |
|
576 } |
|
577 else if( iDTMFAlwaysConfirm == EFalse && |
|
578 iConfirmedOnce == EFalse ) |
|
579 { |
|
580 retVal = ShowDialogL( aDTMF, |
|
581 EConfirmSendDTMF ); |
|
582 iConfirmedOnce = ETrue; |
|
583 repository->Set( KBrowserConfirmedDTMFOnce, iConfirmedOnce ); |
|
584 } |
|
585 |
|
586 CleanupStack::PopAndDestroy( repository ); |
|
587 |
|
588 return retVal; |
|
589 } |
|
590 |
|
591 #endif // __BROWSER_TEL_SERVICES_CALLUI__ |
|
592 |
|
593 //--------------------------------------------------------------------------------------- |
|
594 // CBrowserTelService::CleanupBuffs() |
|
595 //--------------------------------------------------------------------------------------- |
|
596 // |
|
597 void CBrowserTelService::CleanupBuffers() |
|
598 { |
|
599 if( iSendableDTMFNumbers ) |
|
600 { |
|
601 iSendableDTMFNumbers->ResetAndDestroy(); |
|
602 delete iSendableDTMFNumbers; |
|
603 iSendableDTMFNumbers = NULL; |
|
604 } |
|
605 |
|
606 if( iDlgDTMFNumbers ) |
|
607 { |
|
608 iDlgDTMFNumbers->ResetAndDestroy(); |
|
609 delete iDlgDTMFNumbers; |
|
610 iDlgDTMFNumbers = NULL; |
|
611 } |
|
612 } |
|
613 |
|
614 //--------------------------------------------------------------------------------------- |
|
615 // CBrowserTelService::DoMakeCallL() |
|
616 //--------------------------------------------------------------------------------------- |
|
617 // |
|
618 void CBrowserTelService::DoMakeCallL( TDesC& aNumber, TBool voipCall ) |
|
619 { |
|
620 TELSERVICE_ENTERFN( "DoMakeCallL()" ) |
|
621 |
|
622 #ifndef __BROWSER_TEL_SERVICES_CALLUI__ |
|
623 |
|
624 RTelServer::TPhoneInfo info; |
|
625 RPhone::TLineInfo lineInfo; |
|
626 |
|
627 // Connect to the telephony server and load the TSY. |
|
628 User::LeaveIfError( iRTelServer.Connect() ); |
|
629 User::LeaveIfError( iRTelServer.LoadPhoneModule( KMmTsyModuleName ) ); |
|
630 // Get the details for the first (and only) phone. |
|
631 User::LeaveIfError( iRTelServer.GetPhoneInfo( 0, info ) ); |
|
632 // Open the phone. |
|
633 User::LeaveIfError( iRPhone.Open( iRTelServer, info.iName ) ); |
|
634 // Get the information for the voice line, line 0. |
|
635 User::LeaveIfError( iRPhone.GetLineInfo( 0, lineInfo ) ); |
|
636 // Open the line. iName will now be "VoiceLine1". |
|
637 User::LeaveIfError( iRLine.Open( iRPhone, KMmTsyVoice1LineName ) ); |
|
638 TInt count; |
|
639 // Gets the number of calls opened from a line. |
|
640 User::LeaveIfError( iRLine.EnumerateCall( count ) ); |
|
641 if ( count > 2 ) |
|
642 { |
|
643 HBufC* text = StringLoader::LoadL( |
|
644 R_TEXT_CALL_NOT_ALLOWED, |
|
645 CEikonEnv::Static() ); |
|
646 CleanupStack::PushL( text ); |
|
647 TDialerDialogs::ErrorNoteL( *text ); |
|
648 CleanupStack::PopAndDestroy();// text |
|
649 User::Leave( KErrNone ); |
|
650 } |
|
651 |
|
652 // Open a new phone call. |
|
653 User::LeaveIfError( iRCall.OpenNewCall( iRLine ) ); |
|
654 |
|
655 // Initialize state |
|
656 SetState( EDialing ); |
|
657 |
|
658 // Actually dial the specified number. |
|
659 iRCall.Dial( iStatus, aNumber ); |
|
660 SetActive(); |
|
661 |
|
662 NotifyObservers(); |
|
663 |
|
664 if( iSynch ) |
|
665 { |
|
666 TELSERVICE_WRITE( "starting DoMakeCallL wait loop" ) |
|
667 iWait.Start(); // start the wait loop. DoMakeCallL() method won't |
|
668 // return until iWait->AsyncStop() is called in RunL() |
|
669 TELSERVICE_WRITE( "DoMakeCallL wait loop stopped" ) |
|
670 |
|
671 if( iRetVal == KErrNone ) |
|
672 { |
|
673 if( HandleInternalSendDTMFL() ) |
|
674 { |
|
675 TELSERVICE_WRITE( "starting HandleInternalSendDTMFL wait loop" ) |
|
676 iInternalDTMFWaitStarted = ETrue; |
|
677 iWait.Start(); |
|
678 iRAdvGsmPhone.Close(); |
|
679 TELSERVICE_WRITE( "HandleInternalSendDTMFL wait loop stopped" ) |
|
680 |
|
681 if( iWaitDlg ) |
|
682 { |
|
683 iWaitDlg->ProcessFinishedL(); |
|
684 } |
|
685 iInternalDTMFWaitStarted = EFalse; |
|
686 } |
|
687 } |
|
688 else |
|
689 { |
|
690 User::Leave( iRetVal ); |
|
691 } |
|
692 } |
|
693 |
|
694 #else // __BROWSER_TEL_SERVICES_CALLUI__ |
|
695 |
|
696 if(!iServiceHandler) |
|
697 { |
|
698 iServiceHandler = CAiwServiceHandler::NewL(); |
|
699 } |
|
700 iServiceHandler->AttachL( R_BROWSERTELSERVICES_MENU_AIW_INTERESTS ); |
|
701 |
|
702 |
|
703 CAiwGenericParamList& paramList = iServiceHandler->InParamListL(); |
|
704 CAiwGenericParamList& output = iServiceHandler->OutParamListL(); |
|
705 |
|
706 TPtrC number = aNumber; |
|
707 |
|
708 iDialData->SetPhoneNumberL( number ); |
|
709 if( !voipCall ) |
|
710 { |
|
711 iDialData->SetCallType( CAiwDialData::EAIWVideo ); |
|
712 } |
|
713 else |
|
714 { |
|
715 iDialData->SetCallType( CAiwDialData::EAIWVoiP ); |
|
716 } |
|
717 iDialData->FillInParamListL( paramList ); |
|
718 |
|
719 iServiceHandler->ExecuteServiceCmdL( |
|
720 KAiwCmdCall, |
|
721 paramList, |
|
722 output, |
|
723 0, // No options used. |
|
724 this ); // |
|
725 |
|
726 if( iSynch ) |
|
727 { |
|
728 iWait.Start(); |
|
729 } |
|
730 |
|
731 #endif // __BROWSER_TEL_SERVICES_CALLUI__ |
|
732 |
|
733 TELSERVICE_LEAVEFN( "DoMakeCallL()" ) |
|
734 } |
|
735 |
|
736 //--------------------------------------------------------------------------------------- |
|
737 // CBrowserTelService::SendDTMFL() |
|
738 //--------------------------------------------------------------------------------------- |
|
739 // |
|
740 void CBrowserTelService::SendDTMFL( TDesC& aNumber, TBool aSendDTMFAlwaysConfirm ) |
|
741 { |
|
742 iDTMFAlwaysConfirm = aSendDTMFAlwaysConfirm; |
|
743 |
|
744 iRetVal = KErrNone; |
|
745 CheckIsThereActivateVoiceCallOnL(); |
|
746 |
|
747 if( State() == EConnected ) |
|
748 { |
|
749 CheckDTMFNumberL( aNumber ); |
|
750 |
|
751 // Set flag to indicate that synchronous method was called |
|
752 iSynch = ETrue; |
|
753 |
|
754 delete iSendableDTMFNumbers; |
|
755 iSendableDTMFNumbers = NULL; |
|
756 |
|
757 delete iDlgDTMFNumbers; |
|
758 iDlgDTMFNumbers = NULL; |
|
759 |
|
760 iSendableDTMFNumbers = ParseDTMFSequencesL( &aNumber ); |
|
761 iDlgDTMFNumbers = ParseDTMFSequencesForDlgL( &aNumber ); |
|
762 |
|
763 if( HandleInternalSendDTMFL() ) |
|
764 { |
|
765 TELSERVICE_WRITE( "starting HandleInternalSendDTMFL wait loop" ) |
|
766 iInternalDTMFWaitStarted = ETrue; |
|
767 iWait.Start(); |
|
768 TELSERVICE_WRITE( "HandleInternalSendDTMFL wait loop stopped" ) |
|
769 |
|
770 if( iWaitDlg ) |
|
771 { |
|
772 iWaitDlg->ProcessFinishedL(); |
|
773 } |
|
774 iInternalDTMFWaitStarted = EFalse; |
|
775 } |
|
776 |
|
777 // Unset flag |
|
778 iSynch = EFalse; |
|
779 } |
|
780 else // no active voice connection |
|
781 { |
|
782 User::Leave( KErrNoCallActive ); |
|
783 } |
|
784 } |
|
785 |
|
786 //--------------------------------------------------------------------------------------- |
|
787 // CBrowserTelService::SendDTMFL() |
|
788 //--------------------------------------------------------------------------------------- |
|
789 // |
|
790 void CBrowserTelService::SendDTMFL( TRequestStatus& aStatus,TDesC& aNumber, |
|
791 TBool aSendDTMFAlwaysConfirm ) |
|
792 { |
|
793 iDTMFAlwaysConfirm = aSendDTMFAlwaysConfirm; |
|
794 |
|
795 aStatus = KRequestPending; |
|
796 iUserRequestStatus = &aStatus; |
|
797 CheckIsThereActivateVoiceCallOnL(); |
|
798 |
|
799 if( State() == EConnected ) |
|
800 { |
|
801 CheckDTMFNumberL( aNumber ); |
|
802 |
|
803 if( iSendableDTMFNumbers ) |
|
804 { |
|
805 iSendableDTMFNumbers->ResetAndDestroy(); |
|
806 } |
|
807 delete iSendableDTMFNumbers; |
|
808 iSendableDTMFNumbers = NULL; |
|
809 |
|
810 if( iDlgDTMFNumbers ) |
|
811 { |
|
812 iDlgDTMFNumbers->ResetAndDestroy(); |
|
813 } |
|
814 delete iDlgDTMFNumbers; |
|
815 iDlgDTMFNumbers = NULL; |
|
816 |
|
817 iSendableDTMFNumbers = ParseDTMFSequencesL( &aNumber ); |
|
818 iDlgDTMFNumbers = ParseDTMFSequencesForDlgL( &aNumber ); |
|
819 |
|
820 HandleInternalSendDTMFL(); |
|
821 } |
|
822 else // no active voice connection |
|
823 { |
|
824 User::Leave( KErrNoCallActive ); |
|
825 } |
|
826 } |
|
827 |
|
828 //--------------------------------------------------------------------------------------- |
|
829 // CBrowserTelService::DoSendDTMFL() |
|
830 //--------------------------------------------------------------------------------------- |
|
831 // |
|
832 void CBrowserTelService::DoSendDTMFL( TDesC& aNumber ) |
|
833 { |
|
834 TELSERVICE_ENTERFN( "DoSendDTMFL()" ) |
|
835 |
|
836 CheckIsThereActivateVoiceCallOnL(); |
|
837 |
|
838 if( State() == EConnected ) |
|
839 { |
|
840 // Cancel any outstanding requests |
|
841 Cancel(); |
|
842 |
|
843 RTelServer::TPhoneInfo info; |
|
844 User::LeaveIfError( iRTelServer.GetPhoneInfo( 0, info ) ); |
|
845 User::LeaveIfError( iRAdvGsmPhone.Open( iRTelServer, info.iName ) ); |
|
846 |
|
847 // Set state |
|
848 SetState( EDialingDTMF ); |
|
849 // Notify the observer |
|
850 NotifyObservers(); |
|
851 |
|
852 // Send DTMF tones |
|
853 if( aNumber.Length() ) |
|
854 { |
|
855 iRAdvGsmPhone.SendDTMFTones( iStatus, aNumber ); |
|
856 } |
|
857 else |
|
858 { |
|
859 TRequestStatus* status = &iStatus; |
|
860 User::RequestComplete( status, KErrNone ); |
|
861 } |
|
862 |
|
863 SetActive(); |
|
864 |
|
865 if( iSynch ) |
|
866 { |
|
867 iWait.Start(); // start the wait loop. DoSendDTMFL() |
|
868 // method won't return |
|
869 // until iWait->AsyncStop() is called in RunL() |
|
870 } |
|
871 } |
|
872 else |
|
873 { |
|
874 User::Leave( KErrCancel ); |
|
875 } |
|
876 |
|
877 TELSERVICE_LEAVEFN( "DoSendDTMFL()" ) |
|
878 } |
|
879 |
|
880 //--------------------------------------------------------------------------------------- |
|
881 // CBrowserTelService::ValidateNumberL() |
|
882 //--------------------------------------------------------------------------------------- |
|
883 // |
|
884 HBufC* CBrowserTelService::ValidateNumberL( TDesC& aNumber ) |
|
885 { |
|
886 TELSERVICE_ENTERFN( "ValidateNumberL()" ) |
|
887 |
|
888 HBufC* buf = HBufC::NewLC( aNumber.Length() ); |
|
889 TPtr ptr = buf->Des(); |
|
890 ptr.Copy( aNumber ); |
|
891 |
|
892 for( TInt i = 0; i < ptr.Length(); i++ ) |
|
893 { |
|
894 TChar currentChar = ptr[i]; |
|
895 |
|
896 if( currentChar.IsSpace() ) |
|
897 { |
|
898 ptr.Delete( i, 1 ); |
|
899 i--; |
|
900 } |
|
901 else if( !currentChar.IsDigit() ) |
|
902 { |
|
903 if( currentChar == '+' ) |
|
904 { |
|
905 if( i != 0 ) |
|
906 { |
|
907 User::Leave( KErrInvocationError ); |
|
908 } |
|
909 } |
|
910 else |
|
911 { |
|
912 currentChar.UpperCase(); |
|
913 |
|
914 switch( currentChar ) |
|
915 { |
|
916 case '*': |
|
917 case '#': |
|
918 case 'A': |
|
919 case 'B': |
|
920 case 'C': |
|
921 case 'D': |
|
922 case 'P': |
|
923 case 'W': |
|
924 case ',': |
|
925 case '/': |
|
926 if( i == 0 ) |
|
927 { |
|
928 User::Leave( KErrInvocationError ); |
|
929 } |
|
930 break; |
|
931 |
|
932 case '.': |
|
933 case '-': |
|
934 case '(': |
|
935 case ')': |
|
936 { |
|
937 ptr.Delete( i, 1 ); |
|
938 i--; |
|
939 } |
|
940 break; |
|
941 |
|
942 default: |
|
943 // invalid character in the phone number |
|
944 { |
|
945 User::Leave( KErrInvocationError ); |
|
946 } |
|
947 break; |
|
948 } |
|
949 } |
|
950 } |
|
951 } |
|
952 |
|
953 CleanupStack::Pop( buf ); // buf |
|
954 |
|
955 TELSERVICE_LEAVEFN( "ValidateNumberL()" ) |
|
956 return buf; |
|
957 } |
|
958 |
|
959 //--------------------------------------------------------------------------------------- |
|
960 // CBrowserTelService::FindAndHandlePostdL() |
|
961 //--------------------------------------------------------------------------------------- |
|
962 // |
|
963 HBufC* CBrowserTelService::FindPostdParmL( TDes& aNumber ) |
|
964 { |
|
965 TELSERVICE_ENTERFN( "FindPostdParmL()" ) |
|
966 |
|
967 HBufC* buf = NULL; |
|
968 _LIT( KPostd, ";postd=" ); |
|
969 TInt ret = aNumber.Find( KPostd ); |
|
970 if ( ret != KErrNotFound ) |
|
971 { |
|
972 buf = aNumber.Mid( ret + KPostd().Length() ).AllocL(); |
|
973 aNumber.SetLength ( ret ); |
|
974 } |
|
975 TELSERVICE_LEAVEFN( "FindPostdParmL()" ) |
|
976 return buf; |
|
977 } |
|
978 |
|
979 |
|
980 //--------------------------------------------------------------------------------------- |
|
981 // CBrowserTelService::FindAndRipDTMFSequenceL() |
|
982 //--------------------------------------------------------------------------------------- |
|
983 // |
|
984 HBufC* CBrowserTelService::FindAndRipDTMFSequenceL( TDes* aNumber ) |
|
985 { |
|
986 TELSERVICE_ENTERFN( "FindAndRipDTMFSequnceL()" ) |
|
987 |
|
988 HBufC* buf = NULL; |
|
989 |
|
990 TPtrC waitChars; |
|
991 waitChars.Set( KDTMFWaitChars ); |
|
992 |
|
993 // Look for the first DTMF-wait char and extract the |
|
994 // dtmf string from the phonenumber |
|
995 for( TInt i = 0; i < aNumber->Length(); i++ ) |
|
996 { |
|
997 if( ( waitChars.Locate( (*aNumber)[i] ) != KErrNotFound ) ) |
|
998 { |
|
999 #ifdef __BROWSER_TEL_SERVICES_CALLUI__ |
|
1000 |
|
1001 buf = aNumber->Mid(i).AllocL(); |
|
1002 aNumber->Delete( i, buf->Length() ); |
|
1003 |
|
1004 // Remove all the invalid wait chars from |
|
1005 // the sequence which is not accepted by CallUi |
|
1006 TPtrC invalidWaitChars; |
|
1007 invalidWaitChars.Set( KDTMFInvalidWaitChars ); |
|
1008 |
|
1009 for( TInt j = 0; j < buf->Length(); j++ ) |
|
1010 { |
|
1011 if( ( invalidWaitChars.Locate( (*buf)[j] ) != KErrNotFound ) ) |
|
1012 { |
|
1013 TPtr ptr = buf->Des(); |
|
1014 ptr.Replace( j, 1,KDTMFValidPause() ); |
|
1015 } |
|
1016 } |
|
1017 |
|
1018 #else // __BROWSER_TEL_SERVICES_CALLUI__ |
|
1019 |
|
1020 if( (*aNumber)[i] == '#' || |
|
1021 (*aNumber)[i] == '*' ) |
|
1022 // these chars are parts of the dtms sequence |
|
1023 { |
|
1024 buf = aNumber->Mid(i).AllocL(); |
|
1025 aNumber->Delete( i, buf->Length() ); |
|
1026 } |
|
1027 else |
|
1028 { |
|
1029 // +1 -> wait char is not part of the dtmf sequence |
|
1030 buf = aNumber->Mid(i+1).AllocL(); |
|
1031 aNumber->Delete( i, buf->Length() + 1); |
|
1032 } |
|
1033 |
|
1034 #endif // __BROWSER_TEL_SERVICES_CALLUI__ |
|
1035 break; |
|
1036 } |
|
1037 } |
|
1038 TELSERVICE_LEAVEFN( "FindAndRipDTMFSequenceL()" ) |
|
1039 return buf; |
|
1040 } |
|
1041 |
|
1042 //--------------------------------------------------------------------------------------- |
|
1043 // CBrowserTelService::FindAndRipURIParametersL() |
|
1044 //--------------------------------------------------------------------------------------- |
|
1045 // |
|
1046 HBufC* CBrowserTelService::FindAndRipURIParametersL( TDes& aNumber ) |
|
1047 { |
|
1048 TELSERVICE_ENTERFN( "FindAndRipURIParametersL()" ) |
|
1049 |
|
1050 HBufC* buf = NULL; |
|
1051 TInt offset = aNumber.Locate( TChar( ';' ) ); |
|
1052 if( offset > 0 ) // Separator is not allowed to be a first char |
|
1053 { |
|
1054 __ASSERT_DEBUG( offset <= aNumber.Length(), User::Leave( KErrGeneral ) ); |
|
1055 buf = aNumber.Mid( offset ).AllocL(); |
|
1056 aNumber.SetLength( offset ); |
|
1057 } |
|
1058 else |
|
1059 { |
|
1060 buf = HBufC::NewL( 0 ); |
|
1061 } |
|
1062 |
|
1063 TELSERVICE_LEAVEFN( "FindAndRipURIParametersL()" ) |
|
1064 return buf; |
|
1065 } |
|
1066 |
|
1067 |
|
1068 //--------------------------------------------------------------------------------------- |
|
1069 // CBrowserTelService::FindAndRipVoipParametersL() |
|
1070 //--------------------------------------------------------------------------------------- |
|
1071 // |
|
1072 void CBrowserTelService::FindAndRipVoipParametersL( TDes& aNumber ) |
|
1073 { |
|
1074 TELSERVICE_ENTERFN( "FindAndRipVoipParametersL()" ) |
|
1075 |
|
1076 HBufC* buf = NULL; |
|
1077 TInt offset = aNumber.Locate( TChar( '@' ) ); |
|
1078 if( offset > 0 ) // Separator is not allowed to be a first char |
|
1079 { |
|
1080 __ASSERT_DEBUG( offset <= aNumber.Length(), User::Leave( KErrGeneral ) ); |
|
1081 buf = aNumber.Mid( offset ).AllocL(); |
|
1082 aNumber.SetLength( offset ); |
|
1083 } |
|
1084 else |
|
1085 { |
|
1086 buf = HBufC::NewL( 0 ); |
|
1087 } |
|
1088 |
|
1089 TELSERVICE_LEAVEFN( "FindAndRipVoipParametersL()" ) |
|
1090 } |
|
1091 |
|
1092 //--------------------------------------------------------------------------------------- |
|
1093 // CBrowserTelService::ValidateDTMFNumberL() |
|
1094 //--------------------------------------------------------------------------------------- |
|
1095 // |
|
1096 void CBrowserTelService::ValidateDTMFNumberL( TDes* aNumber ) |
|
1097 { |
|
1098 TELSERVICE_ENTERFN( "ValidateDTMFNumberL()" ) |
|
1099 |
|
1100 TPtrC validDTMFChars; |
|
1101 validDTMFChars.Set( KValidDTMFChars ); |
|
1102 |
|
1103 if( aNumber ) |
|
1104 { |
|
1105 for( TInt i = 0; i < aNumber->Length(); i++ ) |
|
1106 { |
|
1107 if( ( validDTMFChars.Locate( (*aNumber)[i] ) == KErrNotFound ) ) |
|
1108 { |
|
1109 // Invalid character found, remove it! |
|
1110 aNumber->Delete( i, 1 ); |
|
1111 i--; |
|
1112 } |
|
1113 } |
|
1114 } |
|
1115 TELSERVICE_LEAVEFN( "ValidateDTMFNumberL()" ) |
|
1116 } |
|
1117 |
|
1118 //--------------------------------------------------------------------------------------- |
|
1119 // CBrowserTelService::ParseDTMFSequencesForDlg() |
|
1120 //--------------------------------------------------------------------------------------- |
|
1121 // |
|
1122 CArrayPtrFlat<HBufC>* CBrowserTelService::ParseDTMFSequencesForDlgL( |
|
1123 const TDesC* aDTMFString ) |
|
1124 { |
|
1125 TELSERVICE_ENTERFN( "ParseDTMFSequencesForDlgL()" ) |
|
1126 CArrayPtrFlat<HBufC>* parsedArray = NULL; |
|
1127 |
|
1128 if( aDTMFString ) |
|
1129 { |
|
1130 parsedArray = new ( ELeave ) CArrayPtrFlat<HBufC>( KParseArrayAllocation ); |
|
1131 |
|
1132 TLex dtmfSequence( *aDTMFString ); |
|
1133 |
|
1134 TChar previousChar = dtmfSequence.Peek(); // first char |
|
1135 |
|
1136 while( !dtmfSequence.Eos() ) |
|
1137 { |
|
1138 // |
|
1139 if ( dtmfSequence.Offset() ) // if not at start of line |
|
1140 { |
|
1141 TChar nextChar = dtmfSequence.Peek(); |
|
1142 if( nextChar == '/' || nextChar == 'w' || nextChar == 'p' || |
|
1143 nextChar == ',' ) |
|
1144 { |
|
1145 // if the previous wait char was either 'w' or '/' then skip it |
|
1146 // and mark new extraction mark. |
|
1147 if( previousChar == 'w' || previousChar == '/' ) |
|
1148 { |
|
1149 dtmfSequence.Mark(); |
|
1150 } |
|
1151 else |
|
1152 { |
|
1153 parsedArray->AppendL( |
|
1154 dtmfSequence.RemainderFromMark().Alloc() ); |
|
1155 dtmfSequence.Mark(); |
|
1156 } |
|
1157 } |
|
1158 previousChar = nextChar; |
|
1159 } |
|
1160 |
|
1161 dtmfSequence.Inc(); |
|
1162 } |
|
1163 |
|
1164 parsedArray->AppendL( dtmfSequence.RemainderFromMark().Alloc() ); |
|
1165 } |
|
1166 TELSERVICE_LEAVEFN( "ParseDTMFSequencesForDlgL()" ) |
|
1167 return parsedArray; |
|
1168 } |
|
1169 |
|
1170 |
|
1171 //--------------------------------------------------------------------------------------- |
|
1172 // CBrowserTelService::ParseDTMFSequencesForDlg() |
|
1173 //--------------------------------------------------------------------------------------- |
|
1174 // |
|
1175 CArrayPtrFlat<HBufC>* CBrowserTelService::ParseDTMFSequencesL( |
|
1176 const TDesC* aDTMFString ) |
|
1177 { |
|
1178 TELSERVICE_ENTERFN( "ParseDTFMSequencesL()" ) |
|
1179 CArrayPtrFlat<HBufC>* parsedArray = NULL; |
|
1180 |
|
1181 if( aDTMFString ) |
|
1182 { |
|
1183 parsedArray = new ( ELeave ) CArrayPtrFlat<HBufC>( |
|
1184 KParseArrayAllocation ); |
|
1185 CleanupStack::PushL( parsedArray ); |
|
1186 |
|
1187 TLex dtmfSequence( *aDTMFString ); |
|
1188 |
|
1189 TChar previousChar = dtmfSequence.Peek(); // first char |
|
1190 |
|
1191 while( !dtmfSequence.Eos() ) |
|
1192 { |
|
1193 // |
|
1194 if ( dtmfSequence.Offset() ) // if not at start of line |
|
1195 { |
|
1196 TChar nextChar = dtmfSequence.Peek(); |
|
1197 if( nextChar == '/' || nextChar == 'w' || |
|
1198 nextChar == 'p' || nextChar == ',' ) |
|
1199 { |
|
1200 // if the previous wait char was either 'w' or '/' |
|
1201 // then skip it |
|
1202 // and mark new extraction mark. |
|
1203 if( previousChar == 'w' || previousChar == '/' ) |
|
1204 { |
|
1205 dtmfSequence.Mark(); |
|
1206 } |
|
1207 else |
|
1208 { |
|
1209 parsedArray->AppendL( |
|
1210 dtmfSequence.MarkedToken().Alloc() ); |
|
1211 dtmfSequence.Mark(); |
|
1212 } |
|
1213 } |
|
1214 previousChar = nextChar; |
|
1215 } |
|
1216 |
|
1217 dtmfSequence.Inc(); |
|
1218 } |
|
1219 |
|
1220 parsedArray->AppendL( dtmfSequence.RemainderFromMark().Alloc() ); |
|
1221 |
|
1222 CleanupStack::Pop( parsedArray ); |
|
1223 } |
|
1224 TELSERVICE_LEAVEFN( "ParseDTMFSequencesL()" ) |
|
1225 return parsedArray; |
|
1226 } |
|
1227 |
|
1228 //--------------------------------------------------------------------------------------- |
|
1229 // CBrowserTelService::DisplaySendDTMFDialog() |
|
1230 //--------------------------------------------------------------------------------------- |
|
1231 // |
|
1232 TBool CBrowserTelService::DisplaySendDTMFDialog( TDes* aNumber ) |
|
1233 { |
|
1234 TELSERVICE_ENTERFN( "DisplaySendDTMFDialog()" ) |
|
1235 TBool ret = EFalse; |
|
1236 |
|
1237 if( aNumber ) |
|
1238 { |
|
1239 TInt length = aNumber->Length(); |
|
1240 if( length ) |
|
1241 { |
|
1242 TChar waitChar = RipWaitChar( aNumber ); |
|
1243 |
|
1244 switch( waitChar ) |
|
1245 { |
|
1246 case '/': |
|
1247 case 'w': |
|
1248 { |
|
1249 ret = ETrue; |
|
1250 } |
|
1251 break; |
|
1252 |
|
1253 case 'p': |
|
1254 case ',': |
|
1255 { |
|
1256 ret = EFalse; |
|
1257 } |
|
1258 break; |
|
1259 |
|
1260 default: |
|
1261 { |
|
1262 ret = ((iDTMFAlwaysConfirm) || (!iConfirmedOnce)); |
|
1263 } |
|
1264 break; |
|
1265 } |
|
1266 } |
|
1267 } |
|
1268 TELSERVICE_LEAVEFN( "DisplaySendDTMFDialog()" ) |
|
1269 return ret; |
|
1270 } |
|
1271 |
|
1272 //--------------------------------------------------------------------------------------- |
|
1273 // CBrowserTelService::RipWaitChar() |
|
1274 //--------------------------------------------------------------------------------------- |
|
1275 // |
|
1276 TChar CBrowserTelService::RipWaitChar( TDes* aNumber ) |
|
1277 { |
|
1278 TELSERVICE_ENTERFN( "RipWaitChar()" ) |
|
1279 TChar waitChar = NULL; |
|
1280 if( aNumber ) |
|
1281 { |
|
1282 TInt length = aNumber->Length(); |
|
1283 if( length ) |
|
1284 { |
|
1285 TChar tempWaitChar = ( *aNumber )[0]; |
|
1286 if( tempWaitChar == 'w' || tempWaitChar == '/' || |
|
1287 tempWaitChar == 'p' || tempWaitChar == ',') |
|
1288 { |
|
1289 waitChar = tempWaitChar; |
|
1290 aNumber->Delete( 0, 1 ); |
|
1291 } |
|
1292 } |
|
1293 } |
|
1294 TELSERVICE_LEAVEFN( "RipWaitChar()" ) |
|
1295 return waitChar; |
|
1296 } |
|
1297 |
|
1298 //--------------------------------------------------------------------------------------- |
|
1299 // CBrowserTelService::SendDTMF() |
|
1300 //--------------------------------------------------------------------------------------- |
|
1301 // |
|
1302 EXPORT_C TInt CBrowserTelService::SendDTMF( TDesC& aNumber, |
|
1303 TBool aSendDTMFAlwaysConfirm ) |
|
1304 { |
|
1305 TELSERVICE_ENTERFN( "SendDTMF() synchronous" ) |
|
1306 |
|
1307 iRetVal = KErrNone; |
|
1308 |
|
1309 TRAPD( err, SendDTMFL( aNumber, aSendDTMFAlwaysConfirm ) ); |
|
1310 |
|
1311 if( err ) |
|
1312 { |
|
1313 ErrorHandler( err ); |
|
1314 iRetVal = KErrCancel; |
|
1315 } |
|
1316 |
|
1317 TELSERVICE_LEAVEFN( "SendDTMF() synchronous" ) |
|
1318 return iRetVal; |
|
1319 } |
|
1320 |
|
1321 //--------------------------------------------------------------------------------------- |
|
1322 // CBrowserTelService::SendDTMFL() |
|
1323 //--------------------------------------------------------------------------------------- |
|
1324 // |
|
1325 EXPORT_C void CBrowserTelService::SendDTMF( TRequestStatus& aStatus, |
|
1326 TDesC& aNumber, |
|
1327 TBool aSendDTMFAlwaysConfirm ) |
|
1328 { |
|
1329 TELSERVICE_ENTERFN( "SendDTMF() asynchronous" ) |
|
1330 |
|
1331 iRetVal = KErrNone; |
|
1332 |
|
1333 TRAPD( err, SendDTMFL( aStatus, aNumber, aSendDTMFAlwaysConfirm ) ); |
|
1334 |
|
1335 if( err ) |
|
1336 { |
|
1337 TELSERVICE_WRITE_FORMAT( "Complete the request: %d", KErrInvocationError ) |
|
1338 |
|
1339 ErrorHandler( err ); |
|
1340 |
|
1341 User::RequestComplete( iUserRequestStatus, KErrInvocationError ); |
|
1342 } |
|
1343 |
|
1344 TELSERVICE_LEAVEFN( "SendDTMF() asynchronous" ) |
|
1345 } |
|
1346 |
|
1347 //--------------------------------------------------------------------------------------- |
|
1348 // CBrowserTelService::CancelSendDTMFL() |
|
1349 //--------------------------------------------------------------------------------------- |
|
1350 // |
|
1351 EXPORT_C void CBrowserTelService::CancelSendDTMFL() |
|
1352 { |
|
1353 TELSERVICE_ENTERFN( "CancelSendDTMF()" ) |
|
1354 |
|
1355 if( State() == EDialingDTMF ) |
|
1356 { |
|
1357 RCall::TStatus callStatus; |
|
1358 User::LeaveIfError( iRCall.GetStatus( callStatus ) ); |
|
1359 |
|
1360 if( callStatus == RCall::EStatusConnected ) |
|
1361 { |
|
1362 if( State() == EDialingDTMF ) |
|
1363 { |
|
1364 Cancel(); |
|
1365 SetState( EConnected ); |
|
1366 } |
|
1367 } |
|
1368 } |
|
1369 |
|
1370 TELSERVICE_LEAVEFN( "CancelSendDTMF()" ) |
|
1371 } |
|
1372 |
|
1373 //--------------------------------------------------------------------------------------- |
|
1374 // CBrowserTelService::AddPBEntryL() |
|
1375 //--------------------------------------------------------------------------------------- |
|
1376 // |
|
1377 EXPORT_C TInt CBrowserTelService::AddPBEntryL( |
|
1378 TDesC& aNumber, |
|
1379 TDesC& aName, |
|
1380 TDesC& aEmail ) |
|
1381 { |
|
1382 TELSERVICE_ENTERFN( "AddPBEntryL()" ) |
|
1383 |
|
1384 CPbkContactEngine* pbkEngine = CPbkContactEngine::NewL(); |
|
1385 CleanupStack::PushL( pbkEngine ); |
|
1386 |
|
1387 // Make sure a resource file is available |
|
1388 RPbkViewResourceFile pbkResourceFile( *CCoeEnv::Static() ); |
|
1389 pbkResourceFile.OpenL(); |
|
1390 CleanupClosePushL<RPbkViewResourceFile> ( pbkResourceFile ); |
|
1391 |
|
1392 // Step 1: Search Pb for matches and open existing or create new |
|
1393 TBool newContact; |
|
1394 CPbkContactItem* contactItem = SearchPBItemLC( *pbkEngine |
|
1395 , aNumber |
|
1396 , aEmail |
|
1397 , newContact ); |
|
1398 |
|
1399 TPtrC lastName; |
|
1400 TPtrC firstName; |
|
1401 TPtrC email; |
|
1402 |
|
1403 email.Set( aEmail ); |
|
1404 |
|
1405 // Step 2: Set values to the correct lines |
|
1406 // default focused dialog line |
|
1407 TInt formIndex = -1; |
|
1408 |
|
1409 if( JAPANESE ) |
|
1410 // Japanese version only. See Vodafone spec: |
|
1411 // http://developers.vodafone.jp/dp/tool_dl/download.php?docid=120 |
|
1412 { |
|
1413 TPtrC lastNameReading; |
|
1414 |
|
1415 TInt yomiganaInd = aName.LocateReverse( TChar('-') ); |
|
1416 |
|
1417 if( yomiganaInd != KErrNotFound ) |
|
1418 { |
|
1419 lastNameReading.Set( aName.Right( aName.Length() - yomiganaInd - 1 ) ); |
|
1420 lastName.Set( aName.Left( yomiganaInd ) ); |
|
1421 } |
|
1422 else |
|
1423 { |
|
1424 lastName.Set( aName ); |
|
1425 } |
|
1426 |
|
1427 SetPBEntryFieldL( EPbkFieldIdLastName, pbkEngine, contactItem, lastName, formIndex ); |
|
1428 SetPBEntryFieldL( EPbkFieldIdLastNameReading, pbkEngine, contactItem, lastNameReading, formIndex ); |
|
1429 } |
|
1430 else |
|
1431 { |
|
1432 TInt lastNameInd = aName.LocateReverse( TChar(' ') ); |
|
1433 TBool whichtag = EFalse; |
|
1434 if ( lastNameInd == KErrNotFound ) |
|
1435 { |
|
1436 _LIT( tag, "%20" ); |
|
1437 lastNameInd = aName.Find( tag ); |
|
1438 whichtag = ETrue; |
|
1439 } |
|
1440 |
|
1441 if( lastNameInd != KErrNotFound ) |
|
1442 { |
|
1443 if( lastNameInd ) |
|
1444 { |
|
1445 if ( whichtag ) |
|
1446 { |
|
1447 lastName.Set( aName.Right( aName.Length() - lastNameInd - 3 ) ); |
|
1448 } |
|
1449 else |
|
1450 { |
|
1451 lastName.Set( aName.Right( aName.Length() - lastNameInd - 1 ) ); |
|
1452 } |
|
1453 firstName.Set( aName.Left( lastNameInd ) ); |
|
1454 } |
|
1455 else |
|
1456 { |
|
1457 lastName.Set( aName ); |
|
1458 } |
|
1459 } |
|
1460 else |
|
1461 { |
|
1462 lastName.Set( aName ); |
|
1463 } |
|
1464 |
|
1465 SetPBEntryFieldL( EPbkFieldIdLastName, pbkEngine, contactItem, lastName, formIndex ); |
|
1466 SetPBEntryFieldL( EPbkFieldIdFirstName, pbkEngine, contactItem, firstName, formIndex ); |
|
1467 } |
|
1468 |
|
1469 // common fields |
|
1470 SetPBEntryFieldL( EPbkFieldIdPhoneNumberStandard, pbkEngine, contactItem, aNumber, formIndex ); |
|
1471 SetPBEntryFieldL( EPbkFieldIdEmailAddress, pbkEngine, contactItem, aEmail, formIndex ); |
|
1472 |
|
1473 // Step 3: Open the editor dialog |
|
1474 CPbkContactEditorDlg* dlg = CPbkContactEditorDlg::NewL( |
|
1475 *pbkEngine, *contactItem, newContact, formIndex, formIndex >= 0 ); |
|
1476 |
|
1477 // Execute phonebook editor |
|
1478 dlg->ExecuteLD(); |
|
1479 |
|
1480 CleanupStack::PopAndDestroy( 3 ); // contactItem, pbkResourceFile, pbkEngine |
|
1481 |
|
1482 TELSERVICE_LEAVEFN( "AddPBEntryL()" ) |
|
1483 |
|
1484 return KErrNone; |
|
1485 } |
|
1486 |
|
1487 //--------------------------------------------------------------------------------------- |
|
1488 // CBrowserTelService::State() |
|
1489 //--------------------------------------------------------------------------------------- |
|
1490 // |
|
1491 EXPORT_C TBrowserTelServiceState CBrowserTelService::State() const |
|
1492 { |
|
1493 TELSERVICE_WRITE_FORMAT( "State(): %d", iState ) |
|
1494 return iState; |
|
1495 } |
|
1496 |
|
1497 //--------------------------------------------------------------------------------------- |
|
1498 // CBrowserTelService::SetState() |
|
1499 //--------------------------------------------------------------------------------------- |
|
1500 // |
|
1501 void CBrowserTelService::SetState( TBrowserTelServiceState aState ) |
|
1502 { |
|
1503 TELSERVICE_WRITE( "SetState()" ) |
|
1504 iState = aState; |
|
1505 } |
|
1506 |
|
1507 //--------------------------------------------------------------------------------------- |
|
1508 // CBrowserTelService::AddObserver() |
|
1509 //--------------------------------------------------------------------------------------- |
|
1510 // |
|
1511 EXPORT_C void CBrowserTelService::AddObserver( |
|
1512 MBrowserTelServiceObserver* aObserver ) |
|
1513 { |
|
1514 TELSERVICE_ENTERFN( "AddObserver()" ) |
|
1515 |
|
1516 if( aObserver ) |
|
1517 { |
|
1518 iObserverList.Append( aObserver ); |
|
1519 } |
|
1520 TELSERVICE_LEAVEFN( "AddObserver()" ) |
|
1521 } |
|
1522 |
|
1523 //--------------------------------------------------------------------------------------- |
|
1524 // CBrowserTelService::RemoveObserver() |
|
1525 //--------------------------------------------------------------------------------------- |
|
1526 |
|
1527 EXPORT_C void CBrowserTelService::RemoveObserver( |
|
1528 MBrowserTelServiceObserver* aObserver ) |
|
1529 { |
|
1530 TELSERVICE_ENTERFN( "RemoveObserver()" ) |
|
1531 |
|
1532 TInt count = iObserverList.Count(); |
|
1533 if( count ) |
|
1534 { |
|
1535 TInt index = iObserverList.Find( aObserver ); |
|
1536 if( index != KErrNotFound ) |
|
1537 { |
|
1538 iObserverList.Remove( index ); |
|
1539 iObserverList.GranularCompress(); |
|
1540 } |
|
1541 } |
|
1542 TELSERVICE_LEAVEFN( "AddObserver()" ) |
|
1543 } |
|
1544 //--------------------------------------------------------------------------------------- |
|
1545 // CBrowserTelService::SendEmailMessageL() |
|
1546 //--------------------------------------------------------------------------------------- |
|
1547 // |
|
1548 EXPORT_C TInt CBrowserTelService::SendEmailMessageL( |
|
1549 const TDesC& aToRecipients, |
|
1550 const TDesC& aCcRecipients, |
|
1551 const TDesC& aParams, |
|
1552 const TDesC& aBody ) |
|
1553 { |
|
1554 return this->SendEmailMessageL( aToRecipients, aCcRecipients, |
|
1555 aParams, aBody, 0 ); |
|
1556 } |
|
1557 //--------------------------------------------------------------------------------------- |
|
1558 // CBrowserTelService::SendEmailMessageL() |
|
1559 //--------------------------------------------------------------------------------------- |
|
1560 // |
|
1561 EXPORT_C TInt CBrowserTelService::SendEmailMessageL( |
|
1562 const TDesC& aToRecipients, |
|
1563 const TDesC& aCcRecipients, |
|
1564 const TDesC& aParams, |
|
1565 const TDesC& aBody, |
|
1566 TBool aLaunchEmbedded ) |
|
1567 { |
|
1568 TELSERVICE_ENTERFN( "SendEmailMessageL()" ) |
|
1569 |
|
1570 /////////////////////////////////////////////////////////////// |
|
1571 // Determine if mailto handled via MMS from variation mechanism |
|
1572 TBool sendMms( EFalse ); |
|
1573 TInt keyVal( 0 ); |
|
1574 CRepository* repository = CRepository::NewL( KCRUidBrowserUiLV ); |
|
1575 CleanupStack::PushL( repository ); |
|
1576 if(repository->Get( KBrowserMailtoSendingApp, keyVal ) == KErrNone ) |
|
1577 { |
|
1578 sendMms = ( keyVal == 1 ); |
|
1579 } |
|
1580 CleanupStack::PopAndDestroy( repository ); |
|
1581 |
|
1582 //Search for @ and .(dot) characters |
|
1583 TInt at = aToRecipients.Locate('@'); |
|
1584 TInt dot = aToRecipients.Locate('.'); |
|
1585 TInt len = aToRecipients.Length(); |
|
1586 if(len > 0 && KErrNotFound == at && KErrNotFound == dot) |
|
1587 { |
|
1588 TELSERVICE_WRITE("CBrowserTelService::SendEmailMessageL chars @ and .(dot) are not present"); |
|
1589 sendMms = ETrue; |
|
1590 //Make sure all chars are numbers only except first char '+' |
|
1591 TInt loopCounter = 0; |
|
1592 const TUint16 *ptr = aToRecipients.Ptr(); |
|
1593 |
|
1594 if(*ptr == '+') |
|
1595 { |
|
1596 ptr = ptr + 1; |
|
1597 loopCounter = 1; |
|
1598 } |
|
1599 |
|
1600 for(loopCounter; loopCounter<len; loopCounter++) |
|
1601 { |
|
1602 if( (*ptr >= '0' && *ptr <= '9') || *ptr == ',') |
|
1603 { |
|
1604 TELSERVICE_WRITE_FORMAT("CBrowserTelService::SendEmailMessageL character: %c", *ptr ); |
|
1605 ptr = ptr + 1; |
|
1606 continue; |
|
1607 } |
|
1608 else |
|
1609 { |
|
1610 TELSERVICE_WRITE_FORMAT("CBrowserTelService::SendEmailMessageL found invalid character: %c", *ptr ); |
|
1611 TELSERVICE_WRITE("CBrowserTelService::SendEmailMessageL chars otherthan numbers are present"); |
|
1612 sendMms = EFalse; |
|
1613 break; |
|
1614 } |
|
1615 } |
|
1616 } |
|
1617 |
|
1618 if ( sendMms ) |
|
1619 { |
|
1620 TELSERVICE_WRITE("CBrowserTelService::SendEmailMessageL Sending MMS message"); |
|
1621 return SendMmsMessageL( aToRecipients, aCcRecipients, aParams, aBody, aLaunchEmbedded ); |
|
1622 } |
|
1623 |
|
1624 ///////////////////////////////// |
|
1625 // Email editor is launched. |
|
1626 TInt cleanUpCount = 0; |
|
1627 |
|
1628 CParaFormatLayer* paraFormat = CParaFormatLayer::NewL(); |
|
1629 CleanupStack::PushL( paraFormat ); |
|
1630 ++cleanUpCount; |
|
1631 |
|
1632 CCharFormatLayer* charFormat = CCharFormatLayer::NewL(); |
|
1633 CleanupStack::PushL( charFormat ); |
|
1634 ++cleanUpCount; |
|
1635 |
|
1636 CRichText* body = CRichText::NewL( paraFormat, charFormat ); |
|
1637 CleanupStack::PushL( body ); |
|
1638 ++cleanUpCount; |
|
1639 |
|
1640 if( aBody.Length() ) |
|
1641 { |
|
1642 body->InsertL( 0, aBody ); |
|
1643 } |
|
1644 else |
|
1645 { |
|
1646 body->InsertL( 0, KNullDesC ); |
|
1647 } |
|
1648 |
|
1649 CPtrC16Array* recipients = ParseRecipientsLC( aToRecipients ); |
|
1650 ++cleanUpCount; |
|
1651 CPtrC16Array* ccrecipients = ParseRecipientsLC( aCcRecipients ); |
|
1652 ++cleanUpCount; |
|
1653 |
|
1654 CSendUi* sendUi = CSendUi::NewL(); |
|
1655 CleanupStack::PushL( sendUi ); |
|
1656 ++cleanUpCount; |
|
1657 CMessageData* messageData = CMessageData::NewL(); |
|
1658 CleanupStack::PushL( messageData ); |
|
1659 ++cleanUpCount; |
|
1660 messageData->SetSubjectL( &aParams ); |
|
1661 messageData->SetBodyTextL( body ); |
|
1662 for( TInt i = 0; i < recipients->Count(); i++ ) |
|
1663 { |
|
1664 messageData->AppendToAddressL( (*recipients)[i] ); |
|
1665 } |
|
1666 for( TInt j = 0; j < ccrecipients->Count(); j++ ) |
|
1667 { |
|
1668 messageData->AppendCcAddressL( (*ccrecipients)[j] ); |
|
1669 } |
|
1670 // check first that the selected mtm supports bodytext |
|
1671 /* |
|
1672 TSendingCapabilities caps( aBody.Size(), |
|
1673 aBody.Size(), |
|
1674 TSendingCapabilities::ESupportsBodyText ); |
|
1675 if( sendUi->ValidateServiceL( KUidMsgTypeSMTP, caps ) ) |
|
1676 { |
|
1677 sendUi->CreateAndSendMessageL( KUidMsgTypeSMTP, messageData ); |
|
1678 } */ |
|
1679 sendUi->CreateAndSendMessageL( KUidMsgTypeSMTP, messageData ); |
|
1680 |
|
1681 CleanupStack::PopAndDestroy( cleanUpCount ); |
|
1682 |
|
1683 TELSERVICE_LEAVEFN( "SendEmailMessageL()" ) |
|
1684 return KErrNone; |
|
1685 } |
|
1686 |
|
1687 //--------------------------------------------------------------------------------------- |
|
1688 // CBrowserTelService::SendMmsMessageL() |
|
1689 //--------------------------------------------------------------------------------------- |
|
1690 // |
|
1691 TInt CBrowserTelService::SendMmsMessageL( |
|
1692 const TDesC& aToRecipients, |
|
1693 const TDesC& aCcRecipients, |
|
1694 const TDesC& aParams, |
|
1695 const TDesC& aBody, |
|
1696 TBool aLaunchEmbedded ) |
|
1697 { |
|
1698 TELSERVICE_ENTERFN( "SendMmsMessageL()" ) |
|
1699 |
|
1700 TInt cleanUpCount = 0; |
|
1701 // We give NULL body for the SendUi. |
|
1702 CRichText* body = NULL; |
|
1703 |
|
1704 // We need to write body to file in order to give as a attachment |
|
1705 // for the SendUi. |
|
1706 CDesCArrayFlat* attachments = NULL; |
|
1707 TFileName fileName; |
|
1708 TFileName tempPath; |
|
1709 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
1710 RFs& fs = coeEnv->FsSession(); |
|
1711 |
|
1712 attachments = new (ELeave) CDesCArrayFlat(1); |
|
1713 CleanupStack::PushL(attachments); |
|
1714 ++cleanUpCount; |
|
1715 if ( aBody.Length() > 0 ) |
|
1716 { |
|
1717 // Create plaintext object from body |
|
1718 CPlainText* text = CPlainText::NewL( CEditableText::EFlatStorage ); |
|
1719 CleanupStack::PushL( text ); |
|
1720 text->InsertL( 0, aBody ); |
|
1721 |
|
1722 TInt err = KErrNone; |
|
1723 RFileWriteStream writer; |
|
1724 tempPath.Copy(KTempDrive); |
|
1725 tempPath.Append(KTempPath); |
|
1726 err = fs.MkDirAll( tempPath ); |
|
1727 if ( err != KErrNone && err != KErrAlreadyExists ) |
|
1728 { |
|
1729 User::Leave( err ); |
|
1730 } |
|
1731 writer.PushL(); |
|
1732 User::LeaveIfError( writer.Temp( fs, tempPath, fileName, EFileWrite ) ); |
|
1733 writer.WriteUint16L(CEditableText::EByteOrderMark); |
|
1734 text->ExportTextL( 0, writer, |
|
1735 CPlainText::EOrganiseByParagraph ); |
|
1736 CleanupStack::PopAndDestroy( 2 ); // text, writer |
|
1737 attachments->AppendL( fileName ); |
|
1738 } |
|
1739 |
|
1740 // Create address arrays |
|
1741 CPtrC16Array* recipients = ParseRecipientsLC( aToRecipients ); |
|
1742 ++cleanUpCount; |
|
1743 CPtrC16Array* ccrecipients = ParseRecipientsLC( aCcRecipients ); |
|
1744 ++cleanUpCount; |
|
1745 TInt count = ccrecipients->Count(); |
|
1746 if ( count > 0 ) |
|
1747 { |
|
1748 for (TInt i = 0; i < count; i++) |
|
1749 { |
|
1750 recipients->AppendL( ccrecipients->At(i) ); |
|
1751 } |
|
1752 } |
|
1753 CleanupStack::PopAndDestroy(ccrecipients); |
|
1754 --cleanUpCount; |
|
1755 ccrecipients = NULL; |
|
1756 |
|
1757 CSendUi* sendUi = CSendUi::NewL(); |
|
1758 CleanupStack::PushL( sendUi ); |
|
1759 ++cleanUpCount; |
|
1760 CMessageData* messageData = CMessageData::NewL(); |
|
1761 CleanupStack::PushL( messageData ); |
|
1762 ++cleanUpCount; |
|
1763 messageData->SetSubjectL( &aParams ); |
|
1764 messageData->SetBodyTextL( body ); |
|
1765 for( TInt i = 0; i < recipients->Count(); i++ ) |
|
1766 { |
|
1767 messageData->AppendToAddressL( (*recipients)[i] ); |
|
1768 } |
|
1769 for( TInt j = 0; j < attachments->Count(); j++ ) |
|
1770 { |
|
1771 messageData->AppendAttachmentL( (*attachments)[j] ); |
|
1772 } |
|
1773 sendUi->CreateAndSendMessageL( KSenduiMtmMmsUid, messageData, |
|
1774 KNullUid, aLaunchEmbedded ); |
|
1775 |
|
1776 fs.Delete( fileName ); |
|
1777 CleanupStack::PopAndDestroy( cleanUpCount ); |
|
1778 |
|
1779 TELSERVICE_LEAVEFN( "SendMmsMessageL()" ) |
|
1780 return KErrNone; |
|
1781 } |
|
1782 //--------------------------------------------------------------------------------------- |
|
1783 // CBrowserTelService::DisconnectActiveCSDConnectionL() |
|
1784 //--------------------------------------------------------------------------------------- |
|
1785 // |
|
1786 EXPORT_C void CBrowserTelService::DisconnectActiveCSDConnectionL() |
|
1787 { |
|
1788 TELSERVICE_ENTERFN( "DisconnectActiveCSDConnectionL()" ) |
|
1789 |
|
1790 RSocketServ server; |
|
1791 RConnection connection; |
|
1792 TInt err( KErrNone ); |
|
1793 |
|
1794 User::LeaveIfError( server.Connect() ); |
|
1795 CleanupClosePushL<RSocketServ>( server ); |
|
1796 |
|
1797 User::LeaveIfError( connection.Open( server, KAfInet ) ); |
|
1798 CleanupClosePushL<RConnection>( connection ); |
|
1799 |
|
1800 TUint conns( 0 ); |
|
1801 connection.EnumerateConnections( conns ); |
|
1802 if( conns ) |
|
1803 // we need to check if there is any (HS)CSD conneciton |
|
1804 { |
|
1805 TPckgBuf<TConnectionInfo> connInfo; |
|
1806 TBool found = EFalse; |
|
1807 TUint index = 1; |
|
1808 for( index = 1; index <= conns; ++index ) |
|
1809 { |
|
1810 err = connection.GetConnectionInfo( index, connInfo ); |
|
1811 if( err == KErrNone ) |
|
1812 { |
|
1813 TApBearerType bearerType = EApBearerTypeGPRS; |
|
1814 |
|
1815 // Fixing SLAA-6k52P which only happens in MAGNUM. Since |
|
1816 // we only need to find if there is CSD or HSCSD, we should |
|
1817 // not leave here |
|
1818 TRAP_IGNORE( bearerType = ConnectionTypeL( connInfo().iIapId ) ); |
|
1819 |
|
1820 if( bearerType == EApBearerTypeCSD || |
|
1821 bearerType == EApBearerTypeHSCSD ) |
|
1822 { |
|
1823 found = ETrue; |
|
1824 } |
|
1825 } |
|
1826 } |
|
1827 |
|
1828 if( found ) |
|
1829 // there is active (HS)CSD. We need to close it. |
|
1830 { |
|
1831 if( ( err = connection.Attach( connInfo, |
|
1832 RConnection::EAttachTypeNormal ) ) == KErrNone ) |
|
1833 { |
|
1834 // disconnect |
|
1835 connection.Stop(); |
|
1836 } |
|
1837 TELSERVICE_WRITE( "Found active (HS)CSD connection" ) |
|
1838 } |
|
1839 } |
|
1840 |
|
1841 CleanupStack::PopAndDestroy( 2 ); // connection, server |
|
1842 |
|
1843 TELSERVICE_LEAVEFN( "DisconnectActiveCSDConnectionL()" ) |
|
1844 |
|
1845 User::LeaveIfError( err ); |
|
1846 } |
|
1847 |
|
1848 //--------------------------------------------------------------------------------------- |
|
1849 // CBrowserTelService::ShowDialogL() |
|
1850 //--------------------------------------------------------------------------------------- |
|
1851 // |
|
1852 EXPORT_C TInt CBrowserTelService::ShowDialogL( |
|
1853 const TDesC& aDynamicText, |
|
1854 const TBrowserTelServiceDlgType& aDlgType) |
|
1855 { |
|
1856 TELSERVICE_ENTERFN( "ShowDialogL()" ) |
|
1857 |
|
1858 TInt retVal = 0; |
|
1859 |
|
1860 switch( aDlgType ) |
|
1861 { |
|
1862 case EConfirmMakeCall: |
|
1863 { |
|
1864 HBufC* number = NULL; |
|
1865 HBufC* valNumber = NULL; |
|
1866 HBufC* text = NULL; |
|
1867 number = aDynamicText.AllocLC(); |
|
1868 |
|
1869 valNumber = ValidateNumberL( *number ); |
|
1870 CleanupStack::PopAndDestroy( number ); // number; |
|
1871 |
|
1872 CleanupStack::PushL( valNumber ); |
|
1873 |
|
1874 HBufC* name = SearchPbForMatchL( *valNumber ); |
|
1875 if( name ) |
|
1876 { |
|
1877 CleanupStack::PushL( name ); |
|
1878 text = StringLoader::LoadL( |
|
1879 R_QTN_WML_WTAI_CALL_NO, *name ); |
|
1880 CleanupStack::PopAndDestroy(); // name |
|
1881 CleanupStack::PushL( text ); |
|
1882 } |
|
1883 else |
|
1884 { |
|
1885 text = StringLoader::LoadLC( |
|
1886 R_QTN_WML_WTAI_CALL_NO, *valNumber ); |
|
1887 } |
|
1888 |
|
1889 retVal = TDialerDialogs::ConfirmationDlgL( |
|
1890 *text, R_CONFIRMATION_DIALOG ); |
|
1891 |
|
1892 CleanupStack::PopAndDestroy( 2 ); // valNumber, text |
|
1893 } |
|
1894 break; |
|
1895 |
|
1896 case EConfirmSendDTMF: |
|
1897 { |
|
1898 HBufC* text = StringLoader::LoadLC( |
|
1899 R_QTN_WML_WTAI_SEND_DTMF, aDynamicText, CEikonEnv::Static() ); |
|
1900 retVal = TDialerDialogs::ConfirmationDlgL( |
|
1901 *text, R_CONFIRMATION_DIALOG ); |
|
1902 CleanupStack::PopAndDestroy(); // text |
|
1903 } |
|
1904 break; |
|
1905 |
|
1906 case EConfirmAddToPb: |
|
1907 { |
|
1908 TInt index = 0; |
|
1909 CAknListQueryDialog* dlg = |
|
1910 new( ELeave ) CAknListQueryDialog( &index ); |
|
1911 if ( dlg->ExecuteLD( R_ADD_TO_CONTACTS_DIALOG ) ) |
|
1912 { |
|
1913 return index; |
|
1914 } |
|
1915 else |
|
1916 { |
|
1917 User::Leave( KErrCancel ); |
|
1918 } |
|
1919 } |
|
1920 break; |
|
1921 |
|
1922 case ESendingDTMF: |
|
1923 { |
|
1924 HBufC* text = StringLoader::LoadLC( |
|
1925 R_QTN_DTMF_SENDING_WAIT_NOTE, |
|
1926 aDynamicText, CEikonEnv::Static() ); |
|
1927 if( !iWaitDlg ) |
|
1928 { |
|
1929 TELSERVICE_WRITE( "Create Sending DTMF wait dialog" ) |
|
1930 iWaitDlg = new ( ELeave ) CAknWaitDialog( |
|
1931 reinterpret_cast<CEikDialog**>( &iWaitDlg ), ETrue ); |
|
1932 iWaitDlg->SetCallback( this ); |
|
1933 iWaitDlg->PrepareLC( R_SENDDTMF_DIALOG ); |
|
1934 iWaitDlg->SetTextL( *text ); |
|
1935 iWaitDlg->RunLD(); |
|
1936 } |
|
1937 else |
|
1938 { |
|
1939 TELSERVICE_WRITE( "Update Sending DTMF wait dialog" ) |
|
1940 iWaitDlg->SetTextL( *text ); // Just update the text |
|
1941 } |
|
1942 CleanupStack::PopAndDestroy(); // text |
|
1943 } |
|
1944 break; |
|
1945 default: |
|
1946 break; |
|
1947 } |
|
1948 TELSERVICE_LEAVEFN( "ShowDialogL()" ) |
|
1949 return retVal; |
|
1950 } |
|
1951 |
|
1952 |
|
1953 |
|
1954 //--------------------------------------------------------------------------------------- |
|
1955 // CBrowserTelService::MakeVOIPCall() |
|
1956 //--------------------------------------------------------------------------------------- |
|
1957 // |
|
1958 EXPORT_C TInt CBrowserTelService::MakeVOIPCall( TDesC& aNumber, |
|
1959 TBool aSendDTMFAlwaysConfirm ) |
|
1960 { |
|
1961 TELSERVICE_ENTERFN( "MakeVOIPCall() synchronous" ) |
|
1962 |
|
1963 TInt retVal( KErrNone ); |
|
1964 |
|
1965 iRetVal = KErrNone; |
|
1966 |
|
1967 // Flag to indicate that synchronous method was called |
|
1968 iSynch = ETrue; |
|
1969 TBool voipCall = ETrue; |
|
1970 TRAP( retVal, MakeCallL( aNumber, aSendDTMFAlwaysConfirm, voipCall ) ); |
|
1971 |
|
1972 if( retVal != KErrNone ) |
|
1973 { |
|
1974 ErrorHandler( retVal ); |
|
1975 |
|
1976 retVal = KErrCancel; |
|
1977 } |
|
1978 iSynch = EFalse; |
|
1979 |
|
1980 TELSERVICE_LEAVEFN( "MakeVOIPCall() synchronous" ) |
|
1981 return retVal; |
|
1982 } |
|
1983 |
|
1984 |
|
1985 //--------------------------------------------------------------------------------------- |
|
1986 // CBrowserTelService::DoCancel() |
|
1987 //--------------------------------------------------------------------------------------- |
|
1988 // |
|
1989 void CBrowserTelService::DoCancel() |
|
1990 { |
|
1991 TELSERVICE_ENTERFN( "DoCancel()" ) |
|
1992 |
|
1993 switch( State() ) |
|
1994 { |
|
1995 case EDialing: |
|
1996 { |
|
1997 iRCall.DialCancel(); |
|
1998 } |
|
1999 break; |
|
2000 |
|
2001 case EDialingDTMF: |
|
2002 { |
|
2003 iRAdvGsmPhone.StopDTMFTone(); |
|
2004 if( iInternalDTMFWaitStarted ) |
|
2005 { |
|
2006 // We have to hold on a bit so that the CSendAppUi is |
|
2007 // properly initialized |
|
2008 iIdle->Start( TCallBack( IdleCallback,this ) ); |
|
2009 } |
|
2010 } |
|
2011 break; |
|
2012 |
|
2013 case EConnected: |
|
2014 { |
|
2015 } |
|
2016 break; |
|
2017 |
|
2018 case EIdle: |
|
2019 default: |
|
2020 break; |
|
2021 } |
|
2022 |
|
2023 TELSERVICE_LEAVEFN( "DoCancel()" ) |
|
2024 } |
|
2025 |
|
2026 //--------------------------------------------------------------------------------------- |
|
2027 // CBrowserTelService::RunL() |
|
2028 //--------------------------------------------------------------------------------------- |
|
2029 // |
|
2030 void CBrowserTelService::RunL() |
|
2031 { |
|
2032 TELSERVICE_ENTERFN( "CBrowserTelService::RunL()" ) |
|
2033 |
|
2034 RCall::TStatus callStatus; |
|
2035 callStatus = RCall::EStatusUnknown; |
|
2036 |
|
2037 iRCall.GetStatus( callStatus ); |
|
2038 |
|
2039 TInt status = iStatus.Int(); |
|
2040 TELSERVICE_WRITE_FORMAT( "status: %d", status ); |
|
2041 TELSERVICE_WRITE_FORMAT( "callStatus: %d", callStatus ); |
|
2042 |
|
2043 if ( status != KErrNone ) |
|
2044 { |
|
2045 TELSERVICE_WRITE_FORMAT( "RunL() - iStatus error: %d", status ) |
|
2046 HandleError( status ); |
|
2047 return; |
|
2048 } |
|
2049 |
|
2050 if( status == KErrNone ) |
|
2051 { |
|
2052 switch( State() ) |
|
2053 { |
|
2054 // the call is now active |
|
2055 case EDialing: |
|
2056 { |
|
2057 TELSERVICE_WRITE( "RunL - KDialing" ) |
|
2058 |
|
2059 BringBrowserToForeground(); |
|
2060 |
|
2061 if( callStatus == RCall::EStatusConnected ) |
|
2062 { |
|
2063 SetState( EConnected ); |
|
2064 // Notify the observer |
|
2065 NotifyObservers(); |
|
2066 |
|
2067 if( iSynch ) |
|
2068 { |
|
2069 iWait.AsyncStop(); // stop the wait loop. |
|
2070 // Now DoMakeCallL will return |
|
2071 } |
|
2072 else |
|
2073 { // async variant was called |
|
2074 if( HandleInternalSendDTMFL() == EFalse ) |
|
2075 { // nothing to handle anymore |
|
2076 |
|
2077 // Complete the request |
|
2078 TELSERVICE_WRITE_FORMAT( |
|
2079 "Complete the request: %d",KErrNone ) |
|
2080 |
|
2081 User::RequestComplete( |
|
2082 iUserRequestStatus, KErrNone ); |
|
2083 } |
|
2084 } |
|
2085 } |
|
2086 } |
|
2087 break; |
|
2088 |
|
2089 // the DTMF tones have been sent |
|
2090 case EDialingDTMF: |
|
2091 { |
|
2092 TELSERVICE_WRITE( "RunL - KDialingDTMF" ) |
|
2093 |
|
2094 iRAdvGsmPhone.Close(); |
|
2095 |
|
2096 if( HandleInternalSendDTMFL() == EFalse ) |
|
2097 { // nothing to handle anymore |
|
2098 SetState( EConnected ); |
|
2099 // Notify the observer |
|
2100 NotifyObservers(); |
|
2101 |
|
2102 if( iSynch || iInternalDTMFWaitStarted ) |
|
2103 { |
|
2104 iWait.AsyncStop(); // stop the wait loop. |
|
2105 //Now SendDTMFL() will return |
|
2106 } |
|
2107 else |
|
2108 { |
|
2109 // Asynchronous method was called. |
|
2110 if( iWaitDlg ) |
|
2111 { |
|
2112 iWaitDlg->ProcessFinishedL(); |
|
2113 } |
|
2114 // Complete the request |
|
2115 TELSERVICE_WRITE_FORMAT( |
|
2116 "Complete the request: %d",KErrNone ) |
|
2117 |
|
2118 User::RequestComplete( iUserRequestStatus, KErrNone ); |
|
2119 } |
|
2120 } |
|
2121 } |
|
2122 break; |
|
2123 |
|
2124 // the call has been active, but |
|
2125 // the caller has hanged up. |
|
2126 case EConnected: |
|
2127 { |
|
2128 TELSERVICE_WRITE( "RunL - EPhoneAnswered,EConnected" ) |
|
2129 |
|
2130 if( iCallStatus == RCall::EStatusIdle || |
|
2131 iCallStatus == RCall::EStatusHangingUp ) |
|
2132 { |
|
2133 SetStateIdleAndNotifyObservers(); |
|
2134 } |
|
2135 } |
|
2136 break; |
|
2137 |
|
2138 case EIdle: |
|
2139 default: |
|
2140 { |
|
2141 TELSERVICE_WRITE( "RunL - Default" ) |
|
2142 break; |
|
2143 } |
|
2144 } |
|
2145 } |
|
2146 else |
|
2147 { |
|
2148 if ( State() == EDialing ) |
|
2149 { |
|
2150 BringBrowserToForeground(); |
|
2151 // If there is not activate voice call on |
|
2152 // changes state to EIdle. |
|
2153 CheckIsThereActivateVoiceCallOnL(); |
|
2154 // MakeCall must return error code Canceled in this case. |
|
2155 iRetVal = KErrCancel; |
|
2156 |
|
2157 if( iSynch ) |
|
2158 { |
|
2159 iWait.AsyncStop(); // stop the wait loop. |
|
2160 // Now DoMakeCallL will return |
|
2161 } |
|
2162 else |
|
2163 { // async variant was called |
|
2164 if( HandleInternalSendDTMFL() == EFalse ) |
|
2165 { // nothing to handle anymore |
|
2166 |
|
2167 // Complete the request |
|
2168 TELSERVICE_WRITE_FORMAT( |
|
2169 "Complete the request: %d",KErrNone ) |
|
2170 |
|
2171 User::RequestComplete( |
|
2172 iUserRequestStatus, KErrNone ); |
|
2173 } |
|
2174 } |
|
2175 } |
|
2176 } |
|
2177 TELSERVICE_LEAVEFN("CBrowserTelService::RunL()") |
|
2178 } |
|
2179 |
|
2180 //--------------------------------------------------------------------------------------- |
|
2181 // CBrowserTelService::CloseAllSessions() |
|
2182 //--------------------------------------------------------------------------------------- |
|
2183 // |
|
2184 void CBrowserTelService::CloseAllSessions() |
|
2185 { |
|
2186 TELSERVICE_ENTERFN( "CloseAllSessions()" ) |
|
2187 |
|
2188 iRCall.Close(); |
|
2189 iRLine.Close(); |
|
2190 iRPhone.Close(); |
|
2191 iRTelServer.Close(); |
|
2192 TELSERVICE_LEAVEFN( "CloseAllSessions()" ) |
|
2193 } |
|
2194 |
|
2195 //--------------------------------------------------------------------------------------- |
|
2196 // CBrowserTelService::SetStateIdleAndNotifyObserver() |
|
2197 //--------------------------------------------------------------------------------------- |
|
2198 // |
|
2199 void CBrowserTelService::SetStateIdleAndNotifyObservers() |
|
2200 { |
|
2201 TELSERVICE_ENTERFN("SetStateIdleAndNotifyObservers()") |
|
2202 |
|
2203 SetState( EIdle ); |
|
2204 CloseAllSessions(); |
|
2205 // Notify the observers |
|
2206 NotifyObservers(); |
|
2207 TELSERVICE_LEAVEFN( "SetStateIdleAndNotifyObservers()" ) |
|
2208 } |
|
2209 |
|
2210 //--------------------------------------------------------------------------------------- |
|
2211 // CBrowserTelService::NotifyObservers() |
|
2212 //--------------------------------------------------------------------------------------- |
|
2213 // |
|
2214 void CBrowserTelService::NotifyObservers() |
|
2215 { |
|
2216 TELSERVICE_ENTERFN( "NotifyObservers()" ) |
|
2217 |
|
2218 TInt count = iObserverList.Count(); |
|
2219 |
|
2220 for( TInt i = 0; i < count ;i++ ) |
|
2221 { |
|
2222 iObserverList[i]->BrowserTelServiceEvent( State() ); |
|
2223 } |
|
2224 TELSERVICE_LEAVEFN( "NotifyObservers()" ) |
|
2225 } |
|
2226 |
|
2227 //--------------------------------------------------------------------------------------- |
|
2228 // CBrowserTelService::NotifyObservers() |
|
2229 //--------------------------------------------------------------------------------------- |
|
2230 // |
|
2231 void CBrowserTelService::NotifyObservers( TBrowserTelServiceError aError ) |
|
2232 { |
|
2233 TELSERVICE_ENTERFN( "NotifyObservers( TBrowserTelServiceError )" ) |
|
2234 |
|
2235 TInt count = iObserverList.Count(); |
|
2236 |
|
2237 for( TInt i = 0; i < count; i++) |
|
2238 { |
|
2239 iObserverList[i]->BrowserTelServiceError( aError ); |
|
2240 } |
|
2241 TELSERVICE_LEAVEFN( "NotifyObservers(TBrowserTelServiceError)" ) |
|
2242 } |
|
2243 |
|
2244 //--------------------------------------------------------------------------------------- |
|
2245 // CBrowserTelService::HandleError() |
|
2246 // |
|
2247 //--------------------------------------------------------------------------------------- |
|
2248 // |
|
2249 void CBrowserTelService::HandleError( TInt aError ) |
|
2250 { |
|
2251 TELSERVICE_ENTERFN( "HandleError()" ) |
|
2252 |
|
2253 switch( State() ) |
|
2254 { |
|
2255 case EDialingDTMF: |
|
2256 { |
|
2257 iRAdvGsmPhone.Close(); // close RAdvGsmPhone session. |
|
2258 NotifyObservers( ESendDTMFFailed ); |
|
2259 SetState( EConnected ); |
|
2260 NotifyObservers(); |
|
2261 } |
|
2262 break; |
|
2263 |
|
2264 case EDialing: |
|
2265 case EConnected: |
|
2266 { |
|
2267 Cancel(); |
|
2268 } |
|
2269 break; |
|
2270 |
|
2271 case EIdle: |
|
2272 default: |
|
2273 break; |
|
2274 } |
|
2275 |
|
2276 iRetVal = aError; |
|
2277 |
|
2278 if( iSynch || iInternalDTMFWaitStarted ) |
|
2279 { |
|
2280 iWait.AsyncStop(); // stop the wait loop. |
|
2281 // Now synchronous method will return |
|
2282 } |
|
2283 else |
|
2284 { |
|
2285 // Asynchronous method was called. |
|
2286 // Complete the request |
|
2287 TELSERVICE_WRITE_FORMAT( "Complete the request: %d", aError ) |
|
2288 User::RequestComplete( iUserRequestStatus, aError ); |
|
2289 } |
|
2290 TELSERVICE_LEAVEFN( "HandleError()" ) |
|
2291 } |
|
2292 |
|
2293 //--------------------------------------------------------------------------------------- |
|
2294 // CBrowserTelService::EtelWatcherEvent() |
|
2295 //--------------------------------------------------------------------------------------- |
|
2296 // |
|
2297 void CBrowserTelService::BrowserTelServiceEtelWatcherEvent( |
|
2298 RCall::TStatus& aStatus ) |
|
2299 { |
|
2300 TELSERVICE_ENTERFN( "EtelWatcherEvent()" ) |
|
2301 |
|
2302 if( aStatus == RCall::EStatusIdle ) |
|
2303 { |
|
2304 // the call recepient has hung up without answering the call, |
|
2305 // so lets reset our state and notify observers |
|
2306 |
|
2307 Cancel(); |
|
2308 SetStateIdleAndNotifyObservers(); |
|
2309 |
|
2310 iRetVal = KErrUserBusy; |
|
2311 |
|
2312 if( iSynch ) |
|
2313 { |
|
2314 iWait.AsyncStop(); // stop the wait loop. |
|
2315 // Now DoMakeCallL will return |
|
2316 } |
|
2317 else |
|
2318 { |
|
2319 // Asynchronous method was called. |
|
2320 // Complete the request |
|
2321 TELSERVICE_WRITE_FORMAT( "Complete the request: %d", KErrUserBusy ) |
|
2322 User::RequestComplete( iUserRequestStatus, KErrUserBusy ); |
|
2323 } |
|
2324 } |
|
2325 TELSERVICE_LEAVEFN( "EtelWatcherEvent()" ) |
|
2326 } |
|
2327 |
|
2328 //--------------------------------------------------------------------------------------- |
|
2329 // CBrowserTelService::ConnectionStageAchievedL() |
|
2330 //--------------------------------------------------------------------------------------- |
|
2331 // |
|
2332 void CBrowserTelService::ConnectionStageAchievedL() |
|
2333 { |
|
2334 TELSERVICE_ENTERFN( "ConnectionStageAchievedL()" ) |
|
2335 iAgentDisconnected = ETrue; |
|
2336 if( iWait.IsStarted() ) |
|
2337 { |
|
2338 iWait.AsyncStop(); |
|
2339 } |
|
2340 TELSERVICE_LEAVEFN( "ConnectionStageAchievedL()" ) |
|
2341 } |
|
2342 |
|
2343 //--------------------------------------------------------------------------------------- |
|
2344 // CBrowserTelService::SearchPbForMatchL() |
|
2345 //--------------------------------------------------------------------------------------- |
|
2346 // |
|
2347 HBufC* CBrowserTelService::SearchPbForMatchL( |
|
2348 const TDesC& aPhoneNumber ) |
|
2349 { |
|
2350 TELSERVICE_ENTERFN( "SearchPbForMatchL()" ) |
|
2351 |
|
2352 HBufC* matchingName = NULL; |
|
2353 |
|
2354 // Create phonebook engine |
|
2355 CPbkContactEngine* pbkEngine = CPbkContactEngine::NewL(); |
|
2356 CleanupStack::PushL( pbkEngine ); |
|
2357 |
|
2358 // Make sure a resource file is available |
|
2359 RPbkViewResourceFile pbkResourceFile( *CCoeEnv::Static() ); |
|
2360 pbkResourceFile.OpenL(); |
|
2361 CleanupClosePushL<RPbkViewResourceFile> ( pbkResourceFile ); |
|
2362 |
|
2363 CContactIdArray* idArray = SearchPbForMatchLC( *pbkEngine |
|
2364 ,aPhoneNumber |
|
2365 ,EPhoneNumber |
|
2366 ); |
|
2367 |
|
2368 if( idArray->Count() ) |
|
2369 { |
|
2370 // retrive contact's full matching name |
|
2371 CPbkContactItem* item = pbkEngine->ReadMinimalContactLC( (*idArray)[0] ); |
|
2372 |
|
2373 matchingName = item->GetContactTitleOrNullL(); |
|
2374 |
|
2375 CleanupStack::PopAndDestroy( item ); |
|
2376 } |
|
2377 |
|
2378 CleanupStack::PopAndDestroy( 3 ); // idArray, pbkResourceFile, pbkEngine |
|
2379 |
|
2380 TELSERVICE_LEAVEFN("SearchPbForMatchL()") |
|
2381 |
|
2382 return matchingName; |
|
2383 } |
|
2384 |
|
2385 //--------------------------------------------------------------------------------------- |
|
2386 // CBrowserTelService::SearchPbForMatchLC() |
|
2387 //--------------------------------------------------------------------------------------- |
|
2388 // |
|
2389 CContactIdArray* CBrowserTelService::SearchPbForMatchLC( |
|
2390 CPbkContactEngine& aPbkEngine, |
|
2391 const TDesC& aToMatch, |
|
2392 const TMatchType& aMatchType ) |
|
2393 { |
|
2394 TELSERVICE_ENTERFN( "SearchPbForMatchLC()" ) |
|
2395 |
|
2396 CContactIdArray* idArray = NULL; |
|
2397 |
|
2398 if( aMatchType == EPhoneNumber ) |
|
2399 { |
|
2400 idArray = aPbkEngine.MatchPhoneNumberL( aToMatch, aToMatch.Length() ); |
|
2401 } |
|
2402 else if( aMatchType == EEmail ) |
|
2403 { |
|
2404 CPbkFieldIdArray* findFrom = new( ELeave ) CPbkFieldIdArray; |
|
2405 CleanupStack::PushL( findFrom ); |
|
2406 |
|
2407 findFrom->AppendL( EPbkFieldIdEmailAddress ); |
|
2408 idArray = aPbkEngine.FindLC( aToMatch, findFrom ); |
|
2409 |
|
2410 CleanupStack::Pop( idArray ); |
|
2411 CleanupStack::PopAndDestroy( findFrom ); |
|
2412 } |
|
2413 |
|
2414 CleanupStack::PushL( idArray ); |
|
2415 TELSERVICE_LEAVEFN( "SearchPbForMatchLC()" ) |
|
2416 return idArray; |
|
2417 } |
|
2418 |
|
2419 //--------------------------------------------------------------------------------------- |
|
2420 // CBrowserTelService::IdleCallback() |
|
2421 //--------------------------------------------------------------------------------------- |
|
2422 // |
|
2423 TInt CBrowserTelService::IdleCallback( TAny* aTelService ) |
|
2424 { |
|
2425 TELSERVICE_ENTERFN( "IdleCallback()" ) |
|
2426 ( ( CBrowserTelService* ) aTelService )->DoIdleCallback(); |
|
2427 TELSERVICE_LEAVEFN( "IdleCallback()" ) |
|
2428 return EFalse; // return false since we don't want to run idle again |
|
2429 } |
|
2430 |
|
2431 //--------------------------------------------------------------------------------------- |
|
2432 // CBrowserTelService::IdleCallback() |
|
2433 //--------------------------------------------------------------------------------------- |
|
2434 // |
|
2435 void CBrowserTelService::DoIdleCallback() |
|
2436 { |
|
2437 TELSERVICE_WRITE( "DoIdleCallback()" ) |
|
2438 iWait.AsyncStop(); |
|
2439 } |
|
2440 |
|
2441 // --------------------------------------------------------- |
|
2442 // CBrowserTelService::DialogDismissedL |
|
2443 // --------------------------------------------------------- |
|
2444 // |
|
2445 void CBrowserTelService::DialogDismissedL( TInt aButtonId ) |
|
2446 { |
|
2447 TELSERVICE_ENTERFN( "DialogDismissedL()" ) |
|
2448 |
|
2449 if ( aButtonId == EAknSoftkeyCancel ) |
|
2450 { |
|
2451 Cancel(); |
|
2452 } |
|
2453 iWaitDlg = NULL; // Dialog will delete itself; prevent DoCancel |
|
2454 // deleting it beforehand. |
|
2455 TELSERVICE_LEAVEFN( "DialogDismissedL()" ) |
|
2456 } |
|
2457 |
|
2458 // --------------------------------------------------------- |
|
2459 // CBrowserTelService::HandleInternalSendDTMFL |
|
2460 // --------------------------------------------------------- |
|
2461 // |
|
2462 TBool CBrowserTelService::HandleInternalSendDTMFL() |
|
2463 { |
|
2464 TELSERVICE_ENTERFN( "HandleInternalSendDTMFL()" ) |
|
2465 |
|
2466 iSynch = EFalse; // Reset to EFalse since the HandleInternalSendDTMFL() |
|
2467 // is asynchronous! |
|
2468 |
|
2469 if( !(iSendableDTMFNumbers && iDlgDTMFNumbers) ) |
|
2470 { |
|
2471 return EFalse; |
|
2472 } |
|
2473 |
|
2474 TBool retVal = EFalse; |
|
2475 |
|
2476 CRepository* repository = CRepository::NewL( KCRUidBrowser ); |
|
2477 CleanupStack::PushL (repository ); |
|
2478 repository->Get( KBrowserConfirmedDTMFOnce, iConfirmedOnce ); |
|
2479 |
|
2480 if( iSendableDTMFNumbers->Count() > 0 && iDlgDTMFNumbers->Count() > 0 ) |
|
2481 { |
|
2482 TELSERVICE_WRITE( "we have dtmf numbers to send" ) |
|
2483 TInt sendDTMF = 1; |
|
2484 TPtr sendableNumberPtr = iSendableDTMFNumbers->At(0)->Des(); |
|
2485 TPtr dlgNumberPtr = iDlgDTMFNumbers->At(0)->Des(); |
|
2486 |
|
2487 if( DisplaySendDTMFDialog( &dlgNumberPtr ) ) |
|
2488 { |
|
2489 if( dlgNumberPtr.Length() > 0 ) |
|
2490 { |
|
2491 TELSERVICE_WRITE( "display send dtmf dialog" ) |
|
2492 if( iDTMFAlwaysConfirm ) |
|
2493 { |
|
2494 sendDTMF = ShowDialogL( dlgNumberPtr,EConfirmSendDTMF ); |
|
2495 } |
|
2496 else if( iDTMFAlwaysConfirm == EFalse && |
|
2497 iConfirmedOnce == EFalse ) |
|
2498 { |
|
2499 sendDTMF = ShowDialogL( dlgNumberPtr, |
|
2500 EConfirmSendDTMF ); |
|
2501 iConfirmedOnce = ETrue; |
|
2502 repository->Set( KBrowserConfirmedDTMFOnce, iConfirmedOnce ); |
|
2503 } |
|
2504 else |
|
2505 { |
|
2506 sendDTMF = 1; |
|
2507 } |
|
2508 } |
|
2509 else |
|
2510 { |
|
2511 TELSERVICE_WRITE("don't display send dtmf dialog dlgNumberPtr.Length() < 0") |
|
2512 sendDTMF = 0; |
|
2513 } |
|
2514 } |
|
2515 else |
|
2516 { |
|
2517 TELSERVICE_WRITE( "don't display send dtmf dialog" ) |
|
2518 |
|
2519 if( dlgNumberPtr.Length() > 0 ) |
|
2520 { |
|
2521 TELSERVICE_WRITE( "start dtmf wait timer" ) |
|
2522 |
|
2523 RTimer timer; |
|
2524 TRequestStatus timerStatus; // request status |
|
2525 // associated with timer |
|
2526 timer.CreateLocal(); // create for this thread |
|
2527 timer.After( timerStatus, KTimerDelay ); // pause for 2,5 |
|
2528 // seconds |
|
2529 User::WaitForRequest( timerStatus ); |
|
2530 timer.Close(); |
|
2531 } |
|
2532 else |
|
2533 { |
|
2534 sendDTMF = 0; |
|
2535 } |
|
2536 } |
|
2537 |
|
2538 if( sendDTMF ) |
|
2539 { |
|
2540 TELSERVICE_WRITE( "Send the DTMF" ) |
|
2541 |
|
2542 RipWaitChar( &sendableNumberPtr ); |
|
2543 ValidateDTMFNumberL( &sendableNumberPtr ); |
|
2544 // Send DTMF tones |
|
2545 DoSendDTMFL( sendableNumberPtr ); |
|
2546 |
|
2547 TELSERVICE_WRITE( "DoSendDTMFL() ok!" ) |
|
2548 |
|
2549 ShowDialogL( dlgNumberPtr, ESendingDTMF ); |
|
2550 retVal = ETrue; |
|
2551 } |
|
2552 |
|
2553 iSendableDTMFNumbers->Delete(0); |
|
2554 iSendableDTMFNumbers->Compress(); |
|
2555 iDlgDTMFNumbers->Delete(0); |
|
2556 iDlgDTMFNumbers->Compress(); |
|
2557 } |
|
2558 |
|
2559 CleanupStack::PopAndDestroy( repository ); |
|
2560 |
|
2561 TELSERVICE_LEAVEFN( "HandleInternalSendDTMFL()" ) |
|
2562 return retVal; |
|
2563 } |
|
2564 |
|
2565 // --------------------------------------------------------------------------- |
|
2566 // CBrowserTelService::BringBrowserToForeground |
|
2567 // --------------------------------------------------------------------------- |
|
2568 // |
|
2569 void CBrowserTelService::BringBrowserToForeground() |
|
2570 { |
|
2571 TELSERVICE_ENTERFN( "BringBrowserToForeground()" ) |
|
2572 TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); |
|
2573 TUid wapUid = KUidBrowserApplication; |
|
2574 TApaTask task = taskList.FindApp( wapUid ); |
|
2575 task.BringToForeground(); |
|
2576 TELSERVICE_LEAVEFN( "BringBrowserToForeground()" ) |
|
2577 } |
|
2578 |
|
2579 // --------------------------------------------------------------------------- |
|
2580 // CBrowserTelService::CheckIsThereActivateVoiceCallOnL |
|
2581 // --------------------------------------------------------------------------- |
|
2582 // |
|
2583 void CBrowserTelService::CheckIsThereActivateVoiceCallOnL() |
|
2584 { |
|
2585 RTelServer::TPhoneInfo info; |
|
2586 RPhone::TLineInfo lineInfo; |
|
2587 RLine::TLineInfo callInfo; |
|
2588 |
|
2589 // Connect to the telephony server and load the TSY. |
|
2590 User::LeaveIfError( iRTelServer.Connect() ); |
|
2591 User::LeaveIfError( iRTelServer.LoadPhoneModule( KMmTsyModuleName ) ); |
|
2592 // Get the details for the first (and only) phone. |
|
2593 User::LeaveIfError( iRTelServer.GetPhoneInfo( 0, info ) ); |
|
2594 // Open the phone. |
|
2595 iRPhone.Close(); |
|
2596 User::LeaveIfError( iRPhone.Open( iRTelServer, info.iName ) ); |
|
2597 // Get the information for the voice line, line 0. |
|
2598 User::LeaveIfError( iRPhone.GetLineInfo( 0, lineInfo ) ); |
|
2599 |
|
2600 if( lineInfo.iStatus > RCall::EStatusIdle ) |
|
2601 { |
|
2602 TELSERVICE_WRITE( "There's an active call" ); |
|
2603 // Open the line. iName will now be "VoiceLine1". |
|
2604 iRLine.Close(); |
|
2605 User::LeaveIfError( iRLine.Open( iRPhone, KMmTsyVoice1LineName ) ); |
|
2606 TInt count; |
|
2607 // Gets the number of calls opened from a line. |
|
2608 User::LeaveIfError( iRLine.EnumerateCall( count ) ); |
|
2609 if ( count >= 1 ) |
|
2610 { |
|
2611 SetState( EConnected ); |
|
2612 User::LeaveIfError( iRLine.GetInfo( callInfo ) ); |
|
2613 iRCall.Close(); |
|
2614 |
|
2615 User::LeaveIfError( iRCall.OpenExistingCall( iRLine, |
|
2616 callInfo.iNameOfLastCallAdded ) ); |
|
2617 } |
|
2618 else |
|
2619 { |
|
2620 SetState( EIdle ); |
|
2621 } |
|
2622 } |
|
2623 else |
|
2624 { |
|
2625 TELSERVICE_WRITE( "No active call" ); |
|
2626 SetState( EIdle ); |
|
2627 } |
|
2628 } |
|
2629 |
|
2630 // --------------------------------------------------------------------------- |
|
2631 // CBrowserTelService::CheckDTMFNumber |
|
2632 // --------------------------------------------------------------------------- |
|
2633 // |
|
2634 void CBrowserTelService::CheckDTMFNumberL( TDesC& aNumber ) |
|
2635 { |
|
2636 TBool multiw = EFalse; |
|
2637 TBool multikeno = EFalse; |
|
2638 |
|
2639 for ( TInt i = 0; i < aNumber.Length(); i++ ) |
|
2640 { |
|
2641 if( (KValidDTMFChars().Locate( aNumber[i] ) ) == KErrNotFound ) |
|
2642 { |
|
2643 User::Leave( KErrArgument ); |
|
2644 } |
|
2645 else |
|
2646 { |
|
2647 if( aNumber[i] == 'w' ) |
|
2648 { |
|
2649 if( multiw ) |
|
2650 { |
|
2651 User::Leave( KErrArgument ); |
|
2652 } |
|
2653 multiw = ETrue; |
|
2654 } |
|
2655 else if( aNumber[i] == '/' ) |
|
2656 { |
|
2657 if( multikeno ) |
|
2658 { |
|
2659 User::Leave( KErrArgument ); |
|
2660 } |
|
2661 multikeno = ETrue; |
|
2662 } |
|
2663 } |
|
2664 } |
|
2665 } |
|
2666 |
|
2667 // --------------------------------------------------------------------------- |
|
2668 // CBrowserTelService::CheckDTMFNumber |
|
2669 // --------------------------------------------------------------------------- |
|
2670 // |
|
2671 CPbkContactItem* CBrowserTelService::SearchPBItemLC( CPbkContactEngine& aPbkEngine, |
|
2672 TDesC& aNumber, |
|
2673 TDesC& aEmail, |
|
2674 TBool& aNewContact ) |
|
2675 { |
|
2676 CPbkContactItem* contactItem = NULL; |
|
2677 CContactIdArray* idArrayPhoneNr = SearchPbForMatchLC( aPbkEngine, aNumber, EPhoneNumber ); |
|
2678 CContactIdArray* idArrayEmail = SearchPbForMatchLC( aPbkEngine, aEmail, EEmail ); |
|
2679 |
|
2680 aNewContact = ETrue; |
|
2681 |
|
2682 if( idArrayPhoneNr->Count() && aNumber.Length() ) |
|
2683 { |
|
2684 // Open existing |
|
2685 if ( ShowDialogL( aNumber, EConfirmAddToPb ) ) |
|
2686 { |
|
2687 contactItem = aPbkEngine.OpenContactL( ( *idArrayPhoneNr )[0] ); |
|
2688 aNewContact = EFalse; |
|
2689 } |
|
2690 else |
|
2691 { |
|
2692 // Create a new contact |
|
2693 contactItem = aPbkEngine.CreateEmptyContactL(); |
|
2694 } |
|
2695 |
|
2696 } |
|
2697 else if( idArrayEmail->Count() && aEmail.Length() ) |
|
2698 { |
|
2699 if ( ShowDialogL( aEmail, EConfirmAddToPb ) ) |
|
2700 { |
|
2701 // Open existing |
|
2702 contactItem = aPbkEngine.OpenContactL( ( *idArrayEmail )[0] ); |
|
2703 aNewContact = EFalse; |
|
2704 } |
|
2705 else |
|
2706 { |
|
2707 // Create a new contact |
|
2708 contactItem = aPbkEngine.CreateEmptyContactL(); |
|
2709 } |
|
2710 } |
|
2711 else |
|
2712 { |
|
2713 // Create a new contact |
|
2714 contactItem = aPbkEngine.CreateEmptyContactL(); |
|
2715 } |
|
2716 |
|
2717 CleanupStack::PopAndDestroy( 2 ); // idArrayEmail,idArrayPhoneNr |
|
2718 |
|
2719 CleanupStack::PushL( contactItem ); |
|
2720 |
|
2721 return contactItem; |
|
2722 } |
|
2723 |
|
2724 // --------------------------------------------------------------------------- |
|
2725 // CBrowserTelService::SetPBEntryField() |
|
2726 // --------------------------------------------------------------------------- |
|
2727 // |
|
2728 void CBrowserTelService::SetPBEntryFieldL( TInt aField, |
|
2729 CPbkContactEngine* aPbkEngine, |
|
2730 CPbkContactItem* aContactItem, |
|
2731 const TPtrC& aFieldValue, |
|
2732 TInt& aFormIndex ) |
|
2733 { |
|
2734 if( aFieldValue.Length() ) |
|
2735 { |
|
2736 TPbkContactItemField *dataField = aContactItem->FindField( aField ); |
|
2737 |
|
2738 if( !dataField ) |
|
2739 { |
|
2740 CPbkFieldInfo* newFieldType = NULL; |
|
2741 |
|
2742 for ( TInt i = 0; !newFieldType && |
|
2743 i < aPbkEngine->FieldsInfo().Count(); ++i ) |
|
2744 { |
|
2745 CPbkFieldInfo* fieldInfo = aPbkEngine->FieldsInfo()[i]; |
|
2746 if( fieldInfo->FieldId() == aField ) |
|
2747 { |
|
2748 // we found the proper field. Yeah! |
|
2749 newFieldType = fieldInfo; |
|
2750 } |
|
2751 } |
|
2752 // add new field |
|
2753 dataField = aContactItem->AddOrReturnUnusedFieldL( *newFieldType ); |
|
2754 } |
|
2755 |
|
2756 if( dataField ) |
|
2757 { |
|
2758 // Put the data to the field |
|
2759 dataField->TextStorage()->SetTextL( aFieldValue ); |
|
2760 if( aFormIndex == -1 ) |
|
2761 { |
|
2762 aFormIndex = aContactItem->FindFieldIndex( *dataField ); |
|
2763 } |
|
2764 } |
|
2765 } |
|
2766 } |
|
2767 |
|
2768 // --------------------------------------------------------------------------- |
|
2769 // CBrowserTelService::ParseRecipientsLC |
|
2770 // --------------------------------------------------------------------------- |
|
2771 // |
|
2772 CPtrC16Array* CBrowserTelService::ParseRecipientsLC( const TDesC& aRecipients ) |
|
2773 { |
|
2774 CPtrC16Array* recips = new( ELeave ) CPtrC16Array( 2 ); |
|
2775 |
|
2776 CleanupStack::PushL( recips ); |
|
2777 |
|
2778 if( aRecipients.Length() ) |
|
2779 { |
|
2780 TPtrC tempRec( aRecipients ); |
|
2781 |
|
2782 do |
|
2783 { |
|
2784 int posComma = tempRec.Find( _L(",") ); |
|
2785 |
|
2786 |
|
2787 if( posComma != KErrNotFound ) |
|
2788 { |
|
2789 recips->AppendL( tempRec.Left( posComma ) ); |
|
2790 tempRec.Set( tempRec.Right( tempRec.Length() - posComma - 1 ) ); |
|
2791 } |
|
2792 else |
|
2793 { |
|
2794 recips->AppendL( tempRec ); |
|
2795 tempRec.Set( KNullDesC ); |
|
2796 } |
|
2797 |
|
2798 }while( tempRec.Length() ); |
|
2799 } |
|
2800 |
|
2801 return recips; |
|
2802 } |
|
2803 |
|
2804 // --------------------------------------------------------------------------- |
|
2805 // CBrowserTelService::ConnectionTypeL |
|
2806 // --------------------------------------------------------------------------- |
|
2807 // |
|
2808 TApBearerType CBrowserTelService::ConnectionTypeL( TUint aApId ) |
|
2809 { |
|
2810 CCommsDatabase* commsDb = CCommsDatabase::NewL( EDatabaseTypeIAP ); |
|
2811 CleanupStack::PushL( commsDb ); |
|
2812 |
|
2813 CApDataHandler* apDataHandler = CApDataHandler::NewLC( *commsDb ); |
|
2814 TUint32 apId = 0; |
|
2815 CApUtils* apUtils = CApUtils::NewLC( *commsDb ); |
|
2816 |
|
2817 apId = apUtils->WapIdFromIapIdL( aApId ); |
|
2818 |
|
2819 CleanupStack::PopAndDestroy(); //apUtils |
|
2820 apUtils = NULL; |
|
2821 |
|
2822 CApAccessPointItem* apItem = CApAccessPointItem::NewLC(); |
|
2823 |
|
2824 apDataHandler->AccessPointDataL( apId, *apItem ); |
|
2825 |
|
2826 TApBearerType bearerType = apItem->BearerTypeL(); |
|
2827 |
|
2828 CleanupStack::PopAndDestroy( 3 ); // apItem, apDataHandler, commsDb |
|
2829 |
|
2830 return bearerType; |
|
2831 } |
|
2832 |
|
2833 //--------------------------------------------------------------------------------------- |
|
2834 // CBrowserTelService::ErrorHandler() |
|
2835 //--------------------------------------------------------------------------------------- |
|
2836 // |
|
2837 void CBrowserTelService::ErrorHandler( TInt aErrorId ) |
|
2838 { |
|
2839 TELSERVICE_WRITE_FORMAT( "Error handler: %d", aErrorId ); |
|
2840 |
|
2841 if( aErrorId == KErrCancel ) |
|
2842 { |
|
2843 return; |
|
2844 } |
|
2845 |
|
2846 TInt i; |
|
2847 for( i = 0; KErrorConvTable[i][0] && KErrorConvTable[i][0] != aErrorId; ++i ){}; |
|
2848 |
|
2849 if( KErrorConvTable[i][0] ) |
|
2850 { |
|
2851 // If KErrorConvTable[i][1] is 0 it's already handled by the system |
|
2852 if( KErrorConvTable[i][1] ) |
|
2853 { |
|
2854 TRAP_IGNORE( iErrorUi->ShowGlobalErrorNoteL( -(KErrorConvTable[i][1] + KKimonoBase )) ); |
|
2855 } |
|
2856 } |
|
2857 else |
|
2858 // global error id is received |
|
2859 { |
|
2860 TRAP_IGNORE( iErrorUi->ShowGlobalErrorNoteL( aErrorId ) ); |
|
2861 } |
|
2862 } |
|
2863 |
|
2864 #ifdef __BROWSER_TEL_SERVICES_CALLUI__ |
|
2865 |
|
2866 //--------------------------------------------------------------------------------------- |
|
2867 // CBrowserTelService::HandleNotifyL() |
|
2868 //--------------------------------------------------------------------------------------- |
|
2869 // |
|
2870 TInt CBrowserTelService::HandleNotifyL( TInt /*aCmdId*/, |
|
2871 TInt /*aEventId*/, |
|
2872 CAiwGenericParamList& /*aEventParamList*/, |
|
2873 const CAiwGenericParamList& /*aInParamList*/ ) |
|
2874 { |
|
2875 TELSERVICE_ENTERFN("CBrowserTelService::HandleNotifyL"); |
|
2876 |
|
2877 if( iSynch && iWait.IsStarted() ) |
|
2878 { |
|
2879 iWait.AsyncStop(); // stop the wait loop. |
|
2880 // Now DoMakeCallL will return |
|
2881 } |
|
2882 else |
|
2883 { |
|
2884 // The client is not interested what happened! |
|
2885 iSynch = EFalse; // Just in case not to start iWait after ExecuteServiceCmdL |
|
2886 if( iUserRequestStatus ) |
|
2887 { |
|
2888 User::RequestComplete( iUserRequestStatus, KErrNone ); |
|
2889 } |
|
2890 } |
|
2891 |
|
2892 TELSERVICE_LEAVEFN( "CBrowserTelService::HandleNotifyL" ); |
|
2893 return KErrNone; |
|
2894 } |
|
2895 |
|
2896 #endif // __BROWSER_TEL_SERVICES_CALLUI__ |
|
2897 |
|
2898 // ================= OTHER EXPORTED FUNCTIONS ============== |
|
2899 |