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