1 /* |
1 /* |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
8 * |
9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * WLAN Wizard Page: Security mode Selection. |
15 * WLAN Wizard Page: Security mode Selection. |
16 * |
16 */ |
17 */ |
|
18 |
17 |
19 // System includes |
18 // System includes |
|
19 |
20 #include <HbDocumentLoader> |
20 #include <HbDocumentLoader> |
21 #include <HbWidget> |
21 #include <HbWidget> |
22 #include <HbRadioButtonList> |
22 #include <HbRadioButtonList> |
23 #include <HbMainWindow> |
23 #include <HbMainWindow> |
24 #include <HbLabel> |
24 #include <HbLabel> |
|
25 |
25 #include <cmmanagerdefines_shim.h> |
26 #include <cmmanagerdefines_shim.h> |
26 |
27 |
27 // User includes |
28 // User includes |
|
29 |
28 #include "wlanwizard_p.h" |
30 #include "wlanwizard_p.h" |
29 #include "wlanwizard.h" |
31 #include "wlanwizard.h" |
30 #include "wlanwizardpagesecuritymode.h" |
32 #include "wlanwizardpagesecuritymode.h" |
31 #include "wlanwizardscanlist.h" |
33 #include "wlanwizardscanlist.h" |
|
34 |
32 #include "OstTraceDefinitions.h" |
35 #include "OstTraceDefinitions.h" |
33 #ifdef OST_TRACE_COMPILER_IN_USE |
36 #ifdef OST_TRACE_COMPILER_IN_USE |
34 #include "wlanwizardpagesecuritymodeTraces.h" |
37 #include "wlanwizardpagesecuritymodeTraces.h" |
35 #endif |
38 #endif |
36 |
39 |
45 mList(NULL), |
48 mList(NULL), |
46 mLabel(NULL), |
49 mLabel(NULL), |
47 mLoader(NULL), |
50 mLoader(NULL), |
48 mValid(false) |
51 mValid(false) |
49 { |
52 { |
50 OstTraceFunctionEntry0( WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_ENTRY ); |
53 OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_ENTRY); |
51 OstTraceFunctionExit0( WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_EXIT ); |
54 OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_EXIT); |
52 } |
55 } |
53 |
56 |
54 /*! |
57 /*! |
55 * Destructor. Loader widget is deleted. |
58 * Destructor. Loader widget is deleted. |
56 * All document widgets are deleted by wlanwizard_p destructor. |
59 * All document widgets are deleted by wlanwizard_p destructor. |
57 */ |
60 */ |
58 WlanWizardPageSecurityMode::~WlanWizardPageSecurityMode() |
61 WlanWizardPageSecurityMode::~WlanWizardPageSecurityMode() |
59 { |
62 { |
60 OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_ENTRY ); |
63 OstTraceFunctionEntry0(DUP1_WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_ENTRY); |
|
64 |
61 delete mLoader; |
65 delete mLoader; |
62 OstTraceFunctionExit0( DUP1_WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_EXIT ); |
66 |
|
67 OstTraceFunctionExit0(DUP1_WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_EXIT); |
63 } |
68 } |
64 |
69 |
65 /*! |
70 /*! |
66 * Page initialization. If view widget is already loaded, does nothing. |
71 * Page initialization. If view widget is already loaded, does nothing. |
67 * @return pointer to widget "occ_add_wlan_02". |
72 * @return pointer to widget "occ_add_wlan_02". |
68 */ |
73 */ |
69 HbWidget* WlanWizardPageSecurityMode::initializePage() |
74 HbWidget* WlanWizardPageSecurityMode::initializePage() |
70 { |
75 { |
71 OstTraceFunctionEntry0( WLANWIZARDPAGESECURITYMODE_INITIALIZEPAGE_ENTRY ); |
76 OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_INITIALIZEPAGE_ENTRY); |
72 OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESECURITYMODE_INITIALIZEPAGE, |
77 |
73 "WlanWizardPageSecurityMode::initializePage" ); |
78 OstTrace0( |
|
79 TRACE_NORMAL, |
|
80 WLANWIZARDPAGESECURITYMODE_INITIALIZEPAGE, |
|
81 "WlanWizardPageSecurityMode::initializePage"); |
74 |
82 |
75 if (mWidget==NULL) { |
83 if (mWidget==NULL) { |
76 |
84 |
77 mLoader = new HbDocumentLoader(mWizard->mainWindow()); |
85 mLoader = new HbDocumentLoader(mWizard->mainWindow()); |
78 |
86 |
124 * @return depending on the sequrity mode, returns the appropriate view |
132 * @return depending on the sequrity mode, returns the appropriate view |
125 * identifier. |
133 * identifier. |
126 */ |
134 */ |
127 int WlanWizardPageSecurityMode::nextId(bool &removeFromStack) const |
135 int WlanWizardPageSecurityMode::nextId(bool &removeFromStack) const |
128 { |
136 { |
129 OstTraceFunctionEntry0( WLANWIZARDPAGESECURITYMODE_NEXTID_ENTRY ); |
137 OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_NEXTID_ENTRY); |
|
138 |
130 removeFromStack = false; |
139 removeFromStack = false; |
131 |
140 |
132 // The configuration is selected from the mSecModes list, which is ordered |
141 // The configuration is selected from the mSecModes list, which is ordered |
133 // during the page initialization. |
142 // during the page initialization. |
134 mWizard->setConfiguration( WlanWizardPrivate::ConfSecurityMode, |
143 mWizard->setConfiguration( |
135 mSecModes.at( mList->selected() ) ); |
144 WlanWizardPrivate::ConfSecurityMode, |
|
145 mSecModes.at(mList->selected())); |
136 |
146 |
137 // The configuration is selected from the mUsePsk list, which is ordered |
147 // The configuration is selected from the mUsePsk list, which is ordered |
138 // during the page initialization. |
148 // during the page initialization. |
139 mWizard->setConfiguration( WlanWizardPrivate::ConfUsePsk, |
149 mWizard->setConfiguration( |
140 mUsePsk.at( mList->selected() ) ); |
150 WlanWizardPrivate::ConfUsePsk, |
141 OstTraceFunctionExit0( LANWIZARDPAGESECURITYMODE_NEXTID_EXIT ); |
151 mUsePsk.at(mList->selected())); |
|
152 |
|
153 OstTraceFunctionExit0(LANWIZARDPAGESECURITYMODE_NEXTID_EXIT); |
142 return mPageIds.at( mList->selected() ); |
154 return mPageIds.at( mList->selected() ); |
143 } |
155 } |
144 |
156 |
145 /*! |
157 /*! |
146 * This method is overrides the default implementation from WlanWizardPage. |
158 * This method is overrides the default implementation from WlanWizardPage. |
147 * It indicates whether the Next-button should be enabled or not. |
159 * It indicates whether the Next-button should be enabled or not. |
148 * @return true, if a mode has been selected. |
160 * @return true, if a mode has been selected. |
149 */ |
161 */ |
150 bool WlanWizardPageSecurityMode::showPage() |
162 bool WlanWizardPageSecurityMode::showPage() |
151 { |
163 { |
152 OstTraceFunctionEntry0( WLANWIZARDPAGESECURITYMODE_SHOWPAGE_ENTRY ); |
164 OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_SHOWPAGE_ENTRY); |
153 OstTraceFunctionExit0( WLANWIZARDPAGESECURITYMODE_SHOWPAGE_EXIT ); |
165 OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_SHOWPAGE_EXIT); |
154 return mValid; |
166 return mValid; |
155 } |
167 } |
156 |
168 |
157 /*! |
169 /*! |
158 * Is invoked when user selects a mode from the radio button list. |
170 * Is invoked when user selects a mode from the radio button list. |
159 * (HbRadioButtonList's itemSelected-signal) |
171 * (HbRadioButtonList's itemSelected-signal) |
160 */ |
172 */ |
161 void WlanWizardPageSecurityMode::itemSelected() |
173 void WlanWizardPageSecurityMode::itemSelected() |
162 { |
174 { |
163 OstTraceFunctionEntry0( WLANWIZARDPAGESECURITYMODE_ITEMSELECTED_ENTRY ); |
175 OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_ITEMSELECTED_ENTRY); |
164 OstTrace0( TRACE_BORDER, WLANWIZARDPAGESECURITYMODE_ITEMSELECTED, |
176 |
165 "WlanWizardPageSecurityMode::itemSelected" ); |
177 OstTrace0( |
|
178 TRACE_BORDER, |
|
179 WLANWIZARDPAGESECURITYMODE_ITEMSELECTED, |
|
180 "WlanWizardPageSecurityMode::itemSelected"); |
166 |
181 |
167 mValid = true; |
182 mValid = true; |
168 mWizard->enableNextButton(mValid); |
183 mWizard->enableNextButton(mValid); |
169 OstTraceFunctionExit0( WLANWIZARDPAGESECURITYMODE_ITEMSELECTED_EXIT ); |
184 |
|
185 OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_ITEMSELECTED_EXIT); |
170 } |
186 } |
171 |
187 |
172 /*! |
188 /*! |
173 * Loads the document orientation information from occ_add_wlan_02_03.docml |
189 * Loads the document orientation information from occ_add_wlan_02_03.docml |
174 * This is called each time phone orientation changes. |
190 * This is called each time phone orientation changes. |
175 * @param [in] orientation indicates whether the phone is in portrait or |
191 * @param [in] orientation indicates whether the phone is in portrait or |
176 * landscape mode. |
192 * landscape mode. |
177 */ |
193 */ |
178 void WlanWizardPageSecurityMode::loadDocmlSection(Qt::Orientation orientation) |
194 void WlanWizardPageSecurityMode::loadDocmlSection(Qt::Orientation orientation) |
179 { |
195 { |
180 OstTraceFunctionEntry0( WLANWIZARDPAGESECURITYMODE_LOADDOCMLSECTION_ENTRY ); |
196 OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_LOADDOCMLSECTION_ENTRY); |
181 OstTrace1( TRACE_NORMAL, WLANWIZARDPAGESECURITYMODE_LOADDOCML, |
197 |
|
198 OstTrace1( |
|
199 TRACE_NORMAL, |
|
200 WLANWIZARDPAGESECURITYMODE_LOADDOCML, |
182 "WlanWizardPageSecurityMode::loadDocml - orientation;orientation=%x", |
201 "WlanWizardPageSecurityMode::loadDocml - orientation;orientation=%x", |
183 ( TUint )( orientation ) ); |
202 (TUint)orientation); |
184 |
203 |
185 WlanWizardPageInternal::loadDocmlSection( |
204 WlanWizardPageInternal::loadDocmlSection( |
186 mLoader, |
205 mLoader, |
187 orientation, |
206 orientation, |
188 ":/docml/occ_add_wlan_02_03.docml", |
207 ":/docml/occ_add_wlan_02_03.docml", |
189 "portrait_section", |
208 "portrait_section", |
190 "landscape_section"); |
209 "landscape_section"); |
191 OstTraceFunctionExit0( WLANWIZARDPAGESECURITYMODE_LOADDOCMLSECTION_EXIT ); |
210 |
|
211 OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_LOADDOCMLSECTION_EXIT); |
192 } |
212 } |
193 |
213 |
194 /*! |
214 /*! |
195 * Support function that creates the contents of the security mode list. |
215 * Support function that creates the contents of the security mode list. |
196 */ |
216 */ |
197 void WlanWizardPageSecurityMode::populateSecModeList() |
217 void WlanWizardPageSecurityMode::populateSecModeList() |
198 { |
218 { |
199 OstTraceFunctionEntry0( WLANWIZARDPAGESECURITYMODE_POPULATESECMODELIST_ENTRY ); |
219 OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_POPULATESECMODELIST_ENTRY); |
|
220 |
200 QStringList items; |
221 QStringList items; |
201 |
222 |
202 mSecModes.clear(); |
223 mSecModes.clear(); |
203 mPageIds.clear(); |
224 mPageIds.clear(); |
204 mUsePsk.clear(); |
225 mUsePsk.clear(); |
209 mValid = false; |
230 mValid = false; |
210 |
231 |
211 // Create the radio button list to correspond to correct security mode |
232 // Create the radio button list to correspond to correct security mode |
212 // identifiers and page identifiers. |
233 // identifiers and page identifiers. |
213 // Populate the list according to network mode selection. |
234 // Populate the list according to network mode selection. |
214 addToList(items, hbTrId("txt_occ_list_open"), |
235 addToList( |
|
236 items, |
|
237 hbTrId("txt_occ_list_open"), |
215 CMManagerShim::WlanSecModeOpen, |
238 CMManagerShim::WlanSecModeOpen, |
216 WlanWizardPage::PageProcessSettings, |
239 WlanWizardPage::PageProcessSettings, |
217 false); |
240 false); |
218 |
241 |
219 addToList(items, hbTrId("txt_occ_list_wep_1"), |
242 addToList( |
|
243 items, |
|
244 hbTrId("txt_occ_list_wep_1"), |
220 CMManagerShim::WlanSecModeWep, |
245 CMManagerShim::WlanSecModeWep, |
221 WlanWizardPageInternal::PageKeyQuery, |
246 WlanWizardPageInternal::PageKeyQuery, |
222 true); |
247 true); |
223 |
248 |
224 // In case of Ad-hoc network, exclude wpa, eap and 802.1X modes. |
249 // In case of Ad-hoc network, exclude wpa, eap and 802.1X modes. |
225 if (mWizard->configuration(WlanWizardPrivate::ConfNetworkMode).toInt() |
250 if (mWizard->configuration(WlanWizardPrivate::ConfNetworkMode).toInt() |
226 != CMManagerShim::Adhoc) { |
251 != CMManagerShim::Adhoc) { |
227 |
252 |
228 addToList(items, hbTrId("txt_occ_list_wpa_with_password"), |
253 addToList( |
|
254 items, |
|
255 hbTrId("txt_occ_list_wpa_with_password"), |
229 CMManagerShim::WlanSecModeWpa, |
256 CMManagerShim::WlanSecModeWpa, |
230 WlanWizardPageInternal::PageKeyQuery, |
257 WlanWizardPageInternal::PageKeyQuery, |
231 true); |
258 true); |
232 |
259 |
233 addToList(items, hbTrId("txt_occ_list_wpa_with_eap"), |
260 addToList( |
|
261 items, |
|
262 hbTrId("txt_occ_list_wpa_with_eap"), |
234 CMManagerShim::WlanSecModeWpa, |
263 CMManagerShim::WlanSecModeWpa, |
235 WlanWizardPage::PageEapStart, |
264 WlanWizardPage::PageEapStart, |
236 false); |
265 false); |
237 |
266 |
238 addToList(items, hbTrId("txt_occ_list_8021x_1"), |
267 addToList( |
|
268 items, |
|
269 hbTrId("txt_occ_list_8021x_1"), |
239 CMManagerShim::WlanSecMode802_1x, |
270 CMManagerShim::WlanSecMode802_1x, |
240 WlanWizardPage::PageEapStart, |
271 WlanWizardPage::PageEapStart, |
241 false); |
272 false); |
242 } |
273 } |
243 |
274 |
244 mList->setItems(items); |
275 mList->setItems(items); |
245 |
276 |
246 OstTraceFunctionExit0( WLANWIZARDPAGESECURITYMODE_POPULATESECMODELIST_EXIT ); |
277 OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_POPULATESECMODELIST_EXIT); |
247 } |
278 } |
248 |
279 |
249 /*! |
280 /*! |
250 * A support function to map the radio button list to a generic network |
281 * A support function to map the radio button list to a generic network |
251 * mode list. This enables the changing of button order without it |
282 * mode list. This enables the changing of button order without it |
256 * list |
287 * list |
257 * @param [in] mode is the security mode associated with the item |
288 * @param [in] mode is the security mode associated with the item |
258 * @param [in] page is the id of the next wizard page when this item is selected. |
289 * @param [in] page is the id of the next wizard page when this item is selected. |
259 * @param [in] psk indicates whether password needs to be queried. |
290 * @param [in] psk indicates whether password needs to be queried. |
260 */ |
291 */ |
261 void WlanWizardPageSecurityMode::addToList(QStringList &list, |
292 void WlanWizardPageSecurityMode::addToList( |
262 const QString &item, int mode, int page, bool psk) |
293 QStringList &list, |
263 { |
294 const QString &item, |
264 OstTraceFunctionEntry0( WLANWIZARDPAGESECURITYMODE_ADDTOLIST_ENTRY ); |
295 int mode, |
|
296 int page, |
|
297 bool psk) |
|
298 { |
|
299 OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_ADDTOLIST_ENTRY); |
|
300 |
265 if (mWizard->configurationExists(WlanWizardHelper::ConfAvailableNetworkOptions)) { |
301 if (mWizard->configurationExists(WlanWizardHelper::ConfAvailableNetworkOptions)) { |
266 WlanNetworkSetting netMode; |
302 WlanNetworkSetting netMode; |
267 netMode.mode = mWizard->configuration(WlanWizardPrivate::ConfNetworkMode).toInt(); |
303 netMode.mode = mWizard->configuration(WlanWizardPrivate::ConfNetworkMode).toInt(); |
268 netMode.hidden = mWizard->configuration(WlanWizardPrivate::ConfHiddenWlan).toBool(); |
304 netMode.hidden = mWizard->configuration(WlanWizardPrivate::ConfWlanScanSSID).toBool(); |
269 netMode.wpsSupported = mWizard->configuration(WlanWizardPrivate::ConfWpsSupported).toBool(); |
305 netMode.wpsSupported = mWizard->configuration(WlanWizardPrivate::ConfWpsSupported).toBool(); |
270 WlanWizardScanList networkOptions = mWizard->configuration( |
306 WlanWizardScanList networkOptions = mWizard->configuration( |
271 WlanWizardHelper::ConfAvailableNetworkOptions).value<WlanWizardScanList>(); |
307 WlanWizardHelper::ConfAvailableNetworkOptions).value<WlanWizardScanList>(); |
272 |
308 |
273 for (int i = 0; i < networkOptions.secModes(netMode); i++) { |
309 for (int i = 0; i < networkOptions.secModes(netMode); i++) { |