|
1 /* |
|
2 * Copyright (c) 2005-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: Dialog renderer. |
|
15 * |
|
16 */ |
|
17 |
|
18 // System includes |
|
19 #include <e32property.h> |
|
20 #include <aknnotedialog.h> |
|
21 #include <avkon.rsg> |
|
22 #include <StringLoader.h> |
|
23 |
|
24 // User includes |
|
25 #include <hscontentpublisher.h> |
|
26 #include <hspublisherinfo.h> |
|
27 #include <activeidle2domainpskeys.h> |
|
28 #include <AiNativeUi.rsg> |
|
29 #include "aidialogrenderer.h" |
|
30 #include "ainativeuiplugins.h" |
|
31 #ifdef __COVER_DISPLAY |
|
32 #include "aisecondarydisplayapi.h" |
|
33 #endif |
|
34 |
|
35 |
|
36 // AVKON headers |
|
37 #include <aknnotewrappers.h> // for Note Wrappers |
|
38 #include <aknPopup.h> // for Popup menus |
|
39 #include <AknWaitDialog.h> // for CAknWaitDialog |
|
40 #include <StringLoader.h> // for StringLoader |
|
41 #include <eiktxlbm.h> // for CTextListBoxModel |
|
42 #include <aknlists.h> // for AknPopupListEmpty |
|
43 #include <bautils.h> // for BaflUtils |
|
44 |
|
45 // Phonesettings headers |
|
46 #include <PsetContainer.h> // for CPsetContainer |
|
47 #include <PsetNetwork.h> // for CPsetNetwork |
|
48 #include <PsetSAObserver.h> // for CPsetSAObserver |
|
49 #include <gsmerror.h> // for GSM-specific error messages |
|
50 |
|
51 #include <GsNetworkPluginRsc.rsg> // for resource IDs |
|
52 #include <CoreApplicationUIsSDKCRKeys.h> // for KCRUidCoreApplicationUIs, TCoreAppUIsNetworkConnectionAllowed |
|
53 #include <featmgr.h> |
|
54 |
|
55 const TInt KAIAlphaTagIconAdditionalChars = 5; |
|
56 // Length of long network name. |
|
57 const TInt KAIAlphaTagLongNameLength = 20; |
|
58 // Length of short network name. |
|
59 const TInt KAIAlphaTagShortNameLength = 10; |
|
60 |
|
61 // array granularity |
|
62 const TInt KAINetworkInfoArrayGranularity = 10; |
|
63 |
|
64 // Error note type ID - for Net view internal usage only |
|
65 const TInt KAIPPErrorNote = 5001; |
|
66 // Confirmation note type ID - for Net view internal usage only |
|
67 const TInt KAIPPConfirmationNote = 5002; |
|
68 //Information note type ID - for Net view internal usage only |
|
69 const TInt KAIPPInformationNote = 5003; |
|
70 |
|
71 const TInt KAIPLMNListPopupMenuItems = 3; |
|
72 |
|
73 // Some resources defined for GSNetworkPlugin are used |
|
74 _LIT(KGSNetworkPluginResource, "z:\\resource\\GsNetworkPluginRsc.rsc"); |
|
75 |
|
76 enum TGSSoftKeys |
|
77 { |
|
78 EGSSoftkeyQuit = 1, |
|
79 EGSSoftkeyEmpty |
|
80 }; |
|
81 |
|
82 |
|
83 using namespace AiNativeUiController; |
|
84 |
|
85 // ======== MEMBER FUNCTIONS ======== |
|
86 // ---------------------------------------------------------------------------- |
|
87 // CAiDialogRenderer::NewLC() |
|
88 // |
|
89 // ---------------------------------------------------------------------------- |
|
90 // |
|
91 CAiDialogRenderer* CAiDialogRenderer::NewLC() |
|
92 { |
|
93 CAiDialogRenderer* self = new( ELeave ) CAiDialogRenderer; |
|
94 CleanupStack::PushL( self ); |
|
95 self->ConstructL(); |
|
96 return self; |
|
97 } |
|
98 |
|
99 // ---------------------------------------------------------------------------- |
|
100 // CAiDialogRenderer::~CAiDialogRenderer() |
|
101 // |
|
102 // ---------------------------------------------------------------------------- |
|
103 // |
|
104 CAiDialogRenderer::~CAiDialogRenderer() |
|
105 { |
|
106 if ( FeatureManager::FeatureSupported( KFeatureIdFfManualSelectionPopulatedPlmnList ) ) |
|
107 { |
|
108 if( iRscIndex ) |
|
109 { |
|
110 CEikonEnv::Static()->DeleteResourceFile( iRscIndex ); |
|
111 } |
|
112 if ( iNetwork ) |
|
113 { |
|
114 if ( iSearchForNetworksActive ) |
|
115 { |
|
116 // Reset back to previously used network |
|
117 iNetwork->ResetNetworkSearch(); |
|
118 } |
|
119 delete iNetwork; |
|
120 } |
|
121 |
|
122 if ( iNetworkArray ) |
|
123 { |
|
124 iNetworkArray->Reset(); |
|
125 } |
|
126 delete iNetworkArray; |
|
127 |
|
128 if ( iDlg ) |
|
129 { |
|
130 delete iDlg; |
|
131 } |
|
132 if ( iNetworkPopupList ) |
|
133 { |
|
134 iNetworkPopupList->CancelPopup(); |
|
135 } |
|
136 |
|
137 if ( iSettingsContainer ) |
|
138 { |
|
139 delete iSettingsContainer; |
|
140 } |
|
141 } |
|
142 |
|
143 FeatureManager::UnInitializeLib(); |
|
144 |
|
145 delete iDialog; |
|
146 delete iText; |
|
147 } |
|
148 |
|
149 // ---------------------------------------------------------------------------- |
|
150 // CAiDialogRenderer::CAiDialogRenderer() |
|
151 // |
|
152 // ---------------------------------------------------------------------------- |
|
153 // |
|
154 CAiDialogRenderer::CAiDialogRenderer() |
|
155 { |
|
156 } |
|
157 |
|
158 void CAiDialogRenderer::ConstructL() |
|
159 { |
|
160 FeatureManager::InitializeLibL(); |
|
161 |
|
162 if ( FeatureManager::FeatureSupported( KFeatureIdFfManualSelectionPopulatedPlmnList ) ) |
|
163 { |
|
164 iSettingsContainer = CPsetContainer::NewL(); |
|
165 iNetwork = iSettingsContainer->CreateNetworkObjectL( *this ); |
|
166 |
|
167 iApprovedNetwork = EFalse; |
|
168 CheckAndCreateDlgL( EFalse ); |
|
169 iSearchForNetworksActive = EFalse; |
|
170 iPLMNListPopulateShowIsHandling = EFalse; |
|
171 |
|
172 // Open the resource file. Assume that the resource is stored on the same |
|
173 // drive the DLL is installed on. |
|
174 TFileName file; |
|
175 Dll::FileName( file ); |
|
176 TParse parse; |
|
177 parse.Set( KGSNetworkPluginResource, &file, NULL ); |
|
178 file = parse.FullName(); |
|
179 CEikonEnv* eikonEnv = CEikonEnv::Static(); |
|
180 BaflUtils::NearestLanguageFile( eikonEnv->FsSession(), file ); |
|
181 iRscIndex = eikonEnv->AddResourceFileL( file ); |
|
182 } |
|
183 } |
|
184 |
|
185 void CAiDialogRenderer::DoPublishL( CHsContentPublisher& aPlugin, |
|
186 TInt aContent, TInt aResource, TInt /*aIndex*/ ) |
|
187 { |
|
188 const THsPublisherInfo& info( aPlugin.PublisherInfo() ); |
|
189 |
|
190 if( info.Uid() == KDeviceStatusPluginUid ) |
|
191 { |
|
192 switch( aContent ) |
|
193 { |
|
194 case EAiDeviceStatusContentSIMRegStatus: |
|
195 { |
|
196 TInt idleState; |
|
197 if ( RProperty::Get( |
|
198 KPSUidAiInformation, |
|
199 KActiveIdleState, |
|
200 idleState ) != KErrNone ) |
|
201 { |
|
202 idleState = EPSAiBackground; |
|
203 } |
|
204 if( aResource == EAiDeviceStatusResourceSIMRegFail ) |
|
205 { |
|
206 if( iShowDialog ) |
|
207 { |
|
208 break; |
|
209 } |
|
210 HBufC* temp = StringLoader::LoadL( |
|
211 R_ACTIVEIDLE_SIM_REGISTRATION_FAILED ); |
|
212 delete iText; |
|
213 iText = temp; |
|
214 #ifdef __COVER_DISPLAY |
|
215 iDialogId = EAiSimRegistrationFailed; |
|
216 #endif |
|
217 iShowDialog = ETrue; |
|
218 } |
|
219 if ( idleState == EPSAiForeground ) |
|
220 { |
|
221 ShowDialogL(); |
|
222 } |
|
223 break; |
|
224 } |
|
225 |
|
226 case EAiDeviceStatusContentNetRegStatus: |
|
227 { |
|
228 MPsetNetworkSelect::TSelectMode mode = |
|
229 MPsetNetworkSelect::ENetSelectModeAutomatic; |
|
230 |
|
231 if ( iNetwork ) |
|
232 { |
|
233 iNetwork->GetNetworkSelectMode( mode ); |
|
234 } |
|
235 |
|
236 if ( mode == MPsetNetworkSelect::ENetSelectModeManual ) |
|
237 { |
|
238 if ( aResource == EAiDeviceStatusResourceNetRegFail ) |
|
239 { |
|
240 PopulatePLMNListL(); |
|
241 } |
|
242 } |
|
243 break; |
|
244 } |
|
245 |
|
246 |
|
247 default: |
|
248 { |
|
249 User::Leave( KErrNotFound ); |
|
250 break; |
|
251 } |
|
252 }; |
|
253 } |
|
254 else |
|
255 { |
|
256 User::Leave( KErrNotFound ); |
|
257 } |
|
258 } |
|
259 |
|
260 // ---------------------------------------------------------------------------- |
|
261 // CAiDialogRenderer::DoCleanL() |
|
262 // |
|
263 // ---------------------------------------------------------------------------- |
|
264 // |
|
265 void CAiDialogRenderer::DoCleanL( CHsContentPublisher& /*aPlugin*/, |
|
266 TInt aContent ) |
|
267 { |
|
268 switch( aContent ) |
|
269 { |
|
270 case EAiDeviceStatusContentSIMRegStatus: |
|
271 { |
|
272 delete iDialog; |
|
273 iDialog = NULL; |
|
274 iShowDialog = EFalse; |
|
275 break; |
|
276 } |
|
277 default: |
|
278 { |
|
279 User::Leave( KErrNotFound ); |
|
280 break; |
|
281 } |
|
282 } |
|
283 } |
|
284 |
|
285 // ---------------------------------------------------------------------------- |
|
286 // CAiDialogRenderer::ShowDialogL() |
|
287 // |
|
288 // ---------------------------------------------------------------------------- |
|
289 // |
|
290 void CAiDialogRenderer::ShowDialogL() |
|
291 { |
|
292 if ( iDialog ) |
|
293 { |
|
294 return; |
|
295 } |
|
296 |
|
297 iDialog = |
|
298 new (ELeave) CAknNoteDialog( |
|
299 reinterpret_cast< CEikDialog** >( &iDialog ), |
|
300 CAknNoteDialog::EConfirmationTone, |
|
301 CAknNoteDialog::ENoTimeout ); |
|
302 |
|
303 #ifdef __COVER_DISPLAY |
|
304 iDialog->PublishDialogL( iDialogId, KAICategory ); |
|
305 #endif |
|
306 |
|
307 iDialog->PrepareLC( R_AKN_INFORMATION_NOTE_DIALOG ); |
|
308 |
|
309 iDialog->ButtonGroupContainer().SetCommandSetL( R_AVKON_SOFTKEYS_OK_EMPTY ); |
|
310 iDialog->SetTextL( *iText ); |
|
311 iDialog->RunLD(); |
|
312 } |
|
313 |
|
314 // ---------------------------------------------------------------------------- |
|
315 // CAiDialogRenderer::FocusObtainedL() |
|
316 // |
|
317 // ---------------------------------------------------------------------------- |
|
318 // |
|
319 void CAiDialogRenderer::FocusObtainedL() |
|
320 { |
|
321 if( iShowDialog ) |
|
322 { |
|
323 ShowDialogL(); |
|
324 } |
|
325 } |
|
326 |
|
327 void CAiDialogRenderer::PopulatePLMNListL() |
|
328 { |
|
329 // Ignore any subsequent EAiDeviceStatusResourcePLMNListPopulateShow content while one is handling |
|
330 if ( iPLMNListPopulateShowIsHandling ) |
|
331 { |
|
332 return; |
|
333 } |
|
334 |
|
335 iPLMNListPopulateShowIsHandling = ETrue; |
|
336 iSearchForNetworksActive = ETrue; |
|
337 iNetwork->GetAvailableNetworksL(); |
|
338 } |
|
339 |
|
340 // --------------------------------------------------------------------------- |
|
341 // |
|
342 // While request to find networks is processed |
|
343 // |
|
344 // --------------------------------------------------------------------------- |
|
345 void CAiDialogRenderer::HandleSearchingNetworksL( |
|
346 MPsetNetworkInfoObserver::TServiceRequest aRequest ) |
|
347 { |
|
348 // Create a network info array if doesn't exist |
|
349 if ( !iNetworkArray ) |
|
350 { |
|
351 iNetworkArray = new ( ELeave ) |
|
352 CNetworkInfoArray( KAINetworkInfoArrayGranularity ); |
|
353 } |
|
354 |
|
355 if ( aRequest != MPsetNetworkInfoObserver::EServiceRequestNone ) |
|
356 { |
|
357 CheckAndCreateDlgL( EFalse ); |
|
358 iSearchForNetworksActive = ETrue; |
|
359 TInt res = iDlg->ExecuteLD( R_SEARCHING_NOTE ); |
|
360 if ( res == EGSSoftkeyQuit ) |
|
361 { |
|
362 iNetwork->CancelProcess(); |
|
363 iPLMNListPopulateShowIsHandling = EFalse; |
|
364 } |
|
365 } |
|
366 else // If EServiceRequestNone received, hide the "Searching..." note |
|
367 { |
|
368 delete iDlg; |
|
369 iDlg = NULL; |
|
370 } |
|
371 } |
|
372 |
|
373 // --------------------------------------------------------------------------- |
|
374 // |
|
375 // Handles network info |
|
376 // |
|
377 // --------------------------------------------------------------------------- |
|
378 void CAiDialogRenderer::HandleNetworkInfoReceivedL( |
|
379 const CNetworkInfoArray* aInfoArray, const TInt /* aResult */ ) |
|
380 { |
|
381 const TInt itemsCount = aInfoArray->Count(); |
|
382 |
|
383 // First delete old ones |
|
384 iNetworkArray->Delete( 0, iNetworkArray->Count() ); |
|
385 |
|
386 // Then insert found networks |
|
387 for ( TInt i = 0; i < itemsCount; i++ ) |
|
388 { |
|
389 MPsetNetworkSelect::TNetworkInfo info = aInfoArray->At( i ); |
|
390 iNetworkArray->InsertL( i, info ); |
|
391 } |
|
392 |
|
393 NetworkListL(); // After search complete, show results |
|
394 } |
|
395 |
|
396 // --------------------------------------------------------------------------- |
|
397 // |
|
398 // While request to change network is processed, a note is shown |
|
399 // |
|
400 // --------------------------------------------------------------------------- |
|
401 void CAiDialogRenderer::HandleRequestingSelectedNetworkL( TBool aOngoing ) |
|
402 { |
|
403 if ( aOngoing ) |
|
404 { |
|
405 CheckAndCreateDlgL( ETrue ); |
|
406 |
|
407 if ( iDlg->ExecuteLD( R_REQUESTING_NOTE ) == EGSSoftkeyQuit ) |
|
408 { |
|
409 iNetwork->CancelProcess(); |
|
410 |
|
411 CAknNoteDialog* dlg = new ( ELeave ) CAknNoteDialog( |
|
412 CAknNoteDialog::EConfirmationTone, |
|
413 CAknNoteDialog::EShortTimeout ); |
|
414 dlg->ExecuteLD( R_REGISTRATION_INTERRUPTED ); |
|
415 iApprovedNetwork = EFalse; |
|
416 iPLMNListPopulateShowIsHandling = EFalse; |
|
417 } |
|
418 } |
|
419 else |
|
420 { |
|
421 delete iDlg; |
|
422 iDlg = NULL; |
|
423 } |
|
424 } |
|
425 |
|
426 // --------------------------------------------------------------------------- |
|
427 // |
|
428 // Handle network change |
|
429 // |
|
430 // --------------------------------------------------------------------------- |
|
431 void CAiDialogRenderer::HandleNetworkChangedL( |
|
432 const MPsetNetworkSelect::TNetworkInfo& aCurrentInfo, |
|
433 const RMobilePhone::TMobilePhoneRegistrationStatus& aStatus, |
|
434 const TInt aResult ) |
|
435 { |
|
436 switch ( aStatus ) |
|
437 { |
|
438 case RMobilePhone::ERegisteredOnHomeNetwork: |
|
439 { |
|
440 ShowNoteL( R_HOME_NETWORK_SELECTED, KAIPPConfirmationNote ); |
|
441 PurgeNetworkList(); |
|
442 break; |
|
443 } |
|
444 case RMobilePhone::ERegisteredRoaming: |
|
445 { |
|
446 HBufC* stringholder = NULL; |
|
447 if ( aCurrentInfo.iLongName.Length() > 0 && |
|
448 aCurrentInfo.iLongName.Length() <= |
|
449 MPsetNetworkSelect::ENetLongNameSize ) |
|
450 { |
|
451 stringholder = StringLoader::LoadLC( R_NETSL_NETWORKSELECTED, |
|
452 aCurrentInfo.iLongName ); |
|
453 } |
|
454 else if (aCurrentInfo.iShortName.Length() > 0 && |
|
455 aCurrentInfo.iShortName.Length() <= |
|
456 MPsetNetworkSelect::ENetShortNameSize ) |
|
457 { |
|
458 stringholder = StringLoader::LoadLC( R_NETSL_NETWORKSELECTED, |
|
459 aCurrentInfo.iShortName ); |
|
460 } |
|
461 |
|
462 CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote( ETrue ); |
|
463 if ( stringholder ) |
|
464 { |
|
465 note->ExecuteLD( *stringholder ); |
|
466 CleanupStack::PopAndDestroy( stringholder ); |
|
467 } |
|
468 |
|
469 //After list has been used, clear it. |
|
470 PurgeNetworkList(); |
|
471 break; |
|
472 } |
|
473 case RMobilePhone::ERegistrationUnknown: |
|
474 case RMobilePhone::ENotRegisteredNoService: |
|
475 case RMobilePhone::ENotRegisteredEmergencyOnly: |
|
476 case RMobilePhone::ENotRegisteredSearching: |
|
477 case RMobilePhone::ERegisteredBusy: |
|
478 case RMobilePhone::ERegistrationDenied: |
|
479 default: |
|
480 break; |
|
481 } |
|
482 |
|
483 iPLMNListPopulateShowIsHandling = EFalse; |
|
484 iSearchForNetworksActive = EFalse; |
|
485 } |
|
486 |
|
487 // --------------------------------------------------------------------------- |
|
488 // |
|
489 // Handles errors. |
|
490 // |
|
491 // --------------------------------------------------------------------------- |
|
492 void CAiDialogRenderer::HandleNetworkErrorL( |
|
493 const MPsetNetworkInfoObserver::TServiceRequest aRequest, |
|
494 const TInt aError ) |
|
495 { |
|
496 TInt resourceTxt = KErrNone; |
|
497 |
|
498 switch ( aRequest ) |
|
499 { |
|
500 case MPsetNetworkInfoObserver::EServiceRequestGetNetworkInfo: |
|
501 { |
|
502 iNetwork->CancelProcess(); |
|
503 iApprovedNetwork = EFalse; |
|
504 break; |
|
505 } |
|
506 case MPsetNetworkInfoObserver::EServiceRequestSetNetwork: |
|
507 { |
|
508 } |
|
509 default: |
|
510 { |
|
511 break; |
|
512 } |
|
513 } |
|
514 |
|
515 TBool ignore = EFalse; |
|
516 |
|
517 switch ( aError ) |
|
518 { |
|
519 case KErrGsmNetCauseCallActive: |
|
520 { |
|
521 ignore = ETrue; // Do not show an error |
|
522 break; |
|
523 } |
|
524 case KErrGsm0707NoNetworkService: |
|
525 { |
|
526 resourceTxt = R_NO_NETWORK_FOUND; |
|
527 break; |
|
528 } |
|
529 case KErrGsmOfflineOpNotAllowed: |
|
530 { |
|
531 resourceTxt = R_OFFLINE_MODE; |
|
532 break; |
|
533 } |
|
534 default: |
|
535 { |
|
536 resourceTxt = R_NO_NETWORK_ACCESS; |
|
537 break; |
|
538 } |
|
539 } |
|
540 |
|
541 if ( !ignore ) |
|
542 { |
|
543 ShowNoteL( resourceTxt, KAIPPErrorNote ); |
|
544 iApprovedNetwork = EFalse; |
|
545 } |
|
546 } |
|
547 |
|
548 // --------------------------------------------------------------------------- |
|
549 // |
|
550 // Creates list of Network providers |
|
551 // |
|
552 // --------------------------------------------------------------------------- |
|
553 void CAiDialogRenderer::NetworkListL() |
|
554 { |
|
555 //if no net items were found, do not show list |
|
556 if ( iNetworkArray->Count() > 0 ) |
|
557 { |
|
558 while ( !iApprovedNetwork ) |
|
559 { |
|
560 AknPopupListEmpty<CEikFormattedCellListBox>* list; |
|
561 list = new ( ELeave ) CAknSinglePopupMenuStyleListBox; |
|
562 CleanupStack::PushL( list ); |
|
563 |
|
564 if ( iNetworkPopupList ) |
|
565 { |
|
566 iNetworkPopupList->CancelPopup(); |
|
567 iNetworkPopupList = NULL; |
|
568 } // |
|
569 |
|
570 iNetworkPopupList = |
|
571 CAknPopupList::NewL( list, R_AVKON_SOFTKEYS_OK_CANCEL ); |
|
572 |
|
573 list->ConstructL( iNetworkPopupList, |
|
574 CEikListBox::ELeftDownInViewRect ); |
|
575 list->CreateScrollBarFrameL( ETrue ); |
|
576 list->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
577 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
|
578 |
|
579 // Fill in the list texts |
|
580 CDesCArrayFlat* items = |
|
581 new ( ELeave ) CDesCArrayFlat( KAIPLMNListPopupMenuItems ); |
|
582 CleanupStack::PushL( items ); |
|
583 |
|
584 const TInt itemsCount = iNetworkArray->Count(); |
|
585 |
|
586 for ( TInt loop = 0; loop < itemsCount; loop++ ) |
|
587 { |
|
588 HBufC* insertString = |
|
589 HBufC::NewLC( |
|
590 KAIAlphaTagLongNameLength + KAIAlphaTagIconAdditionalChars ); |
|
591 MPsetNetworkSelect::TNetworkInfo info = |
|
592 iNetworkArray->At( loop ); |
|
593 |
|
594 if ( info.iLongName.Length() <= 0 || |
|
595 info.iLongName.Length() > KAIAlphaTagLongNameLength ) |
|
596 { |
|
597 // Short name received |
|
598 if ( info.iShortName.Length() > 0 && |
|
599 info.iShortName.Length() <= KAIAlphaTagShortNameLength ) |
|
600 { |
|
601 insertString->Des().Append( info.iShortName ); |
|
602 } // |
|
603 } // |
|
604 // Long name received |
|
605 else |
|
606 { |
|
607 insertString->Des().Append( info.iLongName ); |
|
608 } // |
|
609 |
|
610 items->AppendL( *insertString ); |
|
611 CleanupStack::PopAndDestroy(); |
|
612 } |
|
613 |
|
614 CTextListBoxModel* model = list->Model(); |
|
615 model->SetItemTextArray( items ); |
|
616 model->SetOwnershipType( ELbmOwnsItemArray ); |
|
617 CleanupStack::Pop( items ); // Listbox model now owns this |
|
618 |
|
619 // Set title for list |
|
620 SetTitleToPopupL( *iNetworkPopupList, R_NETSL_FOUNDOPERATORS ); |
|
621 |
|
622 TInt res = 0; |
|
623 // Show the PLMN list |
|
624 if ( items->Count() ) |
|
625 { |
|
626 res = iNetworkPopupList->ExecuteLD(); |
|
627 } // |
|
628 |
|
629 iNetworkPopupList = NULL; |
|
630 iApprovedNetwork = ETrue; // User might want to quit |
|
631 TInt selection = list->CurrentItemIndex(); |
|
632 |
|
633 CleanupStack::PopAndDestroy( list ); |
|
634 |
|
635 if ( res ) |
|
636 { |
|
637 MPsetNetworkSelect::TNetworkInfo info = |
|
638 iNetworkArray->At( selection ); |
|
639 info.iMode = MPsetNetworkSelect::ENetSelectModeManual; |
|
640 iNetwork->SelectNetworkL( info ); |
|
641 } // |
|
642 else // User selected "Cancel" |
|
643 { |
|
644 // Reset back to previously used network |
|
645 iNetwork->ResetNetworkSearch(); |
|
646 iSearchForNetworksActive = EFalse; |
|
647 // After list has been used, clear it |
|
648 PurgeNetworkList(); |
|
649 iPLMNListPopulateShowIsHandling = EFalse; |
|
650 } // |
|
651 } |
|
652 } |
|
653 |
|
654 iApprovedNetwork = EFalse; // Initialize before new search |
|
655 } |
|
656 |
|
657 // --------------------------------------------------------------------------- |
|
658 // |
|
659 // Creates dialog, if it is does not exist yet. |
|
660 // |
|
661 // --------------------------------------------------------------------------- |
|
662 // |
|
663 void CAiDialogRenderer::CheckAndCreateDlgL( TBool aDelayOff ) |
|
664 { |
|
665 if ( !iDlg ) |
|
666 { |
|
667 iDlg = new ( ELeave ) CAknWaitDialog( |
|
668 reinterpret_cast<CEikDialog**> ( &iDlg ), aDelayOff ); |
|
669 } |
|
670 } |
|
671 |
|
672 // --------------------------------------------------------------------------- |
|
673 // |
|
674 // Sets a title to a given popup list. |
|
675 // |
|
676 // --------------------------------------------------------------------------- |
|
677 void CAiDialogRenderer::SetTitleToPopupL( CAknPopupList& aList, TInt aTitleID ) |
|
678 { |
|
679 HBufC* text = StringLoader::LoadLC( aTitleID ); |
|
680 |
|
681 aList.SetTitleL( *text ); |
|
682 |
|
683 CleanupStack::PopAndDestroy( text ); |
|
684 text = NULL; |
|
685 } |
|
686 |
|
687 // --------------------------------------------------------------------------- |
|
688 // |
|
689 // Shows note. |
|
690 // |
|
691 // --------------------------------------------------------------------------- |
|
692 // |
|
693 void CAiDialogRenderer::ShowNoteL( TInt aResourceId, TInt aType ) |
|
694 { |
|
695 HBufC* string = StringLoader::LoadLC( aResourceId ); |
|
696 |
|
697 switch ( aType ) |
|
698 { |
|
699 case KAIPPErrorNote: |
|
700 { |
|
701 CAknErrorNote* note = new ( ELeave ) CAknErrorNote ( ETrue ); |
|
702 note->ExecuteLD( *string ); |
|
703 break; |
|
704 } |
|
705 case KAIPPConfirmationNote: |
|
706 { |
|
707 CAknConfirmationNote* note = |
|
708 new ( ELeave ) CAknConfirmationNote( ETrue ); |
|
709 note->ExecuteLD( *string ); |
|
710 break; |
|
711 } |
|
712 case KAIPPInformationNote: |
|
713 { |
|
714 CAknInformationNote* note = |
|
715 new ( ELeave ) CAknInformationNote( ETrue ); |
|
716 note->ExecuteLD( *string ); |
|
717 break; |
|
718 } |
|
719 default: |
|
720 break; |
|
721 } |
|
722 |
|
723 CleanupStack::PopAndDestroy( string ); |
|
724 } |
|
725 |
|
726 // --------------------------------------------------------------------------- |
|
727 // |
|
728 // Empties fetched network provider's list |
|
729 // |
|
730 // --------------------------------------------------------------------------- |
|
731 // |
|
732 void CAiDialogRenderer::PurgeNetworkList() |
|
733 { |
|
734 if ( iNetworkArray ) |
|
735 { |
|
736 iNetworkArray->Reset(); |
|
737 delete iNetworkArray; |
|
738 iNetworkArray = NULL; |
|
739 } |
|
740 } |
|
741 |
|
742 // End of file |