|
1 /* |
|
2 * Copyright (c) 2006-2008 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: Call submenu in General Settings. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "GSNetworkPlugin.h" //for CGSCallPlugin |
|
21 #include "GSNetworkPluginContainer.h" //for CGSCallPluginContainer |
|
22 #include "GsLogger.h" |
|
23 #include "GSNetworkPlugin.h" //for pluginUID |
|
24 |
|
25 #include <coeaui.h> |
|
26 #include <hlplch.h> // For HlpLauncher |
|
27 |
|
28 //AVKON headers |
|
29 #include <aknnotewrappers.h> //for Note Wrappers |
|
30 #include <aknPopup.h> //for Popup menus |
|
31 #include <aknradiobuttonsettingpage.h> //for Radio Button Setting Pages |
|
32 #include <aknViewAppUi.h> //for viewappui |
|
33 #include <AknWaitDialog.h> //for CAknWaitDialog |
|
34 #include <AknIconArray.h> //for AknIconArray |
|
35 #include <StringLoader.h> //for StringLoader |
|
36 #include <apparc.h> |
|
37 |
|
38 #include <gscommon.hrh> |
|
39 |
|
40 //Phonesettings and TSY headers |
|
41 #include <PsetContainer.h> //for CPsetContainer |
|
42 #include <PsetNetwork.h> //for CPsetNetwork |
|
43 #include <PsetSAObserver.h> //for CPsetSAObserver |
|
44 #include <gsmerror.h> //for GSM-specific error messages |
|
45 #include <exterror.h> |
|
46 #include <featmgr.h> |
|
47 #include <MSSSettingsRefreshObserver.h> //for SAT refresh |
|
48 #include <gslistbox.h> //for radiobutton class |
|
49 |
|
50 #include <e32property.h> |
|
51 #include <PSVariables.h> |
|
52 |
|
53 #include <gsnetworkpluginrsc.rsg> //for resource IDs |
|
54 #include <gsfwviewuids.h> |
|
55 #include <gslistbox.h> //for CGSListBoxItemTextArray |
|
56 |
|
57 #include <e32property.h> |
|
58 #include <PSVariables.h> |
|
59 #include <gsprivatepluginproviderids.h> |
|
60 #include <gsnetworkplugin.mbg> |
|
61 #include <BTSapInternalPSKeys.h> |
|
62 #include <CoreApplicationUIsSDKCRKeys.h> // KCRUidCoreApplicationUIs, TCoreAppUIsNetworkConnectionAllowed |
|
63 #include <activeidle2domainpskeys.h> |
|
64 |
|
65 #include <CNWSession.h> |
|
66 #include <NetworkHandlingProxy.h> |
|
67 #include <gsparentplugin.h> |
|
68 #include "GSNetworkDebugHelper.h" |
|
69 |
|
70 #ifdef FF_POWER_SAVE |
|
71 #include "GSNetworkPluginAO.h" |
|
72 #endif // FF_POWER_SAVE |
|
73 |
|
74 // LOCAL CONSTANTS |
|
75 _LIT( KGSNetWCDMAIcon, "0\t" ); |
|
76 _LIT( KGSNetGSMIcon, "1\t" ); |
|
77 _LIT( KEmptyStr, "" ); |
|
78 /* Implementation of forbidden operator icon begins */ |
|
79 _LIT( KGSNetNoIcon, "\t"); |
|
80 _LIT( KGSNetForbiddenIcon, "2\t" ); |
|
81 /* Implementation of forbidden operator icon ends */ |
|
82 // Warning disabled as this constant is used inside __ASSERT_DEBUG |
|
83 #pragma diag_suppress 177 |
|
84 _LIT( KGSNetworkPluginAssertName, "CGSNetworkPlugin" ); |
|
85 |
|
86 |
|
87 // Middle Softkey control ID. |
|
88 const TInt KGSMSKControlID = 3; |
|
89 |
|
90 const TInt KGSNetIconAdditionalChars = 5; |
|
91 |
|
92 |
|
93 // ========================= MEMBER FUNCTIONS ================================ |
|
94 // --------------------------------------------------------------------------- |
|
95 // |
|
96 // Constructor. |
|
97 // |
|
98 // --------------------------------------------------------------------------- |
|
99 CGSNetworkPlugin::CGSNetworkPlugin() |
|
100 :iMskCommandFlag( ETrue ) , iPsmActive( NULL ) |
|
101 { |
|
102 } |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 // Symbian OS two-phased constructor (second phase) |
|
107 // |
|
108 // --------------------------------------------------------------------------- |
|
109 void CGSNetworkPlugin::ConstructL() |
|
110 { |
|
111 __GSLOGSTRING("[CGSNetworkPlugin]--> CGSNetworkPlugin::ConstructL"); |
|
112 FeatureManager::InitializeLibL(); |
|
113 OpenLocalizedResourceFileL( KGSNetworkPluginResourceFileName, |
|
114 iResourceLoader ); |
|
115 |
|
116 //PS listener initialization |
|
117 iBtSapListener = CGSPubSubsListener::NewL( |
|
118 KPSUidBluetoothSapConnectionState, |
|
119 KBTSapConnectionState, this ); |
|
120 |
|
121 BaseConstructL( R_GS_NET_VIEW ); |
|
122 |
|
123 iSettingsContainer = CPsetContainer::NewL(); |
|
124 iPSRefreshHandler = iSettingsContainer->CreateRefreshHandlerL(); |
|
125 iPSRefreshHandler->NotifyFileChangeL( |
|
126 *this, |
|
127 KCspEf, |
|
128 EFileChangeNotification ); |
|
129 iPhoneSettingsEngine = iSettingsContainer->CreateNetworkObjectL( *this ); |
|
130 iApprovedNetwork = EFalse; |
|
131 CheckAndCreateDlgL( EFalse ); |
|
132 iSearchForNetworksActive = EFalse; |
|
133 |
|
134 iNetworkText = HBufC::NewL( KNWShortNameLength ); |
|
135 UpdateNetworkTextL(); |
|
136 |
|
137 #ifdef FF_POWER_SAVE |
|
138 iPsmActive = CGSNetworkPluginAO::NewL(); |
|
139 iPsmActive->SetView( this ); |
|
140 #endif // FF_POWER_SAVE |
|
141 |
|
142 __GSLOGSTRING("[CGSNetworkPlugin] <--CGSNetworkPlugin::ConstructL"); |
|
143 } |
|
144 |
|
145 // --------------------------------------------------------------------------- |
|
146 // |
|
147 // Symbian OS two-phased constructor (first phase) |
|
148 // |
|
149 // --------------------------------------------------------------------------- |
|
150 CGSNetworkPlugin* CGSNetworkPlugin::NewLC() |
|
151 { |
|
152 CGSNetworkPlugin* self = new ( ELeave ) CGSNetworkPlugin; |
|
153 CleanupStack::PushL( self ); |
|
154 self->ConstructL(); |
|
155 return self; |
|
156 } |
|
157 |
|
158 // --------------------------------------------------------------------------- |
|
159 // CGSNetworkPlugin::NewL() |
|
160 // Static constructor |
|
161 // |
|
162 // --------------------------------------------------------------------------- |
|
163 // |
|
164 CGSNetworkPlugin* CGSNetworkPlugin::NewL( TAny* /*aInitParams*/ ) |
|
165 { |
|
166 CGSNetworkPlugin* self = new ( ELeave ) CGSNetworkPlugin(); |
|
167 CleanupStack::PushL( self ); |
|
168 self->ConstructL(); |
|
169 CleanupStack::Pop( self ); |
|
170 return self; |
|
171 } |
|
172 |
|
173 // --------------------------------------------------------------------------- |
|
174 // |
|
175 // Destructor |
|
176 // |
|
177 // --------------------------------------------------------------------------- |
|
178 CGSNetworkPlugin::~CGSNetworkPlugin() |
|
179 { |
|
180 __GSLOGSTRING("[CGSNetworkPlugin] ~CGSNetworkPlugin()|->"); |
|
181 FeatureManager::UnInitializeLib(); |
|
182 |
|
183 if( iNWSession ) |
|
184 { |
|
185 delete iNWSession; |
|
186 iNWSession = NULL; |
|
187 } |
|
188 if ( iBtSapListener ) |
|
189 { |
|
190 delete iBtSapListener; |
|
191 iBtSapListener = NULL; |
|
192 } |
|
193 |
|
194 if ( iPhoneSettingsEngine ) |
|
195 { |
|
196 if( iSearchForNetworksActive ) |
|
197 { |
|
198 //Reset back to previously used network |
|
199 iPhoneSettingsEngine->ResetNetworkSearch(); |
|
200 } |
|
201 delete iPhoneSettingsEngine; |
|
202 iPhoneSettingsEngine = NULL; |
|
203 } |
|
204 |
|
205 if ( iNetworkArray ) |
|
206 { |
|
207 iNetworkArray->Reset(); |
|
208 delete iNetworkArray; |
|
209 iNetworkArray = NULL; |
|
210 } |
|
211 |
|
212 if ( iDlg ) |
|
213 { |
|
214 delete iDlg; |
|
215 iDlg = NULL; |
|
216 } |
|
217 if ( iNetworkPopupList ) |
|
218 { |
|
219 iNetworkPopupList->CancelPopup(); |
|
220 } |
|
221 |
|
222 CloseDialog(); |
|
223 |
|
224 //Cancel any outstanding SAT notifications |
|
225 if ( iPSRefreshHandler ) |
|
226 { |
|
227 iPSRefreshHandler->CancelNotify(); |
|
228 delete iPSRefreshHandler; |
|
229 iPSRefreshHandler = NULL; |
|
230 } |
|
231 |
|
232 if( iSettingsContainer ) |
|
233 { |
|
234 delete iSettingsContainer; |
|
235 iSettingsContainer = NULL; |
|
236 } |
|
237 |
|
238 delete iNetworkText; |
|
239 iNetworkText = NULL; |
|
240 |
|
241 #ifdef FF_POWER_SAVE |
|
242 delete iPsmActive; |
|
243 iPsmActive = NULL; |
|
244 #endif // FF_POWER_SAVE |
|
245 |
|
246 __GSLOGSTRING("[CGSNetworkPlugin] ~CGSNetworkPlugin()-|"); |
|
247 } |
|
248 |
|
249 // --------------------------------------------------------------------------- |
|
250 // |
|
251 // Returns Id of the Network submenu |
|
252 // |
|
253 // --------------------------------------------------------------------------- |
|
254 TUid CGSNetworkPlugin::Id() const |
|
255 { |
|
256 return KGSNetworkPluginUid; |
|
257 } |
|
258 |
|
259 // ---------------------------------------------------------------------------- |
|
260 // CGSNetworkPlugin::Visible |
|
261 // |
|
262 // Provides the visibility status of self to framework. |
|
263 // ---------------------------------------------------------------------------- |
|
264 // |
|
265 TBool CGSNetworkPlugin::Visible() const |
|
266 { |
|
267 TBool result( EFalse ); |
|
268 TInt value = 0; |
|
269 iBtSapListener->Get( value ); |
|
270 if ( value == EBTSapNotConnected || value == EBTSapConnecting ) |
|
271 { |
|
272 result = ETrue; |
|
273 } |
|
274 else |
|
275 { |
|
276 result = EFalse; |
|
277 } |
|
278 return result; |
|
279 } |
|
280 |
|
281 // --------------------------------------------------------------------------- |
|
282 // |
|
283 // Handles network info |
|
284 // |
|
285 // --------------------------------------------------------------------------- |
|
286 void CGSNetworkPlugin::HandleNetworkInfoReceivedL( |
|
287 const CNetworkInfoArray* aInfoArray, const TInt /* aResult */ ) |
|
288 { |
|
289 __GSLOGSTRING("[GS]--> CGSNetworkPlugin::HandleNetworkInfoReceivedL"); |
|
290 const TInt itemsCount = aInfoArray->Count(); |
|
291 |
|
292 //first delete old ones |
|
293 iNetworkArray->Delete( 0, iNetworkArray->Count() ); |
|
294 |
|
295 //then insert found networks |
|
296 for ( TInt i = 0; i < itemsCount; i++ ) |
|
297 { |
|
298 MPsetNetworkSelect::TNetworkInfo info = aInfoArray->At( i ); |
|
299 iNetworkArray->InsertL( i, info ); |
|
300 } |
|
301 NetworkListL(); //after search complete, show results |
|
302 __GSLOGSTRING("[GS] <--CGSNetworkPlugin::HandleNetworkInfoReceivedL"); |
|
303 } |
|
304 |
|
305 // --------------------------------------------------------------------------- |
|
306 // |
|
307 // Creates list of Network providers |
|
308 // |
|
309 // --------------------------------------------------------------------------- |
|
310 void CGSNetworkPlugin::NetworkListL() |
|
311 { |
|
312 __GSLOGSTRING("[GS]--> CGSNetworkPlugin::NetworkListL"); |
|
313 |
|
314 //check if the graphical list is needed... set in local variation |
|
315 TBool showGraphicalList = |
|
316 Container()->NetPluginModel()->GraphicalNetworkListSupportedL(); |
|
317 __GSLOGSTRING1("[GS] NetworkListL: showGraphicalList: %d", showGraphicalList); |
|
318 |
|
319 //if no net items were found, do not show list |
|
320 if ( iNetworkArray->Count() > 0 ) |
|
321 { |
|
322 /** Implementation of forbidden operator icon begins */ |
|
323 // check if forbidden operator icon is supported |
|
324 TBool forbiddenOperator = |
|
325 FeatureManager::FeatureSupported( KFeatureIdFfTdScdmaForbiddenoperatoricondisplay ); |
|
326 /** Implementation of forbidden operator icon ends */ |
|
327 while ( !iApprovedNetwork ) |
|
328 { |
|
329 AknPopupListEmpty<CEikFormattedCellListBox>* list; |
|
330 /** Implementation of forbidden operator icon begins */ |
|
331 if (forbiddenOperator || showGraphicalList |
|
332 && FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)) |
|
333 { |
|
334 list = new (ELeave) CAknSingleGraphicPopupMenuStyleListBox; |
|
335 } |
|
336 else |
|
337 { |
|
338 list = new (ELeave) CAknSinglePopupMenuStyleListBox; |
|
339 } |
|
340 /** Implementation of forbidden operator icon ends */ |
|
341 |
|
342 CleanupStack::PushL( list ); |
|
343 if ( iNetworkPopupList ) |
|
344 { |
|
345 iNetworkPopupList->CancelPopup(); |
|
346 iNetworkPopupList = NULL; |
|
347 } |
|
348 iNetworkPopupList = |
|
349 CAknPopupList::NewL( list, R_AVKON_SOFTKEYS_OK_CANCEL ); |
|
350 |
|
351 list->ConstructL( iNetworkPopupList, |
|
352 CEikListBox::ELeftDownInViewRect ); |
|
353 list->CreateScrollBarFrameL( ETrue ); |
|
354 list->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
355 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
|
356 |
|
357 //Fill in the list texts |
|
358 CDesCArrayFlat* items = |
|
359 new ( ELeave ) CDesCArrayFlat( KGSNetPopupMenuItems ); |
|
360 CleanupStack::PushL( items ); |
|
361 const TInt itemsCount = iNetworkArray->Count(); |
|
362 __GSLOGSTRING1("[GS] NetworkListL: itemsCount: %d", itemsCount); |
|
363 |
|
364 for ( TInt loop = 0; loop < itemsCount; loop++ ) |
|
365 { |
|
366 HBufC* insertString = |
|
367 HBufC::NewLC( |
|
368 KGSNwLongNameLength + KGSNetIconAdditionalChars ); |
|
369 MPsetNetworkSelect::TNetworkInfo info = |
|
370 iNetworkArray->At( loop ); |
|
371 |
|
372 if ( info.iLongName.Length() <= 0 || |
|
373 info.iLongName.Length() > KGSNwLongNameLength ) |
|
374 { |
|
375 //no names received, use IDs |
|
376 if ( info.iShortName.Length() <= 0 || |
|
377 info.iShortName.Length() > KGSNwShortNameLength ) |
|
378 { |
|
379 TNetworkID ids; |
|
380 TNetworkID networkCode; |
|
381 ids = info.iId.iCountryCode; |
|
382 ids.Append( KGSEmptySpace ); |
|
383 networkCode = info.iId.iNetworkCode; |
|
384 ids.Append( networkCode ); |
|
385 insertString->Des().Append( ids ); |
|
386 __GSLOGSTRING1("[GS] NetworkListL: Network ID: %S", insertString); |
|
387 } |
|
388 //short name received |
|
389 else |
|
390 { |
|
391 insertString->Des().Append( info.iShortName ); |
|
392 __GSLOGSTRING1("[GS] NetworkListL: Network Shortname: %S", insertString); |
|
393 } |
|
394 } |
|
395 //long name received |
|
396 else |
|
397 { |
|
398 insertString->Des().Append( info.iLongName ); |
|
399 __GSLOGSTRING1("[GS] NetworkListL: Network Longname: %S", insertString); |
|
400 } |
|
401 |
|
402 /** Implementation of forbidden operator icon begins */ |
|
403 //set icon for network |
|
404 if ( forbiddenOperator ) |
|
405 { |
|
406 if ( info.iStatus == MPsetNetworkSelect::ENetStatForbidden ) |
|
407 { |
|
408 insertString->Des().Insert( 0, KGSNetForbiddenIcon ); |
|
409 } |
|
410 else |
|
411 { |
|
412 insertString->Des().Insert( 0, KGSNetNoIcon ); |
|
413 } |
|
414 } |
|
415 else if ( showGraphicalList ) |
|
416 { |
|
417 if ( FeatureManager::FeatureSupported( |
|
418 KFeatureIdProtocolWcdma ) ) |
|
419 { |
|
420 if ( info.iAccess != |
|
421 MPsetNetworkSelect::ENetNetworkGSM ) |
|
422 { |
|
423 insertString->Des().Insert( 0, KGSNetWCDMAIcon ); |
|
424 } |
|
425 else |
|
426 { |
|
427 insertString->Des().Insert( 0, KGSNetGSMIcon ); |
|
428 } |
|
429 } |
|
430 } |
|
431 /** Implementation of forbidden operator icon ends */ |
|
432 items->AppendL( *insertString ); |
|
433 CleanupStack::PopAndDestroy(); |
|
434 } |
|
435 |
|
436 // For Testing purpuses ONLY |
|
437 for ( TInt k=0; k<items->Count(); k++ ) |
|
438 { |
|
439 TPtrC itemText( (*items)[k] ); |
|
440 __GSLOGSTRING2("[GS] NetworkListL: POS: %d, VALUE: %S", k, &itemText); |
|
441 } |
|
442 |
|
443 CTextListBoxModel* model = list->Model(); |
|
444 model->SetItemTextArray( items ); |
|
445 model->SetOwnershipType( ELbmOwnsItemArray ); |
|
446 CleanupStack::Pop( items ); //listbox model now owns this |
|
447 |
|
448 //Set title for list |
|
449 SetTitleToPopupL( *iNetworkPopupList, R_NETSL_FOUNDOPERATORS ); |
|
450 |
|
451 // Setup graphic items list for dual mode nw selection listbox |
|
452 // based on the local variation |
|
453 /** Implementation of forbidden operator icon begins */ |
|
454 if ( forbiddenOperator || showGraphicalList ) |
|
455 { |
|
456 CAknIconArray* iconList = new (ELeave) CAknIconArray( 10 ); |
|
457 CleanupStack::PushL( iconList ); |
|
458 iconList->ConstructFromResourceL( R_NET_DUALMODE_ICONS ); |
|
459 list->ItemDrawer()->ColumnData()->SetIconArray( iconList ); |
|
460 CleanupStack::Pop( iconList ); //listbox model now owns this |
|
461 } |
|
462 /** Implementation of forbidden operator icon ends */ |
|
463 TInt res = 0; |
|
464 if( items->Count() ) |
|
465 { |
|
466 res = iNetworkPopupList->ExecuteLD(); |
|
467 } |
|
468 iNetworkPopupList = NULL; |
|
469 |
|
470 iApprovedNetwork = ETrue; //not perhaps, but user might want to quit |
|
471 TInt selection = list->CurrentItemIndex(); |
|
472 __GSLOGSTRING1("[GS] NetworkListL: selection: %d", selection); |
|
473 |
|
474 CleanupStack::PopAndDestroy( list ); |
|
475 |
|
476 if ( res ) |
|
477 { |
|
478 MPsetNetworkSelect::TNetworkInfo info = |
|
479 iNetworkArray->At( selection ); |
|
480 info.iMode = MPsetNetworkSelect::ENetSelectModeManual; |
|
481 iPhoneSettingsEngine->SelectNetworkL( info ); |
|
482 } |
|
483 else // user selected "Cancel" |
|
484 { |
|
485 //Reset back to previously used network |
|
486 iPhoneSettingsEngine->ResetNetworkSearch(); |
|
487 //After list has been used, clear it. |
|
488 PurgeNetworkList(); |
|
489 if ( iPhoneSettingsEngine->IsCallActive() != |
|
490 CPsetSAObserver::EPSetCallActive ) |
|
491 { |
|
492 ShowSettingPageL( EGSNetworkModeSelectionItemId ); |
|
493 } |
|
494 } |
|
495 } |
|
496 } |
|
497 iApprovedNetwork = EFalse; //initialize before new search |
|
498 __GSLOGSTRING("[GS] <--CGSNetworkPlugin::NetworkListL"); |
|
499 } |
|
500 |
|
501 // --------------------------------------------------------------------------- |
|
502 // |
|
503 // Handles requests to change network |
|
504 // |
|
505 // --------------------------------------------------------------------------- |
|
506 void CGSNetworkPlugin::HandleNetworkChangedL( |
|
507 const MPsetNetworkSelect::TNetworkInfo& /*aCurrentInfo*/, |
|
508 const MPsetNetworkSelect::TCurrentNetworkStatus /*aStatus*/, |
|
509 const TInt /*aResult*/ ) |
|
510 { |
|
511 //DEPRECATED |
|
512 } |
|
513 |
|
514 // --------------------------------------------------------------------------- |
|
515 // |
|
516 // Handles requests to change network |
|
517 // |
|
518 // --------------------------------------------------------------------------- |
|
519 void CGSNetworkPlugin::HandleNetworkChangedL( |
|
520 const MPsetNetworkSelect::TNetworkInfo& aCurrentInfo, |
|
521 const RMobilePhone::TMobilePhoneRegistrationStatus& aStatus, |
|
522 const TInt /* aResult */ ) |
|
523 { |
|
524 __GSLOGSTRING("[GS]--> CGSNetworkPlugin::HandleNetworkChangedL"); |
|
525 switch ( aStatus ) |
|
526 { |
|
527 case RMobilePhone::ERegisteredOnHomeNetwork: |
|
528 ShowNoteL( R_HOME_NETWORK_SELECTED, KGSConfirmationNote ); |
|
529 PurgeNetworkList(); |
|
530 break; |
|
531 case RMobilePhone::ERegisteredRoaming: |
|
532 { |
|
533 HBufC* stringholder; |
|
534 if ( aCurrentInfo.iLongName.Length() > 0 && |
|
535 aCurrentInfo.iLongName.Length() <= |
|
536 MPsetNetworkSelect::ENetLongNameSize ) |
|
537 { |
|
538 stringholder = StringLoader::LoadLC( R_NETSL_NETWORKSELECTED, |
|
539 aCurrentInfo.iLongName ); |
|
540 } |
|
541 else if (aCurrentInfo.iShortName.Length() > 0 && |
|
542 aCurrentInfo.iShortName.Length() <= |
|
543 MPsetNetworkSelect::ENetShortNameSize ) |
|
544 { |
|
545 stringholder = StringLoader::LoadLC( R_NETSL_NETWORKSELECTED, |
|
546 aCurrentInfo.iShortName ); |
|
547 } |
|
548 else //network returned only ids |
|
549 { |
|
550 // construct whole "id-string" |
|
551 // e.g. for Finland Nokia's test network "244 7" |
|
552 TNetworkID ids; |
|
553 TNetworkID networkCode; |
|
554 ids = aCurrentInfo.iId.iCountryCode; |
|
555 __GSLOGSTRING1("[GS] HandleNetworkChangedL: iCountryCode: %S", &aCurrentInfo.iId.iCountryCode); |
|
556 |
|
557 ids.Append( KGSEmptySpace ); |
|
558 networkCode = aCurrentInfo.iId.iNetworkCode; |
|
559 __GSLOGSTRING1("[GS] HandleNetworkChangedL: iNetworkCode: %S", &aCurrentInfo.iId.iNetworkCode); |
|
560 |
|
561 ids.Append( networkCode ); |
|
562 stringholder = |
|
563 StringLoader::LoadLC( R_NETSL_NETWORKSELECTED, ids ); |
|
564 } |
|
565 CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote( ETrue ); |
|
566 note->ExecuteLD( *stringholder ); |
|
567 CleanupStack::PopAndDestroy( stringholder ); |
|
568 //After list has been used, clear it. |
|
569 PurgeNetworkList(); |
|
570 break; |
|
571 } |
|
572 case RMobilePhone::ERegistrationUnknown: |
|
573 case RMobilePhone::ENotRegisteredNoService: |
|
574 case RMobilePhone::ENotRegisteredEmergencyOnly: |
|
575 case RMobilePhone::ENotRegisteredSearching: |
|
576 case RMobilePhone::ERegisteredBusy: |
|
577 case RMobilePhone::ERegistrationDenied: |
|
578 default: |
|
579 break; |
|
580 } |
|
581 PhoneIdle(); |
|
582 __GSLOGSTRING("[GS] <--CGSNetworkPlugin::HandleNetworkChangedL"); |
|
583 } |
|
584 |
|
585 |
|
586 // --------------------------------------------------------------------------- |
|
587 // |
|
588 // Handles user inputs in Options menu |
|
589 // |
|
590 // --------------------------------------------------------------------------- |
|
591 void CGSNetworkPlugin::HandleCommandL( TInt aCommand ) |
|
592 { |
|
593 __GSLOGSTRING1("[CGSNetworkPlugin] HandleCommandL(%d)|->", aCommand ); |
|
594 switch ( aCommand ) |
|
595 { |
|
596 case EGSMSKCmdAppChange: |
|
597 HandleListBoxSelectionL(); |
|
598 break; |
|
599 case EGSCmdAppChange: |
|
600 { |
|
601 const TInt currentFeatureId = Container()->CurrentFeatureId(); |
|
602 |
|
603 if ( currentFeatureId == EGSMCNItemId ) |
|
604 { |
|
605 ShowSettingPageL( EGSMCNItemId ); |
|
606 } |
|
607 else if ( currentFeatureId == EGSNetworkModeItemId ) |
|
608 { |
|
609 CheckCallActiveL( EGSNetworkModeItemId ); |
|
610 } |
|
611 else |
|
612 { |
|
613 HandleListBoxEventL( NULL, EEventEnterKeyPressed ); |
|
614 } |
|
615 } |
|
616 break; |
|
617 case EAknSoftkeyBack: |
|
618 { |
|
619 if (!iPhoneSettingsEngine->IsActive()) |
|
620 { |
|
621 iAppUi->ActivateLocalViewL( KGSConPluginUid /*KGSTelPluginUid*/ ); |
|
622 } |
|
623 break; |
|
624 } |
|
625 case EAknCmdHelp: |
|
626 { |
|
627 if( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
628 { |
|
629 HlpLauncher::LaunchHelpApplicationL( |
|
630 iEikonEnv->WsSession(), iAppUi->AppHelpContextL() ); |
|
631 } |
|
632 break; |
|
633 } |
|
634 default: |
|
635 iAppUi->HandleCommandL( aCommand ); |
|
636 break; |
|
637 } |
|
638 __GSLOGSTRING("[CGSNetworkPlugin] HandleCommandL()-|"); |
|
639 } |
|
640 |
|
641 |
|
642 // --------------------------------------------------------------------------- |
|
643 // |
|
644 // Handles user inputs in Options menu |
|
645 // |
|
646 // --------------------------------------------------------------------------- |
|
647 void CGSNetworkPlugin::ProcessCommandL( TInt aCommand ) |
|
648 { |
|
649 // Network base class |
|
650 CAknView::ProcessCommandL( aCommand ); |
|
651 } |
|
652 |
|
653 // --------------------------------------------------------------------------- |
|
654 // |
|
655 // While request to find networks is processed |
|
656 // |
|
657 // --------------------------------------------------------------------------- |
|
658 void CGSNetworkPlugin::HandleSearchingNetworksL( |
|
659 MPsetNetworkInfoObserver::TServiceRequest aRequest ) |
|
660 { |
|
661 __GSLOGSTRING("[GS]--> CGSNetworkPlugin::HandleSearchingNetworksL"); |
|
662 if ( !iNetworkArray ) |
|
663 { |
|
664 iNetworkArray = new ( ELeave ) |
|
665 CNetworkInfoArray( KGSNetworkInfoArrayGranularity ); |
|
666 } |
|
667 |
|
668 if ( aRequest != MPsetNetworkInfoObserver::EServiceRequestNone ) |
|
669 { |
|
670 CheckAndCreateDlgL( EFalse ); |
|
671 if ( aRequest == |
|
672 MPsetNetworkInfoObserver::EServiceRequestSetNetworkAutomatic ) |
|
673 { |
|
674 UpdateListBoxL( EGSNetworkModeSelectionItemId, |
|
675 EGSAutomaticSelectMode ); |
|
676 } |
|
677 else |
|
678 { |
|
679 UpdateListBoxL( EGSNetworkModeSelectionItemId, |
|
680 EGSManualSelectMode ); |
|
681 } |
|
682 |
|
683 iSearchForNetworksActive = ETrue; |
|
684 TInt res = iDlg->ExecuteLD( R_SEARCHING_NOTE ); |
|
685 |
|
686 if ( res == EGSSoftkeyQuit ) |
|
687 { |
|
688 iPhoneSettingsEngine->CancelProcess(); |
|
689 |
|
690 ShowSettingPageL( EGSNetworkModeSelectionItemId ); |
|
691 } |
|
692 else |
|
693 { |
|
694 if ( aRequest == |
|
695 MPsetNetworkInfoObserver::EServiceRequestSetNetworkAutomatic ) |
|
696 { |
|
697 PhoneIdle(); |
|
698 iAppUi->HandleCommandL( EEikCmdExit ); |
|
699 } |
|
700 } |
|
701 } |
|
702 else |
|
703 { |
|
704 delete iDlg; |
|
705 iDlg = NULL; |
|
706 } |
|
707 |
|
708 __GSLOGSTRING("[GS] <--CGSNetworkPlugin::HandleSearchingNetworksL"); |
|
709 } |
|
710 |
|
711 // --------------------------------------------------------------------------- |
|
712 // |
|
713 // While request to change network is processed, a note is shown |
|
714 // |
|
715 // --------------------------------------------------------------------------- |
|
716 void CGSNetworkPlugin::HandleRequestingSelectedNetworkL( TBool aOngoing ) |
|
717 { |
|
718 __GSLOGSTRING("[GS]--> CGSNetworkPlugin::HandleRequestingSelectedNetworkL"); |
|
719 if ( aOngoing ) |
|
720 { |
|
721 CheckAndCreateDlgL( ETrue ); |
|
722 |
|
723 if ( iDlg->ExecuteLD( R_REQUESTING_NOTE ) == EGSSoftkeyQuit ) |
|
724 { |
|
725 iPhoneSettingsEngine->CancelProcess(); |
|
726 |
|
727 CAknNoteDialog* dlg = new ( ELeave ) CAknNoteDialog( |
|
728 CAknNoteDialog::EConfirmationTone, |
|
729 CAknNoteDialog::EShortTimeout ); |
|
730 dlg->ExecuteLD( R_REGISTRATION_INTERRUPTED ); |
|
731 iApprovedNetwork = EFalse; |
|
732 } |
|
733 } |
|
734 else |
|
735 { |
|
736 delete iDlg; |
|
737 iDlg = NULL; |
|
738 } |
|
739 |
|
740 __GSLOGSTRING("[GS] <--CGSNetworkPlugin::HandleRequestingSelectedNetworkL"); |
|
741 } |
|
742 |
|
743 |
|
744 // --------------------------------------------------------------------------- |
|
745 // |
|
746 // Activates the view |
|
747 // |
|
748 // --------------------------------------------------------------------------- |
|
749 void CGSNetworkPlugin::DoActivateL( const TVwsViewId& aPrevViewId , |
|
750 TUid aCustomMessageId, |
|
751 const TDesC8& aCustomMessage ) |
|
752 { |
|
753 __GSLOGSTRING( "[CGSNetworkPlugin] DoActivateL()|->" ); |
|
754 CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage ); |
|
755 Container()->SetMiddleSoftkeyObserver( this ); |
|
756 SetMiddleSoftKeyLabelL( R_CALL_MSK_CHANGE, EGSMSKCmdAppChange ); |
|
757 // This way we set which command is set for MSK |
|
758 iMskCommandFlag = ETrue; |
|
759 iContainer->iListBox->SetTopItemIndex( iTopItemIndex ); |
|
760 |
|
761 if ( iCurrentItem >= 0 && |
|
762 iCurrentItem < iContainer->iListBox->Model()->NumberOfItems() ) |
|
763 { |
|
764 iContainer->iListBox->SetCurrentItemIndexAndDraw( iCurrentItem ); |
|
765 } |
|
766 if ( aCustomMessageId == TUid::Uid( KGSCustomActivateNetView ) ) |
|
767 { |
|
768 UpdateListBoxL( EGSNetworkModeSelectionItemId, EGSManualSelectMode ); |
|
769 iSearchForNetworksActive = ETrue; |
|
770 iPhoneSettingsEngine->GetAvailableNetworksL(); |
|
771 } |
|
772 CheckMiddleSoftkeyLabelL(); |
|
773 __GSLOGSTRING( "[CGSNetworkPlugin] DoActivateL()-|" ); |
|
774 } |
|
775 |
|
776 // --------------------------------------------------------------------------- |
|
777 // |
|
778 // Deactivates the view |
|
779 // |
|
780 // --------------------------------------------------------------------------- |
|
781 void CGSNetworkPlugin::DoDeactivate() |
|
782 { |
|
783 __GSLOGSTRING("[CGSNetworkPlugin]--> DoDeactivate"); |
|
784 if ( Container() ) |
|
785 { |
|
786 if ( Container()->iListBox && iContainer->iListBox->View() ) |
|
787 { |
|
788 iTopItemIndex = iContainer->iListBox->TopItemIndex(); |
|
789 iCurrentItem = iContainer->iListBox->CurrentItemIndex(); |
|
790 } |
|
791 iAppUi->RemoveFromViewStack( *this, Container() ); |
|
792 delete iContainer; |
|
793 iContainer = NULL; |
|
794 } |
|
795 __GSLOGSTRING("[CGSNetworkPlugin] <--DoDeactivate"); |
|
796 } |
|
797 |
|
798 // --------------------------------------------------------------------------- |
|
799 // |
|
800 // Shows setting page - for ON/OFF setting items |
|
801 // |
|
802 // --------------------------------------------------------------------------- |
|
803 void CGSNetworkPlugin::ShowSettingPageL( TGSNetworkItemIds aPage ) |
|
804 { |
|
805 __GSLOGSTRING( "[CGSNetworkPlugin::ShowSettingPageL]" ); |
|
806 TInt resourceId = 0; |
|
807 TInt currentItem = KGSSettingOff; |
|
808 HBufC* settingPageTitle = NULL; |
|
809 |
|
810 switch( aPage ) |
|
811 { |
|
812 case EGSNetworkModeSelectionItemId: |
|
813 resourceId = R_NETSL_NETSELECTMODE_LBX; |
|
814 settingPageTitle = StringLoader::LoadLC( R_NETSL_NETSELECTMODE ); |
|
815 currentItem = Container()->GetSelectionMode(); |
|
816 break; |
|
817 case EGSMCNItemId: |
|
818 resourceId = R_MCN_CELL_INFO_DISP_MODE_LBX; |
|
819 settingPageTitle = StringLoader::LoadLC( R_MCN_CELL_INFO_DISP_MODE ); |
|
820 Container()->GetMcnValue( iMCN ); |
|
821 //for MCN, values need to be switched since Off = 0 in shared data, 1 on screen |
|
822 SwitchOnOffValue( iMCN ); |
|
823 currentItem = iMCN; |
|
824 break; |
|
825 case EGSNetworkModeItemId: |
|
826 resourceId = R_NET_NETWORK_MODE_LBX; |
|
827 settingPageTitle = StringLoader::LoadLC( R_NET_NETWORK_MODE ); |
|
828 currentItem = Container()->GetCurrentNetworkModeSelectionL(); |
|
829 break; |
|
830 default: |
|
831 break; |
|
832 } |
|
833 |
|
834 |
|
835 |
|
836 //Checking if the phone is in offline mode |
|
837 const TBool iOfflineMode = IsPhoneOfflineL(); |
|
838 |
|
839 // If it is in offline mode, then we dont launch the NW mode setting page at all |
|
840 if ( iOfflineMode /*&& aPage == EGSNetworkModeItemId*/ ) |
|
841 { |
|
842 HBufC* string = StringLoader::LoadLC( R_OFFLINE_MODE ); |
|
843 CAknErrorNote* note = new ( ELeave ) CAknErrorNote ( ETrue ); |
|
844 note->ExecuteLD( *string ); |
|
845 CleanupStack::PopAndDestroy( string ); |
|
846 } |
|
847 else // if not offline mode we show the setting page |
|
848 { |
|
849 |
|
850 CGSRadioButtonSettingPageItemTextArray* itemArray = |
|
851 CGSRadioButtonSettingPageItemTextArray::NewL( resourceId, *iCoeEnv, NULL ); |
|
852 |
|
853 // network mode requires special handling as items in the settings page |
|
854 // are variated. The method below checks which items to display & hide. |
|
855 if ( aPage == EGSNetworkModeItemId ) |
|
856 { |
|
857 Container()->CheckAndAlterContentsL( *itemArray ); |
|
858 } |
|
859 |
|
860 CleanupStack::PushL( itemArray ); |
|
861 |
|
862 TInt currentIndex = itemArray->IndexForFeatureIdL( currentItem ); |
|
863 |
|
864 // no editor resource given |
|
865 iSettingDlg = new ( ELeave ) CAknRadioButtonSettingPage( |
|
866 settingPageTitle, EAknSettingPageNoOrdinalDisplayed, 0, 0, |
|
867 R_SETTING_PAGE, currentIndex, itemArray ); |
|
868 itemArray->SetRadioButtonSettingPage( *iSettingDlg ); |
|
869 |
|
870 const TInt prevSelection = currentIndex; |
|
871 if ( settingPageTitle ) |
|
872 { |
|
873 iSettingDlg->SetSettingTextL( *settingPageTitle ); |
|
874 } |
|
875 |
|
876 //Start listening if call occurs |
|
877 iPhoneSettingsEngine->SetNetSAObserver( *this ); |
|
878 |
|
879 __GSLOGSTRING( "[CGSNetworkPlugin::ShowSettingPageL] Executing dialog" ); |
|
880 const TInt res = |
|
881 iSettingDlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); |
|
882 __GSLOGSTRING( "[CGSNetworkPlugin::ShowSettingPageL] Dialog closed" ); |
|
883 iSettingDlg = NULL; |
|
884 // Get the feature id corresponding to array index |
|
885 const TGSNetworkModeItems currentFeature = IntToEnum( currentIndex ); |
|
886 |
|
887 if ( res ) |
|
888 { |
|
889 //not required for network mode UI item. |
|
890 //other items require calling this method. |
|
891 if (aPage != EGSNetworkModeItemId) |
|
892 { |
|
893 CreateNetworkSsCallL(currentFeature, aPage); |
|
894 } |
|
895 else if (prevSelection != currentIndex) |
|
896 { |
|
897 if ( iPsmActive->Mode() == EPsmsrvModePowerSave ) |
|
898 { |
|
899 // If PSM is on, block setting: |
|
900 DisplayBlockNoteL(); |
|
901 } |
|
902 else |
|
903 { |
|
904 // Show the confirmation query. Uses TGSNetworkModeItems. |
|
905 Container()->SetCurrentNetworkModeSelectionL(currentFeature); |
|
906 } |
|
907 } |
|
908 } |
|
909 CleanupStack::PopAndDestroy(itemArray); |
|
910 } |
|
911 //We'll update listbox for Network Mode when we're sure that phone is not |
|
912 //in Offline mode |
|
913 if ( aPage != EGSNetworkModeItemId ) |
|
914 { |
|
915 UpdateListBoxL( aPage ); |
|
916 } |
|
917 |
|
918 CleanupStack::PopAndDestroy( settingPageTitle ); |
|
919 |
|
920 __GSLOGSTRING( "[CGSNetworkPlugin::ShowSettingPageL] End" ); |
|
921 } |
|
922 |
|
923 // --------------------------------------------------------------------------- |
|
924 // |
|
925 // utility for converting TInt to TGSNetworkModes enum. |
|
926 // |
|
927 // --------------------------------------------------------------------------- |
|
928 TGSNetworkModeItems CGSNetworkPlugin::IntToEnum( TInt aFeatureId ) |
|
929 { |
|
930 TGSNetworkModeItems mode = EGSNetworkModeDualmode; |
|
931 TInt supportedNetworks = Container()->NetPluginModel()->GetSupportedNetworksL(); |
|
932 TInt value = 0; |
|
933 |
|
934 switch( aFeatureId ) |
|
935 { |
|
936 case EGSNetworkModeDualmode: |
|
937 mode = EGSNetworkModeDualmode; |
|
938 break; |
|
939 case EGSNetworkModeUMTS: |
|
940 value = supportedNetworks & CGSNetworkPluginContainer::ENetFirstBit; |
|
941 if ( value ) |
|
942 { |
|
943 mode = EGSNetworkModeUMTS; |
|
944 } |
|
945 else |
|
946 //assume that only dual mode and gsm are possible. |
|
947 { |
|
948 mode = EGSNetworkModeGSM; |
|
949 } |
|
950 break; |
|
951 case EGSNetworkModeGSM: |
|
952 mode = EGSNetworkModeGSM; |
|
953 break; |
|
954 default: |
|
955 // This should not happen as items should always have matching id. |
|
956 __ASSERT_DEBUG( EFalse, User::Panic( KGSNetworkPluginAssertName, KErrArgument ) ); |
|
957 } |
|
958 return mode; |
|
959 } |
|
960 |
|
961 |
|
962 // --------------------------------------------------------------------------- |
|
963 // |
|
964 // If calls are started when in Network Setting Page, it is closed. |
|
965 // |
|
966 // --------------------------------------------------------------------------- |
|
967 void CGSNetworkPlugin::HandleCallActivatedL() |
|
968 { |
|
969 __GSLOGSTRING("[GS]--> CGSNetworkPlugin::HandleCallActivatedL"); |
|
970 |
|
971 CGSNetworkPluginContainer* container = Container(); |
|
972 if ( container ) |
|
973 { |
|
974 const TInt currentFeatureId = container->CurrentFeatureId(); |
|
975 |
|
976 if ( currentFeatureId != EGSNetworkModeSelectionItemId ) |
|
977 { |
|
978 iPhoneSettingsEngine->CancelProcess(); |
|
979 return; |
|
980 } |
|
981 iPhoneSettingsEngine->CancelProcess(); |
|
982 //Close requesting notes |
|
983 if ( iDlg ) |
|
984 { |
|
985 HandleSearchingNetworksL( MPsetNetworkInfoObserver::EServiceRequestNone ); |
|
986 HandleRequestingSelectedNetworkL( EFalse ); |
|
987 } |
|
988 |
|
989 //Close available network's list |
|
990 if ( iNetworkPopupList ) |
|
991 { |
|
992 iNetworkPopupList->CancelPopup(); |
|
993 iNetworkPopupList = NULL; |
|
994 } |
|
995 |
|
996 CloseDialog(); |
|
997 |
|
998 } |
|
999 __GSLOGSTRING("[GS] <--CGSNetworkPlugin::HandleCallActivatedL"); |
|
1000 } |
|
1001 |
|
1002 // --------------------------------------------------------------------------- |
|
1003 // |
|
1004 // Handles errors. |
|
1005 // From MPsetNetworkInfoObserver. |
|
1006 // --------------------------------------------------------------------------- |
|
1007 void CGSNetworkPlugin::HandleNetworkErrorL( |
|
1008 const MPsetNetworkInfoObserver::TServiceRequest aRequest, |
|
1009 const TInt aError ) |
|
1010 { |
|
1011 |
|
1012 #ifdef _DEBUG |
|
1013 TBuf<KGSNetworkModeDebugStrLen> requestBuf; |
|
1014 GSNetworkDebugHelper::NetworkInfoRequestToDes( aRequest, requestBuf ); |
|
1015 __GSLOGSTRING2( "[CGSNetworkPlugin::HandleNetworkErrorL] %S error:%d", |
|
1016 &requestBuf, aError ); |
|
1017 #endif // _DEBUG |
|
1018 |
|
1019 TInt resourceTxt = KErrNone; |
|
1020 switch ( aRequest ) |
|
1021 { |
|
1022 case MPsetNetworkInfoObserver::EServiceRequestGetNetworkInfo: |
|
1023 iPhoneSettingsEngine->CancelProcess(); |
|
1024 iApprovedNetwork = EFalse; |
|
1025 break; |
|
1026 case MPsetNetworkInfoObserver::EServiceRequestSetNetworkAutomatic: |
|
1027 case MPsetNetworkInfoObserver::EServiceRequestSetNetwork: |
|
1028 default: |
|
1029 break; |
|
1030 } |
|
1031 |
|
1032 TBool ignore = EFalse; |
|
1033 |
|
1034 switch ( aError ) |
|
1035 { |
|
1036 case KErrGsmNetCauseCallActive: |
|
1037 ignore = ETrue; //do not show an error |
|
1038 break; |
|
1039 case KErrGsm0707NoNetworkService: |
|
1040 resourceTxt = R_NO_NETWORK_FOUND; |
|
1041 break; |
|
1042 case KErrGsmOfflineOpNotAllowed: |
|
1043 resourceTxt = R_OFFLINE_MODE; |
|
1044 break; |
|
1045 default: |
|
1046 resourceTxt = R_NO_NETWORK_ACCESS; |
|
1047 break; |
|
1048 } |
|
1049 if ( !ignore ) |
|
1050 { |
|
1051 ShowNoteL( resourceTxt, KGSErrorNote ); |
|
1052 iApprovedNetwork = EFalse; |
|
1053 } |
|
1054 __GSLOGSTRING("[GS] <--CGSNetworkPlugin::HandleNetworkErrorL"); |
|
1055 } |
|
1056 |
|
1057 // --------------------------------------------------------------------------- |
|
1058 // |
|
1059 // Check if calls are active and show note if Nw-menu is tried to be opened |
|
1060 // |
|
1061 // --------------------------------------------------------------------------- |
|
1062 void CGSNetworkPlugin::CheckCallActiveL( TGSNetworkItemIds aItemId ) |
|
1063 { |
|
1064 __GSLOGSTRING("[GS]--> CGSNetworkPlugin::CheckCallActiveL"); |
|
1065 if ( iPhoneSettingsEngine->IsCallActive() == CPsetSAObserver::EPSetCallActive ) |
|
1066 { |
|
1067 ShowNoteL( R_ONGOING_CALL, KGSErrorNote ); |
|
1068 return; |
|
1069 } |
|
1070 |
|
1071 // Show network mode selection only if the mode value is already available! |
|
1072 if ( aItemId == EGSNetworkModeItemId && !iSettingDlg |
|
1073 && Container()->NetPluginModel()->GetNetworkMode() |
|
1074 != KGSNetworkModeCapsNotUpdated |
|
1075 ) |
|
1076 { |
|
1077 #ifdef FF_POWER_SAVE |
|
1078 if ( iPsmActive->Mode() == EPsmsrvModePowerSave ) |
|
1079 { |
|
1080 // If PSM is on, block setting: |
|
1081 DisplayBlockNoteL(); |
|
1082 } |
|
1083 else |
|
1084 { |
|
1085 #endif // FF_POWER_SAVE |
|
1086 ShowSettingPageL( EGSNetworkModeItemId ); |
|
1087 #ifdef FF_POWER_SAVE |
|
1088 } |
|
1089 #endif // FF_POWER_SAVE |
|
1090 } |
|
1091 else if( !iSettingDlg |
|
1092 //&& Container()->NetPluginModel()->GetNetworkMode() |
|
1093 /*!= KGSNetworkModeCapsNotUpdated*/ ) |
|
1094 { |
|
1095 ShowSettingPageL( EGSNetworkModeSelectionItemId ); |
|
1096 } |
|
1097 __GSLOGSTRING("[GS] <--CGSNetworkPlugin::CheckCallActiveL"); |
|
1098 } |
|
1099 |
|
1100 // --------------------------------------------------------------------------- |
|
1101 // |
|
1102 // Sets a title to a given popup list. |
|
1103 // |
|
1104 // --------------------------------------------------------------------------- |
|
1105 void CGSNetworkPlugin::SetTitleToPopupL( CAknPopupList& aList, TInt aTitleID ) |
|
1106 { |
|
1107 HBufC* text = StringLoader::LoadLC( aTitleID ); |
|
1108 aList.SetTitleL( *text ); |
|
1109 CleanupStack::PopAndDestroy( text ); |
|
1110 text = NULL; |
|
1111 } |
|
1112 |
|
1113 // --------------------------------------------------------------------------- |
|
1114 // |
|
1115 // Sets a title to a settings page. |
|
1116 // |
|
1117 // --------------------------------------------------------------------------- |
|
1118 void CGSNetworkPlugin::SetTitleToSettingsL( CAknRadioButtonSettingPage& aDlg, |
|
1119 TInt aTitleID ) |
|
1120 { |
|
1121 HBufC* title = StringLoader::LoadLC( aTitleID ); |
|
1122 aDlg.SetSettingTextL( *title ); |
|
1123 CleanupStack::PopAndDestroy( title ); |
|
1124 title = NULL; |
|
1125 } |
|
1126 |
|
1127 // --------------------------------------------------------------------------- |
|
1128 // |
|
1129 // Appends given item to given list |
|
1130 // |
|
1131 // --------------------------------------------------------------------------- |
|
1132 void CGSNetworkPlugin::AppendItemL( CDesCArrayFlat& aList, TInt aItem ) |
|
1133 { |
|
1134 HBufC* string = StringLoader::LoadLC( aItem ); |
|
1135 aList.AppendL( *string ); |
|
1136 CleanupStack::PopAndDestroy( string ); |
|
1137 } |
|
1138 |
|
1139 // --------------------------------------------------------------------------- |
|
1140 // |
|
1141 // Shows a note if GPRS is active, when MCN is turned on. |
|
1142 // |
|
1143 // --------------------------------------------------------------------------- |
|
1144 void CGSNetworkPlugin::CheckGPRSConnectionL( TInt aCurrentItem ) |
|
1145 { |
|
1146 if ( ( iPhoneSettingsEngine->IsGPRSConnected() == |
|
1147 CPsetSAObserver::EPSetGPRSConnectionActive ) |
|
1148 && ( aCurrentItem == KGSSettingOff ) ) //if trying to set On... |
|
1149 { |
|
1150 ShowNoteL( R_ACTIVE_GPRS_CONN_NOTE, KGSInformationNote ); |
|
1151 } |
|
1152 } |
|
1153 |
|
1154 // --------------------------------------------------------------------------- |
|
1155 // |
|
1156 // Set MCN value: off => on, on => off. |
|
1157 // |
|
1158 // --------------------------------------------------------------------------- |
|
1159 void CGSNetworkPlugin::SwitchOnOffValue( TInt& aValue ) |
|
1160 { |
|
1161 if ( aValue == EGSMcnSetOn ) |
|
1162 { |
|
1163 aValue = EGSMcnSetOff; |
|
1164 } |
|
1165 else |
|
1166 { |
|
1167 aValue = EGSMcnSetOn; |
|
1168 } |
|
1169 } |
|
1170 |
|
1171 // --------------------------------------------------------------------------- |
|
1172 // |
|
1173 // Create new Net container. |
|
1174 // |
|
1175 // --------------------------------------------------------------------------- |
|
1176 // |
|
1177 void CGSNetworkPlugin::NewContainerL() |
|
1178 { |
|
1179 iContainer = new ( ELeave ) CGSNetworkPluginContainer( this ); |
|
1180 } |
|
1181 |
|
1182 |
|
1183 // --------------------------------------------------------------------------- |
|
1184 // CGSNetworkPlugin::HandleListBoxSelectionL |
|
1185 // |
|
1186 // Handle user selection in the listbox to perform an associated action |
|
1187 // --------------------------------------------------------------------------- |
|
1188 void CGSNetworkPlugin::HandleListBoxSelectionL() |
|
1189 { |
|
1190 CEikMenuBar* menuBar = this->MenuBar(); |
|
1191 |
|
1192 const TInt currentFeatureId = Container()->CurrentFeatureId(); |
|
1193 |
|
1194 switch ( currentFeatureId ) |
|
1195 { |
|
1196 case EGSNetworkModeSelectionItemId: |
|
1197 CheckCallActiveL( EGSNetworkModeSelectionItemId ); |
|
1198 return; |
|
1199 case EGSMCNItemId: |
|
1200 if ( IsPhoneOfflineL() ) |
|
1201 { |
|
1202 HBufC* string = StringLoader::LoadLC( R_OFFLINE_MODE ); |
|
1203 CAknErrorNote* note = new ( ELeave ) CAknErrorNote ( ETrue ); |
|
1204 note->ExecuteLD( *string ); |
|
1205 CleanupStack::PopAndDestroy( string ); |
|
1206 } |
|
1207 else |
|
1208 { |
|
1209 Container()->GetMcnValue( iMCN ); |
|
1210 CheckGPRSConnectionL( iMCN ); |
|
1211 SwitchOnOffValue( iMCN ); |
|
1212 Container()->SetMcnValue( iMCN ); |
|
1213 } |
|
1214 break; |
|
1215 case EGSNetworkModeItemId: |
|
1216 CheckCallActiveL( EGSNetworkModeItemId ); |
|
1217 return; |
|
1218 default: |
|
1219 break; |
|
1220 } |
|
1221 |
|
1222 UpdateListBoxL( currentFeatureId ); |
|
1223 } |
|
1224 |
|
1225 |
|
1226 // --------------------------------------------------------------------------- |
|
1227 // |
|
1228 // Makes a Network/MCN Ss operation. |
|
1229 // |
|
1230 // --------------------------------------------------------------------------- |
|
1231 void CGSNetworkPlugin::CreateNetworkSsCallL( TInt aIndex, |
|
1232 TGSNetworkItemIds aPage ) |
|
1233 { |
|
1234 __GSLOGSTRING("[GS]--> CGSNetworkPlugin::CreateNetworkSsCallL"); |
|
1235 if ( aPage == EGSNetworkModeSelectionItemId ) |
|
1236 { |
|
1237 if ( aIndex == CGSNetworkPlugin::EAutomaticMode ) |
|
1238 { |
|
1239 MPsetNetworkSelect::TNetworkInfo info; |
|
1240 MPsetNetworkSelect::TSelectMode mode = |
|
1241 MPsetNetworkSelect::ENetSelectModeAutomatic; |
|
1242 iSearchForNetworksActive = ETrue; |
|
1243 iPhoneSettingsEngine->GetNetworkSelectMode( mode ); |
|
1244 if ( mode == MPsetNetworkSelect::ENetSelectModeAutomatic ) |
|
1245 { |
|
1246 iPreviousState = ETrue; |
|
1247 } |
|
1248 |
|
1249 //get the local variation status for auto-auto net search support |
|
1250 //the flag is negative... so 1 means "no search allowed". |
|
1251 TBool autoNetSearchOff = |
|
1252 Container()->NetPluginModel()->AutomaticNetworkSearchSupportedL(); |
|
1253 |
|
1254 //autoNetSearch is defaulted to 0 |
|
1255 if ( iPreviousState && autoNetSearchOff ) |
|
1256 { |
|
1257 PhoneIdle(); |
|
1258 } |
|
1259 else |
|
1260 { |
|
1261 info.iMode = MPsetNetworkSelect::ENetSelectModeAutomatic; |
|
1262 iSearchForNetworksActive = ETrue; |
|
1263 iPhoneSettingsEngine->SelectNetworkL( info ); |
|
1264 } |
|
1265 } |
|
1266 else //manual mode |
|
1267 { |
|
1268 iSearchForNetworksActive = ETrue; |
|
1269 iPhoneSettingsEngine->GetAvailableNetworksL(); |
|
1270 } |
|
1271 } |
|
1272 else // MCN Setting page |
|
1273 { |
|
1274 iMCN = aIndex; |
|
1275 CheckGPRSConnectionL( iMCN ); |
|
1276 SwitchOnOffValue( iMCN ); |
|
1277 Container()->SetMcnValue( iMCN ); |
|
1278 } |
|
1279 __GSLOGSTRING("[GS] <--CGSNetworkPlugin::CreateNetworkSsCallL"); |
|
1280 } |
|
1281 |
|
1282 // --------------------------------------------------------------------------- |
|
1283 // |
|
1284 // Shows note. |
|
1285 // |
|
1286 // --------------------------------------------------------------------------- |
|
1287 // |
|
1288 void CGSNetworkPlugin::ShowNoteL( TInt aResourceId, TInt aType ) |
|
1289 { |
|
1290 HBufC* string = StringLoader::LoadLC( aResourceId ); |
|
1291 switch ( aType ) |
|
1292 { |
|
1293 case KGSErrorNote: |
|
1294 { |
|
1295 CAknErrorNote* note = new ( ELeave ) CAknErrorNote ( ETrue ); |
|
1296 note->ExecuteLD( *string ); |
|
1297 break; |
|
1298 } |
|
1299 case KGSConfirmationNote: |
|
1300 { |
|
1301 CAknConfirmationNote* note = |
|
1302 new ( ELeave ) CAknConfirmationNote( ETrue ); |
|
1303 note->ExecuteLD( *string ); |
|
1304 break; |
|
1305 } |
|
1306 case KGSInformationNote: |
|
1307 { |
|
1308 CAknInformationNote* note = |
|
1309 new ( ELeave ) CAknInformationNote( ETrue ); |
|
1310 note->ExecuteLD( *string ); |
|
1311 break; |
|
1312 } |
|
1313 default: |
|
1314 break; |
|
1315 } |
|
1316 CleanupStack::PopAndDestroy( string ); |
|
1317 } |
|
1318 |
|
1319 // --------------------------------------------------------------------------- |
|
1320 // |
|
1321 // Creates dialog, if it is does not exist yet. |
|
1322 // |
|
1323 // --------------------------------------------------------------------------- |
|
1324 // |
|
1325 void CGSNetworkPlugin::CheckAndCreateDlgL( TBool aDelayOff ) |
|
1326 { |
|
1327 if ( !iDlg ) |
|
1328 { |
|
1329 iDlg = new ( ELeave ) CAknWaitDialog( |
|
1330 reinterpret_cast<CEikDialog**> ( &iDlg ), aDelayOff ); |
|
1331 } |
|
1332 } |
|
1333 |
|
1334 // --------------------------------------------------------------------------- |
|
1335 // |
|
1336 // Empties fetched network provider's list |
|
1337 // |
|
1338 // --------------------------------------------------------------------------- |
|
1339 // |
|
1340 void CGSNetworkPlugin::PurgeNetworkList() |
|
1341 { |
|
1342 __GSLOGSTRING("[GS]--> CGSNetworkPlugin::PurgeNetworkList"); |
|
1343 if ( iNetworkArray ) |
|
1344 { |
|
1345 iNetworkArray->Reset(); |
|
1346 delete iNetworkArray; |
|
1347 iNetworkArray = NULL; |
|
1348 } |
|
1349 __GSLOGSTRING("[GS] <--CGSNetworkPlugin::PurgeNetworkList"); |
|
1350 } |
|
1351 |
|
1352 |
|
1353 // --------------------------------------------------------------------------- |
|
1354 // CGSNetworkPlugin::Container |
|
1355 // |
|
1356 // Returns Network container item |
|
1357 // --------------------------------------------------------------------------- |
|
1358 // |
|
1359 CGSNetworkPluginContainer* CGSNetworkPlugin::Container() |
|
1360 { |
|
1361 return static_cast <CGSNetworkPluginContainer*> ( iContainer ); |
|
1362 } |
|
1363 |
|
1364 // --------------------------------------------------------------------------- |
|
1365 // @@see MSSSettingsRefreshObserver::AllowRefresh |
|
1366 // |
|
1367 // Notification to allow refresh from SAT |
|
1368 // --------------------------------------------------------------------------- |
|
1369 // |
|
1370 TBool CGSNetworkPlugin::AllowRefresh( |
|
1371 const TSatRefreshType aType, |
|
1372 const TSatElementaryFiles aFiles ) |
|
1373 { |
|
1374 __GSLOGSTRING("[GS]--> CGSNetworkPlugin::AllowRefresh"); |
|
1375 TBool allowRefresh = ETrue; |
|
1376 if ( iPhoneSettingsEngine->IsCallActive() == CPsetSAObserver::EPSetCallActive ) |
|
1377 { |
|
1378 allowRefresh = EFalse; |
|
1379 } |
|
1380 |
|
1381 //check that aFiles has a value before issuing a refresh command |
|
1382 //no need to check for a specific file... |
|
1383 if ( ( aType != EFileChangeNotification ) || |
|
1384 ( aType == EFileChangeNotification ) && |
|
1385 ( aFiles & KCsp1Ef || aFiles & KCsp2Ef ) ) |
|
1386 { |
|
1387 if ( iNetworkPopupList ) |
|
1388 { |
|
1389 allowRefresh = EFalse; |
|
1390 } |
|
1391 } |
|
1392 |
|
1393 __GSLOGSTRING1("[GS] AllowRefresh: allowRefresh: %d", allowRefresh); |
|
1394 __GSLOGSTRING("[GS] <--CGSNetworkPlugin::AllowRefresh"); |
|
1395 return allowRefresh; |
|
1396 } |
|
1397 |
|
1398 |
|
1399 |
|
1400 // --------------------------------------------------------------------------- |
|
1401 // @@see MSSSettingsRefreshObserver::Refresh |
|
1402 // |
|
1403 // Do the actual refresh of the UI for CSP file updation |
|
1404 // --------------------------------------------------------------------------- |
|
1405 // |
|
1406 void CGSNetworkPlugin::Refresh( |
|
1407 const TSatRefreshType aType, |
|
1408 const TSatElementaryFiles aFiles ) |
|
1409 { |
|
1410 __GSLOGSTRING("[GS]--> CGSNetworkPlugin::Refresh"); |
|
1411 // for a file change notification to be handled, aFiles must always |
|
1412 // contain a value |
|
1413 if ( ( aType != EFileChangeNotification ) || |
|
1414 ( aType == EFileChangeNotification ) && |
|
1415 ( aFiles & KCsp1Ef || aFiles & KCsp2Ef ) ) |
|
1416 { |
|
1417 //check if this check is required, as it is visible in the UI |
|
1418 if ( iNetworkPopupList ) |
|
1419 { |
|
1420 iNetworkPopupList->CancelPopup(); |
|
1421 iNetworkPopupList = NULL; |
|
1422 } |
|
1423 |
|
1424 //Change the network mode to Automatic. |
|
1425 MPsetNetworkSelect::TNetworkInfo info; |
|
1426 info.iMode = MPsetNetworkSelect::ENetSelectModeAutomatic; |
|
1427 iSearchForNetworksActive = ETrue; |
|
1428 TRAP_IGNORE( iPhoneSettingsEngine->SelectNetworkL( info ) ); |
|
1429 __GSLOGSTRING("[GS] Refresh: before Updating the listbox"); |
|
1430 TRAP_IGNORE( UpdateListBoxL( EGSNetworkModeSelectionItemId ) ); |
|
1431 __GSLOGSTRING("[GS] Refresh: after Updating the listbox"); |
|
1432 } |
|
1433 |
|
1434 __GSLOGSTRING("[GS] <--CGSNetworkPlugin::Refresh"); |
|
1435 } |
|
1436 |
|
1437 |
|
1438 // --------------------------------------------------------------------------- |
|
1439 // CGSNetworkPlugin::PhoneIdle |
|
1440 // |
|
1441 // Switch to Phone Idle view. GS is running at the background. |
|
1442 // --------------------------------------------------------------------------- |
|
1443 // |
|
1444 void CGSNetworkPlugin::PhoneIdle() |
|
1445 { |
|
1446 // Fetching the current Idle id |
|
1447 TInt idleApp; |
|
1448 RProperty::Get( KPSUidAiInformation, KActiveIdleUid, idleApp ); |
|
1449 TUid idleAppUid = { idleApp } ; |
|
1450 TApaTaskList taskList( iEikonEnv->WsSession() ); |
|
1451 TApaTask task = taskList.FindApp( idleAppUid ); |
|
1452 |
|
1453 // Expecting that idle application is open always |
|
1454 // if not we dont do anything |
|
1455 if( task.Exists() ) // App open |
|
1456 { |
|
1457 task.BringToForeground(); |
|
1458 } |
|
1459 |
|
1460 //No need to reset network search on exit |
|
1461 iSearchForNetworksActive = EFalse; |
|
1462 } |
|
1463 |
|
1464 |
|
1465 // ----------------------------------------------------------------------------- |
|
1466 // When this method is called, view checks based on highlight focus, if the MSK |
|
1467 // label is correct. |
|
1468 // ----------------------------------------------------------------------------- |
|
1469 // |
|
1470 void CGSNetworkPlugin::CheckMiddleSoftkeyLabelL() |
|
1471 { |
|
1472 } |
|
1473 |
|
1474 |
|
1475 // ----------------------------------------------------------------------------- |
|
1476 // Remove unnecessary commands from Middle softkey. |
|
1477 // @flag = ETrue means presently MSK value is "Change" so we remove that |
|
1478 // @flag = EFalse means presently MSK value is "Context Options" so we remove that |
|
1479 // ----------------------------------------------------------------------------- |
|
1480 // |
|
1481 void CGSNetworkPlugin::RemoveCommandFromMSK(const TBool flag ) |
|
1482 { |
|
1483 CEikButtonGroupContainer* cbaGroup = Cba(); |
|
1484 if ( cbaGroup ) |
|
1485 { |
|
1486 if ( flag ) |
|
1487 { |
|
1488 cbaGroup->RemoveCommandFromStack( |
|
1489 KGSMSKControlID, EGSMSKCmdAppChange ); |
|
1490 } |
|
1491 else |
|
1492 { |
|
1493 cbaGroup->RemoveCommandFromStack( |
|
1494 KGSMSKControlID, EAknSoftkeyContextOptions ); |
|
1495 } |
|
1496 } |
|
1497 } |
|
1498 |
|
1499 // --------------------------------------------------------------------------- |
|
1500 // Sets middle softkey label. |
|
1501 // --------------------------------------------------------------------------- |
|
1502 // |
|
1503 void CGSNetworkPlugin::SetMiddleSoftKeyLabelL( |
|
1504 const TInt aResourceId, const TInt aCommandId ) |
|
1505 { |
|
1506 CEikButtonGroupContainer* cbaGroup = Cba(); |
|
1507 if ( cbaGroup ) |
|
1508 { |
|
1509 HBufC* middleSKText = StringLoader::LoadLC( aResourceId ); |
|
1510 TPtr mskPtr = middleSKText->Des(); |
|
1511 cbaGroup->AddCommandToStackL( |
|
1512 KGSMSKControlID, |
|
1513 aCommandId, |
|
1514 mskPtr ); |
|
1515 CleanupStack::PopAndDestroy( middleSKText ); |
|
1516 } |
|
1517 } |
|
1518 |
|
1519 // ----------------------------------------------------------------------------- |
|
1520 // CGSNetworkPlugin::HandleClientRectChange |
|
1521 // |
|
1522 // |
|
1523 // ----------------------------------------------------------------------------- |
|
1524 // |
|
1525 void CGSNetworkPlugin::HandleClientRectChange() |
|
1526 { |
|
1527 if ( iContainer ) |
|
1528 { |
|
1529 iContainer->SetRect( ClientRect() ); |
|
1530 } |
|
1531 } |
|
1532 |
|
1533 // ========================= From CGSPluginInterface ================== |
|
1534 |
|
1535 // ----------------------------------------------------------------------------- |
|
1536 // CGSNetworkPlugin::GetCaptionL |
|
1537 // |
|
1538 // |
|
1539 // ----------------------------------------------------------------------------- |
|
1540 // |
|
1541 void CGSNetworkPlugin::GetCaptionL( TDes& aCaption ) const |
|
1542 { |
|
1543 HBufC* result = StringLoader::LoadL( R_GS_NET_VIEW_CAPTION ); |
|
1544 aCaption.Copy( *result ); |
|
1545 delete result; |
|
1546 } |
|
1547 |
|
1548 |
|
1549 // ----------------------------------------------------------------------------- |
|
1550 // CGSNetworkPlugin::PluginProviderCategory |
|
1551 // |
|
1552 // |
|
1553 // ----------------------------------------------------------------------------- |
|
1554 // |
|
1555 TInt CGSNetworkPlugin::PluginProviderCategory() const |
|
1556 { |
|
1557 //This plugin is created by 3rd party. |
|
1558 return KGSPluginProviderInternal; |
|
1559 } |
|
1560 |
|
1561 // --------------------------------------------------------------------------- |
|
1562 // |
|
1563 // Updates specific value to container. |
|
1564 // |
|
1565 // --------------------------------------------------------------------------- |
|
1566 // |
|
1567 void CGSNetworkPlugin::UpdateListBoxL( const TInt& aListItem, |
|
1568 const TInt aNewValue ) |
|
1569 { |
|
1570 if ( iContainer && iContainer->iListBox ) |
|
1571 { |
|
1572 Container()->UpdateListBoxL( aListItem, aNewValue ); |
|
1573 } |
|
1574 CheckMiddleSoftkeyLabelL(); |
|
1575 } |
|
1576 |
|
1577 // ----------------------------------------------------------------------------- |
|
1578 // CGSNetworkPlugin::CreateIconL() |
|
1579 // |
|
1580 // |
|
1581 // ----------------------------------------------------------------------------- |
|
1582 // |
|
1583 CGulIcon* CGSNetworkPlugin::CreateIconL( const TUid aIconType ) |
|
1584 { |
|
1585 //EMbm<Mbm_file_name><Bitmap_name> |
|
1586 CGulIcon* icon; |
|
1587 TParse* fp = new( ELeave ) TParse(); |
|
1588 CleanupStack::PushL( fp ); |
|
1589 fp->Set( KGSNetworkPluginIconDirAndName, &KDC_BITMAP_DIR, NULL ); |
|
1590 |
|
1591 if( aIconType == KGSIconTypeLbxItem && PhoneOnline() ) |
|
1592 { |
|
1593 icon = AknsUtils::CreateGulIconL( |
|
1594 AknsUtils::SkinInstance(), |
|
1595 KAknsIIDQgnPropSetNetworkSub, |
|
1596 fp->FullName(), |
|
1597 EMbmGsnetworkpluginQgn_prop_set_network_sub, |
|
1598 EMbmGsnetworkpluginQgn_prop_set_network_sub_mask ); |
|
1599 } |
|
1600 else if( aIconType == KGSIconTypeLbxItem /*->phone offline*/ ) |
|
1601 { |
|
1602 icon = AknsUtils::CreateGulIconL( |
|
1603 AknsUtils::SkinInstance(), |
|
1604 KAknsIIDQgnPropSetNetworkSub, |
|
1605 fp->FullName(), |
|
1606 EMbmGsnetworkpluginQgn_prop_set_network_sub_offline, |
|
1607 EMbmGsnetworkpluginQgn_prop_set_network_sub_offline_mask ); |
|
1608 } |
|
1609 else |
|
1610 { |
|
1611 icon = CGSPluginInterface::CreateIconL( aIconType ); |
|
1612 } |
|
1613 CleanupStack::PopAndDestroy( fp ); |
|
1614 return icon; |
|
1615 } |
|
1616 |
|
1617 // --------------------------------------------------------------------------- |
|
1618 // CGSNetworkPlugin::HandleNotifyPSL |
|
1619 // |
|
1620 // Handling PS keys change |
|
1621 // --------------------------------------------------------------------------- |
|
1622 // |
|
1623 void CGSNetworkPlugin::HandleNotifyPSL( const TUid aUid, const TInt& aKey, |
|
1624 const TRequestStatus& /* aStatus */ ) |
|
1625 { |
|
1626 if ( aUid == KPSUidBluetoothSapConnectionState && |
|
1627 aKey == KBTSapConnectionState ) |
|
1628 { |
|
1629 Visible(); |
|
1630 } |
|
1631 } |
|
1632 |
|
1633 // --------------------------------------------------------- |
|
1634 // CGSNetworkPlugin::IsPhoneOfflineL |
|
1635 // |
|
1636 // Checks if phone is in offline mode or not. |
|
1637 // Return ETrue if phone is in offline mode. |
|
1638 // Return EFalse if phone is not in offline mode. |
|
1639 // --------------------------------------------------------- |
|
1640 // |
|
1641 TBool CGSNetworkPlugin::IsPhoneOfflineL() const |
|
1642 { |
|
1643 if ( FeatureManager::FeatureSupported( KFeatureIdOfflineMode ) ) |
|
1644 { |
|
1645 CRepository* repository = CRepository::NewLC( KCRUidCoreApplicationUIs ); |
|
1646 TInt connAllowed = 1; |
|
1647 repository->Get( KCoreAppUIsNetworkConnectionAllowed, connAllowed ); |
|
1648 CleanupStack::PopAndDestroy(); // repository |
|
1649 if ( !connAllowed ) |
|
1650 { |
|
1651 return ETrue; |
|
1652 } |
|
1653 } |
|
1654 return EFalse; |
|
1655 } |
|
1656 |
|
1657 |
|
1658 // ---------------------------------------------------------------------------- |
|
1659 // CGSNetworkPlugin::DynInitMenuPaneL() |
|
1660 // |
|
1661 // Display the dynamic menu |
|
1662 // ---------------------------------------------------------------------------- |
|
1663 void CGSNetworkPlugin::DynInitMenuPaneL( TInt aResourceId, |
|
1664 CEikMenuPane* aMenuPane ) |
|
1665 { |
|
1666 // show or hide the 'help' menu item when supported |
|
1667 if( aResourceId == R_GS_MENU_ITEM_HELP ) |
|
1668 { |
|
1669 User::LeaveIfNull( aMenuPane ); |
|
1670 |
|
1671 if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
1672 { |
|
1673 aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse ); |
|
1674 } |
|
1675 else |
|
1676 { |
|
1677 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); |
|
1678 } |
|
1679 } |
|
1680 } |
|
1681 |
|
1682 |
|
1683 //Disabling warning caused by err variable used inside macros |
|
1684 #pragma diag_suppress 550 |
|
1685 // ----------------------------------------------------------------------------- |
|
1686 // CGSNetworkPlugin::GetValue() |
|
1687 // |
|
1688 // ----------------------------------------------------------------------------- |
|
1689 // |
|
1690 void CGSNetworkPlugin::GetValue( const TGSPluginValueKeys aKey, |
|
1691 TDes& aValue ) |
|
1692 { |
|
1693 switch( aKey ) |
|
1694 { |
|
1695 case EGSPluginKeySettingsItemValueString: |
|
1696 // Operator name is async function but GetValue is synchronous. |
|
1697 // As a result the first GetValue call might not contain updated |
|
1698 // operator name. A callback will however ask to update parent plugin |
|
1699 // which will then call GetValue a second time and the operator name |
|
1700 // will then be updated. |
|
1701 if( !iNWSession ) |
|
1702 { |
|
1703 __GSLOGSTRING(" [CGSNetworkPlugin::GetValue] Opening iNWSession..." ); |
|
1704 |
|
1705 // Create network handling engine session. |
|
1706 // Question: is this callback one-shot or constant observer? |
|
1707 TRAPD( err, iNWSession = CreateL( *this, iNWInfo ) ); |
|
1708 __GSLOGSTRING1(" [CGSNetworkPlugin::GetValue] Done. Err:%d", err ); |
|
1709 } |
|
1710 aValue.Copy( iNetworkText->Des() ); |
|
1711 break; |
|
1712 default: |
|
1713 aValue.Append( KEmptyStr ); |
|
1714 break; |
|
1715 } |
|
1716 } |
|
1717 |
|
1718 //Enabling warnings |
|
1719 #pragma diag_default 550 |
|
1720 // ----------------------------------------------------------------------------- |
|
1721 // CGSNetworkPlugin::GetNetworkValues() |
|
1722 // Get network status |
|
1723 // qtn.cp.detail.cellular.operational / qtn.cp.detail.cellular.offline |
|
1724 // qtn_cp_detail_cellular_operational / qtn_cp_detail_cellular_offline |
|
1725 // and operator name. |
|
1726 // ----------------------------------------------------------------------------- |
|
1727 // |
|
1728 void CGSNetworkPlugin::UpdateNetworkTextL() |
|
1729 { |
|
1730 // On default text is 'off-line', if online status is received use, |
|
1731 // 'operational'. |
|
1732 TInt networkStatusRscId = R_CELLULAR_OFFLINE; |
|
1733 |
|
1734 if( iNetworkText ) |
|
1735 { |
|
1736 delete iNetworkText; |
|
1737 iNetworkText = NULL; |
|
1738 } |
|
1739 |
|
1740 if( PhoneOnline() ) |
|
1741 { |
|
1742 __GSLOGSTRING(" [CGSNetworkPlugin::UpdateNetworkTextL] Loading operational-text" ); |
|
1743 // The service provider name may missed in SIM card, so display the operator name |
|
1744 // which returned by NTSY here. |
|
1745 iNetworkText = iNWInfo.iOperatorNameInfo.iName.AllocL(); |
|
1746 } |
|
1747 else |
|
1748 { |
|
1749 __GSLOGSTRING(" [CGSNetworkPlugin::UpdateNetworkTextL] Loading offline-text" ); |
|
1750 networkStatusRscId = R_CELLULAR_OFFLINE; |
|
1751 iNetworkText = StringLoader::LoadL( networkStatusRscId ); |
|
1752 } |
|
1753 __GSLOGSTRING1( "[CGSNetworkPlugin::UpdateNetworkTextL] iNetworkText:%S ", iNetworkText ); |
|
1754 } |
|
1755 |
|
1756 |
|
1757 //Disabling warning caused by err variable used inside macros |
|
1758 #pragma diag_suppress 550 |
|
1759 // ----------------------------------------------------------------------------- |
|
1760 // CGSNetworkPlugin::HandleNetworkMessage |
|
1761 // From MNWMessageObserver. |
|
1762 // |
|
1763 // ----------------------------------------------------------------------------- |
|
1764 // |
|
1765 void CGSNetworkPlugin::HandleNetworkMessage( const TNWMessages aMessage ) |
|
1766 { |
|
1767 #ifdef _DEBUG |
|
1768 TBuf<KGSNetworkModeDebugStrLen> messageBuf; |
|
1769 GSNetworkDebugHelper::NetworkMessageToDes( aMessage, messageBuf ); |
|
1770 __GSLOGSTRING1( "[CGSNetworkPlugin::HandleNetworkMessage] %S", |
|
1771 &messageBuf ); |
|
1772 #endif // _DEBUG |
|
1773 |
|
1774 switch( aMessage ) |
|
1775 { |
|
1776 case ENWMessageNetworkInfoChange: |
|
1777 TRAPD |
|
1778 ( |
|
1779 err, |
|
1780 UpdateNetworkTextL(); |
|
1781 ) |
|
1782 __GSLOGSTRING1( |
|
1783 "[CGSNetworkPlugin::HandleNetworkMessage] Update network text error:%d.", |
|
1784 err ); |
|
1785 TRAPD |
|
1786 ( |
|
1787 err2, |
|
1788 UpdateNetworkSettingPageL(); |
|
1789 ) |
|
1790 __GSLOGSTRING1( |
|
1791 "[CGSNetworkPlugin::HandleNetworkMessage] Update network setting page error:%d.", |
|
1792 err2 ); |
|
1793 Parent()->UpdateView(); |
|
1794 break; |
|
1795 default: |
|
1796 break; |
|
1797 } |
|
1798 } |
|
1799 |
|
1800 |
|
1801 // ----------------------------------------------------------------------------- |
|
1802 // CGSNetworkPlugin::UpdateNetworkSettingPageL |
|
1803 // |
|
1804 // |
|
1805 // ----------------------------------------------------------------------------- |
|
1806 // |
|
1807 void CGSNetworkPlugin::UpdateNetworkSettingPageL() |
|
1808 { |
|
1809 // If network mode setting page is open, close it and open |
|
1810 // again so it will update the selected value correctly. |
|
1811 // Whoopee! Who said setting dialogs are dumb? |
|
1812 if( iSettingDlg && Container()->CurrentFeatureId() == EGSNetworkModeItemId ) |
|
1813 { |
|
1814 __GSLOGSTRING( "[CGSNetworkPlugin::UpdateNetworkSettingPageL] Closing and reopening dialog..." ); |
|
1815 CloseDialog(); |
|
1816 ShowSettingPageL( EGSNetworkModeItemId ); |
|
1817 } |
|
1818 } |
|
1819 |
|
1820 //Enabling warnings |
|
1821 #pragma diag_default 550 |
|
1822 |
|
1823 // ----------------------------------------------------------------------------- |
|
1824 // CGSNetworkPlugin::HandleNetworkError |
|
1825 // From MNWMessageObserver. |
|
1826 // |
|
1827 // ----------------------------------------------------------------------------- |
|
1828 // |
|
1829 void CGSNetworkPlugin::HandleNetworkError( const TNWOperation aOperation, |
|
1830 TInt aErrorCode ) |
|
1831 { |
|
1832 // Probably no need to do anything as default assumption is off-line unless |
|
1833 // iNWInfo.iRegistrationStatus defines otherwise. Question is, does |
|
1834 // iNWSession update iNWInfo values to anything sensible in case of error. |
|
1835 #ifdef _DEBUG |
|
1836 TBuf<KGSNetworkModeDebugStrLen> operationBuf; |
|
1837 GSNetworkDebugHelper::NetworkOperationToDes( aOperation, operationBuf ); |
|
1838 __GSLOGSTRING2( "[CGSNetworkPlugin::HandleNetworkError] %S error:%d", |
|
1839 &operationBuf, aErrorCode ); |
|
1840 #endif // _DEBUG |
|
1841 |
|
1842 // Later network operator name seems to be updated after HandleNetworkError |
|
1843 // so we probably want to update the name also in UI as soon as possible. |
|
1844 TRAP_IGNORE( UpdateNetworkTextL(); ); |
|
1845 |
|
1846 // CGSParentPlugin::DoDeactivate() will delete it's container so calling |
|
1847 // CGSParentPlugin::UpdateView() should not cause unnecessary container |
|
1848 // updates. |
|
1849 Parent()->UpdateView(); |
|
1850 } |
|
1851 |
|
1852 |
|
1853 // ----------------------------------------------------------------------------- |
|
1854 // CGSNetworkPlugin::Parent |
|
1855 // |
|
1856 // |
|
1857 // ----------------------------------------------------------------------------- |
|
1858 // |
|
1859 CGSParentPlugin* CGSNetworkPlugin::Parent() |
|
1860 { |
|
1861 CGSParentPlugin* parent = static_cast<CGSParentPlugin*>( |
|
1862 AppUi()->View( KGSConPluginUid ) ); |
|
1863 return parent; |
|
1864 } |
|
1865 |
|
1866 |
|
1867 // ----------------------------------------------------------------------------- |
|
1868 // CGSNetworkPlugin::PhoneOnline |
|
1869 // |
|
1870 // |
|
1871 // ----------------------------------------------------------------------------- |
|
1872 // |
|
1873 TBool CGSNetworkPlugin::PhoneOnline() |
|
1874 { |
|
1875 #ifdef _DEBUG |
|
1876 TBuf<KGSNetworkModeDebugStrLen> statusBuf; |
|
1877 GSNetworkDebugHelper::NetworkStatusToDes( iNWInfo.iRegistrationStatus, statusBuf ); |
|
1878 __GSLOGSTRING1( "[CGSNetworkPlugin::PhoneOnline] %S", &statusBuf ); |
|
1879 #endif // _DEBUG |
|
1880 |
|
1881 TBool online = EFalse; |
|
1882 switch( iNWInfo.iRegistrationStatus ) |
|
1883 { |
|
1884 case ENWRegisteredOnHomeNetwork: // Same functionality as below |
|
1885 case ENWRegisteredRoaming: |
|
1886 { |
|
1887 online = ETrue; |
|
1888 break; |
|
1889 } |
|
1890 default: |
|
1891 { |
|
1892 online = EFalse; |
|
1893 break; |
|
1894 } |
|
1895 } |
|
1896 return online; |
|
1897 } |
|
1898 |
|
1899 |
|
1900 // ----------------------------------------------------------------------------- |
|
1901 // CGSNetworkPlugin::CloseDialog |
|
1902 // |
|
1903 // |
|
1904 // ----------------------------------------------------------------------------- |
|
1905 // |
|
1906 void CGSNetworkPlugin::CloseDialog() |
|
1907 { |
|
1908 //Send ESC key sequence to setting dialog, so that it closes itself. |
|
1909 if ( iSettingDlg ) |
|
1910 { |
|
1911 TKeyEvent event; |
|
1912 event.iCode = EKeyEscape; |
|
1913 event.iScanCode = EStdKeyEscape; |
|
1914 event.iRepeats = 0; |
|
1915 TRAP_IGNORE( iCoeEnv->SimulateKeyEventL( event, EEventKeyDown ); |
|
1916 iCoeEnv->SimulateKeyEventL( event, EEventKey ); |
|
1917 iCoeEnv->SimulateKeyEventL( event, EEventKeyUp ); ); |
|
1918 } |
|
1919 } |
|
1920 |
|
1921 #ifdef FF_POWER_SAVE |
|
1922 // ---------------------------------------------------------------------------------- |
|
1923 // CGSDisplayPlugin::DisplayBlockNoteL() |
|
1924 // ---------------------------------------------------------------------------------- |
|
1925 void CGSNetworkPlugin::DisplayBlockNoteL() |
|
1926 { |
|
1927 HBufC* prompt = iCoeEnv->AllocReadResourceLC( |
|
1928 R_GS_POWER_SAVING_PROTECTED_SETTINGS_INFONOTE ); |
|
1929 CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue ); |
|
1930 note->ExecuteLD( *prompt ); |
|
1931 CleanupStack::PopAndDestroy( prompt ); |
|
1932 } |
|
1933 |
|
1934 // ---------------------------------------------------------------------------------- |
|
1935 // CGSDisplayPlugin::UpdateOnPsmChanged() |
|
1936 // ---------------------------------------------------------------------------------- |
|
1937 void CGSNetworkPlugin::UpdateOnPsmChanged() |
|
1938 { |
|
1939 __GSLOGSTRING( "[CGSNetworkPlugin::UpdateOnPsmChanged]" ); |
|
1940 |
|
1941 if ( Container() && Container()->NetPluginModel() ) |
|
1942 { |
|
1943 Container()->NetPluginModel()->StartAsynGetCurrentNetworkModeSelectionL(); |
|
1944 } |
|
1945 } |
|
1946 |
|
1947 #endif // FF_POWER_SAVE |
|
1948 |
|
1949 //End of File |