|
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: WLAN Ipv6 settings dialog |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <StringLoader.h> |
|
19 #include <akntitle.h> |
|
20 #include <aknnavide.h> |
|
21 #include <cmcommonui.h> |
|
22 #include <cmwlanui.rsg> |
|
23 #include <cmmanager.rsg> |
|
24 #include <csxhelp/cp.hlp.hrh> |
|
25 |
|
26 #include <cmpluginwlandef.h> |
|
27 #include "cmpluginwlan.h" |
|
28 #include "cmpwlansettingsdlgipv6.h" |
|
29 #include "cmwlancommonconstants.h" |
|
30 #include "cmpluginmenucommands.hrh" |
|
31 #include "cmpluginmultilinedialog.h" |
|
32 #include <cmcommonconstants.h> |
|
33 #include <cmpsettingsconsts.h> |
|
34 #include "cmmanagerimpl.h" |
|
35 |
|
36 using namespace CMManager; |
|
37 |
|
38 const TUint32 KIPv6SelectionItems[] = |
|
39 { |
|
40 R_QTN_SET_DNS_SERVERS_AUTOMATIC, |
|
41 R_QTN_SET_IP_WELL_KNOWN, |
|
42 R_QTN_SET_IP_USER_DEFINED, |
|
43 0 |
|
44 }; |
|
45 |
|
46 // ================= MEMBER FUNCTIONS ======================================= |
|
47 |
|
48 // -------------------------------------------------------------------------- |
|
49 // CmPluginWlanSettingsDlgIpv6::NewL |
|
50 // Two-phase dconstructor, second phase is ConstructAndRunLD |
|
51 // -------------------------------------------------------------------------- |
|
52 // |
|
53 CmPluginWlanSettingsDlgIpv6* CmPluginWlanSettingsDlgIpv6::NewL( |
|
54 CCmPluginBaseEng& aCmPluginBase ) |
|
55 { |
|
56 CmPluginWlanSettingsDlgIpv6* self = |
|
57 new (ELeave) CmPluginWlanSettingsDlgIpv6( aCmPluginBase ); |
|
58 return self; |
|
59 } |
|
60 |
|
61 // -------------------------------------------------------------------------- |
|
62 // CmPluginWlanSettingsDlgIpv6::CmPluginWlanSettingsDlgIpv6 |
|
63 // -------------------------------------------------------------------------- |
|
64 // |
|
65 CmPluginWlanSettingsDlgIpv6::CmPluginWlanSettingsDlgIpv6( |
|
66 CCmPluginBaseEng& aCmPluginBase ): |
|
67 CmPluginBaseSettingsDlgIp( aCmPluginBase ) , |
|
68 iParent( NULL ) |
|
69 { |
|
70 iHelpContext = KSET_HLP_AP_WLAN_AS_IPV6; |
|
71 } |
|
72 |
|
73 // -------------------------------------------------------------------------- |
|
74 // CmPluginWlanSettingsDlgIpv6::~CmPluginWlanSettingsDlgIpv6 |
|
75 // -------------------------------------------------------------------------- |
|
76 // |
|
77 CmPluginWlanSettingsDlgIpv6::~CmPluginWlanSettingsDlgIpv6() |
|
78 { |
|
79 } |
|
80 |
|
81 // -------------------------------------------------------------------------- |
|
82 // CmPluginWlanSettingsDlgIpv6::ConstructAndRunLD |
|
83 // -------------------------------------------------------------------------- |
|
84 // |
|
85 TInt CmPluginWlanSettingsDlgIpv6::ConstructAndRunLD() |
|
86 { |
|
87 // Set this flag to allow edit continue |
|
88 iCanEditingContinue = ETrue; |
|
89 |
|
90 CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
|
91 cmMgr.WatcherRegisterL( this ); |
|
92 |
|
93 return CmPluginBaseSettingsDlgIp::ConstructAndRunLD(); |
|
94 } |
|
95 |
|
96 // -------------------------------------------------------------------------- |
|
97 // CmPluginWlanSettingsDlgIpv6::UpdateListBoxContentBearerSpecificL |
|
98 // -------------------------------------------------------------------------- |
|
99 // |
|
100 void CmPluginWlanSettingsDlgIpv6::UpdateListBoxContentBearerSpecificL( |
|
101 CDesCArray& aItemArray ) |
|
102 { |
|
103 TInt value( 0 ); |
|
104 |
|
105 // DNS SERVERS IP ADDRESS |
|
106 switch ( GetIPv6DNSTypeL( EWlanIp6NameServer1, |
|
107 EWlanIp6NameServer2 ) ) |
|
108 { |
|
109 case EIpv6DNSDynamic: |
|
110 { |
|
111 value = R_QTN_SET_DNS_SERVERS_AUTOMATIC; |
|
112 break; |
|
113 } |
|
114 case EIpv6DNSWellKnown: |
|
115 { |
|
116 value = R_QTN_SET_IP_WELL_KNOWN; |
|
117 break; |
|
118 } |
|
119 case EIpv6DNSUserDefined: |
|
120 { |
|
121 value = R_QTN_SET_IP_USER_DEFINED; |
|
122 break; |
|
123 } |
|
124 default: |
|
125 { |
|
126 User::Leave( KErrNotSupported ); |
|
127 break; |
|
128 } |
|
129 } |
|
130 AppendSettingTextsL( aItemArray, |
|
131 EWlanIp6DNSAddrFromServer, |
|
132 value ); |
|
133 } |
|
134 |
|
135 //--------------------------------------------------------------------------- |
|
136 // CmPluginWlanSettingsDlgIpv6::ShowPopupSettingPageL |
|
137 //--------------------------------------------------------------------------- |
|
138 // |
|
139 TBool CmPluginWlanSettingsDlgIpv6::ShowPopupSettingPageL( TUint32 aAttribute, |
|
140 TInt aCommandId ) |
|
141 { |
|
142 TBool retval = EFalse; |
|
143 switch ( aAttribute ) |
|
144 { |
|
145 case EWlanIp6DNSAddrFromServer: |
|
146 { |
|
147 ShowPopupIPv6DNSEditorL( KIPv6SelectionItems, |
|
148 EWlanIp6DNSAddrFromServer, |
|
149 EWlanIp6NameServer1, |
|
150 EWlanIp6NameServer2 ); |
|
151 break; |
|
152 } |
|
153 default: |
|
154 { |
|
155 CmPluginBaseSettingsDlgIp::ShowPopupSettingPageL( aAttribute, |
|
156 aCommandId ); |
|
157 break; |
|
158 } |
|
159 } |
|
160 return retval; |
|
161 } |
|
162 |
|
163 //--------------------------------------------------------------------------- |
|
164 // CmPluginWlanSettingsDlgIpv6::InitTextsL |
|
165 // called before the dialog is shown to initialize localized textual data |
|
166 //--------------------------------------------------------------------------- |
|
167 // |
|
168 void CmPluginWlanSettingsDlgIpv6::InitTextsL() |
|
169 { |
|
170 // set pane text if neccessary... |
|
171 // pane text needed if not pop-up... |
|
172 if ( iEikonEnv ) |
|
173 { |
|
174 iStatusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
175 iTitlePane = ( CAknTitlePane* )iStatusPane->ControlL( |
|
176 TUid::Uid( EEikStatusPaneUidTitle ) ); |
|
177 |
|
178 iOldTitleText = iTitlePane->Text()->AllocL(); |
|
179 HBufC* title = StringLoader::LoadLC ( R_QTN_SET_IPV6_SETTINGS ); |
|
180 iTitlePane->SetTextL( *title ) ; |
|
181 CleanupStack::PopAndDestroy(title); |
|
182 iNaviPane = ( CAknNavigationControlContainer* ) |
|
183 iStatusPane->ControlL( |
|
184 TUid::Uid( EEikStatusPaneUidNavi ) ); |
|
185 iNaviDecorator = iNaviPane->CreateNavigationLabelL( KNullDesC ); |
|
186 iNaviPane->PushL( *iNaviDecorator ); |
|
187 } |
|
188 } |
|
189 |
|
190 // -------------------------------------------------------------------------- |
|
191 // CmPluginWlanSettingsDlgIpv6::ProcessCommandL |
|
192 // -------------------------------------------------------------------------- |
|
193 // |
|
194 void CmPluginWlanSettingsDlgIpv6:: ProcessCommandL( TInt aCommandId ) |
|
195 { |
|
196 if ( !iCanEditingContinue ) |
|
197 { |
|
198 // We have to block all editing activity if database changed by |
|
199 // other application |
|
200 return; |
|
201 } |
|
202 |
|
203 if ( MenuShowing() ) |
|
204 { |
|
205 HideMenu(); |
|
206 } |
|
207 |
|
208 switch ( aCommandId ) |
|
209 { |
|
210 case EPluginBaseCmdExit: |
|
211 { |
|
212 iExitReason = KDialogUserExit; |
|
213 } |
|
214 // fall-through intended here |
|
215 case EAknSoftkeyBack: |
|
216 { |
|
217 CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
|
218 cmMgr.WatcherUnRegister(); |
|
219 |
|
220 TryExitL( iExitReason ); |
|
221 break; |
|
222 } |
|
223 case EAknSoftkeyOk: |
|
224 case EPluginBaseCmdChange: |
|
225 { |
|
226 TInt attrib = iSettingIndex->At( iListbox->CurrentItemIndex() ); |
|
227 ShowPopupSettingPageL( attrib, aCommandId); |
|
228 break; |
|
229 } |
|
230 default: |
|
231 { |
|
232 CmPluginBaseSettingsDlgIp::ProcessCommandL( aCommandId ); |
|
233 break; |
|
234 } |
|
235 } |
|
236 } |
|
237 |
|
238 // -------------------------------------------------------------------------- |
|
239 // CmPluginWlanSettingsDlgIpv6::OkToExitL |
|
240 // -------------------------------------------------------------------------- |
|
241 // |
|
242 TBool CmPluginWlanSettingsDlgIpv6::OkToExitL( TInt aButtonId ) |
|
243 { |
|
244 // Database has been changed by other application so exit from this view |
|
245 // without update editings to database |
|
246 if ( !iCanEditingContinue ) |
|
247 { |
|
248 if ( iExitReason == KDialogUserExit ) |
|
249 { |
|
250 iCmPluginBaseEng.CmMgr().WatcherUnRegister(); |
|
251 |
|
252 // Set iExitReason back to KDialogUserBack so as to exit from this view through else in the next call |
|
253 TInt exitValue = KDialogUserExit; |
|
254 iExitReason = KDialogUserBack; |
|
255 // If destination has been deleted by other application |
|
256 // then we may have to exit from Cmmgr |
|
257 TryExitL( exitValue ); |
|
258 return EFalse; |
|
259 } |
|
260 else |
|
261 { |
|
262 // Exit from this view here to avoid possible update to databse |
|
263 return ETrue; |
|
264 } |
|
265 } |
|
266 |
|
267 TBool retval( EFalse ); |
|
268 |
|
269 switch ( aButtonId ) |
|
270 { |
|
271 case EAknSoftkeyBack: |
|
272 case EAknSoftkeyExit: |
|
273 case KDialogUserExit: |
|
274 { |
|
275 CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
|
276 cmMgr.WatcherUnRegister(); |
|
277 |
|
278 iExitReason = KDialogUserBack; |
|
279 retval = ETrue; |
|
280 } |
|
281 break; |
|
282 default: |
|
283 { |
|
284 retval = CmPluginBaseSettingsDlgIp::OkToExitL( aButtonId ); |
|
285 break; |
|
286 } |
|
287 } |
|
288 return retval; |
|
289 } |
|
290 |
|
291 // -------------------------------------------------------------------------- |
|
292 // CmPluginWlanSettingsDlgIpv6::RegisterParentView |
|
293 // -------------------------------------------------------------------------- |
|
294 // |
|
295 void CmPluginWlanSettingsDlgIpv6::RegisterParentView( CCmParentViewNotifier* aParent ) |
|
296 { |
|
297 iParent = aParent; |
|
298 } |
|
299 |
|
300 // -------------------------------------------------------------------------- |
|
301 // CmPluginWlanSettingsDlgIpv6::CommsDatChangesL |
|
302 // -------------------------------------------------------------------------- |
|
303 // |
|
304 void CmPluginWlanSettingsDlgIpv6::CommsDatChangesL() |
|
305 { |
|
306 if ( !iCanEditingContinue ) |
|
307 { |
|
308 return; |
|
309 } |
|
310 |
|
311 CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
|
312 CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination(); |
|
313 |
|
314 if ( parentDest ) |
|
315 { |
|
316 if( !cmMgr.DestinationStillExistedL( parentDest ) ) |
|
317 { |
|
318 if( iParent ) |
|
319 { |
|
320 iParent->NotifyParentView( KCmNotifiedDestinationDisappear ); |
|
321 } |
|
322 |
|
323 // If parent destination is deleted by somebody then the dialog must exit back to main view |
|
324 iExitReason = KDialogUserExit; |
|
325 iCanEditingContinue = EFalse; |
|
326 |
|
327 cmMgr.RemoveDestFromPool( parentDest ); |
|
328 delete parentDest; |
|
329 return; |
|
330 } |
|
331 |
|
332 // We may have to go back to parent view if database is changed by other application |
|
333 if( iParent ) |
|
334 { |
|
335 iParent->NotifyParentView( KCmNotifiedIapDisappear ); |
|
336 } |
|
337 iCanEditingContinue = EFalse; |
|
338 |
|
339 cmMgr.RemoveDestFromPool( parentDest ); |
|
340 delete parentDest; |
|
341 } |
|
342 else |
|
343 { |
|
344 // We may have to go back to parent view if database is changed by other application |
|
345 if( iParent ) |
|
346 { |
|
347 iParent->NotifyParentView( KCmNotifiedIapDisappear ); |
|
348 } |
|
349 iCanEditingContinue = EFalse; |
|
350 } |
|
351 } |