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 setting packet data plugin advanced settings
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// INCLUDE FILES
|
|
19 |
|
|
20 |
#include <cmpacketdataui.rsg>
|
|
21 |
#include <cmmanager.rsg>
|
|
22 |
#include <StringLoader.h>
|
|
23 |
#include <akntextsettingpage.h>
|
|
24 |
#include <aknradiobuttonsettingpage.h>
|
|
25 |
#include <aknmfnesettingpage.h>
|
|
26 |
#include <csxhelp/cp.hlp.hrh>
|
|
27 |
|
|
28 |
#include <cmpluginpacketdatadef.h>
|
|
29 |
#include "cmppacketdatasettingsdlgadv.h"
|
|
30 |
#include "cmpacketdatacommonconstants.h"
|
|
31 |
#include "cmpluginmultilinedialog.h"
|
|
32 |
#include <cmcommonui.h>
|
|
33 |
#include "cmpluginmenucommands.hrh"
|
|
34 |
#include "cmpluginpacketdata.h"
|
|
35 |
#include <cmcommonconstants.h>
|
|
36 |
#include <cmpsettingsconsts.h>
|
|
37 |
#include "cmmanagerimpl.h"
|
|
38 |
|
|
39 |
using namespace CMManager;
|
|
40 |
|
|
41 |
const TUint32 KDNSSelectionItems[] =
|
|
42 |
{
|
|
43 |
R_QTN_SET_IP_ADDRESS_DYNAMIC,
|
|
44 |
R_QTN_SET_IP_WELL_KNOWN,
|
|
45 |
R_QTN_SET_IP_USER_DEFINED,
|
|
46 |
0
|
|
47 |
};
|
|
48 |
|
|
49 |
const TUint32 KPDPSelectionItems[] =
|
|
50 |
{
|
|
51 |
R_GPRS_PLUGIN_VIEW_PDP_TYPE_IPV4,
|
|
52 |
R_GPRS_PLUGIN_VIEW_PDP_TYPE_IPV6,
|
|
53 |
0
|
|
54 |
};
|
|
55 |
|
|
56 |
// ================= MEMBER FUNCTIONS =======================================
|
|
57 |
|
|
58 |
// --------------------------------------------------------------------------
|
|
59 |
// CmPluginPacketDataSettingsDlgAdv::NewL()
|
|
60 |
// Two-phase dconstructor, second phase is ConstructAndRunLD
|
|
61 |
// --------------------------------------------------------------------------
|
|
62 |
//
|
|
63 |
CmPluginPacketDataSettingsDlgAdv* CmPluginPacketDataSettingsDlgAdv::NewL(
|
|
64 |
CCmPluginBaseEng& aCmPluginBase )
|
|
65 |
{
|
|
66 |
CmPluginPacketDataSettingsDlgAdv* self =
|
|
67 |
new ( ELeave ) CmPluginPacketDataSettingsDlgAdv( aCmPluginBase );
|
|
68 |
return self;
|
|
69 |
}
|
|
70 |
|
|
71 |
// --------------------------------------------------------------------------
|
|
72 |
// CmPluginPacketDataSettingsDlgAdv::CmPluginPacketDataSettingsDlgAdv()
|
|
73 |
// --------------------------------------------------------------------------
|
|
74 |
//
|
|
75 |
CmPluginPacketDataSettingsDlgAdv::CmPluginPacketDataSettingsDlgAdv(
|
|
76 |
CCmPluginBaseEng& aCmPluginBase )
|
|
77 |
: CmPluginBaseSettingsDlgAdv( aCmPluginBase )
|
|
78 |
, iIpv6Supported( aCmPluginBase.FeatureSupported( KFeatureIdIPv6 ) )
|
|
79 |
, iParent( NULL )
|
|
80 |
{
|
|
81 |
iHelpContext = KSET_HLP_AP_SETTING_GPRS_AS;
|
|
82 |
}
|
|
83 |
|
|
84 |
// --------------------------------------------------------------------------
|
|
85 |
// CmPluginPacketDataSettingsDlgAdv::~CmPluginPacketDataSettingsDlgAdv
|
|
86 |
// Destructor
|
|
87 |
// --------------------------------------------------------------------------
|
|
88 |
//
|
|
89 |
CmPluginPacketDataSettingsDlgAdv::~CmPluginPacketDataSettingsDlgAdv()
|
|
90 |
{
|
|
91 |
}
|
|
92 |
|
|
93 |
// --------------------------------------------------------------------------
|
|
94 |
// CmPluginPacketDataSettingsDlgAdv::ConstructAndRunLD
|
|
95 |
// --------------------------------------------------------------------------
|
|
96 |
//
|
|
97 |
TInt CmPluginPacketDataSettingsDlgAdv::ConstructAndRunLD()
|
|
98 |
{
|
|
99 |
// Set this flag to allow edit continue
|
|
100 |
iCanEditingContinue = ETrue;
|
|
101 |
|
|
102 |
CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
|
|
103 |
cmMgr.WatcherRegisterL( this );
|
|
104 |
|
|
105 |
return CmPluginBaseSettingsDlgAdv::ConstructAndRunLD();
|
|
106 |
}
|
|
107 |
|
|
108 |
// --------------------------------------------------------------------------
|
|
109 |
// CmPluginPacketDataSettingsDlgAdv::UpdateListBoxContentBearerSpecificL
|
|
110 |
// --------------------------------------------------------------------------
|
|
111 |
//
|
|
112 |
void CmPluginPacketDataSettingsDlgAdv::UpdateListBoxContentBearerSpecificL(
|
|
113 |
CDesCArray& aItemArray )
|
|
114 |
{
|
|
115 |
TInt valueResId = 0;
|
|
116 |
TInt pdpType = RPacketContext::EPdpTypeIPv4;
|
|
117 |
|
|
118 |
// Get the PDP type - EPdpTypeIPv4 by default
|
|
119 |
if ( iIpv6Supported )
|
|
120 |
{
|
|
121 |
pdpType = iCmPluginBaseEng.GetIntAttributeL( EPacketDataPDPType );
|
|
122 |
|
|
123 |
// NETWORK (PDP) TYPE
|
|
124 |
AppendSettingTextsL( aItemArray,
|
|
125 |
EPacketDataPDPType,
|
|
126 |
pdpType == RPacketContext::EPdpTypeIPv6 ?
|
|
127 |
R_GPRS_PLUGIN_VIEW_PDP_TYPE_IPV6 :
|
|
128 |
R_GPRS_PLUGIN_VIEW_PDP_TYPE_IPV4 );
|
|
129 |
}
|
|
130 |
|
|
131 |
if ( pdpType != RPacketContext::EPdpTypeIPv6 )
|
|
132 |
{
|
|
133 |
// IP ADDRESS
|
|
134 |
AppendSettingTextsL( aItemArray, EPacketDataIPAddr );
|
|
135 |
}
|
|
136 |
|
|
137 |
if ( iIpv6Supported )
|
|
138 |
{
|
|
139 |
// DNS SERVERS IP ADDRESS
|
|
140 |
if ( pdpType == RPacketContext::EPdpTypeIPv6 )
|
|
141 |
{
|
|
142 |
switch ( GetIPv6DNSTypeL( EPacketDataIPIP6NameServer1,
|
|
143 |
EPacketDataIPIP6NameServer2 ) )
|
|
144 |
{
|
|
145 |
case EIPv6Unspecified:
|
|
146 |
{
|
|
147 |
valueResId = R_QTN_SET_IP_ADDRESS_DYNAMIC;
|
|
148 |
break;
|
|
149 |
}
|
|
150 |
case EIPv6WellKnown:
|
|
151 |
{
|
|
152 |
valueResId = R_QTN_SET_IP_WELL_KNOWN;
|
|
153 |
break;
|
|
154 |
}
|
|
155 |
case EIPv6UserDefined:
|
|
156 |
{
|
|
157 |
valueResId = R_QTN_SET_IP_USER_DEFINED;
|
|
158 |
break;
|
|
159 |
}
|
|
160 |
default:
|
|
161 |
{
|
|
162 |
User::Leave( KErrNotSupported );
|
|
163 |
break;
|
|
164 |
}
|
|
165 |
}
|
|
166 |
}
|
|
167 |
else
|
|
168 |
{
|
|
169 |
if ( !iCmPluginBaseEng.GetBoolAttributeL(
|
|
170 |
EPacketDataIPDNSAddrFromServer ) )
|
|
171 |
{
|
|
172 |
valueResId = R_QTN_SET_IP_USER_DEFINED;
|
|
173 |
}
|
|
174 |
else
|
|
175 |
{
|
|
176 |
valueResId = R_QTN_SET_DNS_SERVERS_AUTOMATIC;
|
|
177 |
}
|
|
178 |
}
|
|
179 |
AppendSettingTextsL( aItemArray,
|
|
180 |
EPacketDataIPIP6DNSAddrFromServer,
|
|
181 |
valueResId );
|
|
182 |
}
|
|
183 |
else
|
|
184 |
{
|
|
185 |
// PRIMARY NAME SERVER
|
|
186 |
AppendSettingTextsL( aItemArray, EPacketDataIPNameServer1 );
|
|
187 |
AppendSettingTextsL( aItemArray, EPacketDataIPNameServer2 );
|
|
188 |
}
|
|
189 |
|
|
190 |
// PROXY SETTINGS
|
|
191 |
// PROXY SERVER ADDRESS
|
|
192 |
AppendSettingTextsL( aItemArray, ECmProxyServerName );
|
|
193 |
// PROXY PORT NUMBER
|
|
194 |
AppendSettingTextsL( aItemArray, ECmProxyPortNumber );
|
|
195 |
}
|
|
196 |
|
|
197 |
// --------------------------------------------------------------------------
|
|
198 |
// CmPluginPacketDataSettingsDlgAdv::ShowPopupPacketDataIPDNSAddrFromServerL
|
|
199 |
// --------------------------------------------------------------------------
|
|
200 |
//
|
|
201 |
void CmPluginPacketDataSettingsDlgAdv::
|
|
202 |
ShowPopupPacketDataIPDNSAddrFromServerL()
|
|
203 |
{
|
|
204 |
TInt PDPType = iCmPluginBaseEng.GetIntAttributeL( EPacketDataPDPType );
|
|
205 |
|
|
206 |
if ( PDPType == RPacketContext::EPdpTypeIPv6 )
|
|
207 |
{
|
|
208 |
ShowPopupIPv6DNSEditorL( KDNSSelectionItems,
|
|
209 |
EPacketDataIPIP6DNSAddrFromServer,
|
|
210 |
EPacketDataIPIP6NameServer1,
|
|
211 |
EPacketDataIPIP6NameServer2 );
|
|
212 |
}
|
|
213 |
else //ipv4
|
|
214 |
{
|
|
215 |
ShowPopupIPv4DNSEditorL( EPacketDataIPDNSAddrFromServer,
|
|
216 |
EPacketDataIPNameServer1,
|
|
217 |
EPacketDataIPNameServer2 );
|
|
218 |
}
|
|
219 |
}
|
|
220 |
|
|
221 |
// --------------------------------------------------------------------------
|
|
222 |
// CmPluginPacketDataSettingsDlgAdv::ShowPopupSettingPageL
|
|
223 |
// --------------------------------------------------------------------------
|
|
224 |
//
|
|
225 |
TBool CmPluginPacketDataSettingsDlgAdv::ShowPopupSettingPageL(
|
|
226 |
TUint32 aAttribute, TInt aCommandId )
|
|
227 |
{
|
|
228 |
TBool retval = EFalse;
|
|
229 |
|
|
230 |
switch ( aAttribute )
|
|
231 |
{
|
|
232 |
// IPDNS Settings
|
|
233 |
case EPacketDataIPDNSAddrFromServer:
|
|
234 |
case EPacketDataIPIP6DNSAddrFromServer:
|
|
235 |
{
|
|
236 |
ShowPopupPacketDataIPDNSAddrFromServerL();
|
|
237 |
break;
|
|
238 |
}
|
|
239 |
case EPacketDataPDPType:
|
|
240 |
{
|
|
241 |
if ( aCommandId == EAknSoftkeyOk )
|
|
242 |
{
|
|
243 |
TInt intFromCM = 0;
|
|
244 |
TRAPD( err, intFromCM = iCmPluginBaseEng.GetIntAttributeL(
|
|
245 |
aAttribute ) );
|
|
246 |
|
|
247 |
if ( !err )
|
|
248 |
{
|
|
249 |
intFromCM == RPacketContext::EPdpTypeIPv6 ?
|
|
250 |
intFromCM = RPacketContext::EPdpTypeIPv4 :
|
|
251 |
intFromCM = RPacketContext::EPdpTypeIPv6;
|
|
252 |
}
|
|
253 |
else
|
|
254 |
{
|
|
255 |
User::Leave( KErrNotSupported );
|
|
256 |
}
|
|
257 |
|
|
258 |
iCmPluginBaseEng.SetIntAttributeL( aAttribute, intFromCM );
|
|
259 |
UpdateListBoxContentL();
|
|
260 |
}
|
|
261 |
else
|
|
262 |
{
|
|
263 |
if ( aCommandId == EPluginBaseCmdChange )
|
|
264 |
|
|
265 |
{
|
|
266 |
ShowPDPTypeRBPageL( aAttribute );
|
|
267 |
}
|
|
268 |
else
|
|
269 |
{
|
|
270 |
TInt pdpType = iCmPluginBaseEng.GetIntAttributeL( EPacketDataPDPType );
|
|
271 |
pdpType = pdpType == RPacketContext::EPdpTypeIPv4 ?
|
|
272 |
RPacketContext::EPdpTypeIPv6 :
|
|
273 |
RPacketContext::EPdpTypeIPv4;
|
|
274 |
iCmPluginBaseEng.SetIntAttributeL( aAttribute, pdpType );
|
|
275 |
UpdateListBoxContentL();
|
|
276 |
}
|
|
277 |
}
|
|
278 |
break;
|
|
279 |
}
|
|
280 |
// IP Setting Page
|
|
281 |
case EPacketDataIPNameServer1:
|
|
282 |
case EPacketDataIPNameServer2:
|
|
283 |
case EPacketDataIPAddr:
|
|
284 |
{
|
|
285 |
ShowPopupIpSettingPageL( aAttribute );
|
|
286 |
break;
|
|
287 |
}
|
|
288 |
// Text Settings
|
|
289 |
case ECmProxyServerName:
|
|
290 |
{
|
|
291 |
retval = ShowPopupTextSettingPageL( aAttribute );
|
|
292 |
break;
|
|
293 |
}
|
|
294 |
// Numeric Settings
|
|
295 |
case ECmProxyPortNumber:
|
|
296 |
{
|
|
297 |
if ( ShowPopupPortNumSettingPageL( aAttribute ) )
|
|
298 |
{
|
|
299 |
retval = ETrue;
|
|
300 |
}
|
|
301 |
break;
|
|
302 |
}
|
|
303 |
default:
|
|
304 |
{
|
|
305 |
CmPluginBaseSettingsDlgAdv::ShowPopupSettingPageL( aAttribute,
|
|
306 |
aCommandId );
|
|
307 |
break;
|
|
308 |
}
|
|
309 |
}
|
|
310 |
return retval;
|
|
311 |
}
|
|
312 |
|
|
313 |
// --------------------------------------------------------------------------
|
|
314 |
// CmPluginPacketDataSettingsDlgAdv::ProcessCommandL
|
|
315 |
// --------------------------------------------------------------------------
|
|
316 |
//
|
|
317 |
void CmPluginPacketDataSettingsDlgAdv::ProcessCommandL( TInt aCommandId )
|
|
318 |
{
|
|
319 |
if ( !iCanEditingContinue )
|
|
320 |
{
|
|
321 |
// We have to block all editing activity if database changed by
|
|
322 |
// other application
|
|
323 |
return;
|
|
324 |
}
|
|
325 |
|
|
326 |
if ( MenuShowing() )
|
|
327 |
{
|
|
328 |
HideMenu();
|
|
329 |
}
|
|
330 |
|
|
331 |
switch ( aCommandId )
|
|
332 |
{
|
|
333 |
case EPluginBaseCmdExit:
|
|
334 |
{
|
|
335 |
iExitReason = KDialogUserExit; // flow to EAknSoftkeyBack
|
|
336 |
}
|
|
337 |
case EAknSoftkeyBack:
|
|
338 |
{
|
|
339 |
TryExitL( iExitReason );
|
|
340 |
break;
|
|
341 |
}
|
|
342 |
case EAknSoftkeyOk:
|
|
343 |
case EPluginBaseCmdChange:
|
|
344 |
{
|
|
345 |
TInt attrib = iSettingIndex->At( iListbox->CurrentItemIndex() );
|
|
346 |
ShowPopupSettingPageL( attrib, aCommandId );
|
|
347 |
|
|
348 |
if ( iHasSettingChanged )
|
|
349 |
{
|
|
350 |
iHasSettingChanged = EFalse; // Don't call UpdateL at this stage
|
|
351 |
}
|
|
352 |
break;
|
|
353 |
}
|
|
354 |
default:
|
|
355 |
{
|
|
356 |
CmPluginBaseSettingsDlgAdv::ProcessCommandL( aCommandId );
|
|
357 |
|
|
358 |
if ( iHasSettingChanged )
|
|
359 |
{
|
|
360 |
iHasSettingChanged = EFalse; // Don't call UpdateL at this stage
|
|
361 |
}
|
|
362 |
break;
|
|
363 |
}
|
|
364 |
}
|
|
365 |
}
|
|
366 |
|
|
367 |
// --------------------------------------------------------------------------
|
|
368 |
// CmPluginPacketDataSettingsDlgAdv::OkToExitL
|
|
369 |
// --------------------------------------------------------------------------
|
|
370 |
//
|
|
371 |
TBool CmPluginPacketDataSettingsDlgAdv::OkToExitL( TInt aButtonId )
|
|
372 |
{
|
|
373 |
// Database has been changed by other application so exit from this view
|
|
374 |
// without update editings to database
|
|
375 |
if ( !iCanEditingContinue )
|
|
376 |
{
|
|
377 |
if ( iExitReason == KDialogUserExit )
|
|
378 |
{
|
|
379 |
iCmPluginBaseEng.CmMgr().WatcherUnRegister();
|
|
380 |
|
|
381 |
// Set iExitReason back to KDialogUserBack so as to exit from this view through else in the next call
|
|
382 |
TInt exitValue = KDialogUserExit;
|
|
383 |
iExitReason = KDialogUserBack;
|
|
384 |
// If destination has been deleted by other application
|
|
385 |
// then we may have to exit from Cmmgr
|
|
386 |
TryExitL( exitValue );
|
|
387 |
return EFalse;
|
|
388 |
}
|
|
389 |
else
|
|
390 |
{
|
|
391 |
// Exit from this view here to avoid possible update to databse
|
|
392 |
return ETrue;
|
|
393 |
}
|
|
394 |
}
|
|
395 |
|
|
396 |
TBool retval( EFalse );
|
|
397 |
switch ( aButtonId )
|
|
398 |
{
|
|
399 |
case EPluginBaseCmdExit:
|
|
400 |
case EAknSoftkeyBack:
|
|
401 |
{
|
|
402 |
CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
|
|
403 |
cmMgr.WatcherUnRegister();
|
|
404 |
|
|
405 |
iExitReason = KDialogUserBack;
|
|
406 |
retval = ETrue;
|
|
407 |
}
|
|
408 |
break;
|
|
409 |
default:
|
|
410 |
{
|
|
411 |
retval = CmPluginBaseSettingsDlgAdv::OkToExitL( aButtonId );
|
|
412 |
break;
|
|
413 |
}
|
|
414 |
}
|
|
415 |
|
|
416 |
return retval;
|
|
417 |
}
|
|
418 |
|
|
419 |
// --------------------------------------------------------------------------
|
|
420 |
// CmPluginPacketDataSettingsDlgAdv::ShowPDPTypeRBPageL
|
|
421 |
// --------------------------------------------------------------------------
|
|
422 |
//
|
|
423 |
void CmPluginPacketDataSettingsDlgAdv::ShowPDPTypeRBPageL( TUint32 aAttribute )
|
|
424 |
{
|
|
425 |
TInt selected = iCmPluginBaseEng.GetIntAttributeL( aAttribute );
|
|
426 |
|
|
427 |
TInt originalValue = selected;
|
|
428 |
|
|
429 |
if ( ShowRadioButtonSettingPageL( KPDPSelectionItems,
|
|
430 |
selected,
|
|
431 |
R_GPRS_PLUGIN_VIEW_PDP_TYPE ) &&
|
|
432 |
originalValue != selected )
|
|
433 |
{
|
|
434 |
iCmPluginBaseEng.SetIntAttributeL( aAttribute , selected );
|
|
435 |
UpdateListBoxContentL();
|
|
436 |
}
|
|
437 |
}
|
|
438 |
|
|
439 |
// --------------------------------------------------------------------------
|
|
440 |
// CmPluginPacketDataSettingsDlgAdv::RegisterParentView
|
|
441 |
// --------------------------------------------------------------------------
|
|
442 |
//
|
|
443 |
void CmPluginPacketDataSettingsDlgAdv::RegisterParentView( CCmParentViewNotifier* aParent )
|
|
444 |
{
|
|
445 |
iParent = aParent;
|
|
446 |
}
|
|
447 |
|
|
448 |
// --------------------------------------------------------------------------
|
|
449 |
// CmPluginPacketDataSettingsDlgAdv::CommsDatChangesL
|
|
450 |
// --------------------------------------------------------------------------
|
|
451 |
//
|
|
452 |
void CmPluginPacketDataSettingsDlgAdv::CommsDatChangesL()
|
|
453 |
{
|
|
454 |
if ( !iCanEditingContinue )
|
|
455 |
{
|
|
456 |
return;
|
|
457 |
}
|
|
458 |
|
|
459 |
CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
|
|
460 |
CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
|
|
461 |
|
|
462 |
if ( parentDest )
|
|
463 |
{
|
|
464 |
if( !cmMgr.DestinationStillExistedL( parentDest ) )
|
|
465 |
{
|
|
466 |
if( iParent )
|
|
467 |
{
|
|
468 |
iParent->NotifyParentView( KCmNotifiedDestinationDisappear );
|
|
469 |
}
|
|
470 |
|
|
471 |
iCanEditingContinue = EFalse;
|
|
472 |
iExitReason = KDialogUserExit;
|
|
473 |
|
|
474 |
cmMgr.RemoveDestFromPool( parentDest );
|
|
475 |
delete parentDest;
|
|
476 |
return;
|
|
477 |
}
|
|
478 |
|
|
479 |
// We may have to go back to parent view if database is changed by other application
|
|
480 |
if( iParent )
|
|
481 |
{
|
|
482 |
iParent->NotifyParentView( KCmNotifiedIapDisappear );
|
|
483 |
}
|
|
484 |
iCanEditingContinue = EFalse;
|
|
485 |
|
|
486 |
cmMgr.RemoveDestFromPool( parentDest );
|
|
487 |
delete parentDest;
|
|
488 |
}
|
|
489 |
else // Legacy
|
|
490 |
{
|
|
491 |
// We may have to go back to parent view if database is changed by other application
|
|
492 |
if( iParent )
|
|
493 |
{
|
|
494 |
iParent->NotifyParentView( KCmNotifiedIapDisappear );
|
|
495 |
}
|
|
496 |
iCanEditingContinue = EFalse;
|
|
497 |
}
|
|
498 |
}
|