|
1 /* |
|
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Actual notifier implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <eikenv.h> |
|
20 #include <bautils.h> |
|
21 #include <eikclbd.h> |
|
22 #include <eikimage.h> |
|
23 #include <cchuinotif.rsg> |
|
24 #include <StringLoader.h> |
|
25 #include <aknnotewrappers.h> |
|
26 #include <cenrepnotifyhandler.h> |
|
27 #include <ctsydomainpskeys.h> |
|
28 #include <crcseprofileregistry.h> |
|
29 #include <sipprofile.h> |
|
30 #include <sipmanagedprofileregistry.h> |
|
31 #include <AknNotiferAppServerApplication.h> // Application Key enable/disable |
|
32 |
|
33 #include "cchuilogger.h" |
|
34 #include "cchuicommon.hrh" |
|
35 #include "cchuinotifierimpl.h" |
|
36 #include "cchuipluginbrandinghandler.h" |
|
37 #include "cchuinotifconnectionhandler.h" |
|
38 #include "cchuicallstatelistener.h" |
|
39 |
|
40 const TUint32 KBearerSettingWlanOnly = 1; |
|
41 |
|
42 // ======== MEMBER FUNCTIONS ======== |
|
43 |
|
44 CCCHUiNotifierImpl::CCCHUiNotifierImpl() |
|
45 { |
|
46 } |
|
47 |
|
48 CCCHUiNotifierImpl* CCCHUiNotifierImpl::NewL() |
|
49 { |
|
50 CCCHUiNotifierImpl* self = new (ELeave) CCCHUiNotifierImpl(); |
|
51 CleanupStack::PushL( self ); |
|
52 self->ConstructL(); |
|
53 CleanupStack::Pop( self ); |
|
54 return self; |
|
55 } |
|
56 |
|
57 void CCCHUiNotifierImpl::ConstructL() |
|
58 { |
|
59 CCCHUiNotifierBase::ConstructL(); |
|
60 iCallStateListener = CCchUiCallStateListener::NewL( *this ); |
|
61 iSipProfileRegistry = CSIPManagedProfileRegistry::NewL( *this ); |
|
62 } |
|
63 |
|
64 CCCHUiNotifierImpl::~CCCHUiNotifierImpl() |
|
65 { |
|
66 CCHUIDEBUG( "CCCHUiNotifierImpl::~CCCHUiNotifierImpl - IN" ); |
|
67 |
|
68 if ( iAppKeyBlocked ) |
|
69 { |
|
70 // Remove application key blocking |
|
71 (void) ((CAknNotifierAppServerAppUi*) |
|
72 iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse); |
|
73 iAppKeyBlocked = EFalse; |
|
74 } |
|
75 |
|
76 CCCHUiNotifierBase::Cancel(); |
|
77 iListQueryDialog = NULL; |
|
78 delete iBrandingHandler; |
|
79 delete iCallStateListener; |
|
80 |
|
81 CCHUIDEBUG( "CCCHUiNotifierImpl::~CCCHUiNotifierImpl - OUT" ); |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // RunL |
|
86 // From CActive. |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 void CCCHUiNotifierImpl::RunL( ) |
|
90 { |
|
91 CCHUIDEBUG( "CCCHUiNotifierImpl::RunL - IN" ); |
|
92 |
|
93 switch( iDialogMode ) |
|
94 { |
|
95 // Only ECchUiDialogTypeNoConnectionAvailable is launched via RunL |
|
96 // currently. |
|
97 case MCchUiObserver::ECchUiDialogTypeNoConnectionAvailable: |
|
98 { |
|
99 CCHUIDEBUG( "CCCHUiNotifierImpl::RunL - ECchUiDialogTypeNoConnectionAvailable" ); |
|
100 ShowNoConnectionsQueryL( iReplySlot, iMessage, iServiceId, EFalse ); |
|
101 } |
|
102 break; |
|
103 |
|
104 default: |
|
105 { |
|
106 CCHUIDEBUG( "CCCHUiNotifierImpl::RunL - Does nothing" ); |
|
107 } |
|
108 break; |
|
109 } |
|
110 |
|
111 CCHUIDEBUG( " CCCHUiNotifierImpl::RunL - OUT" ); |
|
112 } |
|
113 |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 // From class MEikSrvNotifierBase2. |
|
117 // Cancelling method. |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 void CCCHUiNotifierImpl::Cancel() |
|
121 { |
|
122 CCHUIDEBUG( "CCCHUiNotifierImpl::Cancel - IN" ); |
|
123 if ( iListQueryDialog ) |
|
124 { |
|
125 delete iListQueryDialog; |
|
126 iListQueryDialog = NULL; |
|
127 CCCHUiNotifierBase::Cancel(); |
|
128 } |
|
129 |
|
130 CCHUIDEBUG( "CCCHUiNotifierImpl::Cancel - OUT" ); |
|
131 } |
|
132 |
|
133 |
|
134 // --------------------------------------------------------------------------- |
|
135 // Shows username & password query. |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
|
138 void CCCHUiNotifierImpl::ShowUsernamePasswordQueryL( |
|
139 TInt aReplySlot, |
|
140 const RMessagePtr2& aMessage, |
|
141 TUint aServiceId, |
|
142 const TDesC& aUserName ) |
|
143 { |
|
144 CCHUIDEBUG( "CCCHUiNotifierImpl::ShowUsernamePasswordQueryL - IN" ); |
|
145 |
|
146 iMessage = aMessage; |
|
147 iReplySlot = aReplySlot; |
|
148 |
|
149 HBufC* userName = HBufC::NewLC( KUserNameLength ); |
|
150 HBufC* passWord = HBufC::NewLC( KPasswordLength ); |
|
151 |
|
152 // Set current username |
|
153 userName->Des().Copy( aUserName ); |
|
154 |
|
155 TPtr ptrUserName( userName->Des() ); |
|
156 TPtr ptrPassWord( passWord->Des() ); |
|
157 |
|
158 CCHUIDEBUG( "ShowUsernamePasswordQueryL - create query"); |
|
159 |
|
160 CAknMultiLineDataQueryDialog* dlg = CAknMultiLineDataQueryDialog::NewL( |
|
161 ptrUserName, ptrPassWord ); |
|
162 |
|
163 // Block application key while showing query |
|
164 (void) ((CAknNotifierAppServerAppUi*) |
|
165 iEikEnv->EikAppUi())->SuppressAppSwitching(ETrue); |
|
166 iAppKeyBlocked = ETrue; |
|
167 |
|
168 if ( dlg->ExecuteLD( R_CCHUINOTIF_USERNAME_PWD_DIALOG ) ) |
|
169 { |
|
170 iResultParams.iDialogMode = |
|
171 MCchUiObserver::ECchUiDialogTypeAuthenticationFailed; |
|
172 iResultParams.iServiceId = aServiceId; |
|
173 iResultParams.iUsername = *userName; |
|
174 iResultParams.iPwd = *passWord; |
|
175 iMessage.WriteL( iReplySlot, |
|
176 TPckgBuf<TCCHUiNotifierParams>( iResultParams ) ); |
|
177 CompleteMessage(KErrNone); |
|
178 } |
|
179 else |
|
180 { |
|
181 CCHUIDEBUG( "ShowUsernamePasswordQueryL - cancelled" ); |
|
182 CompleteMessage( KErrCancel ); |
|
183 } |
|
184 |
|
185 // Remove application key blocking |
|
186 (void) ((CAknNotifierAppServerAppUi*) |
|
187 iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse); |
|
188 iAppKeyBlocked = EFalse; |
|
189 |
|
190 CleanupStack::PopAndDestroy( passWord ); |
|
191 CleanupStack::PopAndDestroy( userName ); |
|
192 |
|
193 CCHUIDEBUG( "CCCHUiNotifierImpl::ShowUsernamePasswordQueryL - OUT" ); |
|
194 } |
|
195 |
|
196 // --------------------------------------------------------------------------- |
|
197 // Shows no connections query. |
|
198 // --------------------------------------------------------------------------- |
|
199 // |
|
200 void CCCHUiNotifierImpl::ShowNoConnectionsQueryL( |
|
201 TInt aReplySlot, |
|
202 const RMessagePtr2& aMessage, |
|
203 TUint aServiceId, |
|
204 TBool aNoConnectionsDefined ) |
|
205 { |
|
206 CCHUIDEBUG( "CCCHUiNotifierImpl::ShowNoConnectionsQueryL - IN" ); |
|
207 |
|
208 iServiceId = aServiceId; |
|
209 iMessage = aMessage; |
|
210 iReplySlot = aReplySlot; |
|
211 |
|
212 CDesCArray* arrayforDialog = new (ELeave) CDesCArrayFlat( 3 ); |
|
213 CleanupStack::PushL( arrayforDialog ); |
|
214 |
|
215 CCHUIDEBUG( "ShowNoConnectionsQueryL - form content" ); |
|
216 |
|
217 RArray<TCchUiOperationCommand> commandArray; |
|
218 CleanupClosePushL( commandArray ); |
|
219 |
|
220 TInt result = KErrNotFound; |
|
221 MCchUiObserver::TCchUiDialogType currentType = |
|
222 MCchUiObserver::ECchUiDialogTypeNotSet; |
|
223 HBufC* string = NULL; |
|
224 if ( aNoConnectionsDefined ) |
|
225 { |
|
226 string = StringLoader::LoadLC( |
|
227 R_QTN_CCHUINOTIF_NO_CONNECTIONS_DEFINED_HEADING ); |
|
228 FillNoConnectionsDefinedListboxL( *arrayforDialog, commandArray ); |
|
229 currentType = MCchUiObserver::ECchUiDialogTypeNoConnectionDefined; |
|
230 } |
|
231 else |
|
232 { |
|
233 string = StringLoader::LoadLC( |
|
234 R_QTN_CCHUINOTIF_NO_CONNECTIONS_HEADING ); |
|
235 FillNoConnectionsAvailableListboxL( |
|
236 *arrayforDialog, commandArray, aServiceId ); |
|
237 currentType = MCchUiObserver::ECchUiDialogTypeNoConnectionAvailable; |
|
238 } |
|
239 |
|
240 iListQueryDialog = new (ELeave) CAknListQueryDialog( &result ); |
|
241 iListQueryDialog->PrepareLC( R_CCHUINOTIF_NO_CONNECTIONS_AVAILABLE ); |
|
242 |
|
243 iListQueryDialog->MessageBox()->SetMessageTextL( string ); |
|
244 |
|
245 CCHUIDEBUG( "ShowNoConnectionsQueryL - form heading" ); |
|
246 |
|
247 // Set heading ie. service name |
|
248 HBufC* serviceName = HBufC::NewLC( KServiceNameLength ); |
|
249 TPtr serviceNamePtr( serviceName->Des() ); |
|
250 GetServiceNameL( aServiceId, serviceNamePtr ); |
|
251 CCHUIDEBUG( "ShowNoConnectionsQueryL - set heading" ); |
|
252 iListQueryDialog->QueryHeading()->SetTextL( serviceNamePtr ); |
|
253 CCHUIDEBUG( "ShowNoConnectionsQueryL - heading set ok" ); |
|
254 CleanupStack::PopAndDestroy(); // serviceName |
|
255 CCHUIDEBUG( "ShowNoConnectionsQueryL - proceed to list items" ); |
|
256 |
|
257 CCHUIDEBUG( "ShowNoConnectionsQueryL - set item array" ); |
|
258 iListQueryDialog->SetItemTextArray( arrayforDialog ); |
|
259 iListQueryDialog->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
260 |
|
261 CCHUIDEBUG( "ShowNoConnectionsQueryL - retrieve branded icon" ); |
|
262 CFbsBitmap* myBitmap = NULL; |
|
263 CFbsBitmap* myMask = NULL; |
|
264 TRAPD( err, BrandingHandlerL().RetrieveServiceIconL( |
|
265 aServiceId, myBitmap, myMask ) ); |
|
266 CCHUIDEBUG2( "ShowNoConnectionsQueryL - brand err: %d", err ); |
|
267 |
|
268 if ( !err && iListQueryDialog->QueryHeading() ) |
|
269 { |
|
270 CleanupStack::PushL( myBitmap ); |
|
271 CleanupStack::PushL( myMask ); |
|
272 CEikImage* image = new (ELeave) CEikImage(); |
|
273 image->SetPicture( myBitmap, myMask ); |
|
274 CleanupStack::Pop( myMask ); |
|
275 CleanupStack::Pop( myBitmap ); |
|
276 CleanupStack::PushL( image ); |
|
277 iListQueryDialog->QueryHeading()->SetHeaderImageL( image ); |
|
278 iListQueryDialog->QueryHeading()->ActivateL(); |
|
279 CleanupStack::PopAndDestroy( image ); |
|
280 } |
|
281 else if ( !err ) |
|
282 { |
|
283 delete myMask; |
|
284 delete myBitmap; |
|
285 } |
|
286 else |
|
287 { |
|
288 // Error occurred in RetrieveServiceIconL. Nothing to do. |
|
289 } |
|
290 |
|
291 // Block application key while showing query |
|
292 (void) ((CAknNotifierAppServerAppUi*) |
|
293 iEikEnv->EikAppUi())->SuppressAppSwitching(ETrue); |
|
294 iAppKeyBlocked = ETrue; |
|
295 |
|
296 CCHUIDEBUG( "ShowNoConnectionsQueryL - run dialog" ); |
|
297 iListQueryDialog->RunLD(); |
|
298 CCHUIDEBUG( "ShowNoConnectionsQueryL - run dialog done" ); |
|
299 |
|
300 // write result, result now holds the item number |
|
301 if ( KErrNotFound != result ) |
|
302 { |
|
303 iResultParams.iDialogMode = currentType; |
|
304 iResultParams.iServiceId = aServiceId; |
|
305 iResultParams.iOperationCommand = commandArray[ result ]; |
|
306 TInt error = KErrNone; |
|
307 if ( ECchUiCommandCopyGprs == commandArray[ result ] ) |
|
308 { |
|
309 error = ShowGprsSelectionL( aServiceId ); |
|
310 } |
|
311 if ( !error ) |
|
312 { |
|
313 CCHUIDEBUG( "ShowNoConnectionsQueryL - write and complete" ); |
|
314 iMessage.WriteL( iReplySlot, |
|
315 TPckgBuf<TCCHUiNotifierParams>( iResultParams ) ); |
|
316 CompleteMessage( KErrNone ); |
|
317 } |
|
318 else |
|
319 { |
|
320 CCHUIDEBUG( "ShowNoConnectionsQueryL - complete with cancel" ); |
|
321 CompleteMessage( error ); |
|
322 } |
|
323 } |
|
324 else |
|
325 { |
|
326 CCHUIDEBUG( "ShowNoConnectionsQueryL - complete with cancel" ); |
|
327 CompleteMessage( KErrCancel ); |
|
328 } |
|
329 |
|
330 // Remove application key blocking |
|
331 (void) ((CAknNotifierAppServerAppUi*) |
|
332 iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse); |
|
333 iAppKeyBlocked = EFalse; |
|
334 |
|
335 CleanupStack::PopAndDestroy( string ); |
|
336 CleanupStack::PopAndDestroy( &commandArray ); |
|
337 CleanupStack::PopAndDestroy( arrayforDialog ); |
|
338 |
|
339 CCHUIDEBUG( "CCCHUiNotifierImpl::ShowNoConnectionsQueryL - OUT" ); |
|
340 } |
|
341 |
|
342 // --------------------------------------------------------------------------- |
|
343 // Shows change connection query. |
|
344 // --------------------------------------------------------------------------- |
|
345 // |
|
346 void CCCHUiNotifierImpl::ShowChangeConnectionQueryL( |
|
347 TInt aReplySlot, |
|
348 const RMessagePtr2& aMessage, |
|
349 TUint aServiceId, |
|
350 TInt aIapId ) |
|
351 { |
|
352 CCHUIDEBUG( "CCCHUiNotifierImpl::ShowChangeConnectionQueryL - IN" ); |
|
353 |
|
354 iMessage = aMessage; |
|
355 iReplySlot = aReplySlot; |
|
356 |
|
357 CDesCArray* arrayforDialog = new (ELeave) CDesCArrayFlat( 3 ); |
|
358 CleanupStack::PushL( arrayforDialog ); |
|
359 |
|
360 CCHUIDEBUG( "ShowChangeConnectionQueryL - form content" ); |
|
361 |
|
362 RArray<TCchUiOperationCommand> commandArray; |
|
363 CleanupClosePushL( commandArray ); |
|
364 |
|
365 TInt result = KErrNotFound; |
|
366 MCchUiObserver::TCchUiDialogType type = |
|
367 MCchUiObserver::ECchUiDialogTypeChangeConnection; |
|
368 HBufC* string = NULL; |
|
369 |
|
370 RBuf iapName; |
|
371 CleanupClosePushL( iapName ); |
|
372 |
|
373 // If we have current connection, show it in query heading |
|
374 if ( aIapId ) |
|
375 { |
|
376 CurrentConnectionNameL( |
|
377 aServiceId, |
|
378 aIapId, |
|
379 iapName ); |
|
380 |
|
381 string = StringLoader::LoadLC( |
|
382 R_QTN_CCHUINOTIF_CHANGE_CURRENT_CONNECTION_HEADING, iapName ); |
|
383 |
|
384 FillChangeCurrentConnectionListboxL( *arrayforDialog, commandArray ); |
|
385 } |
|
386 else // otherwise show in heading that we have no current connection |
|
387 { |
|
388 string = StringLoader::LoadLC( |
|
389 R_QTN_CCHUINOTIF_CHANGE_CONNECTION_HEADING ); |
|
390 |
|
391 FillChangeConnectionListboxL( *arrayforDialog, commandArray ); |
|
392 } |
|
393 |
|
394 iListQueryDialog = new (ELeave) CAknListQueryDialog( &result ); |
|
395 iListQueryDialog->PrepareLC( R_CCHUINOTIF_CHANGE_CONNECTION_QUERY ); |
|
396 |
|
397 iListQueryDialog->MessageBox()->SetMessageTextL( string ); |
|
398 |
|
399 CCHUIDEBUG( "ShowChangeConnectionQueryL - form heading" ); |
|
400 // Set heading ie. service name |
|
401 HBufC* serviceName = HBufC::NewLC( KServiceNameLength ); |
|
402 TPtr serviceNamePtr( serviceName->Des() ); |
|
403 GetServiceNameL( aServiceId, serviceNamePtr ); |
|
404 CCHUIDEBUG( "ShowChangeConnectionQueryL - set heading" ); |
|
405 iListQueryDialog->QueryHeading()->SetTextL( serviceNamePtr ); |
|
406 CCHUIDEBUG( "ShowChangeConnectionQueryL - heading set ok" ); |
|
407 CleanupStack::PopAndDestroy(); // serviceName |
|
408 CCHUIDEBUG( "ShowChangeConnectionQueryL - proceed to list items" ); |
|
409 |
|
410 CCHUIDEBUG( "ShowChangeConnectionQueryL - set item array" ); |
|
411 iListQueryDialog->SetItemTextArray( arrayforDialog ); |
|
412 iListQueryDialog->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
413 |
|
414 CCHUIDEBUG( "ShowChangeConnectionQueryL - retrieve branded icon" ); |
|
415 |
|
416 CFbsBitmap* myBitmap = NULL; |
|
417 CFbsBitmap* myMask = NULL; |
|
418 TRAPD( err, BrandingHandlerL().RetrieveServiceIconL( |
|
419 aServiceId, myBitmap, myMask ) ); |
|
420 |
|
421 CCHUIDEBUG2( "ShowChangeConnectionQueryL - brand err: %d", err ); |
|
422 |
|
423 if ( !err && iListQueryDialog->QueryHeading() ) |
|
424 { |
|
425 CleanupStack::PushL( myBitmap ); |
|
426 CleanupStack::PushL( myMask ); |
|
427 CEikImage* image = new (ELeave) CEikImage(); |
|
428 image->SetPicture( myBitmap, myMask ); |
|
429 CleanupStack::Pop( myMask ); |
|
430 CleanupStack::Pop( myBitmap ); |
|
431 CleanupStack::PushL( image ); |
|
432 iListQueryDialog->QueryHeading()->SetHeaderImageL( image ); |
|
433 iListQueryDialog->QueryHeading()->ActivateL(); |
|
434 CleanupStack::PopAndDestroy( image ); |
|
435 } |
|
436 else if ( !err ) |
|
437 { |
|
438 delete myMask; |
|
439 delete myBitmap; |
|
440 } |
|
441 else |
|
442 { |
|
443 // Error occurred in RetrieveServiceIconL. Nothing to do. |
|
444 } |
|
445 |
|
446 // Block application key while showing query |
|
447 (void) ((CAknNotifierAppServerAppUi*) |
|
448 iEikEnv->EikAppUi())->SuppressAppSwitching(ETrue); |
|
449 iAppKeyBlocked = ETrue; |
|
450 |
|
451 CCHUIDEBUG( "ShowChangeConnectionQueryL - run dialog" ); |
|
452 |
|
453 // List query dialog is deleted via RunLD except if there is |
|
454 // incoming call at the same time the dialog is shown on screen. |
|
455 // In case of incoming call CallStateChanged() method handles |
|
456 // the deletion |
|
457 iListQueryDialog->RunLD(); |
|
458 // coverity[check_after_deref] |
|
459 if( iListQueryDialog ) |
|
460 { |
|
461 // write result, result now holds the item number |
|
462 if ( KErrNotFound != result ) |
|
463 { |
|
464 iResultParams.iDialogMode = type; |
|
465 iResultParams.iServiceId = aServiceId; |
|
466 iResultParams.iOperationCommand = commandArray[ result ]; |
|
467 TInt error = KErrNone; |
|
468 if ( ECchUiCommandCopyGprs == commandArray[ result ] ) |
|
469 { |
|
470 error = ShowGprsSelectionL( aServiceId ); |
|
471 } |
|
472 if ( !error ) |
|
473 { |
|
474 CCHUIDEBUG( "ShowChangeConnectionQueryL - write and complete" ); |
|
475 iMessage.WriteL( iReplySlot, |
|
476 TPckgBuf<TCCHUiNotifierParams>( iResultParams ) ); |
|
477 CompleteMessage( KErrNone ); |
|
478 } |
|
479 else |
|
480 { |
|
481 CCHUIDEBUG( "ShowChangeConnectionQueryL - complete with cancel" ); |
|
482 CompleteMessage( error ); |
|
483 } |
|
484 } |
|
485 else |
|
486 { |
|
487 CCHUIDEBUG( "ShowChangeConnectionQueryL - complete with cancel" ); |
|
488 CompleteMessage( KErrCancel ); |
|
489 } |
|
490 |
|
491 iListQueryDialog = NULL; |
|
492 } |
|
493 |
|
494 // Remove application key blocking |
|
495 (void) ((CAknNotifierAppServerAppUi*) |
|
496 iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse); |
|
497 iAppKeyBlocked = EFalse; |
|
498 |
|
499 CleanupStack::PopAndDestroy( string ); |
|
500 CleanupStack::PopAndDestroy( &iapName ); |
|
501 CleanupStack::PopAndDestroy( &commandArray ); |
|
502 CleanupStack::PopAndDestroy( arrayforDialog ); |
|
503 |
|
504 CCHUIDEBUG( "CCCHUiNotifierImpl::ShowChangeConnectionQueryL - OUT" ); |
|
505 } |
|
506 |
|
507 // --------------------------------------------------------------------------- |
|
508 // Shows defective settings error note. |
|
509 // --------------------------------------------------------------------------- |
|
510 // |
|
511 void CCCHUiNotifierImpl::ShowDefectiveSettingsL( |
|
512 TInt aReplySlot, |
|
513 const RMessagePtr2& aMessage, |
|
514 TUint aServiceId ) |
|
515 { |
|
516 CCHUIDEBUG( "CCCHUiNotifierImpl::ShowDefectiveSettingsL - IN" ); |
|
517 |
|
518 iMessage = aMessage; |
|
519 iReplySlot = aReplySlot; |
|
520 |
|
521 // Get service name |
|
522 HBufC* serviceName = HBufC::NewLC( KServiceNameLength ); |
|
523 TPtr serviceNamePtr( serviceName->Des() ); |
|
524 GetServiceNameL( aServiceId, serviceNamePtr ); |
|
525 |
|
526 // Show info note about defective settings |
|
527 HBufC* defectiveText = StringLoader::LoadLC( |
|
528 R_QTN_SERVTAB_CONN_ESTABLSH_FAILED_PERMANENTLY_NOTE_TEXT, serviceNamePtr ); |
|
529 CAknInformationNote* note = |
|
530 new( ELeave ) CAknInformationNote( ETrue ); |
|
531 note->SetTimeout(CAknNoteDialog::ELongTimeout); |
|
532 note->ExecuteLD( *defectiveText ); |
|
533 CleanupStack::PopAndDestroy( defectiveText ); |
|
534 CleanupStack::PopAndDestroy( serviceName ); |
|
535 |
|
536 iResultParams.iDialogMode = |
|
537 MCchUiObserver::ECchUiDialogTypeDefectiveSettings; |
|
538 iResultParams.iServiceId = aServiceId; |
|
539 iMessage.WriteL( iReplySlot, |
|
540 TPckgBuf<TCCHUiNotifierParams>( iResultParams ) ); |
|
541 CompleteMessage(KErrNone); |
|
542 |
|
543 CCHUIDEBUG( "CCCHUiNotifierImpl::ShowDefectiveSettingsL - OUT" ); |
|
544 } |
|
545 |
|
546 // --------------------------------------------------------------------------- |
|
547 // Shows error in connection error note. |
|
548 // --------------------------------------------------------------------------- |
|
549 // |
|
550 void CCCHUiNotifierImpl::ShowErrorInConnectionNoteL( |
|
551 TInt aReplySlot, |
|
552 const RMessagePtr2& aMessage, |
|
553 TUint aServiceId ) |
|
554 { |
|
555 CCHUIDEBUG( "CCCHUiNotifierImpl::ShowErrorInConnectionL - IN" ); |
|
556 |
|
557 iMessage = aMessage; |
|
558 iReplySlot = aReplySlot; |
|
559 |
|
560 // Show info note about error in connection |
|
561 //(access point not suitable for internet calls) |
|
562 HBufC* noteText = StringLoader::LoadLC( |
|
563 R_QTN_VOIP_ERROR_IN_CONNECTION_NOTE_TEXT ); |
|
564 CAknInformationNote* note = |
|
565 new( ELeave ) CAknInformationNote( ETrue ); |
|
566 note->SetTimeout(CAknNoteDialog::ELongTimeout); |
|
567 note->ExecuteLD( *noteText ); |
|
568 CleanupStack::PopAndDestroy( noteText ); |
|
569 |
|
570 iResultParams.iDialogMode = |
|
571 MCchUiObserver::ECchUiDialogTypeErrorInConnection; |
|
572 iResultParams.iServiceId = aServiceId; |
|
573 iMessage.WriteL( iReplySlot, |
|
574 TPckgBuf<TCCHUiNotifierParams>( iResultParams ) ); |
|
575 CompleteMessage(KErrNone); |
|
576 |
|
577 CCHUIDEBUG( "CCCHUiNotifierImpl::ShowErrorInConnectionL - OUT" ); |
|
578 } |
|
579 |
|
580 // --------------------------------------------------------------------------- |
|
581 // Shows invalid username/password note. |
|
582 // --------------------------------------------------------------------------- |
|
583 // |
|
584 void CCCHUiNotifierImpl::ShowInvalidUsernamePasswordNoteL( |
|
585 TInt aReplySlot, |
|
586 const RMessagePtr2& aMessage, |
|
587 TUint aServiceId ) |
|
588 { |
|
589 CCHUIDEBUG( "CCCHUiNotifierImpl::ShowInvalidUsernamePasswordNoteL - IN" ); |
|
590 |
|
591 iMessage = aMessage; |
|
592 iReplySlot = aReplySlot; |
|
593 |
|
594 // Show info note about invalid username password |
|
595 HBufC* textForNote = StringLoader::LoadLC( |
|
596 R_QTN_VOIP_WRONG_SIP_AUTH_NOTE_TEXT ); |
|
597 CAknInformationNote* note = |
|
598 new( ELeave ) CAknInformationNote( ETrue ); |
|
599 note->SetTimeout(CAknNoteDialog::ELongTimeout); |
|
600 note->ExecuteLD( *textForNote ); |
|
601 CleanupStack::PopAndDestroy( textForNote ); |
|
602 |
|
603 iResultParams.iDialogMode = |
|
604 MCchUiObserver::ECchUiDialogTypeUsernamePasswordFailed; |
|
605 iResultParams.iServiceId = aServiceId; |
|
606 iMessage.WriteL( iReplySlot, |
|
607 TPckgBuf<TCCHUiNotifierParams>( iResultParams ) ); |
|
608 CompleteMessage(KErrNone); |
|
609 |
|
610 CCHUIDEBUG( |
|
611 "CCCHUiNotifierImpl::ShowInvalidUsernamePasswordNoteL - OUT" ); |
|
612 } |
|
613 |
|
614 // --------------------------------------------------------------------------- |
|
615 // Shows confirmation note to change connection. |
|
616 // --------------------------------------------------------------------------- |
|
617 // |
|
618 void CCCHUiNotifierImpl::ShowConfirmChangeConnectionL( |
|
619 TInt aReplySlot, |
|
620 const RMessagePtr2& aMessage, |
|
621 TUint aServiceId, |
|
622 TInt aIapId ) |
|
623 { |
|
624 CCHUIDEBUG( "CCCHUiNotifierImpl::ShowConfirmChangeConnectionL - IN" ); |
|
625 |
|
626 CCHUIDEBUG2( |
|
627 "ShowConfirmChangeConnectionL - aServiceId: %d", aServiceId ); |
|
628 CCHUIDEBUG2( |
|
629 "ShowConfirmChangeConnectionL - aIapId: %d", aIapId ); |
|
630 |
|
631 iMessage = aMessage; |
|
632 iReplySlot = aReplySlot; |
|
633 |
|
634 // Show confirmation note to change connection |
|
635 RBuf iapName; |
|
636 CleanupClosePushL( iapName ); |
|
637 |
|
638 CurrentConnectionNameL( |
|
639 aServiceId, |
|
640 aIapId, |
|
641 iapName ); |
|
642 |
|
643 HBufC* textForQuery = NULL; |
|
644 CAknQueryDialog* query = |
|
645 new( ELeave ) CAknQueryDialog( CAknQueryDialog::ENoTone ); |
|
646 |
|
647 CleanupStack::PushL( query ); |
|
648 |
|
649 TBool askToRemoveOldConnection( EFalse ); |
|
650 |
|
651 // Check if current connection is used by any other service |
|
652 if ( aIapId && !ConnectionUsedByOthersL( aServiceId, aIapId ) ) |
|
653 { |
|
654 // connection not used by others -> ask to remove old connection |
|
655 askToRemoveOldConnection = ETrue; |
|
656 } |
|
657 |
|
658 if ( askToRemoveOldConnection ) |
|
659 { |
|
660 CCHUIDEBUG( |
|
661 "ShowConfirmChangeConnectionL - ask to remove connection" ); |
|
662 |
|
663 query->PrepareLC( |
|
664 R_CCHUINOTIF_REMOVE_AND_CHANGE_CONNECTION_CONFIRMATION_QUERY ); |
|
665 |
|
666 textForQuery = StringLoader::LoadLC( |
|
667 R_QTN_SERVTAB_AP_VOIP_NOT_SUPPORTED_RECONNECT_QUERY_TEXT, |
|
668 iapName ); |
|
669 } |
|
670 else |
|
671 { |
|
672 CCHUIDEBUG( |
|
673 "ShowConfirmChangeConnectionL - ask to change connection" ); |
|
674 |
|
675 query->PrepareLC( R_CCHUINOTIF_CHANGE_CONNECTION_CONFIRMATION_QUERY ); |
|
676 |
|
677 textForQuery = StringLoader::LoadLC( |
|
678 R_QTN_SERVTAB_AP_VOIP_NOT_SUPPORTED_QUERY_TEXT, iapName ); |
|
679 } |
|
680 |
|
681 CCHUIDEBUG( "ShowConfirmChangeConnectionL - set prompt" ); |
|
682 |
|
683 query->SetPromptL( *textForQuery ); |
|
684 CleanupStack::PopAndDestroy( textForQuery ); |
|
685 CleanupStack::Pop( query ); |
|
686 |
|
687 // Block application key while showing query |
|
688 (void) ((CAknNotifierAppServerAppUi*) |
|
689 iEikEnv->EikAppUi())->SuppressAppSwitching(ETrue); |
|
690 iAppKeyBlocked = ETrue; |
|
691 |
|
692 // Run query |
|
693 if( query->RunLD() ) |
|
694 { |
|
695 iResultParams.iDialogMode = |
|
696 MCchUiObserver::ECchUiDialogTypeConfirmChangeConnection; |
|
697 iResultParams.iServiceId = aServiceId; |
|
698 |
|
699 if ( askToRemoveOldConnection ) |
|
700 { |
|
701 CCHUIDEBUG( |
|
702 "ShowConfirmChangeConnectionL - set remove old connection"); |
|
703 |
|
704 iResultParams.iRemoveOldConnection = ETrue; |
|
705 iResultParams.iCurrentConnectionIapId = aIapId; |
|
706 } |
|
707 else |
|
708 { |
|
709 iResultParams.iRemoveOldConnection = EFalse; |
|
710 } |
|
711 |
|
712 iMessage.WriteL( iReplySlot, |
|
713 TPckgBuf<TCCHUiNotifierParams>( iResultParams ) ); |
|
714 |
|
715 CCHUIDEBUG( "ShowConfirmChangeConnectionL - complete message" ); |
|
716 |
|
717 CompleteMessage( KErrNone ); |
|
718 } |
|
719 else |
|
720 { |
|
721 CCHUIDEBUG( "ShowConfirmChangeConnectionL - canceled" ); |
|
722 |
|
723 CompleteMessage( KErrCancel ); |
|
724 } |
|
725 |
|
726 // Remove application key blocking |
|
727 (void) ((CAknNotifierAppServerAppUi*) |
|
728 iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse); |
|
729 iAppKeyBlocked = EFalse; |
|
730 |
|
731 CleanupStack::PopAndDestroy( &iapName ); |
|
732 |
|
733 CCHUIDEBUG( "CCCHUiNotifierImpl::ShowConfirmChangeConnectionL - OUT" ); |
|
734 } |
|
735 |
|
736 // --------------------------------------------------------------------------- |
|
737 // Shows gprs iap selection. |
|
738 // --------------------------------------------------------------------------- |
|
739 // |
|
740 TInt CCCHUiNotifierImpl::ShowGprsSelectionL( TUint aServiceId ) |
|
741 { |
|
742 CCHUIDEBUG( "CCCHUiNotifierImpl::ShowGprsSelectionL - IN" ); |
|
743 |
|
744 TInt error = KErrNone; |
|
745 RArray<TUint32> iapIds; |
|
746 CleanupClosePushL( iapIds ); |
|
747 |
|
748 CDesCArray* arrayforDialog = new (ELeave) CDesCArrayFlat( 3 ); |
|
749 CleanupStack::PushL( arrayforDialog ); |
|
750 CCHUIDEBUG( "ShowGprsSelectionL - form content" ); |
|
751 |
|
752 TInt result = KErrNotFound; |
|
753 HBufC* string = StringLoader::LoadLC( |
|
754 R_QTN_CCHUINOTIF_SELECT_GPRS_ACCESS_POINT_HEADING ); |
|
755 |
|
756 CAknListQueryDialog* dialog = new (ELeave) CAknListQueryDialog( &result ); |
|
757 dialog->PrepareLC( R_CCHUINOTIF_SELECT_GPRS_DIALOG ); |
|
758 |
|
759 CCHUIDEBUG( "ShowGprsSelectionL - form heading" ); |
|
760 dialog->QueryHeading()->SetTextL( *string ); |
|
761 |
|
762 CCHUIDEBUG( "ShowGprsSelectionL - set item array" ); |
|
763 |
|
764 TUint sourceSnap = KErrNone; |
|
765 // Fill array here |
|
766 sourceSnap = InternetGprsApsMissingFromServiceSnapL( |
|
767 *arrayforDialog, iapIds ); |
|
768 |
|
769 CCHUIDEBUG( "ShowGprsSelectionL - set item array" ); |
|
770 dialog->SetItemTextArray( arrayforDialog ); |
|
771 dialog->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
772 |
|
773 // Block application key while showing query |
|
774 (void) ((CAknNotifierAppServerAppUi*) |
|
775 iEikEnv->EikAppUi())->SuppressAppSwitching(ETrue); |
|
776 iAppKeyBlocked = ETrue; |
|
777 |
|
778 CCHUIDEBUG( "ShowGprsSelectionL - run dialog" ); |
|
779 |
|
780 dialog->RunLD(); |
|
781 |
|
782 // write result, result now holds the item number |
|
783 if ( KErrNotFound != result ) |
|
784 { |
|
785 iResultParams.iServiceId = aServiceId; |
|
786 iResultParams.iGprsSourceSnap = sourceSnap; |
|
787 iResultParams.iGprsIapId = iapIds[ result ]; |
|
788 } |
|
789 else |
|
790 { |
|
791 error = KErrCancel; |
|
792 } |
|
793 |
|
794 // Remove application key blocking |
|
795 (void) ((CAknNotifierAppServerAppUi*) |
|
796 iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse); |
|
797 iAppKeyBlocked = EFalse; |
|
798 |
|
799 CleanupStack::PopAndDestroy( string ); |
|
800 CleanupStack::PopAndDestroy( arrayforDialog ); |
|
801 CleanupStack::PopAndDestroy( &iapIds ); |
|
802 |
|
803 CCHUIDEBUG2( "CCCHUiNotifierImpl::ShowGprsSelectionL -return %d", error ); |
|
804 return error; |
|
805 } |
|
806 |
|
807 // --------------------------------------------------------------------------- |
|
808 // Returns handle to branding handler. |
|
809 // --------------------------------------------------------------------------- |
|
810 // |
|
811 CCchUiPluginBrandingHandler& CCCHUiNotifierImpl::BrandingHandlerL() |
|
812 { |
|
813 if ( !iBrandingHandler ) |
|
814 { |
|
815 iBrandingHandler = |
|
816 CCchUiPluginBrandingHandler::NewL( *iSettings ); |
|
817 } |
|
818 return *iBrandingHandler; |
|
819 } |
|
820 |
|
821 // --------------------------------------------------------------------------- |
|
822 // Fills list items and commands for no connections available dialog |
|
823 // --------------------------------------------------------------------------- |
|
824 // |
|
825 void CCCHUiNotifierImpl::FillNoConnectionsAvailableListboxL( |
|
826 CDesCArray& aListItems, |
|
827 RArray<TCchUiOperationCommand>& aCommandArray, |
|
828 TUint aServiceId ) |
|
829 { |
|
830 CCHUIDEBUG( |
|
831 "CCCHUiNotifierImpl::FillNoConnectionsAvailableListboxL - IN" ); |
|
832 |
|
833 HBufC* connectWhenAv = StringLoader::LoadLC( |
|
834 R_QTN_CCHUINOTIF_CONNECT_WHEN_AV_TEXT ); |
|
835 HBufC* searchWlan = StringLoader::LoadLC( |
|
836 R_QTN_CCHUINOTIF_SEARCH_WLAN_NO_COVERAGE_TEXT ); |
|
837 HBufC* useGprs = StringLoader::LoadLC( |
|
838 R_QTN_CCHUINOTIF_USE_GPRS_NO_COVERAGE_TEXT ); |
|
839 |
|
840 // Item is available only for SIP protocol services. |
|
841 // Check if service supports SIP/VoIP. |
|
842 TBool sipVoip( EFalse ); |
|
843 TRAPD( err, sipVoip = IsSIPVoIPL( aServiceId ) ); |
|
844 |
|
845 if ( !err && sipVoip && IsVoIPOverWCDMAAllowedL() ) |
|
846 { |
|
847 aListItems.AppendL( *connectWhenAv ); |
|
848 aCommandArray.AppendL( ECchUiCommandConnectWhenAvailable ); |
|
849 } |
|
850 |
|
851 aListItems.AppendL( *searchWlan ); |
|
852 aCommandArray.AppendL( ECchUiCommandSearchWlan ); |
|
853 |
|
854 if ( !IsPhoneOfflineL() && IsGprsIapsAvailableL() |
|
855 && IsVoIPOverWCDMAAllowedL() ) |
|
856 { |
|
857 aListItems.AppendL( *useGprs ); |
|
858 aCommandArray.AppendL( ECchUiCommandCopyGprs ); |
|
859 } |
|
860 |
|
861 CleanupStack::PopAndDestroy( useGprs ); |
|
862 CleanupStack::PopAndDestroy( searchWlan ); |
|
863 CleanupStack::PopAndDestroy( connectWhenAv ); |
|
864 |
|
865 CCHUIDEBUG( |
|
866 "CCCHUiNotifierImpl::FillNoConnectionsAvailableListboxL - OUT" ); |
|
867 } |
|
868 |
|
869 // --------------------------------------------------------------------------- |
|
870 // Fills list items and commands for no connections defined dialog. |
|
871 // --------------------------------------------------------------------------- |
|
872 // |
|
873 void CCCHUiNotifierImpl::FillNoConnectionsDefinedListboxL( |
|
874 CDesCArray& aListItems, RArray<TCchUiOperationCommand>& aCommandArray ) |
|
875 { |
|
876 CCHUIDEBUG( |
|
877 "CCCHUiNotifierImpl::FillNoConnectionsDefinedListboxL - IN" ); |
|
878 |
|
879 CleanupClosePushL( aCommandArray ); |
|
880 |
|
881 HBufC* searchWlan = StringLoader::LoadLC( |
|
882 R_QTN_CCHUINOTIF_SEARCH_WLAN_NOT_DEF_TEXT ); |
|
883 |
|
884 HBufC* useGprs = StringLoader::LoadLC( |
|
885 R_QTN_CCHUINOTIF_USE_GPRS_NOT_DEF_TEXT ); |
|
886 |
|
887 aListItems.AppendL( *searchWlan ); |
|
888 aCommandArray.AppendL( ECchUiCommandSearchWlan ); |
|
889 |
|
890 if ( !IsPhoneOfflineL() && IsGprsIapsAvailableL() |
|
891 && IsVoIPOverWCDMAAllowedL() ) |
|
892 { |
|
893 aListItems.AppendL( *useGprs ); |
|
894 aCommandArray.AppendL( ECchUiCommandCopyGprs ); |
|
895 } |
|
896 |
|
897 CleanupStack::PopAndDestroy( useGprs ); |
|
898 CleanupStack::PopAndDestroy( searchWlan ); |
|
899 CleanupStack::Pop( &aCommandArray ); |
|
900 |
|
901 CCHUIDEBUG( |
|
902 "CCCHUiNotifierImpl::FillNoConnectionsDefinedListboxL - OUT" ); |
|
903 } |
|
904 |
|
905 // --------------------------------------------------------------------------- |
|
906 // Fills list items and commands for no connections defined dialog |
|
907 // --------------------------------------------------------------------------- |
|
908 // |
|
909 void CCCHUiNotifierImpl::FillNoConnectionsFoundListboxL( |
|
910 CDesCArray& aListItems, RArray<TCchUiOperationCommand>& aCommandArray ) |
|
911 { |
|
912 CCHUIDEBUG( "CCCHUiNotifierImpl::FillNoConnectionsFoundListboxL - IN" ); |
|
913 |
|
914 CleanupClosePushL( aCommandArray ); |
|
915 |
|
916 HBufC* searchWlan = StringLoader::LoadLC( |
|
917 R_QTN_CCHUINOTIF_SEARCH_WLAN_NOT_FOUND_TEXT ); |
|
918 |
|
919 HBufC* useGprs = StringLoader::LoadLC( |
|
920 R_QTN_CCHUINOTIF_USE_GPRS_NOT_FOUND_TEXT ); |
|
921 |
|
922 aListItems.AppendL( *searchWlan ); |
|
923 aCommandArray.AppendL( ECchUiCommandSearchWlan ); |
|
924 |
|
925 if ( !IsPhoneOfflineL() && IsGprsIapsAvailableL() |
|
926 && IsVoIPOverWCDMAAllowedL() ) |
|
927 { |
|
928 aListItems.AppendL( *useGprs ); |
|
929 aCommandArray.AppendL( ECchUiCommandCopyGprs ); |
|
930 } |
|
931 |
|
932 CleanupStack::PopAndDestroy( useGprs ); |
|
933 CleanupStack::PopAndDestroy( searchWlan ); |
|
934 CleanupStack::Pop( &aCommandArray ); |
|
935 |
|
936 CCHUIDEBUG( "CCCHUiNotifierImpl::FillNoConnectionsFoundListboxL - OUT" ); |
|
937 } |
|
938 |
|
939 // --------------------------------------------------------------------------- |
|
940 // Fills list items and commands for change current connection dialog |
|
941 // --------------------------------------------------------------------------- |
|
942 // |
|
943 void CCCHUiNotifierImpl::FillChangeCurrentConnectionListboxL( |
|
944 CDesCArray& aListItems, RArray<TCchUiOperationCommand>& aCommandArray ) |
|
945 { |
|
946 CCHUIDEBUG( |
|
947 "CCCHUiNotifierImpl::FillChangeCurrentConnectionListboxL - IN" ); |
|
948 |
|
949 HBufC* searchWlan = StringLoader::LoadLC( |
|
950 R_QTN_CCHUINOTIF_SEARCH_WLAN_CHANGE_CURRENT_CONNECTION_TEXT ); |
|
951 |
|
952 HBufC* useGprs = StringLoader::LoadLC( |
|
953 R_QTN_CCHUINOTIF_USE_GPRS_CHANGE_CURRENT_CONNECTION_TEXT ); |
|
954 |
|
955 aListItems.AppendL( *searchWlan ); |
|
956 aCommandArray.AppendL( ECchUiCommandSearchWlan ); |
|
957 |
|
958 if ( !IsPhoneOfflineL() && IsGprsIapsAvailableL() && |
|
959 IsVoIPOverWCDMAAllowedL() && |
|
960 IsServiceSnapMissingInternetGprsApsL() ) |
|
961 { |
|
962 aListItems.AppendL( *useGprs ); |
|
963 aCommandArray.AppendL( ECchUiCommandCopyGprs ); |
|
964 } |
|
965 |
|
966 CleanupStack::PopAndDestroy( useGprs ); |
|
967 CleanupStack::PopAndDestroy( searchWlan ); |
|
968 |
|
969 CCHUIDEBUG( |
|
970 "CCCHUiNotifierImpl::FillChangeCurrentConnectionListboxL - OUT" ); |
|
971 } |
|
972 |
|
973 // --------------------------------------------------------------------------- |
|
974 // CCCHUiNotifierImpl::IsServiceSnapMissingInternetGprsApsL |
|
975 // --------------------------------------------------------------------------- |
|
976 // |
|
977 TBool CCCHUiNotifierImpl::IsServiceSnapMissingInternetGprsApsL() const |
|
978 { |
|
979 CCHUIDEBUG( |
|
980 "CCCHUiNotifierImpl::IsServiceSnapMissingInternetGprsApsL - IN" ); |
|
981 |
|
982 TBool isMissingGPRSIap = EFalse; |
|
983 |
|
984 RArray<TUint32> iapIds; |
|
985 CleanupClosePushL( iapIds ); |
|
986 |
|
987 CDesCArray* iaps = new (ELeave) CDesCArrayFlat( 1 ); |
|
988 CleanupStack::PushL( iaps ); |
|
989 |
|
990 InternetGprsApsMissingFromServiceSnapL( *iaps, iapIds ); |
|
991 |
|
992 if ( iapIds.Count() ) |
|
993 { |
|
994 isMissingGPRSIap = ETrue; |
|
995 } |
|
996 CleanupStack::PopAndDestroy( iaps ); |
|
997 CleanupStack::PopAndDestroy( &iapIds ); |
|
998 |
|
999 CCHUIDEBUG2( |
|
1000 "CCCHUiNotifierImpl::IsServiceSnapMissingInternetGprsApsL - return: %d", isMissingGPRSIap ); |
|
1001 |
|
1002 return isMissingGPRSIap; |
|
1003 } |
|
1004 |
|
1005 // --------------------------------------------------------------------------- |
|
1006 // CCCHUiNotifierImpl::InternetGprsApsMissingFromServiceSnapL |
|
1007 // --------------------------------------------------------------------------- |
|
1008 // |
|
1009 TUint32 CCCHUiNotifierImpl::InternetGprsApsMissingFromServiceSnapL( |
|
1010 CDesCArray& aIaps, RArray<TUint32>& aIapIds ) const |
|
1011 { |
|
1012 CCHUIDEBUG( |
|
1013 "CCCHUiNotifierImpl::InternetGprsApsMissingFromServiceSnapL - IN" ); |
|
1014 |
|
1015 TUint32 internetSnapId = KErrNone; |
|
1016 |
|
1017 CCchUiNotifConnectionHandler* connHandler = |
|
1018 CCchUiNotifConnectionHandler::NewLC(); |
|
1019 |
|
1020 CDesCArray* voipGprsIaps = new (ELeave) CDesCArrayFlat( 1 ); |
|
1021 CleanupStack::PushL( voipGprsIaps ); |
|
1022 |
|
1023 RArray<TUint32> voipGprsIapIds; |
|
1024 CleanupClosePushL( voipGprsIapIds ); |
|
1025 |
|
1026 connHandler->GetGprsAccessPointsSetToServiceSnapL( |
|
1027 *voipGprsIaps, voipGprsIapIds, iCurrentConnectionIapId ); |
|
1028 |
|
1029 CDesCArray* internetGprsIapNames = new (ELeave) CDesCArrayFlat( 2 ); |
|
1030 CleanupStack::PushL( internetGprsIapNames ); |
|
1031 |
|
1032 RArray<TUint32> internetGprsIapIds; |
|
1033 CleanupClosePushL( internetGprsIapIds ); |
|
1034 |
|
1035 TRAPD( err, internetSnapId = connHandler->GetGprsAccessPointsL( |
|
1036 *internetGprsIapNames, internetGprsIapIds ) ); |
|
1037 CCHUIDEBUG2( "-GetGprsAccessPointsL -Trap err = %d", err ); |
|
1038 |
|
1039 if ( !KErrNone == err && !KErrNotFound == err ) |
|
1040 { |
|
1041 User::Leave( err ); |
|
1042 } |
|
1043 |
|
1044 for ( TInt i( 0 ); i < internetGprsIapIds.Count(); i++ ) |
|
1045 { |
|
1046 TBool found = EFalse; |
|
1047 for ( TInt j( 0 ); j < voipGprsIapIds.Count() && !found; j++ ) |
|
1048 { |
|
1049 found = connHandler->IsConnectionMethodSimilarL( |
|
1050 internetGprsIapIds[ i ], voipGprsIapIds[ j ] ); |
|
1051 } |
|
1052 if ( !found ) |
|
1053 { |
|
1054 CCHUIDEBUG2( |
|
1055 "IsVoIPSNAPMissingInternetGPRSAp -missing GPRS AP id: %d", internetGprsIapIds[ i ] ); |
|
1056 aIapIds.AppendL( internetGprsIapIds[ i ] ); |
|
1057 aIaps.AppendL( internetGprsIapNames->MdcaPoint( i ) ); |
|
1058 } |
|
1059 } |
|
1060 |
|
1061 CleanupStack::PopAndDestroy( &internetGprsIapIds ); |
|
1062 CleanupStack::PopAndDestroy( internetGprsIapNames ); |
|
1063 CleanupStack::PopAndDestroy( &voipGprsIapIds ); |
|
1064 CleanupStack::PopAndDestroy( voipGprsIaps ); |
|
1065 CleanupStack::PopAndDestroy( connHandler ); |
|
1066 |
|
1067 CCHUIDEBUG( "CCCHUiNotifierImpl::InternetGprsApsMissingFromServiceSnapL - OUT" ); |
|
1068 |
|
1069 return internetSnapId; |
|
1070 } |
|
1071 |
|
1072 // --------------------------------------------------------------------------- |
|
1073 // Fills list items and commands for change connection dialog. |
|
1074 // --------------------------------------------------------------------------- |
|
1075 // |
|
1076 void CCCHUiNotifierImpl::FillChangeConnectionListboxL( |
|
1077 CDesCArray& aListItems, RArray<TCchUiOperationCommand>& aCommandArray ) |
|
1078 { |
|
1079 CCHUIDEBUG( "CCCHUiNotifierImpl::FillChangeConnectionListboxL - IN" ); |
|
1080 |
|
1081 HBufC* searchWlan = StringLoader::LoadLC( |
|
1082 R_QTN_CCHUINOTIF_SEARCH_WLAN_CHANGE_CONNECTION_TEXT ); |
|
1083 |
|
1084 HBufC* useGprs = StringLoader::LoadLC( |
|
1085 R_QTN_CCHUINOTIF_USE_GPRS_CHANGE_CONNECTION_TEXT ); |
|
1086 |
|
1087 aListItems.AppendL( *searchWlan ); |
|
1088 aCommandArray.AppendL( ECchUiCommandSearchWlan ); |
|
1089 |
|
1090 if ( !IsPhoneOfflineL() && IsGprsIapsAvailableL() |
|
1091 && IsVoIPOverWCDMAAllowedL() ) |
|
1092 { |
|
1093 aListItems.AppendL( *useGprs ); |
|
1094 aCommandArray.AppendL( ECchUiCommandCopyGprs ); |
|
1095 } |
|
1096 |
|
1097 CleanupStack::PopAndDestroy( useGprs ); |
|
1098 CleanupStack::PopAndDestroy( searchWlan ); |
|
1099 |
|
1100 CCHUIDEBUG( "CCCHUiNotifierImpl::FillChangeConnectionListboxL - OUT" ); |
|
1101 } |
|
1102 |
|
1103 // --------------------------------------------------------------------------- |
|
1104 // Check if VoIP over WCDMA is allowed |
|
1105 // --------------------------------------------------------------------------- |
|
1106 // |
|
1107 TBool CCCHUiNotifierImpl::IsVoIPOverWCDMAAllowedL() |
|
1108 { |
|
1109 CCHUIDEBUG( "CCCHUiNotifierImpl::IsVoIPOverWCDMAAllowed - IN" ); |
|
1110 |
|
1111 TBool allowed( EFalse ); |
|
1112 CRCSEProfileRegistry* cRCSEProfileRegistry; |
|
1113 cRCSEProfileRegistry = CRCSEProfileRegistry::NewLC(); |
|
1114 |
|
1115 RPointerArray<CRCSEProfileEntry> entries; |
|
1116 |
|
1117 CleanupStack::PushL( TCleanupItem ( ResetAndDestroy, &entries ) ); //CS |
|
1118 |
|
1119 cRCSEProfileRegistry->FindByServiceIdL( iServiceId, entries ); |
|
1120 if( entries.Count() ) |
|
1121 { |
|
1122 RArray<TSettingIds> settingIdArray; |
|
1123 CleanupClosePushL( settingIdArray ); // CS 3 |
|
1124 settingIdArray = entries[ 0 ]->iIds; |
|
1125 TInt sipProfileId( KErrNotFound ); |
|
1126 for ( TUint i( 0 ) ; i < settingIdArray.Count() ; i++ ) |
|
1127 { |
|
1128 if ( settingIdArray[ i ].iProfileType == |
|
1129 CRCSEProfileEntry::EProtocolSIP ) |
|
1130 { |
|
1131 sipProfileId = settingIdArray[ i ].iProfileId; |
|
1132 } |
|
1133 } |
|
1134 TUint32 bearerSetting( KErrNone ); |
|
1135 if ( KErrNotFound != sipProfileId ) |
|
1136 { |
|
1137 CSIPProfile* profile = |
|
1138 iSipProfileRegistry->ProfileL( sipProfileId ); |
|
1139 CleanupStack::PushL( profile ); // CS 4 |
|
1140 User::LeaveIfError( |
|
1141 profile->GetParameter( KBearerType, bearerSetting ) ); |
|
1142 if ( KBearerSettingWlanOnly != bearerSetting ) |
|
1143 { |
|
1144 allowed = ETrue; |
|
1145 } |
|
1146 CleanupStack::PopAndDestroy( profile ); // CS 3 |
|
1147 } |
|
1148 CleanupStack::Pop( &settingIdArray ); // CS 2 |
|
1149 } |
|
1150 |
|
1151 CleanupStack::PopAndDestroy( &entries ); // clItem CS 1 |
|
1152 |
|
1153 CleanupStack::PopAndDestroy(); //cRCSEProfileRegistry CS 0 |
|
1154 |
|
1155 return allowed; |
|
1156 } |
|
1157 |
|
1158 // --------------------------------------------------------------------------- |
|
1159 // For deleting RPointerArray in case of leave |
|
1160 // --------------------------------------------------------------------------- |
|
1161 // |
|
1162 void CCCHUiNotifierImpl::ResetAndDestroy( TAny* aPointerArray ) |
|
1163 { |
|
1164 CCHUIDEBUG( "CCCHUiNotifierImpl::ResetAndDestroy - IN" ); |
|
1165 if ( aPointerArray ) |
|
1166 { |
|
1167 RPointerArray<CRCSEProfileEntry>* array = |
|
1168 reinterpret_cast<RPointerArray<CRCSEProfileEntry>*>( aPointerArray ); |
|
1169 TInt i = array->Count(); |
|
1170 array->ResetAndDestroy(); |
|
1171 array->Close(); |
|
1172 } |
|
1173 CCHUIDEBUG( "CCCHUiNotifierImpl::ResetAndDestroy - OUT" ); |
|
1174 } |
|
1175 |
|
1176 // --------------------------------------------------------------------------- |
|
1177 // From class CCCHUiNotifierBase. |
|
1178 // --------------------------------------------------------------------------- |
|
1179 // |
|
1180 CCCHUiNotifierImpl::TNotifierInfo CCCHUiNotifierImpl::RegisterL() |
|
1181 { |
|
1182 iInfo.iUid=KCchUiNotifierUid; |
|
1183 iInfo.iChannel=KCchUiNotifierChannel; |
|
1184 iInfo.iPriority=ENotifierPriorityVHigh; |
|
1185 return iInfo; |
|
1186 } |
|
1187 |
|
1188 // --------------------------------------------------------------------------- |
|
1189 // From class CCCHUiNotifierBase. |
|
1190 // --------------------------------------------------------------------------- |
|
1191 // |
|
1192 TPtrC8 CCCHUiNotifierImpl::UpdateL( const TDesC8& /*aBuffer*/ ) |
|
1193 { |
|
1194 TPtrC8 ret( KNullDesC8 ); |
|
1195 return ret; |
|
1196 } |
|
1197 |
|
1198 // --------------------------------------------------------------------------- |
|
1199 // From class CCCHUiNotifierBase. |
|
1200 // --------------------------------------------------------------------------- |
|
1201 // |
|
1202 void CCCHUiNotifierImpl::StartL( |
|
1203 const TDesC8& aBuffer, |
|
1204 TInt aReplySlot, |
|
1205 const RMessagePtr2& aMessage) |
|
1206 { |
|
1207 CCHUIDEBUG( "CCCHUiNotifierImpl::StartL - IN" ); |
|
1208 |
|
1209 __ASSERT_DEBUG( iMessage.IsNull(), User::Leave( KErrAlreadyExists ) ); |
|
1210 |
|
1211 // Read aBuffer for control information |
|
1212 TCCHUiNotifierParams param; |
|
1213 TPckgC<TCCHUiNotifierParams> pckg(param); |
|
1214 pckg.Set( aBuffer ); |
|
1215 |
|
1216 CCCHUiNotifierBase::StartL( aBuffer, aReplySlot, aMessage ); |
|
1217 iDialogMode = pckg().iDialogMode; |
|
1218 iServiceId = pckg().iServiceId; |
|
1219 iCurrentConnectionIapId = pckg().iCurrentConnectionIapId; |
|
1220 |
|
1221 switch( pckg().iDialogMode ) |
|
1222 { |
|
1223 case MCchUiObserver::ECchUiDialogTypeUsernamePasswordFailed: |
|
1224 { |
|
1225 CCHUIDEBUG( "StartL - wrong username/password" ); |
|
1226 ShowInvalidUsernamePasswordNoteL( |
|
1227 aReplySlot, aMessage, pckg().iServiceId ); |
|
1228 } |
|
1229 break; |
|
1230 case MCchUiObserver::ECchUiDialogTypeAuthenticationFailed: |
|
1231 { |
|
1232 CCHUIDEBUG( "StartL - auth failed" ); |
|
1233 ShowUsernamePasswordQueryL( |
|
1234 aReplySlot, aMessage, pckg().iServiceId, pckg().iUsername ); |
|
1235 } |
|
1236 break; |
|
1237 |
|
1238 case MCchUiObserver::ECchUiDialogTypeNoConnectionAvailable: |
|
1239 { |
|
1240 CCHUIDEBUG( "StartL - no connections" ); |
|
1241 // Do nothing here. Uses RunL to show notifier instead. |
|
1242 // Needed for cancel functionality. |
|
1243 } |
|
1244 break; |
|
1245 case MCchUiObserver::ECchUiDialogTypeNoConnectionDefined: |
|
1246 { |
|
1247 CCHUIDEBUG( "StartL - no conn defined" ); |
|
1248 ShowNoConnectionsQueryL( |
|
1249 aReplySlot, aMessage, pckg().iServiceId, ETrue ); |
|
1250 } |
|
1251 break; |
|
1252 case MCchUiObserver::ECchUiDialogTypeDefectiveSettings: |
|
1253 { |
|
1254 CCHUIDEBUG( "StartL - defective settings" ); |
|
1255 ShowDefectiveSettingsL( |
|
1256 aReplySlot, aMessage, pckg().iServiceId ); |
|
1257 } |
|
1258 break; |
|
1259 case MCchUiObserver::ECchUiDialogTypeErrorInConnection: |
|
1260 { |
|
1261 CCHUIDEBUG( "StartL - error in connection" ); |
|
1262 ShowErrorInConnectionNoteL( |
|
1263 aReplySlot, aMessage, pckg().iServiceId ); |
|
1264 } |
|
1265 break; |
|
1266 case MCchUiObserver::ECchUiDialogTypeConfirmChangeConnection: |
|
1267 { |
|
1268 CCHUIDEBUG( "StartL - confirm change connection" ); |
|
1269 ShowConfirmChangeConnectionL( |
|
1270 aReplySlot, |
|
1271 aMessage, |
|
1272 pckg().iServiceId, |
|
1273 pckg().iCurrentConnectionIapId ); |
|
1274 } |
|
1275 break; |
|
1276 case MCchUiObserver::ECchUiDialogTypeChangeConnection: |
|
1277 { |
|
1278 CCHUIDEBUG( "StartL - change connection" ); |
|
1279 ShowChangeConnectionQueryL( |
|
1280 aReplySlot, |
|
1281 aMessage, |
|
1282 pckg().iServiceId, |
|
1283 pckg().iCurrentConnectionIapId ); |
|
1284 } |
|
1285 break; |
|
1286 default: |
|
1287 { |
|
1288 User::Leave( KErrNotSupported ); |
|
1289 } |
|
1290 break; |
|
1291 } |
|
1292 |
|
1293 CCHUIDEBUG( "CCCHUiNotifierImpl::StartL - OUT" ); |
|
1294 } |
|
1295 |
|
1296 // --------------------------------------------------------------------------- |
|
1297 // From class MCchUiCallStateObserver. |
|
1298 // --------------------------------------------------------------------------- |
|
1299 // |
|
1300 void CCCHUiNotifierImpl::CallStateChanged( TInt aCallState ) |
|
1301 { |
|
1302 CCHUIDEBUG( "CCCHUiNotifierImpl::CallStateChangedL - Start" ); |
|
1303 |
|
1304 switch( aCallState ) |
|
1305 { |
|
1306 case EPSCTsyCallStateRinging: |
|
1307 { |
|
1308 if ( iListQueryDialog ) |
|
1309 { |
|
1310 delete iListQueryDialog; |
|
1311 iListQueryDialog = NULL; |
|
1312 |
|
1313 CompleteMessage( KErrCancel ); |
|
1314 CCCHUiNotifierBase::Cancel(); |
|
1315 } |
|
1316 } |
|
1317 break; |
|
1318 default: |
|
1319 { |
|
1320 // Nothing to do. |
|
1321 } |
|
1322 break; |
|
1323 } |
|
1324 |
|
1325 CCHUIDEBUG( "CCCHUiNotifierImpl::CallStateChangedL - End" ); |
|
1326 } |
|
1327 |
|
1328 // --------------------------------------------------------------------------- |
|
1329 // From class MSIPProfileRegistryObserver. |
|
1330 // --------------------------------------------------------------------------- |
|
1331 // |
|
1332 void CCCHUiNotifierImpl::ProfileRegistryEventOccurred( |
|
1333 TUint32 /*aSIPProfileId*/, |
|
1334 TEvent /*aEvent*/ ) |
|
1335 { |
|
1336 } |
|
1337 |
|
1338 |
|
1339 // --------------------------------------------------------------------------- |
|
1340 // From class MSIPProfileRegistryObserver. |
|
1341 // --------------------------------------------------------------------------- |
|
1342 // |
|
1343 void CCCHUiNotifierImpl::ProfileRegistryErrorOccurred( |
|
1344 TUint32 /*aSIPProfileId*/, |
|
1345 TInt /*aError*/ ) |
|
1346 { |
|
1347 } |