58
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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: Cpp file for Connectivity Settings plugin.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// Includes
|
|
20 |
#include <featmgr.h>
|
|
21 |
#include "gsconnsettingsplugin.h"
|
|
22 |
#include "gsconnsettingsplugin.hrh"
|
|
23 |
#include "gsconnsettingspluginmodel.h"
|
|
24 |
#include "gsconnsettingsplugincontainer.h"
|
|
25 |
#include "gsconnsettingsselectiondlg.h"
|
|
26 |
|
|
27 |
#include <gsconnsettingspluginrsc.rsg>
|
|
28 |
#include <gsconnsettingsplugin.mbg>
|
|
29 |
|
|
30 |
// Includes from GS framework:
|
|
31 |
#include <gscommon.hrh>
|
|
32 |
#include <gsfwviewuids.h>
|
|
33 |
#include <gsprivatepluginproviderids.h>
|
|
34 |
#include <gstabhelper.h>
|
|
35 |
#include <gsmainview.h>
|
|
36 |
|
|
37 |
#include <hlplch.h> // For HlpLauncher
|
|
38 |
#include <featmgr.h>
|
|
39 |
#include <csxhelp/cp.hlp.hrh>
|
|
40 |
|
|
41 |
#include <gulicon.h>
|
|
42 |
#include <AknsUtils.h>
|
|
43 |
#include <aknViewAppUi.h>
|
|
44 |
#include <aknradiobuttonsettingpage.h>
|
|
45 |
#include <AknQueryDialog.h>
|
|
46 |
#include <ConeResLoader.h>
|
|
47 |
#include <barsread.h> // For TResourceReader
|
|
48 |
#include <StringLoader.h>
|
|
49 |
|
|
50 |
// Constants
|
|
51 |
|
|
52 |
|
|
53 |
// ========================= MEMBER FUNCTIONS ================================
|
|
54 |
|
|
55 |
|
|
56 |
// ---------------------------------------------------------------------------
|
|
57 |
// CGSConnSettingsPlugin::CConnectivitySettingsPlugin()
|
|
58 |
// Constructor
|
|
59 |
// ---------------------------------------------------------------------------
|
|
60 |
//
|
|
61 |
CGSConnSettingsPlugin::CGSConnSettingsPlugin()
|
|
62 |
: iResourceLoader( *iCoeEnv )
|
|
63 |
, iProcessing( EFalse )
|
|
64 |
{
|
|
65 |
}
|
|
66 |
|
|
67 |
// ---------------------------------------------------------------------------
|
|
68 |
// CGSConnSettingsPlugin::~CConnectivitySettingsPlugin()
|
|
69 |
// Destructor
|
|
70 |
// ---------------------------------------------------------------------------
|
|
71 |
//
|
|
72 |
CGSConnSettingsPlugin::~CGSConnSettingsPlugin()
|
|
73 |
{
|
|
74 |
iResourceLoader.Close();
|
|
75 |
|
|
76 |
|
|
77 |
// Delete plugin loader
|
|
78 |
if ( iPluginLoader )
|
|
79 |
{
|
|
80 |
delete iPluginLoader;
|
|
81 |
}
|
|
82 |
|
|
83 |
// Delete possible plugins
|
|
84 |
if ( iPluginArray )
|
|
85 |
{
|
|
86 |
// Since the plugins are actually avkon views, avkon is responsible
|
|
87 |
// for owning the plugins. This means we do not reset and destroy
|
|
88 |
// the contents of the array in which the plugins reside. We have to
|
|
89 |
// leave it up to avkon to tidy up.
|
|
90 |
delete iPluginArray;
|
|
91 |
}
|
|
92 |
}
|
|
93 |
|
|
94 |
// ---------------------------------------------------------------------------
|
|
95 |
// CGSConnSettingsPlugin::NewL()
|
|
96 |
// First phase constructor
|
|
97 |
// ---------------------------------------------------------------------------
|
|
98 |
//
|
|
99 |
CGSConnSettingsPlugin* CGSConnSettingsPlugin::NewL( TAny* /*aInitParams*/ )
|
|
100 |
{
|
|
101 |
CGSConnSettingsPlugin* self = new(ELeave) CGSConnSettingsPlugin();
|
|
102 |
CleanupStack::PushL(self);
|
|
103 |
self->ConstructL();
|
|
104 |
CleanupStack::Pop(self);
|
|
105 |
return self;
|
|
106 |
}
|
|
107 |
|
|
108 |
// ---------------------------------------------------------------------------
|
|
109 |
// CGSConnSettingsPlugin::ConstructL()
|
|
110 |
// Second phase constructor
|
|
111 |
// ---------------------------------------------------------------------------
|
|
112 |
//
|
|
113 |
void CGSConnSettingsPlugin::ConstructL()
|
|
114 |
{
|
|
115 |
// Initialize FeatureManager
|
|
116 |
FeatureManager::InitializeLibL();
|
|
117 |
iIsWlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
|
|
118 |
// Unload FeatureManager
|
|
119 |
FeatureManager::UnInitializeLib();
|
|
120 |
|
|
121 |
OpenLocalizedResourceFileL( KGSConnSettingsPluginResourceFileName,
|
|
122 |
iResourceLoader );
|
|
123 |
BaseConstructL( R_GS_CONN_SETTINGS_PLUGIN_VIEW );
|
|
124 |
}
|
|
125 |
|
|
126 |
// ---------------------------------------------------------------------------
|
|
127 |
// CGSConnSettingsPlugin::Id()
|
|
128 |
// ---------------------------------------------------------------------------
|
|
129 |
//
|
|
130 |
TUid CGSConnSettingsPlugin::Id() const
|
|
131 |
{
|
|
132 |
return KGSConnSettingsPluginUid;
|
|
133 |
}
|
|
134 |
|
|
135 |
|
|
136 |
|
|
137 |
// ----------------------------------------------------------------------------
|
|
138 |
// CGSConnSettingsPlugin::NewContainerL()
|
|
139 |
// Creates new iContainer.
|
|
140 |
//
|
|
141 |
// ----------------------------------------------------------------------------
|
|
142 |
//
|
|
143 |
void CGSConnSettingsPlugin::NewContainerL()
|
|
144 |
{
|
|
145 |
iContainer = new( ELeave ) CGSConnSettingsPluginContainer( *this );
|
|
146 |
|
|
147 |
//Check if ECOM plugins are already loaded
|
|
148 |
if ( iPluginArray == NULL )
|
|
149 |
{
|
|
150 |
//Load plugins here after container is constructed. This saves memory when Connectivity Settings view
|
|
151 |
//is not visible(object from CGSConnSettingsPlugin is constructed already in Connectivity view by GS and
|
|
152 |
//container class only when the plugin is actually accessed)
|
|
153 |
|
|
154 |
iPluginArray = new ( ELeave ) CArrayPtrFlat<CGSPluginInterface>( KGConnSettingsPluginCount );
|
|
155 |
iPluginLoader = CGSPluginLoader::NewL( iAppUi );
|
|
156 |
iPluginLoader->SetObserver( this );
|
|
157 |
iPluginLoader->LoadAsyncL( KGSPluginInterfaceUid, Id(), iPluginArray );
|
|
158 |
}
|
|
159 |
|
|
160 |
Container()->SetPluginArray( iPluginArray );
|
|
161 |
}
|
|
162 |
|
|
163 |
// ---------------------------------------------------------------------------
|
|
164 |
// CGSConnSettingsPlugin::DoActivateL()
|
|
165 |
//
|
|
166 |
//
|
|
167 |
// ---------------------------------------------------------------------------
|
|
168 |
//
|
|
169 |
void CGSConnSettingsPlugin::DoActivateL( const TVwsViewId& aPrevViewId,
|
|
170 |
TUid aCustomMessageId,
|
|
171 |
const TDesC8& aCustomMessage )
|
|
172 |
{
|
|
173 |
CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
|
|
174 |
|
|
175 |
// Add support for external view activation
|
|
176 |
if ( iPrevViewId.iAppUid != KUidGS || iPrevViewId.iViewUid == TUid::Uid(0x0DEADBED) )
|
|
177 |
{
|
|
178 |
CEikButtonGroupContainer* cbaGroup = Cba();
|
|
179 |
if(cbaGroup)
|
|
180 |
{
|
|
181 |
HBufC* rightSKText = StringLoader::LoadLC (R_GS_CONN_SETTINGS_RSK_LABEL_EXIT);
|
|
182 |
TPtr rskPtr = rightSKText->Des();
|
|
183 |
cbaGroup->SetCommandL(2,EAknSoftkeyExit,*rightSKText);
|
|
184 |
CleanupStack::PopAndDestroy(rightSKText);
|
|
185 |
}
|
|
186 |
}
|
|
187 |
iModel = Container()->Model();
|
|
188 |
}
|
|
189 |
|
|
190 |
// ---------------------------------------------------------------------------
|
|
191 |
// CGSConnSettingsPlugin::DoDeactivate()
|
|
192 |
//
|
|
193 |
//
|
|
194 |
// ---------------------------------------------------------------------------
|
|
195 |
//
|
|
196 |
void CGSConnSettingsPlugin::DoDeactivate()
|
|
197 |
{
|
|
198 |
CGSBaseView::DoDeactivate();
|
|
199 |
}
|
|
200 |
|
|
201 |
// ---------------------------------------------------------------------------
|
|
202 |
// CGSConnSettingsPlugin:: HandleForegroundEventL
|
|
203 |
//
|
|
204 |
//
|
|
205 |
// ---------------------------------------------------------------------------
|
|
206 |
//
|
|
207 |
void CGSConnSettingsPlugin::HandleForegroundEventL( TBool aForeground )
|
|
208 |
{
|
|
209 |
//Load saved settings from Connection Settings API
|
|
210 |
//If function leaves it is trapped and ignored as there is nothing that we can do about it
|
|
211 |
if ( iModel && aForeground )
|
|
212 |
{
|
|
213 |
TRAP_IGNORE( iModel->LoadSettingsL() );
|
|
214 |
UpdateListBoxL( EGSSettIdDataUsageHomeNw );
|
|
215 |
}
|
|
216 |
}
|
|
217 |
|
|
218 |
// ----------------------------------------------------------------------------
|
|
219 |
// CGSConnSettingsPlugin::HandleCommandL
|
|
220 |
//
|
|
221 |
// Handles menu commands directed to this class.
|
|
222 |
// ----------------------------------------------------------------------------
|
|
223 |
void CGSConnSettingsPlugin::HandleCommandL( TInt aCommand )
|
|
224 |
{
|
|
225 |
switch ( aCommand )
|
|
226 |
{
|
|
227 |
case EGSConnSettMenuOpen:
|
|
228 |
case EGSConnSettMenuChange:
|
|
229 |
case EGSConnSettMskGeneral:
|
|
230 |
HandleListBoxSelectionL();
|
|
231 |
break;
|
|
232 |
|
|
233 |
case EAknSoftkeyBack:
|
|
234 |
iAppUi->ActivateLocalViewL( KGSConPluginUid );
|
|
235 |
break;
|
|
236 |
|
|
237 |
case EAknCmdHelp:
|
|
238 |
{
|
|
239 |
if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
|
|
240 |
{
|
|
241 |
HlpLauncher::LaunchHelpApplicationL(
|
|
242 |
iEikonEnv->WsSession(), iAppUi->AppHelpContextL() );
|
|
243 |
}
|
|
244 |
break;
|
|
245 |
}
|
|
246 |
default:
|
|
247 |
iAppUi->HandleCommandL( aCommand );
|
|
248 |
break;
|
|
249 |
}
|
|
250 |
}
|
|
251 |
|
|
252 |
|
|
253 |
// -----------------------------------------------------------------------------
|
|
254 |
// CGSSensorPlugin::DynInitMenuPaneL
|
|
255 |
// -----------------------------------------------------------------------------
|
|
256 |
//
|
|
257 |
void CGSConnSettingsPlugin::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
|
|
258 |
{
|
|
259 |
// Check resource
|
|
260 |
if ( R_GS_CONN_SETTINGS_MENU_ITEM_OPEN == aResourceId )
|
|
261 |
{
|
|
262 |
// First, resolve current item in listbox
|
|
263 |
const TInt currentItem = Container()->CurrentFeatureId();
|
|
264 |
|
|
265 |
switch (currentItem)
|
|
266 |
{
|
|
267 |
case EGSSettIdUsageOfWlan:
|
|
268 |
case EGSSettIdDataUsageAbroad:
|
|
269 |
case EGSSettIdDataUsageHomeNw:
|
|
270 |
// Hide menu item 'Open'
|
|
271 |
aMenuPane->SetItemDimmed( EGSConnSettMenuOpen, ETrue );
|
|
272 |
aMenuPane->SetItemDimmed( EGSConnSettMenuChange, EFalse );
|
|
273 |
break;
|
|
274 |
|
|
275 |
default:
|
|
276 |
{
|
|
277 |
// Hide menu item 'Change' if current item is ECOM plugin
|
|
278 |
aMenuPane->SetItemDimmed( EGSConnSettMenuOpen, EFalse );
|
|
279 |
aMenuPane->SetItemDimmed( EGSConnSettMenuChange, ETrue );
|
|
280 |
break;
|
|
281 |
}
|
|
282 |
}
|
|
283 |
}
|
|
284 |
// Forward to base class
|
|
285 |
CGSBaseView::DynInitMenuPaneL( aResourceId, aMenuPane );
|
|
286 |
}
|
|
287 |
|
|
288 |
|
|
289 |
// ----------------------------------------------------------------------------
|
|
290 |
// CGSConnSettingsPlugin::HandleListBoxSelectionL()
|
|
291 |
//
|
|
292 |
// Handles events raised through a rocker key
|
|
293 |
// ----------------------------------------------------------------------------
|
|
294 |
void CGSConnSettingsPlugin::HandleListBoxSelectionL()
|
|
295 |
{
|
|
296 |
const TInt currentFeatureId = Container()->CurrentFeatureId();
|
|
297 |
|
|
298 |
switch ( currentFeatureId )
|
|
299 |
{
|
|
300 |
case EGSSettIdUsageOfWlan:
|
|
301 |
ShowUsageOfWlanSettingPageL();
|
|
302 |
break;
|
|
303 |
|
|
304 |
case EGSSettIdDataUsageAbroad:
|
|
305 |
ShowDataUsageAbroadSettingPageL();
|
|
306 |
break;
|
|
307 |
|
|
308 |
case EGSSettIdDataUsageHomeNw:
|
|
309 |
ShowDataUsageInHomeNwSettingPageL();
|
|
310 |
break;
|
|
311 |
|
|
312 |
default:
|
|
313 |
{
|
|
314 |
//Feature ID didn't match, try plugins
|
|
315 |
CGSPluginInterface* selectedPlugin( Container()->SelectedPluginL() );
|
|
316 |
|
|
317 |
switch( selectedPlugin->ItemType() )
|
|
318 |
{
|
|
319 |
// In these cases the plugin is a view:
|
|
320 |
case EGSItemTypeSingleLarge:
|
|
321 |
case EGSItemTypeSetting:
|
|
322 |
case EGSItemTypeSettingIcon:
|
|
323 |
{
|
|
324 |
CleanupStack::PushL( selectedPlugin );
|
|
325 |
iAppUi->ActivateLocalViewL( selectedPlugin->Id() );
|
|
326 |
CleanupStack::Pop( selectedPlugin );
|
|
327 |
break;
|
|
328 |
}
|
|
329 |
|
|
330 |
// In these cases the plugin is a dialog:
|
|
331 |
case EGSItemTypeSettingDialog:
|
|
332 |
case EGSItemTypeSingleLargeDialog:
|
|
333 |
// Ignore duplicate Window's events
|
|
334 |
if( iProcessing )
|
|
335 |
{
|
|
336 |
return;
|
|
337 |
}
|
|
338 |
|
|
339 |
iProcessing = ETrue;
|
|
340 |
selectedPlugin->HandleSelection( EGSSelectionByMenu );
|
|
341 |
iProcessing = EFalse;
|
|
342 |
break;
|
|
343 |
default:
|
|
344 |
break;
|
|
345 |
}
|
|
346 |
break;
|
|
347 |
}
|
|
348 |
}
|
|
349 |
}
|
|
350 |
|
|
351 |
// ----------------------------------------------------------------------------
|
|
352 |
// CGSConnSettingsPlugin::UpdateListBoxL
|
|
353 |
//
|
|
354 |
//
|
|
355 |
// ----------------------------------------------------------------------------
|
|
356 |
//
|
|
357 |
void CGSConnSettingsPlugin::UpdateListBoxL( TInt aItemId )
|
|
358 |
{
|
|
359 |
if( Container() )
|
|
360 |
{
|
|
361 |
Container()->UpdateListBoxL( aItemId );
|
|
362 |
}
|
|
363 |
}
|
|
364 |
|
|
365 |
// ----------------------------------------------------------------------------
|
|
366 |
// CGSConnSettingsPlugin::Container
|
|
367 |
//
|
|
368 |
// Return handle to container class.
|
|
369 |
// ----------------------------------------------------------------------------
|
|
370 |
//
|
|
371 |
CGSConnSettingsPluginContainer* CGSConnSettingsPlugin::Container()
|
|
372 |
{
|
|
373 |
return static_cast<CGSConnSettingsPluginContainer*>( iContainer );
|
|
374 |
}
|
|
375 |
|
|
376 |
// ---------------------------------------------------------------------------
|
|
377 |
// CGSConnSettingsPlugin::UpperLevelViewUid()
|
|
378 |
//
|
|
379 |
//
|
|
380 |
// ---------------------------------------------------------------------------
|
|
381 |
//
|
|
382 |
TUid CGSConnSettingsPlugin::UpperLevelViewUid()
|
|
383 |
{
|
|
384 |
return KGSConPluginUid;
|
|
385 |
}
|
|
386 |
|
|
387 |
// -----------------------------------------------------------------------------
|
|
388 |
// CGSConnSettingsPlugin::GetHelpContext()
|
|
389 |
//
|
|
390 |
//
|
|
391 |
// -----------------------------------------------------------------------------
|
|
392 |
//
|
|
393 |
void CGSConnSettingsPlugin::GetHelpContext( TCoeHelpContext& aContext )
|
|
394 |
{
|
|
395 |
aContext.iMajor = KUidGS;
|
|
396 |
aContext.iContext = KHLP_OCC_CONN_SETTINGS;
|
|
397 |
}
|
|
398 |
|
|
399 |
// ---------------------------------------------------------------------------
|
|
400 |
// CGSConnSettingsPlugin::GetCaptionL()
|
|
401 |
//
|
|
402 |
//
|
|
403 |
// ---------------------------------------------------------------------------
|
|
404 |
//
|
|
405 |
void CGSConnSettingsPlugin::GetCaptionL( TDes& aCaption ) const
|
|
406 |
{
|
|
407 |
// The resource file is already opened by iResourceLoader.
|
|
408 |
HBufC* result = StringLoader::LoadL( R_GS_CONN_SETTINGS_VIEW_CAPTION );
|
|
409 |
aCaption.Copy( *result );
|
|
410 |
delete result;
|
|
411 |
}
|
|
412 |
|
|
413 |
// ---------------------------------------------------------------------------
|
|
414 |
// CGSConnSettingsPlugin::CreateIconL
|
|
415 |
//
|
|
416 |
// Return the icon, if has one.
|
|
417 |
// ---------------------------------------------------------------------------
|
|
418 |
//
|
|
419 |
CGulIcon* CGSConnSettingsPlugin::CreateIconL( const TUid aIconType )
|
|
420 |
{
|
|
421 |
|
|
422 |
//EMbm<Mbm_file_name><Bitmap_name>
|
|
423 |
CGulIcon* icon;
|
|
424 |
TParse* fp = new( ELeave ) TParse();
|
|
425 |
CleanupStack::PushL( fp );
|
|
426 |
fp->Set( KGSConnSettingsPluginIconDirAndName, &KDC_BITMAP_DIR, NULL );
|
|
427 |
|
|
428 |
if( aIconType == KGSIconTypeLbxItem )
|
|
429 |
{
|
|
430 |
icon = AknsUtils::CreateGulIconL(
|
|
431 |
AknsUtils::SkinInstance(),
|
|
432 |
KAknsIIDQgnPropCpConnAdmin,
|
|
433 |
fp->FullName(),
|
|
434 |
// Let's use Connectivity plugin icon until we get graphics
|
|
435 |
// for Connectivity Settings plugin icon
|
|
436 |
// EMbmGsconnsettingspluginQgn_prop_cp_conn_settings,
|
|
437 |
// EMbmGsconnsettingspluginQgn_prop_cp_conn_settings_mask );
|
|
438 |
EMbmGsconnsettingspluginQgn_prop_cp_conn, //from generated \epoc32\include\gsconnsettingsplugin.mbg
|
|
439 |
EMbmGsconnsettingspluginQgn_prop_cp_conn_mask ); //from generated \epoc32\include\gsconnsettingsplugin.mbg
|
|
440 |
}
|
|
441 |
else
|
|
442 |
{
|
|
443 |
icon = CGSPluginInterface::CreateIconL( aIconType );
|
|
444 |
}
|
|
445 |
CleanupStack::PopAndDestroy( fp );
|
|
446 |
return icon;
|
|
447 |
}
|
|
448 |
|
|
449 |
// ---------------------------------------------------------------------------
|
|
450 |
// CGSConnSettingsPlugin::PluginProviderCategory()
|
|
451 |
//
|
|
452 |
//
|
|
453 |
// ---------------------------------------------------------------------------
|
|
454 |
//
|
|
455 |
TInt CGSConnSettingsPlugin::PluginProviderCategory() const
|
|
456 |
{
|
|
457 |
return KGSPluginProviderInternal;
|
|
458 |
}
|
|
459 |
|
|
460 |
// ---------------------------------------------------------------------------
|
|
461 |
// CGSConnSettingsPlugin::ShowUsageOfNewWlanSettingPageL()
|
|
462 |
//
|
|
463 |
//
|
|
464 |
// ---------------------------------------------------------------------------
|
|
465 |
//
|
|
466 |
void CGSConnSettingsPlugin::ShowUsageOfWlanSettingPageL()
|
|
467 |
{
|
|
468 |
TBool currentItem = (TBool)iModel->UsageOfWlan();
|
|
469 |
iModel->SetUsageOfWlan( !currentItem );
|
|
470 |
UpdateListBoxL( EGSSettIdUsageOfWlan );
|
|
471 |
//Save current settings when the setting is changed
|
|
472 |
//If function leaves it is trapped and ignored as there is nothing that we can do about it
|
|
473 |
TRAP_IGNORE(iModel->SaveSettingsL());
|
|
474 |
}
|
|
475 |
|
|
476 |
// ---------------------------------------------------------------------------
|
|
477 |
// CGSConnSettingsPlugin::ShowDataUsageAbroadSettingPageL()
|
|
478 |
//
|
|
479 |
//
|
|
480 |
// ---------------------------------------------------------------------------
|
|
481 |
//
|
|
482 |
void CGSConnSettingsPlugin::ShowDataUsageAbroadSettingPageL()
|
|
483 |
{
|
|
484 |
CDesCArrayFlat* items;
|
|
485 |
|
|
486 |
if ( iIsWlanSupported )
|
|
487 |
{
|
|
488 |
items = iCoeEnv->ReadDesC16ArrayResourceL(
|
|
489 |
R_DATA_USAGE_ABROAD_SETTING_PAGE_LBX );
|
|
490 |
}
|
|
491 |
else
|
|
492 |
{
|
|
493 |
items = iCoeEnv->ReadDesC16ArrayResourceL(
|
|
494 |
R_DATA_USAGE_ABROAD_SETTING_PAGE_LBX_NOWLAN );
|
|
495 |
}
|
|
496 |
|
|
497 |
CleanupStack::PushL( items );
|
|
498 |
|
|
499 |
TInt currentItem = iModel->DataUsageAbroad();
|
|
500 |
|
|
501 |
// We may have to do in this way because EDataUsageAbroadDisabled is equal to 3
|
|
502 |
// and the actual index number should be 2 in this case
|
|
503 |
if( !iIsWlanSupported && currentItem == EDataUsageAbroadDisabled )
|
|
504 |
{
|
|
505 |
currentItem --;
|
|
506 |
}
|
|
507 |
|
|
508 |
TInt oldItem = currentItem;
|
|
509 |
|
|
510 |
CAknSettingPage* dlg = new( ELeave ) CAknRadioButtonSettingPage(
|
|
511 |
R_DATA_USAGE_ABROAD_SETTING_PAGE, currentItem, items );
|
|
512 |
|
|
513 |
if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
|
|
514 |
{
|
|
515 |
|
|
516 |
if( currentItem != oldItem )
|
|
517 |
{
|
|
518 |
iModel->SetDataUsageAbroad( currentItem );
|
|
519 |
UpdateListBoxL( EGSSettIdDataUsageAbroad );
|
|
520 |
//Save current settings when the setting is changed
|
|
521 |
//If function leaves it is trapped and ignored as there is nothing that we can do about it
|
|
522 |
TRAP_IGNORE(iModel->SaveSettingsL());
|
|
523 |
}
|
|
524 |
}
|
|
525 |
CleanupStack::PopAndDestroy( items );
|
|
526 |
}
|
|
527 |
|
|
528 |
// ---------------------------------------------------------------------------
|
|
529 |
// CGSConnSettingsPlugin::ShowDataUsageInHomeNwSettingPageL()
|
|
530 |
//
|
|
531 |
//
|
|
532 |
// ---------------------------------------------------------------------------
|
|
533 |
//
|
|
534 |
void CGSConnSettingsPlugin::ShowDataUsageInHomeNwSettingPageL()
|
|
535 |
{
|
|
536 |
CDesCArrayFlat* items;
|
|
537 |
|
|
538 |
if ( iIsWlanSupported )
|
|
539 |
{
|
|
540 |
items = iCoeEnv->ReadDesC16ArrayResourceL(
|
|
541 |
R_DATA_USAGE_HOME_NW_SETTING_PAGE_LBX );
|
|
542 |
}
|
|
543 |
else
|
|
544 |
{
|
|
545 |
items = iCoeEnv->ReadDesC16ArrayResourceL(
|
|
546 |
R_DATA_USAGE_HOME_NW_SETTING_PAGE_LBX_NOWLAN );
|
|
547 |
}
|
|
548 |
|
|
549 |
CleanupStack::PushL( items );
|
|
550 |
|
|
551 |
TInt currentItem = iModel->DataUsageInHomeNw();
|
|
552 |
|
|
553 |
// We may have to do in this way because EDataUsageAbroadDisabled is equal to 3
|
|
554 |
// and the actual index number should be 2 in this case
|
|
555 |
if( !iIsWlanSupported && currentItem == EDataUsageAbroadDisabled )
|
|
556 |
{
|
|
557 |
currentItem --;
|
|
558 |
}
|
|
559 |
|
|
560 |
TInt oldItem = currentItem;
|
|
561 |
|
|
562 |
CAknSettingPage* dlg = new( ELeave ) CAknRadioButtonSettingPage(
|
|
563 |
R_DATA_USAGE_HOME_NW_SETTING_PAGE, currentItem, items );
|
|
564 |
|
|
565 |
if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
|
|
566 |
{
|
|
567 |
|
|
568 |
if( currentItem != oldItem )
|
|
569 |
{
|
|
570 |
iModel->SetDataUsageInHomeNw( currentItem );
|
|
571 |
UpdateListBoxL( EGSSettIdDataUsageHomeNw );
|
|
572 |
//Save current settings when the setting is changed
|
|
573 |
//If function leaves it is trapped and ignored as there is nothing that we can do about it
|
|
574 |
TRAP_IGNORE(iModel->SaveSettingsL());
|
|
575 |
}
|
|
576 |
}
|
|
577 |
CleanupStack::PopAndDestroy( items );
|
|
578 |
}
|
|
579 |
|
|
580 |
// ---------------------------------------------------------------------------
|
|
581 |
// CGSConnSettingsPlugin::CheckMiddleSoftkeyLabelL
|
|
582 |
// ---------------------------------------------------------------------------
|
|
583 |
//
|
|
584 |
void CGSConnSettingsPlugin::CheckMiddleSoftkeyLabelL()
|
|
585 |
{
|
|
586 |
//Resolve current item
|
|
587 |
const TInt currentItem = Container()->CurrentFeatureId();
|
|
588 |
|
|
589 |
//remove current middle soft key label
|
|
590 |
RemoveCommandFromMSK();
|
|
591 |
|
|
592 |
switch (currentItem)
|
|
593 |
{
|
|
594 |
case EGSSettIdUsageOfWlan:
|
|
595 |
case EGSSettIdDataUsageAbroad:
|
|
596 |
case EGSSettIdDataUsageHomeNw:
|
|
597 |
//Set middle soft key label to "Change"
|
|
598 |
SetMiddleSoftKeyLabelL( R_GS_CONN_SETTINGS_MSK_LABEL_CHANGE, EGSConnSettMskGeneral );
|
|
599 |
break;
|
|
600 |
|
|
601 |
default:
|
|
602 |
{
|
|
603 |
//If current item is ECOM plugin set middle soft key label to "Open"
|
|
604 |
SetMiddleSoftKeyLabelL( R_GS_CONN_SETTINGS_MSK_LABEL_OPEN, EGSConnSettMskGeneral );
|
|
605 |
break;
|
|
606 |
}
|
|
607 |
}
|
|
608 |
}
|
|
609 |
|
|
610 |
// -----------------------------------------------------------------------------
|
|
611 |
// CGSConnSettingsPlugin::HandleListBoxEventL
|
|
612 |
//
|
|
613 |
// -----------------------------------------------------------------------------
|
|
614 |
//
|
|
615 |
void CGSConnSettingsPlugin::HandleListBoxEventL( CEikListBox* /*aListBox*/,
|
|
616 |
TListBoxEvent aEventType )
|
|
617 |
{
|
|
618 |
switch ( aEventType )
|
|
619 |
{
|
|
620 |
case EEventEnterKeyPressed:
|
|
621 |
case EEventItemSingleClicked:
|
|
622 |
HandleListBoxSelectionL();
|
|
623 |
break;
|
|
624 |
default:
|
|
625 |
break;
|
|
626 |
}
|
|
627 |
}
|
|
628 |
|
|
629 |
// -----------------------------------------------------------------------------
|
|
630 |
// CGSConnSettingsPlugin::RemoveCommandFromMSK
|
|
631 |
//
|
|
632 |
// -----------------------------------------------------------------------------
|
|
633 |
//
|
|
634 |
void CGSConnSettingsPlugin::RemoveCommandFromMSK()
|
|
635 |
{
|
|
636 |
CEikButtonGroupContainer* cbaGroup = Cba();
|
|
637 |
if ( cbaGroup )
|
|
638 |
{
|
|
639 |
// Remove command from stack
|
|
640 |
cbaGroup->RemoveCommandFromStack( KGSConnSettingsMSKControlID, EGSConnSettMskGeneral );
|
|
641 |
}
|
|
642 |
}
|
|
643 |
|
|
644 |
// ---------------------------------------------------------------------------
|
|
645 |
// CGSConnSettingsPlugin::SetMiddleSoftKeyLabelL
|
|
646 |
// Sets middle softkey label.
|
|
647 |
// ---------------------------------------------------------------------------
|
|
648 |
//
|
|
649 |
void CGSConnSettingsPlugin::SetMiddleSoftKeyLabelL(
|
|
650 |
const TInt aResourceId, const TInt aCommandId )
|
|
651 |
{
|
|
652 |
CEikButtonGroupContainer* cbaGroup = Cba();
|
|
653 |
if ( cbaGroup )
|
|
654 |
{
|
|
655 |
HBufC* middleSKText = StringLoader::LoadLC( aResourceId );
|
|
656 |
TPtr mskPtr = middleSKText->Des();
|
|
657 |
cbaGroup->AddCommandToStackL(
|
|
658 |
KGSConnSettingsMSKControlID,
|
|
659 |
aCommandId,
|
|
660 |
mskPtr );
|
|
661 |
CleanupStack::Pop( middleSKText );
|
|
662 |
delete middleSKText;
|
|
663 |
}
|
|
664 |
}
|
|
665 |
|
|
666 |
// ---------------------------------------------------------------------------
|
|
667 |
// CGSConnSettingsPlugin::HandlePluginLoaded
|
|
668 |
// Called by GSPluginLoader when plugins are loaded or error occured during that
|
|
669 |
// ---------------------------------------------------------------------------
|
|
670 |
//
|
|
671 |
void CGSConnSettingsPlugin::HandlePluginLoaded( KGSPluginLoaderStatus aStatus )
|
|
672 |
{
|
|
673 |
if ( iContainer && MGSPluginLoadObserver::EGSFinished == aStatus )
|
|
674 |
{
|
|
675 |
#ifdef __DEBUG
|
|
676 |
TRAPD( ignore, Container()->UpdateListBoxL( EGSExtPluginsListItemId ); );
|
|
677 |
TRACE_1( "[GSSensorPlugin] CGSSensorPlugin::HandlePluginLoaded() - Error: %i", ignore );
|
|
678 |
#else
|
|
679 |
TRAP_IGNORE( Container()->UpdateListBoxL( EGSExtPluginsListItemId ); );
|
|
680 |
#endif // __DEBUG
|
|
681 |
}
|
|
682 |
}
|
|
683 |
|
|
684 |
// End of File
|