58
|
1 |
/*
|
|
2 |
* Copyright (c) 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: Dialog for editing packet data settings for a packet data
|
|
15 |
* connection method
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
|
|
21 |
// System
|
|
22 |
#include <StringLoader.h>
|
|
23 |
#include <akntextsettingpage.h>
|
|
24 |
#include <cmpacketdataui.rsg>
|
|
25 |
#include <cmmanager.rsg>
|
|
26 |
#include <csxhelp/cp.hlp.hrh>
|
|
27 |
|
|
28 |
// User
|
|
29 |
#include "cmlogger.h"
|
|
30 |
#include "cmpacketdatacommonconstants.h"
|
|
31 |
#include <cmpluginpacketdatadef.h>
|
|
32 |
#include "cmppacketdatasettingsdlg.h"
|
|
33 |
#include "cmppacketdatasettingsdlgadv.h"
|
|
34 |
#include "cmpluginpacketdata.h"
|
|
35 |
#include "cmpluginmenucommands.hrh"
|
|
36 |
#include <cmcommonconstants.h>
|
|
37 |
#include <cmpsettingsconsts.h>
|
|
38 |
#include "cmmanagerimpl.h"
|
|
39 |
|
|
40 |
using namespace CMManager;
|
|
41 |
|
|
42 |
const TUint32 KPlainAuthSelectionItems[] =
|
|
43 |
{
|
|
44 |
R_QTN_SET_PASSWD_AUT_NORMAL,
|
|
45 |
R_QTN_SET_PASSWD_AUT_SECURE,
|
|
46 |
0
|
|
47 |
};
|
|
48 |
|
|
49 |
const TUint32 KPromptForAuthSelectionItems[] =
|
|
50 |
{
|
|
51 |
R_QTN_SET_PROMPT_PASSWD_NO,
|
|
52 |
R_QTN_SET_PROMPT_PASSWD_YES,
|
|
53 |
0
|
|
54 |
};
|
|
55 |
|
|
56 |
// ================= MEMBER FUNCTIONS =======================================
|
|
57 |
|
|
58 |
// --------------------------------------------------------------------------
|
|
59 |
// CmPluginPacketDataSettingsDlg::NewL()
|
|
60 |
// Two-phase dconstructor, second phase is ConstructAndRunLD
|
|
61 |
// --------------------------------------------------------------------------
|
|
62 |
//
|
|
63 |
CmPluginPacketDataSettingsDlg* CmPluginPacketDataSettingsDlg::NewL(
|
|
64 |
CCmPluginBaseEng& aCmPluginBase )
|
|
65 |
{
|
|
66 |
CmPluginPacketDataSettingsDlg* self =
|
|
67 |
new ( ELeave ) CmPluginPacketDataSettingsDlg( aCmPluginBase );
|
|
68 |
return self;
|
|
69 |
}
|
|
70 |
|
|
71 |
// --------------------------------------------------------------------------
|
|
72 |
// CmPluginPacketDataSettingsDlg::CmPluginPacketDataSettingsDlg()
|
|
73 |
// --------------------------------------------------------------------------
|
|
74 |
//
|
|
75 |
CmPluginPacketDataSettingsDlg::CmPluginPacketDataSettingsDlg(
|
|
76 |
CCmPluginBaseEng& aCmPluginBase )
|
|
77 |
: CmPluginBaseSettingsDlg( aCmPluginBase )
|
|
78 |
, iNotifyFromSon( KCmNotifiedNone )
|
|
79 |
{
|
|
80 |
|
|
81 |
}
|
|
82 |
|
|
83 |
// --------------------------------------------------------------------------
|
|
84 |
// CmPluginPacketDataSettingsDlg::UpdateListBoxContentL
|
|
85 |
// --------------------------------------------------------------------------
|
|
86 |
//
|
|
87 |
void CmPluginPacketDataSettingsDlg::UpdateListBoxContentL()
|
|
88 |
{
|
|
89 |
CmPluginBaseSettingsDlg::UpdateListBoxContentL();
|
|
90 |
}
|
|
91 |
|
|
92 |
//---------------------------------------------------------------------------
|
|
93 |
// CmPluginPacketDataSettingsDlg::ConstructAndRunLD
|
|
94 |
// --------------------------------------------------------------------------
|
|
95 |
//
|
|
96 |
|
|
97 |
TInt CmPluginPacketDataSettingsDlg::ConstructAndRunLD( )
|
|
98 |
{
|
|
99 |
// Set this flag to allow edit continue
|
|
100 |
iCanEditingContinue = ETrue;
|
|
101 |
|
|
102 |
CleanupStack::PushL( this );
|
|
103 |
LoadResourceL( KPluginPacketDataResDirAndFileName );
|
|
104 |
CleanupStack::Pop( this );
|
|
105 |
|
|
106 |
CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
|
|
107 |
cmMgr.WatcherRegisterL( this );
|
|
108 |
|
|
109 |
return CmPluginBaseSettingsDlg::ConstructAndRunLD( );
|
|
110 |
}
|
|
111 |
|
|
112 |
|
|
113 |
// --------------------------------------------------------------------------
|
|
114 |
// CmPluginPacketDataSettingsDlg::~CmPluginPacketDataSettingsDlg
|
|
115 |
// Destructor
|
|
116 |
// --------------------------------------------------------------------------
|
|
117 |
//
|
|
118 |
CmPluginPacketDataSettingsDlg::~CmPluginPacketDataSettingsDlg()
|
|
119 |
{
|
|
120 |
iResourceReader.Close();
|
|
121 |
}
|
|
122 |
|
|
123 |
// --------------------------------------------------------------------------
|
|
124 |
// CmPluginBaseSettingsDlg::RunAdvancedSettingsL
|
|
125 |
// --------------------------------------------------------------------------
|
|
126 |
//
|
|
127 |
void CmPluginPacketDataSettingsDlg::RunAdvancedSettingsL()
|
|
128 |
{
|
|
129 |
CmPluginPacketDataSettingsDlgAdv* advDlg =
|
|
130 |
CmPluginPacketDataSettingsDlgAdv::NewL( iCmPluginBaseEng );
|
|
131 |
|
|
132 |
// This view may have to un-register as watcher here
|
|
133 |
CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
|
|
134 |
cmMgr.WatcherUnRegister();
|
|
135 |
|
|
136 |
advDlg->RegisterParentView( this );
|
|
137 |
TInt ret = advDlg->ConstructAndRunLD();
|
|
138 |
|
|
139 |
if( iNotifyFromSon == KCmNotifiedNone )
|
|
140 |
{
|
|
141 |
if( ret == KDialogUserExit )
|
|
142 |
{
|
|
143 |
iExitReason = KDialogUserExit;
|
|
144 |
TryExitL( iExitReason );
|
|
145 |
}
|
|
146 |
else
|
|
147 |
{
|
|
148 |
// Re-register as watcher if advanced view comes back or exists normally
|
|
149 |
cmMgr.WatcherRegisterL( this );
|
|
150 |
}
|
|
151 |
}
|
|
152 |
else
|
|
153 |
{
|
|
154 |
HandleCommsDatChangeL();
|
|
155 |
}
|
|
156 |
}
|
|
157 |
|
|
158 |
// --------------------------------------------------------------------------
|
|
159 |
// CmPluginBaseSettingsDlg::UpdateListBoxContentBearerSpecificL
|
|
160 |
// --------------------------------------------------------------------------
|
|
161 |
//
|
|
162 |
void CmPluginPacketDataSettingsDlg::UpdateListBoxContentBearerSpecificL(
|
|
163 |
CDesCArray& aItemArray )
|
|
164 |
{
|
|
165 |
LOGGER_ENTERFN( "CmPluginPacketDataSettingsDlg::UpdateListBoxContentBearerSpecificL" );
|
|
166 |
|
|
167 |
TBool boolSettingVal( EFalse ); // just for helping make code readable
|
|
168 |
|
|
169 |
// DATA BEARER - only for real bearer types
|
|
170 |
AppendSettingTextsL( aItemArray, ECmBearerSettingName );
|
|
171 |
// AP NAME
|
|
172 |
AppendSettingTextsL( aItemArray, EPacketDataAPName );
|
|
173 |
// USER NAME
|
|
174 |
AppendSettingTextsL( aItemArray, EPacketDataIFAuthName );
|
|
175 |
// PROMPT PASSWORD
|
|
176 |
boolSettingVal = iCmPluginBaseEng.GetBoolAttributeL(
|
|
177 |
EPacketDataIFPromptForAuth );
|
|
178 |
AppendSettingTextsL( aItemArray, EPacketDataIFPromptForAuth,
|
|
179 |
boolSettingVal ?
|
|
180 |
R_QTN_SET_PROMPT_PASSWD_YES :
|
|
181 |
R_QTN_SET_PROMPT_PASSWD_NO );
|
|
182 |
// PASSWORD
|
|
183 |
AppendSettingTextsL( aItemArray, EPacketDataIFAuthPass );
|
|
184 |
// PASSWORD AUTHENTICATION
|
|
185 |
boolSettingVal = iCmPluginBaseEng.GetBoolAttributeL(
|
|
186 |
EPacketDataDisablePlainTextAuth );
|
|
187 |
AppendSettingTextsL( aItemArray,
|
|
188 |
EPacketDataDisablePlainTextAuth,
|
|
189 |
boolSettingVal ?
|
|
190 |
R_QTN_SET_PASSWD_AUT_SECURE :
|
|
191 |
R_QTN_SET_PASSWD_AUT_NORMAL );
|
|
192 |
// HOMEPAGE
|
|
193 |
AppendSettingTextsL( aItemArray, ECmStartPage );
|
|
194 |
}
|
|
195 |
|
|
196 |
// --------------------------------------------------------------------------
|
|
197 |
// CmPluginPacketDataSettingsDlg::ChangeBoolSettingL
|
|
198 |
// --------------------------------------------------------------------------
|
|
199 |
//
|
|
200 |
TBool CmPluginPacketDataSettingsDlg::ChangeBoolSettingL( TUint32 aAttribute,
|
|
201 |
TInt aCommandId )
|
|
202 |
{
|
|
203 |
LOGGER_ENTERFN( "CmPluginPacketDataSettingsDlg::ChangeBoolSettingL" );
|
|
204 |
|
|
205 |
if ( aCommandId == EPluginBaseCmdChange )
|
|
206 |
{
|
|
207 |
const TUint32* items = NULL;
|
|
208 |
TInt titleResId(0);
|
|
209 |
|
|
210 |
// Add the list items
|
|
211 |
switch ( aAttribute )
|
|
212 |
{
|
|
213 |
case EPacketDataDisablePlainTextAuth:
|
|
214 |
{
|
|
215 |
titleResId = R_QTN_SET_PASSWD_AUT;
|
|
216 |
items = KPlainAuthSelectionItems;
|
|
217 |
break;
|
|
218 |
}
|
|
219 |
case EPacketDataIFPromptForAuth:
|
|
220 |
{
|
|
221 |
titleResId = R_QTN_SET_PROMPT_PASSWD;
|
|
222 |
items = KPromptForAuthSelectionItems;
|
|
223 |
break;
|
|
224 |
}
|
|
225 |
default:
|
|
226 |
{
|
|
227 |
User::Leave( KErrNotSupported );
|
|
228 |
}
|
|
229 |
}
|
|
230 |
|
|
231 |
TInt selected = iCmPluginBaseEng.GetBoolAttributeL( aAttribute );
|
|
232 |
TInt originalValue = selected;
|
|
233 |
if ( ShowRadioButtonSettingPageL( items,
|
|
234 |
selected,
|
|
235 |
titleResId ) &&
|
|
236 |
originalValue != selected )
|
|
237 |
{
|
|
238 |
iCmPluginBaseEng.SetBoolAttributeL( aAttribute, selected );
|
|
239 |
UpdateListBoxContentL();
|
|
240 |
}
|
|
241 |
|
|
242 |
return selected;
|
|
243 |
}
|
|
244 |
else
|
|
245 |
{
|
|
246 |
TBool boolFromCM = boolFromCM =
|
|
247 |
iCmPluginBaseEng.GetBoolAttributeL( aAttribute );
|
|
248 |
iCmPluginBaseEng.SetBoolAttributeL( aAttribute, !boolFromCM );
|
|
249 |
UpdateListBoxContentL();
|
|
250 |
return !boolFromCM;
|
|
251 |
}
|
|
252 |
}
|
|
253 |
|
|
254 |
// --------------------------------------------------------------------------
|
|
255 |
// CmPluginPacketDataSettingsDlg::ShowPopupSettingPageL
|
|
256 |
// --------------------------------------------------------------------------
|
|
257 |
//
|
|
258 |
TBool CmPluginPacketDataSettingsDlg::ShowPopupSettingPageL(
|
|
259 |
TUint32 aAttribute, TInt aCommandId )
|
|
260 |
{
|
|
261 |
LOGGER_ENTERFN( "CmPluginPacketDataSettingsDlg::ShowPopupSettingPageL" );
|
|
262 |
|
|
263 |
TBool retval = EFalse;
|
|
264 |
switch ( aAttribute )
|
|
265 |
{
|
|
266 |
case EPacketDataIFAuthPass:
|
|
267 |
{
|
|
268 |
retval = ShowPopupPasswordSettingPageL( aAttribute );
|
|
269 |
break;
|
|
270 |
}
|
|
271 |
case EPacketDataDisablePlainTextAuth:
|
|
272 |
case EPacketDataIFPromptForAuth:
|
|
273 |
{
|
|
274 |
ChangeBoolSettingL( aAttribute, aCommandId );
|
|
275 |
break;
|
|
276 |
}
|
|
277 |
default:
|
|
278 |
{
|
|
279 |
CmPluginBaseSettingsDlg::ShowPopupSettingPageL( aAttribute,
|
|
280 |
aCommandId );
|
|
281 |
break;
|
|
282 |
}
|
|
283 |
}
|
|
284 |
return retval;
|
|
285 |
}
|
|
286 |
|
|
287 |
|
|
288 |
// --------------------------------------------------------------------------
|
|
289 |
// CmPluginPacketDataSettingsDlg::ProcessCommandL
|
|
290 |
// --------------------------------------------------------------------------
|
|
291 |
//
|
|
292 |
void CmPluginPacketDataSettingsDlg::ProcessCommandL( TInt aCommandId )
|
|
293 |
{
|
|
294 |
LOGGER_ENTERFN( "CmPluginPacketDataSettingsDlg::ProcessCommandL" );
|
|
295 |
|
|
296 |
if ( !iCanEditingContinue )
|
|
297 |
{
|
|
298 |
// We have to block all editing activity if database changed by
|
|
299 |
// other application
|
|
300 |
return;
|
|
301 |
}
|
|
302 |
|
|
303 |
if ( MenuShowing() )
|
|
304 |
{
|
|
305 |
HideMenu();
|
|
306 |
}
|
|
307 |
|
|
308 |
switch ( aCommandId )
|
|
309 |
{
|
|
310 |
case EPluginBaseCmdAdvanced:
|
|
311 |
{
|
|
312 |
RunAdvancedSettingsL();
|
|
313 |
break;
|
|
314 |
}
|
|
315 |
case EPluginBaseCmdChange: // flow to EAknSoftkeyOk
|
|
316 |
case EAknSoftkeyOk:
|
|
317 |
{
|
|
318 |
TInt attrib = iSettingIndex->At( iListbox->CurrentItemIndex() );
|
|
319 |
ShowPopupSettingPageL( attrib, aCommandId );
|
|
320 |
break;
|
|
321 |
}
|
|
322 |
default:
|
|
323 |
{
|
|
324 |
CmPluginBaseSettingsDlg::ProcessCommandL( aCommandId );
|
|
325 |
break;
|
|
326 |
}
|
|
327 |
}
|
|
328 |
}
|
|
329 |
|
|
330 |
// --------------------------------------------------------------------------
|
|
331 |
// CmPluginPacketDataSettingsDlg::OkToExitL
|
|
332 |
// --------------------------------------------------------------------------
|
|
333 |
//
|
|
334 |
TBool CmPluginPacketDataSettingsDlg::OkToExitL( TInt aButtonId )
|
|
335 |
{
|
|
336 |
// Database has been changed by other application so exit from this view
|
|
337 |
// without update editings to database
|
|
338 |
if ( !iCanEditingContinue )
|
|
339 |
{
|
|
340 |
if ( iExitReason == KDialogUserExit )
|
|
341 |
{
|
|
342 |
iCmPluginBaseEng.CmMgr().WatcherUnRegister();
|
|
343 |
|
|
344 |
// Set iExitReason back to KDialogUserBack so as to exit from this view through else in the next call
|
|
345 |
TInt exitValue = KDialogUserExit;
|
|
346 |
iExitReason = KDialogUserBack;
|
|
347 |
// If destination has been deleted by other application
|
|
348 |
// then we may have to exit from Cmmgr
|
|
349 |
TryExitL( exitValue );
|
|
350 |
return EFalse;
|
|
351 |
}
|
|
352 |
else
|
|
353 |
{
|
|
354 |
// Exit from this view here to avoid possible update to databse
|
|
355 |
return ETrue;
|
|
356 |
}
|
|
357 |
}
|
|
358 |
|
|
359 |
TBool retval( EFalse );
|
|
360 |
|
|
361 |
switch ( aButtonId )
|
|
362 |
{
|
|
363 |
case EPluginBaseCmdExit:
|
|
364 |
case EAknSoftkeyBack:
|
|
365 |
{
|
|
366 |
CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
|
|
367 |
cmMgr.WatcherUnRegister();
|
|
368 |
}
|
|
369 |
default:
|
|
370 |
{
|
|
371 |
retval = CmPluginBaseSettingsDlg::OkToExitL( aButtonId );
|
|
372 |
break;
|
|
373 |
}
|
|
374 |
}
|
|
375 |
|
|
376 |
return retval;
|
|
377 |
}
|
|
378 |
|
|
379 |
// --------------------------------------------------------------------------
|
|
380 |
// CmPluginPacketDataSettingsDlg::GetHelpContext
|
|
381 |
// --------------------------------------------------------------------------
|
|
382 |
//
|
|
383 |
|
|
384 |
void CmPluginPacketDataSettingsDlg::GetHelpContext( TCoeHelpContext& aContext ) const
|
|
385 |
{
|
|
386 |
LOGGER_ENTERFN( "CmPluginPacketDataSettingsDlg::GetHelpContext" );
|
|
387 |
|
|
388 |
aContext.iMajor = KHelpUidPlugin;
|
|
389 |
aContext.iContext = KSET_HLP_AP_SETTING_GPRS;
|
|
390 |
}
|
|
391 |
|
|
392 |
// --------------------------------------------------------------------------
|
|
393 |
// CmPluginPacketDataSettingsDlg::CommsDatChangesL
|
|
394 |
// --------------------------------------------------------------------------
|
|
395 |
//
|
|
396 |
void CmPluginPacketDataSettingsDlg::CommsDatChangesL()
|
|
397 |
{
|
|
398 |
if ( !iCanEditingContinue )
|
|
399 |
{
|
|
400 |
return;
|
|
401 |
}
|
|
402 |
|
|
403 |
CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
|
|
404 |
CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
|
|
405 |
|
|
406 |
if ( parentDest )
|
|
407 |
{
|
|
408 |
if( !cmMgr.DestinationStillExistedL( parentDest ) )
|
|
409 |
{
|
|
410 |
iExitReason = KDialogUserExit;
|
|
411 |
iCanEditingContinue = EFalse;
|
|
412 |
|
|
413 |
cmMgr.RemoveDestFromPool( parentDest );
|
|
414 |
delete parentDest;
|
|
415 |
return;
|
|
416 |
}
|
|
417 |
|
|
418 |
// We may have to go back to parent view if database is changed by other application
|
|
419 |
iCanEditingContinue = EFalse;
|
|
420 |
|
|
421 |
cmMgr.RemoveDestFromPool( parentDest );
|
|
422 |
delete parentDest;
|
|
423 |
}
|
|
424 |
else // Legacy
|
|
425 |
{
|
|
426 |
// We may have to go back to parent view if database is changed by other application
|
|
427 |
iCanEditingContinue = EFalse;
|
|
428 |
}
|
|
429 |
}
|
|
430 |
|
|
431 |
// --------------------------------------------------------------------------
|
|
432 |
// CmPluginPacketDataSettingsDlg::NotifyParentView
|
|
433 |
// --------------------------------------------------------------------------
|
|
434 |
//
|
|
435 |
void CmPluginPacketDataSettingsDlg::NotifyParentView( TInt aValue )
|
|
436 |
{
|
|
437 |
iNotifyFromSon = aValue;
|
|
438 |
}
|
|
439 |
|
|
440 |
// --------------------------------------------------------------------------
|
|
441 |
// CmPluginPacketDataSettingsDlg::HandleCommsDatChangeL
|
|
442 |
// --------------------------------------------------------------------------
|
|
443 |
//
|
|
444 |
void CmPluginPacketDataSettingsDlg::HandleCommsDatChangeL()
|
|
445 |
{
|
|
446 |
if ( iCanEditingContinue )
|
|
447 |
{
|
|
448 |
// Set iCanEditingContinue to False so that exit fromn this view without update editings
|
|
449 |
iCanEditingContinue = EFalse;
|
|
450 |
}
|
|
451 |
|
|
452 |
if( iNotifyFromSon == KCmNotifiedIapIsNotInThisDestination ||
|
|
453 |
iNotifyFromSon == KCmNotifiedIapDisappear )
|
|
454 |
{
|
|
455 |
TryExitL( iExitReason );
|
|
456 |
}
|
|
457 |
else if( iNotifyFromSon == KCmNotifiedDestinationDisappear )
|
|
458 |
{
|
|
459 |
iExitReason = KDialogUserExit;
|
|
460 |
TryExitL( iExitReason );
|
|
461 |
}
|
|
462 |
}
|