54
|
1 |
/*
|
|
2 |
* Copyright (c) 2002, 2003 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: View for Data call sub-folder
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include "GSDataCallPlugin.h"
|
|
21 |
#include "GSDataCallPluginModel.h"
|
|
22 |
#include "GSDataCallPluginContainer.h"
|
|
23 |
#include "GsDataCallPlugin.hrh"
|
|
24 |
#include <gsdatacallplugin.mbg> // Icons
|
|
25 |
#include <gsdatacallpluginrsc.rsg>
|
|
26 |
#include <gsfwviewuids.h>
|
|
27 |
#include <gsprivatepluginproviderids.h>
|
|
28 |
|
|
29 |
#include <AknQueryDialog.h>
|
|
30 |
#include <aknradiobuttonsettingpage.h>
|
|
31 |
#include <aknViewAppUi.h>
|
|
32 |
#include <featmgr.h>
|
|
33 |
#include <StringLoader.h>
|
|
34 |
#include <bautils.h>
|
|
35 |
#include <coeaui.h>
|
|
36 |
#include <eikfrlbd.h>
|
|
37 |
#include <gulicon.h>
|
|
38 |
#include <hlplch.h> // For HlpLauncher
|
|
39 |
|
|
40 |
#include <gscommon.hrh>
|
|
41 |
|
|
42 |
// EXTERNAL DATA STRUCTURES
|
|
43 |
|
|
44 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
45 |
|
|
46 |
// CONSTANTS
|
|
47 |
|
|
48 |
// MACROS
|
|
49 |
|
|
50 |
// LOCAL CONSTANTS AND MACROS
|
|
51 |
const TInt KGSAutodTimeIndex = 0;
|
|
52 |
|
|
53 |
_LIT( KGSDataCallPluginResourceFileName, "z:GSDataCallPluginRsc.rsc" );
|
|
54 |
|
|
55 |
// MODULE DATA STRUCTURES
|
|
56 |
|
|
57 |
// LOCAL FUNCTION PROTOTYPES
|
|
58 |
|
|
59 |
// FORWARD DECLARATIONS
|
|
60 |
|
|
61 |
// ============================= LOCAL FUNCTIONS ==============================
|
|
62 |
|
|
63 |
// ========================= MEMBER FUNCTIONS ================================
|
|
64 |
|
|
65 |
// ----------------------------------------------------------------------------
|
|
66 |
// CGSDataCallPlugin::CGSDataCallPlugin()
|
|
67 |
//
|
|
68 |
// Constructor
|
|
69 |
// ----------------------------------------------------------------------------
|
|
70 |
//
|
|
71 |
CGSDataCallPlugin::CGSDataCallPlugin()
|
|
72 |
: iResourceLoader( *iCoeEnv )
|
|
73 |
{
|
|
74 |
}
|
|
75 |
|
|
76 |
|
|
77 |
// ---------------------------------------------------------------------------
|
|
78 |
// CGSDataCallPlugin::NewL()
|
|
79 |
//
|
|
80 |
// Symbian OS default constructor
|
|
81 |
// ---------------------------------------------------------------------------
|
|
82 |
CGSDataCallPlugin* CGSDataCallPlugin::NewL( TAny* /*aInitParams*/ )
|
|
83 |
{
|
|
84 |
CGSDataCallPlugin* self = new( ELeave ) CGSDataCallPlugin ();
|
|
85 |
|
|
86 |
CleanupStack::PushL( self );
|
|
87 |
self->ConstructL();
|
|
88 |
CleanupStack::Pop();
|
|
89 |
|
|
90 |
return self;
|
|
91 |
}
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
// ---------------------------------------------------------------------------
|
|
96 |
// CGSDataCallPlugin::ConstructL()
|
|
97 |
//
|
|
98 |
// Symbian OS two-phased constructor
|
|
99 |
// ---------------------------------------------------------------------------
|
|
100 |
void CGSDataCallPlugin::ConstructL()
|
|
101 |
{
|
|
102 |
FeatureManager::InitializeLibL();
|
|
103 |
// Find the resource file
|
|
104 |
TParse parse;
|
|
105 |
parse.Set( KGSDataCallPluginResourceFileName,
|
|
106 |
&KDC_RESOURCE_FILES_DIR, NULL );
|
|
107 |
TFileName fileName( parse.FullName() );
|
|
108 |
|
|
109 |
// Get language of resource file
|
|
110 |
BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName );
|
|
111 |
|
|
112 |
// Open resource file
|
|
113 |
iResourceLoader.OpenL( fileName );
|
|
114 |
|
|
115 |
iModel = CGSDataCallPluginModel::NewL();
|
|
116 |
|
|
117 |
BaseConstructL( R_GS_DCALL_VIEW );
|
|
118 |
}
|
|
119 |
|
|
120 |
|
|
121 |
// ----------------------------------------------------------------------------
|
|
122 |
// CGSDataCallPlugin::~CGSDataCallPlugin
|
|
123 |
//
|
|
124 |
// Destructor
|
|
125 |
// ----------------------------------------------------------------------------
|
|
126 |
CGSDataCallPlugin::~CGSDataCallPlugin()
|
|
127 |
{
|
|
128 |
FeatureManager::UnInitializeLib();
|
|
129 |
iResourceLoader.Close();
|
|
130 |
if ( iModel )
|
|
131 |
{
|
|
132 |
delete iModel;
|
|
133 |
}
|
|
134 |
}
|
|
135 |
|
|
136 |
|
|
137 |
// ---------------------------------------------------------------------------
|
|
138 |
// TUid CGSDataCallPlugin::Id()
|
|
139 |
//
|
|
140 |
// Returns view's ID.
|
|
141 |
// ---------------------------------------------------------------------------
|
|
142 |
TUid CGSDataCallPlugin::Id() const
|
|
143 |
{
|
|
144 |
return KGSDataCallPluginUid;
|
|
145 |
}
|
|
146 |
|
|
147 |
|
|
148 |
// ========================= From CGSPluginInterface ==================
|
|
149 |
|
|
150 |
// ----------------------------------------------------------------------------
|
|
151 |
// CGSDataCallPlugin::GetCaption
|
|
152 |
//
|
|
153 |
// Return application/view caption.
|
|
154 |
// ----------------------------------------------------------------------------
|
|
155 |
//
|
|
156 |
void CGSDataCallPlugin::GetCaptionL( TDes& aCaption ) const
|
|
157 |
{
|
|
158 |
// the resource file is already opened.
|
|
159 |
HBufC* result = StringLoader::LoadL( R_GS_DATACALL_VIEW_CAPTION );
|
|
160 |
|
|
161 |
aCaption.Copy( *result );
|
|
162 |
delete result;
|
|
163 |
}
|
|
164 |
|
|
165 |
|
|
166 |
// ----------------------------------------------------------------------------
|
|
167 |
// CGSDataCallPlugin::PluginProviderCategory
|
|
168 |
//
|
|
169 |
// A means to identify the location of this plug-in in the framework.
|
|
170 |
// ----------------------------------------------------------------------------
|
|
171 |
//
|
|
172 |
TInt CGSDataCallPlugin::PluginProviderCategory() const
|
|
173 |
{
|
|
174 |
//To identify internal plug-ins.
|
|
175 |
return KGSPluginProviderInternal;
|
|
176 |
}
|
|
177 |
|
|
178 |
|
|
179 |
// ----------------------------------------------------------------------------
|
|
180 |
// CGSDataCallPlugin::Visible
|
|
181 |
//
|
|
182 |
// Provides the visibility status of self to framework.
|
|
183 |
// ----------------------------------------------------------------------------
|
|
184 |
//
|
|
185 |
TBool CGSDataCallPlugin::Visible() const
|
|
186 |
{
|
|
187 |
TBool visible = EFalse;
|
|
188 |
|
|
189 |
if ( FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport ) )
|
|
190 |
{
|
|
191 |
visible = ETrue;
|
|
192 |
}
|
|
193 |
|
|
194 |
return visible;
|
|
195 |
}
|
|
196 |
|
|
197 |
|
|
198 |
// ---------------------------------------------------------------------------
|
|
199 |
// CGSDataCallPlugin::HandleCommandL(TInt aCommand)
|
|
200 |
//
|
|
201 |
// Handles commands directed to this class.
|
|
202 |
// ---------------------------------------------------------------------------
|
|
203 |
void CGSDataCallPlugin::HandleCommandL( TInt aCommand )
|
|
204 |
{
|
|
205 |
switch ( aCommand )
|
|
206 |
{
|
|
207 |
case EGSMSKCmdAppChange:
|
|
208 |
case EGSCmdAppChange:
|
|
209 |
HandleListBoxSelectionL();
|
|
210 |
break;
|
|
211 |
case EAknSoftkeyBack:
|
|
212 |
#ifdef RD_CONTROL_PANEL
|
|
213 |
iAppUi->ActivateLocalViewL( KGSAdminPluginUid );
|
|
214 |
#else //RD_CONTROL_PANEL
|
|
215 |
iAppUi->ActivateLocalViewL( KGSConPluginUid );
|
|
216 |
#endif //RD_CONTROL_PANEL
|
|
217 |
break;
|
|
218 |
case EAknCmdHelp:
|
|
219 |
{
|
|
220 |
if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
|
|
221 |
{
|
|
222 |
HlpLauncher::LaunchHelpApplicationL(
|
|
223 |
iEikonEnv->WsSession(), iAppUi->AppHelpContextL() );
|
|
224 |
}
|
|
225 |
break;
|
|
226 |
}
|
|
227 |
default:
|
|
228 |
iAppUi->HandleCommandL( aCommand );
|
|
229 |
break;
|
|
230 |
}
|
|
231 |
}
|
|
232 |
|
|
233 |
|
|
234 |
// ---------------------------------------------------------------------------
|
|
235 |
// CGSDataCallPlugin::UpdateListBoxL
|
|
236 |
//
|
|
237 |
// Updates listbox items.
|
|
238 |
// ---------------------------------------------------------------------------
|
|
239 |
//
|
|
240 |
void CGSDataCallPlugin::UpdateListBoxL( TInt aItemId )
|
|
241 |
{
|
|
242 |
if( Container() )
|
|
243 |
{
|
|
244 |
Container()->UpdateListBoxL( aItemId );
|
|
245 |
}
|
|
246 |
}
|
|
247 |
|
|
248 |
|
|
249 |
// ----------------------------------------------------------------------------
|
|
250 |
// CGSDataCallPlugin::Container
|
|
251 |
//
|
|
252 |
// Return handle to container class.
|
|
253 |
// ----------------------------------------------------------------------------
|
|
254 |
//
|
|
255 |
CGSDataCallPluginContainer* CGSDataCallPlugin::Container()
|
|
256 |
{
|
|
257 |
return static_cast<CGSDataCallPluginContainer*>( iContainer );
|
|
258 |
}
|
|
259 |
|
|
260 |
|
|
261 |
// ---------------------------------------------------------------------------
|
|
262 |
// CGSDataCallPlugin::NewContainerL()
|
|
263 |
//
|
|
264 |
// Creates new iContainer.
|
|
265 |
// ---------------------------------------------------------------------------
|
|
266 |
//
|
|
267 |
void CGSDataCallPlugin::NewContainerL()
|
|
268 |
{
|
|
269 |
iContainer = new( ELeave ) CGSDataCallPluginContainer;
|
|
270 |
}
|
|
271 |
|
|
272 |
|
|
273 |
// ----------------------------------------------------------------------------
|
|
274 |
// CGSDataCallPlugin::DoActivateL
|
|
275 |
//
|
|
276 |
// First method called by the Avkon framwork to invoke a view.
|
|
277 |
// ----------------------------------------------------------------------------
|
|
278 |
//
|
|
279 |
void CGSDataCallPlugin::DoActivateL( const TVwsViewId& aPrevViewId,
|
|
280 |
TUid aCustomMessageId,
|
|
281 |
const TDesC8& aCustomMessage )
|
|
282 |
{
|
|
283 |
CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
|
|
284 |
}
|
|
285 |
|
|
286 |
|
|
287 |
// ----------------------------------------------------------------------------
|
|
288 |
// CGSDataCallPlugin::DoDeactivate
|
|
289 |
//
|
|
290 |
// Called by the Avkon view framework when closing.
|
|
291 |
// ----------------------------------------------------------------------------
|
|
292 |
//
|
|
293 |
void CGSDataCallPlugin::DoDeactivate()
|
|
294 |
{
|
|
295 |
CGSBaseView::DoDeactivate();
|
|
296 |
}
|
|
297 |
|
|
298 |
|
|
299 |
// ---------------------------------------------------------------------------
|
|
300 |
// CGSDataCallPlugin::HandleListBoxSelectionL()
|
|
301 |
//
|
|
302 |
// Handles events raised through a rocker key.
|
|
303 |
// ---------------------------------------------------------------------------
|
|
304 |
void CGSDataCallPlugin::HandleListBoxSelectionL()
|
|
305 |
{
|
|
306 |
const TInt currentFeatureId = Container()->CurrentFeatureId();
|
|
307 |
|
|
308 |
switch ( currentFeatureId )
|
|
309 |
{
|
|
310 |
case KGSSettIdAutodiscon:
|
|
311 |
ShowDialupAutodisconSettingPageL();
|
|
312 |
break;
|
|
313 |
default:
|
|
314 |
break;
|
|
315 |
}
|
|
316 |
}
|
|
317 |
|
|
318 |
|
|
319 |
// ---------------------------------------------------------------------------
|
|
320 |
// CGSDataCallPlugin::HandleSettingPageEventL
|
|
321 |
//
|
|
322 |
// Handle any setting page related events
|
|
323 |
// ---------------------------------------------------------------------------
|
|
324 |
//
|
|
325 |
void CGSDataCallPlugin::HandleSettingPageEventL( CAknSettingPage* aSettingPage,
|
|
326 |
TAknSettingPageEvent aEventType )
|
|
327 |
{
|
|
328 |
TInt settingId = aSettingPage->SettingId();
|
|
329 |
|
|
330 |
if ( aEventType == EEventSettingOked )
|
|
331 |
{
|
|
332 |
TInt current;
|
|
333 |
|
|
334 |
switch ( settingId )
|
|
335 |
{
|
|
336 |
case KGSAutodisconSettingId:
|
|
337 |
current =
|
|
338 |
static_cast<CAknRadioButtonSettingPage*> ( aSettingPage )->
|
|
339 |
ListBoxControl()->CurrentItemIndex();
|
|
340 |
if ( current == KGSAutodTimeIndex )
|
|
341 |
{
|
|
342 |
ShowAutodisconTimeQueryL();
|
|
343 |
}
|
|
344 |
break;
|
|
345 |
default:
|
|
346 |
break;
|
|
347 |
}
|
|
348 |
}
|
|
349 |
}
|
|
350 |
|
|
351 |
|
|
352 |
|
|
353 |
// ---------------------------------------------------------------------------
|
|
354 |
// CGSDataCallPlugin::ShowDialupAutodisconSettingPageL
|
|
355 |
//
|
|
356 |
// Display dialup auto disconnect setting page.
|
|
357 |
// ---------------------------------------------------------------------------
|
|
358 |
//
|
|
359 |
void CGSDataCallPlugin::ShowDialupAutodisconSettingPageL()
|
|
360 |
{
|
|
361 |
TInt value = iModel->AutodisconnectTimeL();
|
|
362 |
TInt currentValue = 0; // magic number (user defined)
|
|
363 |
|
|
364 |
if ( value == static_cast<TInt> ( KGSTimeUnlimited ) )
|
|
365 |
{
|
|
366 |
currentValue = 1; // magic number (unlimited)
|
|
367 |
}
|
|
368 |
|
|
369 |
CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL(
|
|
370 |
R_AUTODISCON_TIME_SETTING_PAGE_LBX );
|
|
371 |
CleanupStack::PushL( items );
|
|
372 |
|
|
373 |
CAknRadioButtonSettingPage* dlg = new( ELeave ) CAknRadioButtonSettingPage(
|
|
374 |
R_AUTODISCON_TIME_SETTING_PAGE,
|
|
375 |
currentValue, items );
|
|
376 |
|
|
377 |
dlg->SetSettingId( KGSAutodisconSettingId );
|
|
378 |
dlg->SetSettingPageObserver( this );
|
|
379 |
|
|
380 |
if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
|
|
381 |
{
|
|
382 |
if ( currentValue == 1 ) // magic number (unlimited)
|
|
383 |
{
|
|
384 |
iModel->SetAutodisconnectTimeL( KGSTimeUnlimited );
|
|
385 |
}
|
|
386 |
|
|
387 |
UpdateListBoxL( KGSSettIdAutodiscon );
|
|
388 |
}
|
|
389 |
|
|
390 |
CleanupStack::PopAndDestroy( items );
|
|
391 |
}
|
|
392 |
|
|
393 |
// ---------------------------------------------------------------------------
|
|
394 |
// CGSDataCallPlugin::ShowAutodisconTimeQueryL()
|
|
395 |
//
|
|
396 |
// Display auto disconnect time query dialog.
|
|
397 |
// ---------------------------------------------------------------------------
|
|
398 |
//
|
|
399 |
void CGSDataCallPlugin::ShowAutodisconTimeQueryL()
|
|
400 |
{
|
|
401 |
TInt time = iModel->AutodisconnectTimeL();
|
|
402 |
if ( time == static_cast<TInt> ( KGSTimeUnlimited ) )
|
|
403 |
{
|
|
404 |
time = KGSZeroMinutes;
|
|
405 |
}
|
|
406 |
|
|
407 |
CAknNumberQueryDialog* dlg = new( ELeave ) CAknNumberQueryDialog( time );
|
|
408 |
dlg->PrepareLC( R_AUTODISCON_TIME_NUMBER_QUERY );
|
|
409 |
CAknQueryControl *ctrl = ( CAknQueryControl* )dlg->Control( EGeneralQuery );
|
|
410 |
CEikEdwin *edwin = ( CEikEdwin* )ctrl->ControlByLayoutOrNull( ENumberLayout );
|
|
411 |
edwin->SetAknEditorNumericKeymap( EAknEditorPlainNumberModeKeymap );
|
|
412 |
|
|
413 |
if( dlg->RunLD() )
|
|
414 |
{
|
|
415 |
if ( time == KGSZeroMinutes )
|
|
416 |
{
|
|
417 |
time = static_cast<TInt> ( KGSTimeUnlimited );
|
|
418 |
}
|
|
419 |
|
|
420 |
iModel->SetAutodisconnectTimeL( time );
|
|
421 |
}
|
|
422 |
}
|
|
423 |
|
|
424 |
|
|
425 |
// -----------------------------------------------------------------------------
|
|
426 |
// CGSDataCallPlugin::CreateIconL()
|
|
427 |
//
|
|
428 |
//
|
|
429 |
// -----------------------------------------------------------------------------
|
|
430 |
//
|
|
431 |
CGulIcon* CGSDataCallPlugin::CreateIconL( const TUid aIconType )
|
|
432 |
{
|
|
433 |
//EMbm<Mbm_file_name><Bitmap_name>
|
|
434 |
CGulIcon* icon;
|
|
435 |
TParse* fp = new( ELeave ) TParse();
|
|
436 |
CleanupStack::PushL( fp );
|
|
437 |
fp->Set( KGSDataCallPluginIconDirAndName, &KDC_BITMAP_DIR, NULL );
|
|
438 |
|
|
439 |
if( aIconType == KGSIconTypeLbxItem )
|
|
440 |
{
|
|
441 |
icon = AknsUtils::CreateGulIconL(
|
|
442 |
AknsUtils::SkinInstance(),
|
|
443 |
KAknsIIDQgnPropSetConnData,
|
|
444 |
fp->FullName(),
|
|
445 |
EMbmGsdatacallpluginQgn_prop_set_conn_data,
|
|
446 |
EMbmGsdatacallpluginQgn_prop_set_conn_data_mask );
|
|
447 |
}
|
|
448 |
else
|
|
449 |
{
|
|
450 |
icon = CGSPluginInterface::CreateIconL( aIconType );
|
|
451 |
}
|
|
452 |
|
|
453 |
CleanupStack::PopAndDestroy( fp );
|
|
454 |
|
|
455 |
return icon;
|
|
456 |
}
|
|
457 |
|
|
458 |
|
|
459 |
// -----------------------------------------------------------------------------
|
|
460 |
// CGSDataCallPlugin::DynInitMenuPaneL()
|
|
461 |
//
|
|
462 |
// dynamically handle help item if not supported
|
|
463 |
// -----------------------------------------------------------------------------
|
|
464 |
//
|
|
465 |
void CGSDataCallPlugin::DynInitMenuPaneL( TInt aResourceId,
|
|
466 |
CEikMenuPane* aMenuPane )
|
|
467 |
{
|
|
468 |
if( aResourceId == R_GS_MENU_ITEM_HELP )
|
|
469 |
{
|
|
470 |
User::LeaveIfNull( aMenuPane );
|
|
471 |
|
|
472 |
if ( FeatureManager::FeatureSupported( KFeatureIdHelp ))
|
|
473 |
{
|
|
474 |
aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse );
|
|
475 |
}
|
|
476 |
else
|
|
477 |
{
|
|
478 |
aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
|
|
479 |
}
|
|
480 |
}
|
|
481 |
}
|
|
482 |
|
|
483 |
// End of File
|