25
|
1 |
/*
|
|
2 |
* Copyright (c) 2003 - 2006 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: Container for Network folder in GSTelPlugin.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include "GSNetworkPluginModel.h" //for CGSModel
|
|
21 |
#include "gssettingid.h" //for view IDs
|
|
22 |
#include "GSNetworkPluginContainer.h" //for CGSNetworkPluginContainer
|
|
23 |
#include "GsLogger.h"
|
|
24 |
|
|
25 |
|
|
26 |
#include <aknlists.h> //for CAknSettingStyleListBox
|
|
27 |
#include <aknnotewrappers.h> //for AknErrorNote
|
|
28 |
#include <aknappui.h> //for iAvkonAppUi
|
|
29 |
#include <StringLoader.h> //for StringLoader
|
|
30 |
#include <gsnetworkpluginrsc.rsg> //for resource IDs
|
|
31 |
#include <PsetContainer.h> //for CPsetContainer
|
|
32 |
#include <PsetNetwork.h> //for CPsetNetwork
|
|
33 |
#include <gslistbox.h> //for listbox classes
|
|
34 |
#include <csxhelp/cp.hlp.hrh>
|
|
35 |
#include <gsfwviewuids.h> // for KUidGS
|
|
36 |
#include <MPsetNetworkModeObs.h> //for network mode values
|
|
37 |
#include <gsmerror.h> //for GSM-specific error messages
|
|
38 |
#include <featmgr.h> //Feature Manager
|
|
39 |
#include <MPsetNetworkModeObs.h>
|
|
40 |
#include "GSNetworkDebugHelper.h"
|
|
41 |
|
|
42 |
#ifndef RD_STARTUP_CHANGE
|
|
43 |
#include <sysstartup.h> //Startup reasons
|
|
44 |
#else
|
|
45 |
#include <starterclient.h> // Startup reasons
|
|
46 |
#endif // RD_STARTUP_CHANGE
|
|
47 |
|
|
48 |
|
|
49 |
// LOCAL CONSTANTS
|
|
50 |
_LIT( KNameOfClass, "CGSNetworkPluginContainer" );
|
|
51 |
|
|
52 |
// ================= MEMBER FUNCTIONS =======================
|
|
53 |
|
|
54 |
// ---------------------------------------------------------------------------
|
|
55 |
// C++ Constructor. Needed for initializing iPlugin.
|
|
56 |
// ---------------------------------------------------------------------------
|
|
57 |
CGSNetworkPluginContainer::CGSNetworkPluginContainer( CGSNetworkPlugin* aPlugin )
|
|
58 |
:iPlugin( aPlugin )
|
|
59 |
{
|
|
60 |
}
|
|
61 |
|
|
62 |
// ---------------------------------------------------------------------------
|
|
63 |
//
|
|
64 |
// Symbian OS two phased constructor with pointer to Network object
|
|
65 |
//
|
|
66 |
// ---------------------------------------------------------------------------
|
|
67 |
void CGSNetworkPluginContainer::ConstructL( const TRect& aRect )
|
|
68 |
{
|
|
69 |
iListBox = new ( ELeave ) CAknSettingStyleListBox;
|
|
70 |
|
|
71 |
//model construction
|
|
72 |
iModel = CGSNetworkPluginModel::NewL( this, iPlugin );
|
|
73 |
|
|
74 |
BaseConstructL( aRect,
|
|
75 |
R_GS_NET_VIEW_TITLE,
|
|
76 |
R_NET_LBX );
|
|
77 |
}
|
|
78 |
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
//
|
|
81 |
// Destructor
|
|
82 |
//
|
|
83 |
// ---------------------------------------------------------------------------
|
|
84 |
CGSNetworkPluginContainer::~CGSNetworkPluginContainer()
|
|
85 |
{
|
|
86 |
if ( iListboxItemArray )
|
|
87 |
{
|
|
88 |
delete iListboxItemArray;
|
|
89 |
iListboxItemArray = NULL;
|
|
90 |
}
|
|
91 |
|
|
92 |
if( iModel )
|
|
93 |
{
|
|
94 |
delete iModel;
|
|
95 |
iModel = NULL;
|
|
96 |
}
|
|
97 |
}
|
|
98 |
|
|
99 |
// ---------------------------------------------------------------------------
|
|
100 |
//
|
|
101 |
// Creates list box
|
|
102 |
//
|
|
103 |
// ---------------------------------------------------------------------------
|
|
104 |
void CGSNetworkPluginContainer::ConstructListBoxL( TInt aResLbxId )
|
|
105 |
{
|
|
106 |
__GSLOGSTRING("[GS]--> CGSNetworkPluginContainer::ConstructListBoxL");
|
|
107 |
iListBox->ConstructL( this, EAknListBoxSelectionList );
|
|
108 |
iListboxItemArray = CGSListBoxItemTextArray::NewL( aResLbxId,
|
|
109 |
*iListBox, *iCoeEnv );
|
|
110 |
iListBox->Model()->SetItemTextArray( iListboxItemArray );
|
|
111 |
iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
|
|
112 |
|
|
113 |
CreateListBoxItemsL();
|
|
114 |
__GSLOGSTRING("[GS] <--CGSNetworkPluginContainer::ConstructListBoxL");
|
|
115 |
}
|
|
116 |
|
|
117 |
// ---------------------------------------------------------------------------
|
|
118 |
//
|
|
119 |
// Creates list box items
|
|
120 |
//
|
|
121 |
// ---------------------------------------------------------------------------
|
|
122 |
void CGSNetworkPluginContainer::CreateListBoxItemsL()
|
|
123 |
{
|
|
124 |
__GSLOGSTRING("[GS]--> CGSNetworkPluginContainer::CreateListBoxItemsL");
|
|
125 |
// do not get check CSP if not using WINS
|
|
126 |
#ifndef __WINS__
|
|
127 |
//Set CSP on, if it is not already
|
|
128 |
if ( !iModel->GetCSPStatus() )
|
|
129 |
{
|
|
130 |
iModel->SetCSPActiveL( ETrue );
|
|
131 |
}
|
|
132 |
#endif
|
|
133 |
|
|
134 |
if ( FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ) )
|
|
135 |
{
|
|
136 |
if ( iModel->IsNetworkModeVisible() )
|
|
137 |
{
|
|
138 |
MakeNwModeUiItemL();
|
|
139 |
}
|
|
140 |
}
|
|
141 |
|
|
142 |
MakeNwItemL();
|
|
143 |
MakeMcnItemL();
|
|
144 |
__GSLOGSTRING("[GS] <--CGSNetworkPluginContainer::CreateListBoxItemsL");
|
|
145 |
}
|
|
146 |
|
|
147 |
// ---------------------------------------------------------------------------
|
|
148 |
//
|
|
149 |
// Updates changed list box item
|
|
150 |
//
|
|
151 |
// ---------------------------------------------------------------------------
|
|
152 |
void CGSNetworkPluginContainer::UpdateListBoxL( TInt aFeatureId, TInt aValue )
|
|
153 |
{
|
|
154 |
__GSLOGSTRING("[GS]--> CGSNetworkPluginContainer::UpdateListBoxL");
|
|
155 |
switch ( aFeatureId )
|
|
156 |
{
|
|
157 |
case EGSNetworkModeItemId:
|
|
158 |
if ( FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ) )
|
|
159 |
{
|
|
160 |
if ( iModel->IsNetworkModeVisible() )
|
|
161 |
{
|
|
162 |
MakeNwModeUiItemL();
|
|
163 |
}
|
|
164 |
}
|
|
165 |
break;
|
|
166 |
case EGSNetworkModeSelectionItemId:
|
|
167 |
MakeNwItemL( aValue );
|
|
168 |
break;
|
|
169 |
case EGSMCNItemId:
|
|
170 |
MakeMcnItemL();
|
|
171 |
break;
|
|
172 |
default:
|
|
173 |
Panic( KNameOfClass, EInvalidIndex );
|
|
174 |
break;
|
|
175 |
}
|
|
176 |
iListBox->HandleItemAdditionL();
|
|
177 |
__GSLOGSTRING("[GS] <--CGSNetworkPluginContainer::UpdateListBoxL");
|
|
178 |
}
|
|
179 |
|
|
180 |
// ---------------------------------------------------------------------------
|
|
181 |
//
|
|
182 |
// Creates new Network list box item
|
|
183 |
//
|
|
184 |
// ---------------------------------------------------------------------------
|
|
185 |
void CGSNetworkPluginContainer::MakeNwItemL( TInt aValue )
|
|
186 |
{
|
|
187 |
__GSLOGSTRING("[GS]--> CGSNetworkPluginContainer::MakeNwItemL");
|
|
188 |
HBufC* dynamicText = NULL;
|
|
189 |
TInt currentValue = KErrNone;
|
|
190 |
|
|
191 |
if ( aValue != KErrNotFound )
|
|
192 |
{
|
|
193 |
currentValue = aValue;
|
|
194 |
}
|
|
195 |
else
|
|
196 |
{
|
|
197 |
//use bogus values for WINS to avoid jamming the emulator
|
|
198 |
#ifdef __WINS__
|
|
199 |
currentValue = EGSManualSelectMode;
|
|
200 |
#else
|
|
201 |
currentValue = GetSelectionMode();
|
|
202 |
#endif // __WINS__
|
|
203 |
}
|
|
204 |
|
|
205 |
TUint32 resourceId = R_NETSL_NETSELECTMODE_LBX;
|
|
206 |
TInt featureId = EGSAutomaticSelectMode;
|
|
207 |
|
|
208 |
if ( currentValue == EGSManualSelectMode )
|
|
209 |
{
|
|
210 |
featureId = EGSManualSelectMode;
|
|
211 |
}
|
|
212 |
|
|
213 |
dynamicText = CGSItemTextArray::GetItemCaptionFromFeatureIdLC(
|
|
214 |
resourceId,
|
|
215 |
featureId,
|
|
216 |
*iCoeEnv );
|
|
217 |
|
|
218 |
#ifndef __WINS__
|
|
219 |
//Create network mode setting item
|
|
220 |
if ( iModel->IsSettingSupported( EGSCSPManualNetworkSelection ) )
|
|
221 |
{
|
|
222 |
#endif
|
|
223 |
// Finally, set the dynamic text
|
|
224 |
iListboxItemArray->SetDynamicTextL( EGSNetworkModeSelectionItemId,
|
|
225 |
*dynamicText );
|
|
226 |
|
|
227 |
// And add to listbox
|
|
228 |
iListboxItemArray->SetItemVisibilityL( EGSNetworkModeSelectionItemId,
|
|
229 |
CGSListBoxItemTextArray::EVisible );
|
|
230 |
|
|
231 |
#ifndef __WINS__
|
|
232 |
}
|
|
233 |
#endif
|
|
234 |
|
|
235 |
CleanupStack::PopAndDestroy( dynamicText );
|
|
236 |
__GSLOGSTRING("[GS] <--CGSNetworkPluginContainer::MakeNwItemL");
|
|
237 |
}
|
|
238 |
|
|
239 |
// ---------------------------------------------------------------------------
|
|
240 |
//
|
|
241 |
// Gets the currently active selection mode.
|
|
242 |
//
|
|
243 |
// ---------------------------------------------------------------------------
|
|
244 |
TInt CGSNetworkPluginContainer::GetSelectionMode()
|
|
245 |
{
|
|
246 |
__GSLOGSTRING("[GS]--> CGSNetworkPluginContainer::GetSelectionMode");
|
|
247 |
MPsetNetworkSelect::TSelectMode mode =
|
|
248 |
iModel->GetNetworkSelectionMode();
|
|
249 |
|
|
250 |
if ( mode == MPsetNetworkSelect::ENetSelectModeManual )
|
|
251 |
{
|
|
252 |
__GSLOGSTRING("[GS] <--CGSNetworkPluginContainer::GetSelectionMode");
|
|
253 |
return EGSManualSelectMode;
|
|
254 |
}
|
|
255 |
else
|
|
256 |
{
|
|
257 |
__GSLOGSTRING("[GS] <--CGSNetworkPluginContainer::GetSelectionMode");
|
|
258 |
return EGSAutomaticSelectMode;
|
|
259 |
}
|
|
260 |
}
|
|
261 |
|
|
262 |
// ---------------------------------------------------------------------------
|
|
263 |
//
|
|
264 |
// Creates new MCN list box item
|
|
265 |
//
|
|
266 |
// ---------------------------------------------------------------------------
|
|
267 |
void CGSNetworkPluginContainer::MakeMcnItemL()
|
|
268 |
{
|
|
269 |
__GSLOGSTRING("[GS]--> CGSNetworkPluginContainer::MakeMcnItemL");
|
|
270 |
HBufC* dynamicText = NULL;
|
|
271 |
TInt readValue = 0;
|
|
272 |
|
|
273 |
GetMcnValue( readValue );
|
|
274 |
TUint32 resourceId = R_MCN_CELL_INFO_DISP_MODE_LBX;
|
|
275 |
TInt featureId = EGSMcnSetOn;
|
|
276 |
|
|
277 |
switch ( readValue ) //resource manipulation
|
|
278 |
{
|
|
279 |
case 0: // Off should be displayed in UI
|
|
280 |
featureId = EGSMcnSetOff;
|
|
281 |
break;
|
|
282 |
case 1: // On should be displayed in UI
|
|
283 |
featureId = EGSMcnSetOn;
|
|
284 |
break;
|
|
285 |
default:
|
|
286 |
break;
|
|
287 |
}
|
|
288 |
|
|
289 |
dynamicText = CGSItemTextArray::GetItemCaptionFromFeatureIdLC(
|
|
290 |
resourceId,
|
|
291 |
featureId,
|
|
292 |
*iCoeEnv );
|
|
293 |
|
|
294 |
// Finally, set the dynamic text
|
|
295 |
iListboxItemArray->SetDynamicTextL( EGSMCNItemId, *dynamicText );
|
|
296 |
|
|
297 |
// And add to listbox
|
|
298 |
iListboxItemArray->SetItemVisibilityL( EGSMCNItemId,
|
|
299 |
CGSListBoxItemTextArray::EVisible );
|
|
300 |
|
|
301 |
CleanupStack::PopAndDestroy( dynamicText );
|
|
302 |
__GSLOGSTRING("[GS] <--CGSNetworkPluginContainer::MakeMcnItemL");
|
|
303 |
}
|
|
304 |
|
|
305 |
// ---------------------------------------------------------------------------
|
|
306 |
//
|
|
307 |
// Gets MCN value from model.
|
|
308 |
//
|
|
309 |
// ---------------------------------------------------------------------------
|
|
310 |
//
|
|
311 |
void CGSNetworkPluginContainer::GetMcnValue( TInt &aMcnValue )
|
|
312 |
{
|
|
313 |
iModel->GetMCNSettingValue( aMcnValue );
|
|
314 |
}
|
|
315 |
|
|
316 |
// ---------------------------------------------------------------------------
|
|
317 |
//
|
|
318 |
// Sets MCN value from model.
|
|
319 |
//
|
|
320 |
// ---------------------------------------------------------------------------
|
|
321 |
//
|
|
322 |
void CGSNetworkPluginContainer::SetMcnValue( TInt &aMcnValue )
|
|
323 |
{
|
|
324 |
iModel->SetMCNSettingValue( aMcnValue );
|
|
325 |
}
|
|
326 |
|
|
327 |
|
|
328 |
// ---------------------------------------------------------------------------
|
|
329 |
//
|
|
330 |
// Creates network mode ui list box item
|
|
331 |
//
|
|
332 |
// ---------------------------------------------------------------------------
|
|
333 |
void CGSNetworkPluginContainer::MakeNwModeUiItemL()
|
|
334 |
{
|
|
335 |
__GSLOGSTRING("[GS]--> CGSNetworkPluginContainer::MakeNwModeUiItemL");
|
|
336 |
HBufC* dynamicText = NULL;
|
|
337 |
|
|
338 |
// In here KGSNetworkModeCapsNotUpdated means mode is not updated yet
|
|
339 |
if( iModel->GetNetworkMode() != KGSNetworkModeCapsNotUpdated )
|
|
340 |
{
|
|
341 |
// Allocate value to dynamicText from the resource item
|
|
342 |
TUint32 resourceId= R_NET_NETWORK_MODE_LBX;
|
|
343 |
dynamicText = CGSItemTextArray::GetItemCaptionFromFeatureIdLC(
|
|
344 |
resourceId, GetCurrentNetworkModeSelectionL(), *iCoeEnv );
|
|
345 |
}
|
|
346 |
else
|
|
347 |
{
|
|
348 |
_LIT( KEmpty, " ");
|
|
349 |
dynamicText = KEmpty().AllocLC ( );
|
|
350 |
}
|
|
351 |
|
|
352 |
// Finally, set the dynamic text
|
|
353 |
iListboxItemArray->SetDynamicTextL( EGSNetworkModeItemId, *dynamicText );
|
|
354 |
|
|
355 |
// And add to listbox
|
|
356 |
iListboxItemArray->SetItemVisibilityL( EGSNetworkModeItemId,
|
|
357 |
CGSListBoxItemTextArray::EVisible );
|
|
358 |
|
|
359 |
// this variable needs to be removed from cleanup stack
|
|
360 |
CleanupStack::PopAndDestroy( dynamicText );
|
|
361 |
__GSLOGSTRING("[GS] <--CGSNetworkPluginContainer::MakeNwModeUiItemL");
|
|
362 |
}
|
|
363 |
|
|
364 |
|
|
365 |
// ---------------------------------------------------------------------------
|
|
366 |
// CGSNetworkPluginContainer::CheckAndAlterContentsL
|
|
367 |
//
|
|
368 |
// Trims non-supported variable options from the array.
|
|
369 |
// This array items are displayed as radio button setting page items
|
|
370 |
// ---------------------------------------------------------------------------
|
|
371 |
//
|
|
372 |
void CGSNetworkPluginContainer::CheckAndAlterContentsL(
|
|
373 |
CGSRadioButtonSettingPageItemTextArray& aItemArray )
|
|
374 |
{
|
|
375 |
__GSLOGSTRING("[GS]--> CGSNetworkPluginContainer::CheckAndAlterContentsL");
|
|
376 |
TInt value = 0;
|
|
377 |
TInt supportedNetworks = iModel->GetSupportedNetworksL();
|
|
378 |
__GSLOGSTRING1("[GS] CheckAndAlterContentsL: supportedNetworks: %d", supportedNetworks);
|
|
379 |
|
|
380 |
// The 0th item corresponds to DualMode. This is always available in the
|
|
381 |
// setting page, so no actions required, just make it visible.
|
|
382 |
aItemArray.SetItemVisibilityL( EGSNetworkModeDualmode,
|
|
383 |
CGSListBoxItemTextArray::EVisible );
|
|
384 |
|
|
385 |
// the first bit corresponds to UMTS
|
|
386 |
value = supportedNetworks & ENetFirstBit;
|
|
387 |
__GSLOGSTRING1("[GS] CheckAndAlterContentsL: (UMTS)value: %d", value);
|
|
388 |
|
|
389 |
if ( value == EGSNetworkModeUMTS )
|
|
390 |
{
|
|
391 |
aItemArray.SetItemVisibilityL( EGSNetworkModeUMTS,
|
|
392 |
CGSListBoxItemTextArray::EVisible );
|
|
393 |
}
|
|
394 |
else
|
|
395 |
{
|
|
396 |
aItemArray.SetItemVisibilityL( EGSNetworkModeUMTS,
|
|
397 |
CGSListBoxItemTextArray::EInvisible );
|
|
398 |
}
|
|
399 |
|
|
400 |
// Get the zeroeth value (GSM) from the list
|
|
401 |
value = supportedNetworks & ENetSecondBit;
|
|
402 |
__GSLOGSTRING1("[GS] CheckAndAlterContentsL: (GSM)value: %d", value);
|
|
403 |
|
|
404 |
if ( value == EGSNetworkModeGSM )
|
|
405 |
{
|
|
406 |
aItemArray.SetItemVisibilityL( EGSNetworkModeGSM,
|
|
407 |
CGSListBoxItemTextArray::EVisible );
|
|
408 |
}
|
|
409 |
else
|
|
410 |
{
|
|
411 |
aItemArray.SetItemVisibilityL( EGSNetworkModeGSM,
|
|
412 |
CGSListBoxItemTextArray::EInvisible );
|
|
413 |
}
|
|
414 |
|
|
415 |
__GSLOGSTRING("[GS] <--CGSNetworkPluginContainer::CheckAndAlterContentsL");
|
|
416 |
}
|
|
417 |
|
|
418 |
// ---------------------------------------------------------------------------
|
|
419 |
// CGSNetworkPluginContainer::GetHelpContext(TCoeHelpContext& aContext) const
|
|
420 |
// Gets Help
|
|
421 |
//
|
|
422 |
// ---------------------------------------------------------------------------
|
|
423 |
//
|
|
424 |
void CGSNetworkPluginContainer::GetHelpContext(TCoeHelpContext& aContext) const
|
|
425 |
{
|
|
426 |
aContext.iMajor = KUidGS;
|
|
427 |
aContext.iContext = KCP_HLP_NETWORK;
|
|
428 |
}
|
|
429 |
|
|
430 |
// ---------------------------------------------------------------------------
|
|
431 |
// CGSSettListCallContainer::CurrentFeatureId()
|
|
432 |
//
|
|
433 |
// ---------------------------------------------------------------------------
|
|
434 |
//
|
|
435 |
TInt CGSNetworkPluginContainer::CurrentFeatureId( ) const
|
|
436 |
{
|
|
437 |
return iListboxItemArray->CurrentFeature( );
|
|
438 |
}
|
|
439 |
|
|
440 |
|
|
441 |
void CGSNetworkPluginContainer::HandleNetworkModeChangeL()
|
|
442 |
{
|
|
443 |
UpdateListBoxL( EGSNetworkModeItemId, GetCurrentNetworkModeSelectionL() );
|
|
444 |
|
|
445 |
//updating value
|
|
446 |
CGSRadioButtonSettingPageItemTextArray* nwModeArray =
|
|
447 |
CGSRadioButtonSettingPageItemTextArray::NewL(
|
|
448 |
R_NET_NETWORK_MODE_LBX,
|
|
449 |
*iCoeEnv,
|
|
450 |
NULL );
|
|
451 |
// For showing updated network mode value???
|
|
452 |
CleanupStack::PushL( nwModeArray );
|
|
453 |
CheckAndAlterContentsL( *nwModeArray );
|
|
454 |
TInt currentIndex = nwModeArray->IndexForFeatureIdL(
|
|
455 |
GetCurrentNetworkModeSelectionL() );
|
|
456 |
HBufC* buf = StringLoader::LoadL(
|
|
457 |
R_CONFIRM_NOTE_NWMODE_STRING,
|
|
458 |
nwModeArray->MdcaPoint( currentIndex ),
|
|
459 |
iEikonEnv );
|
|
460 |
CleanupStack::PushL( buf );
|
|
461 |
CAknConfirmationNote* note = new( ELeave ) CAknConfirmationNote( ETrue );
|
|
462 |
note->ExecuteLD( *buf );
|
|
463 |
CleanupStack::PopAndDestroy( buf );
|
|
464 |
CleanupStack::PopAndDestroy( nwModeArray );
|
|
465 |
}
|
|
466 |
|
|
467 |
|
|
468 |
// ---------------------------------------------------------------------------
|
|
469 |
// CGSNetworkPluginContainer::TelPluginModel
|
|
470 |
//
|
|
471 |
// Return the model pointer for use in view class
|
|
472 |
// ---------------------------------------------------------------------------
|
|
473 |
//
|
|
474 |
CGSNetworkPluginModel* CGSNetworkPluginContainer::NetPluginModel()
|
|
475 |
{
|
|
476 |
return iModel;
|
|
477 |
}
|
|
478 |
|
|
479 |
// ---------------------------------------------------------------------------
|
|
480 |
// Sets observer for MSK label updations.
|
|
481 |
// ---------------------------------------------------------------------------
|
|
482 |
//
|
|
483 |
void CGSNetworkPluginContainer::SetMiddleSoftkeyObserver(
|
|
484 |
MGsFWMSKObserver* aObserver )
|
|
485 |
{
|
|
486 |
if ( !iMSKObserver && aObserver )
|
|
487 |
{
|
|
488 |
iMSKObserver = aObserver;
|
|
489 |
}
|
|
490 |
}
|
|
491 |
|
|
492 |
// ---------------------------------------------------------------------------
|
|
493 |
// CGSNetworkPluginContainer::OfferKeyEventL
|
|
494 |
// Called when a key is pressed.
|
|
495 |
// ---------------------------------------------------------------------------
|
|
496 |
TKeyResponse CGSNetworkPluginContainer::OfferKeyEventL(
|
|
497 |
const TKeyEvent& aKeyEvent,
|
|
498 |
TEventCode aType )
|
|
499 |
{
|
|
500 |
switch ( aKeyEvent.iCode )
|
|
501 |
{
|
|
502 |
case EKeyUpArrow:
|
|
503 |
case EKeyDownArrow:
|
|
504 |
{
|
|
505 |
TKeyResponse listboxResp =
|
|
506 |
iListBox->OfferKeyEventL( aKeyEvent, aType );
|
|
507 |
if ( iMSKObserver )
|
|
508 |
{
|
|
509 |
iMSKObserver->CheckMiddleSoftkeyLabelL();
|
|
510 |
}
|
|
511 |
return listboxResp;
|
|
512 |
}
|
|
513 |
case EKeyLeftArrow:
|
|
514 |
case EKeyRightArrow:
|
|
515 |
// Listbox takes all events even if it doesn't use them
|
|
516 |
return EKeyWasNotConsumed;
|
|
517 |
default:
|
|
518 |
break;
|
|
519 |
}
|
|
520 |
|
|
521 |
return iListBox->OfferKeyEventL( aKeyEvent, aType );
|
|
522 |
}
|
|
523 |
|
|
524 |
|
|
525 |
// ---------------------------------------------------------------------------
|
|
526 |
// CGSNetworkPluginContainer::GetCurrentNetworkModeSelectionL
|
|
527 |
//
|
|
528 |
// Returns the current listbox selection of network mode.
|
|
529 |
// ---------------------------------------------------------------------------
|
|
530 |
//
|
|
531 |
TGSNetworkModeItems CGSNetworkPluginContainer::GetCurrentNetworkModeSelectionL()
|
|
532 |
{
|
|
533 |
TGSNetworkModeItems featureId = EGSNetworkModeDualmode;
|
|
534 |
|
|
535 |
switch( iModel->GetNetworkMode() )
|
|
536 |
{
|
|
537 |
case RMmCustomAPI::KCapsNetworkModeGsm:
|
|
538 |
featureId = EGSNetworkModeGSM;
|
|
539 |
break;
|
|
540 |
|
|
541 |
case RMmCustomAPI::KCapsNetworkModeUmts:
|
|
542 |
featureId = EGSNetworkModeUMTS;
|
|
543 |
break;
|
|
544 |
|
|
545 |
case RMmCustomAPI::KCapsNetworkModeDual:
|
|
546 |
featureId = EGSNetworkModeDualmode;
|
|
547 |
break;
|
|
548 |
default:
|
|
549 |
// Mode might not be updated yet, in which case default is dual.
|
|
550 |
// Not a perfect solution but have to have an item selected in
|
|
551 |
// options box
|
|
552 |
featureId = EGSNetworkModeDualmode;
|
|
553 |
break;
|
|
554 |
}
|
|
555 |
|
|
556 |
#ifdef _DEBUG
|
|
557 |
TBuf<KGSNetworkModeDebugStrLen> selectedModeBuf;
|
|
558 |
GSNetworkDebugHelper::NwToDes( featureId, selectedModeBuf );
|
|
559 |
__GSLOGSTRING1( "[CGSNetworkPluginContainer::GetCurrentNetworkModeSelectionL] %S ",
|
|
560 |
&selectedModeBuf );
|
|
561 |
#endif // _DEBUG
|
|
562 |
|
|
563 |
iModel->CheckState( featureId );
|
|
564 |
return featureId;
|
|
565 |
}
|
|
566 |
|
|
567 |
|
|
568 |
// ---------------------------------------------------------------------------
|
|
569 |
// CGSNetworkPluginContainer::SetCurrentNetworkModeSelectionL
|
|
570 |
//
|
|
571 |
//
|
|
572 |
// ---------------------------------------------------------------------------
|
|
573 |
//
|
|
574 |
void CGSNetworkPluginContainer::SetCurrentNetworkModeSelectionL(
|
|
575 |
TGSNetworkModeItems aNetworkModeLbxItem )
|
|
576 |
{
|
|
577 |
__GSLOGSTRING1( "[CGSNetworkPluginContainer::SetCurrentNetworkModeSelectionL] Mode:%d", aNetworkModeLbxItem );
|
|
578 |
TUint32 networkMode;
|
|
579 |
switch ( aNetworkModeLbxItem )
|
|
580 |
{
|
|
581 |
case EGSNetworkModeGSM: //just using the index
|
|
582 |
networkMode = RMmCustomAPI::KCapsNetworkModeGsm;
|
|
583 |
break;
|
|
584 |
case EGSNetworkModeUMTS:
|
|
585 |
networkMode = RMmCustomAPI::KCapsNetworkModeUmts;
|
|
586 |
break;
|
|
587 |
case EGSNetworkModeDualmode:
|
|
588 |
default:
|
|
589 |
networkMode = RMmCustomAPI::KCapsNetworkModeDual;
|
|
590 |
break;
|
|
591 |
}
|
|
592 |
// Don't change the network mode if there is ongoing phone call
|
|
593 |
// since this will disconnect it
|
|
594 |
if ( !iModel->IsCallActive() )
|
|
595 |
{
|
|
596 |
iModel->SetNetworkModeL( networkMode );
|
|
597 |
iSelectedNetworkModeLbxItem = aNetworkModeLbxItem;
|
|
598 |
}
|
|
599 |
__GSLOGSTRING( "[CGSNetworkPluginContainer::SetCurrentNetworkModeSelectionL] End]" );
|
|
600 |
}
|
|
601 |
|
|
602 |
|
|
603 |
|
|
604 |
//End of File
|