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: Summary |
15 * Wlan Wizard Page: Summary |
16 * |
16 */ |
17 */ |
|
18 |
17 |
19 // System includes |
18 // System includes |
|
19 |
20 #include <HbMainWindow> |
20 #include <HbMainWindow> |
21 #include <HbDocumentLoader> |
21 #include <HbDocumentLoader> |
22 #include <HbWidget> |
22 #include <HbWidget> |
23 #include <HbListWidget> |
23 #include <HbListWidget> |
24 #include <HbListWidgetItem> |
24 #include <HbListWidgetItem> |
25 #include <HbStyleLoader> |
25 #include <HbStyleLoader> |
26 |
26 |
27 // User includes |
27 // User includes |
|
28 |
28 #include "wlanqtutils.h" |
29 #include "wlanqtutils.h" |
29 #include "wlanwizard_p.h" |
30 #include "wlanwizard_p.h" |
30 #include "wlanwizardplugin.h" |
31 #include "wlanwizardplugin.h" |
31 #include "wlanwizardsummaryviewitem.h" |
32 #include "wlanwizardsummaryviewitem.h" |
32 #include "wlanwizardpagesummary.h" |
33 #include "wlanwizardpagesummary.h" |
|
34 |
33 #include "OstTraceDefinitions.h" |
35 #include "OstTraceDefinitions.h" |
34 #ifdef OST_TRACE_COMPILER_IN_USE |
36 #ifdef OST_TRACE_COMPILER_IN_USE |
35 #include "wlanwizardpagesummaryTraces.h" |
37 #include "wlanwizardpagesummaryTraces.h" |
36 #endif |
38 #endif |
37 |
39 |
59 */ |
61 */ |
60 WlanWizardPageSummary::WlanWizardPageSummary(WlanWizardPrivate* parent) : |
62 WlanWizardPageSummary::WlanWizardPageSummary(WlanWizardPrivate* parent) : |
61 WlanWizardPageInternal(parent), |
63 WlanWizardPageInternal(parent), |
62 mListWidget(NULL) |
64 mListWidget(NULL) |
63 { |
65 { |
64 OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_ENTRY ); |
66 OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_ENTRY); |
65 OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_EXIT ); |
67 OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_EXIT); |
66 } |
68 } |
67 |
69 |
68 /*! |
70 /*! |
69 Destructor. |
71 Destructor. |
70 */ |
72 */ |
71 WlanWizardPageSummary::~WlanWizardPageSummary() |
73 WlanWizardPageSummary::~WlanWizardPageSummary() |
72 { |
74 { |
73 OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_ENTRY ); |
75 OstTraceFunctionEntry0(DUP1_WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_ENTRY); |
|
76 |
74 HbStyleLoader::unregisterFilePath(WlanWizardPageSummaryLayout); |
77 HbStyleLoader::unregisterFilePath(WlanWizardPageSummaryLayout); |
75 |
78 |
76 // Wizard framework deletes the visualization (owns mListWidget). |
79 // Wizard framework deletes the visualization (owns mListWidget). |
77 OstTraceFunctionExit0( DUP1_WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_EXIT ); |
80 |
|
81 OstTraceFunctionExit0(DUP1_WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_EXIT); |
78 } |
82 } |
79 |
83 |
80 /*! |
84 /*! |
81 See WlanWizardPage::initializePage() |
85 See WlanWizardPage::initializePage() |
82 */ |
86 */ |
83 HbWidget* WlanWizardPageSummary::initializePage() |
87 HbWidget* WlanWizardPageSummary::initializePage() |
84 { |
88 { |
85 OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_INITIALIZEPAGE_ENTRY ); |
89 OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_INITIALIZEPAGE_ENTRY); |
|
90 |
86 // Note that from summary page it is not possible to step back |
91 // Note that from summary page it is not possible to step back |
87 // this means that it is not possible that this method is called twice. |
92 // this means that it is not possible that this method is called twice. |
88 Q_ASSERT(!mListWidget); |
93 Q_ASSERT(!mListWidget); |
89 |
94 |
90 loadDocml(); |
95 loadDocml(); |
101 appendToList( |
106 appendToList( |
102 row, hbTrId("txt_occ_dblist_security_mode"), securityModeText()); |
107 row, hbTrId("txt_occ_dblist_security_mode"), securityModeText()); |
103 |
108 |
104 addDynamicItems(row); |
109 addDynamicItems(row); |
105 |
110 |
106 OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_INITIALIZEPAGE_EXIT ); |
111 OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_INITIALIZEPAGE_EXIT); |
107 return qobject_cast<HbWidget*>(mListWidget); |
112 return qobject_cast<HbWidget*>(mListWidget); |
108 } |
113 } |
109 |
114 |
110 /*! |
115 /*! |
111 Loads docml. |
116 Loads docml. |
112 */ |
117 */ |
113 void WlanWizardPageSummary::loadDocml() |
118 void WlanWizardPageSummary::loadDocml() |
114 { |
119 { |
115 OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_LOADDOCML_ENTRY ); |
120 OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_LOADDOCML_ENTRY); |
|
121 |
116 bool ok; |
122 bool ok; |
117 HbDocumentLoader docLoader(mWizard->mainWindow()); |
123 HbDocumentLoader docLoader(mWizard->mainWindow()); |
118 |
124 |
119 docLoader.load(":/docml/occ_add_wlan_05.docml", &ok); |
125 docLoader.load(":/docml/occ_add_wlan_05.docml", &ok); |
120 Q_ASSERT(ok); |
126 Q_ASSERT(ok); |
130 mListWidget->setLayoutName("wlanwizardsummaryitem"); |
136 mListWidget->setLayoutName("wlanwizardsummaryitem"); |
131 |
137 |
132 // Register the location of hblistviewitem.css and hblistviewitem.widgetml |
138 // Register the location of hblistviewitem.css and hblistviewitem.widgetml |
133 ok = HbStyleLoader::registerFilePath(WlanWizardPageSummaryLayout); |
139 ok = HbStyleLoader::registerFilePath(WlanWizardPageSummaryLayout); |
134 Q_ASSERT(ok); |
140 Q_ASSERT(ok); |
135 OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_LOADDOCML_EXIT ); |
141 |
|
142 OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_LOADDOCML_EXIT); |
136 } |
143 } |
137 |
144 |
138 /*! |
145 /*! |
139 Gets localized network mode from the WlanWizardPrivate::ConfNetworkMode |
146 Gets localized network mode from the WlanWizardPrivate::ConfNetworkMode |
140 configuration. |
147 configuration. |
141 |
148 |
142 @return localized network mode text. |
149 @return localized network mode text. |
143 */ |
150 */ |
144 QString WlanWizardPageSummary::networkModeText() const |
151 QString WlanWizardPageSummary::networkModeText() const |
145 { |
152 { |
146 OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_NETWORKMODETEXT_ENTRY ); |
153 OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_NETWORKMODETEXT_ENTRY); |
|
154 |
147 QString ret; |
155 QString ret; |
148 int mode = mWizard->configuration( |
156 int mode = mWizard->configuration( |
149 WlanWizardPrivate::ConfNetworkMode).toInt(); |
157 WlanWizardPrivate::ConfNetworkMode).toInt(); |
150 |
158 |
151 switch (mode) { |
159 switch (mode) { |
153 ret = hbTrId("txt_occ_dblist_network_mode_val_adhoc"); |
161 ret = hbTrId("txt_occ_dblist_network_mode_val_adhoc"); |
154 break; |
162 break; |
155 |
163 |
156 default: |
164 default: |
157 Q_ASSERT(mode == CMManagerShim::Infra); |
165 Q_ASSERT(mode == CMManagerShim::Infra); |
158 if (mWizard->configuration(WlanWizardPrivate::ConfHiddenWlan).toBool()) { |
166 if (mWizard->configuration(WlanWizardPrivate::ConfWlanScanSSID).toBool()) { |
159 ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_hi"); |
167 ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_hi"); |
160 } else { |
168 } else { |
161 ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_pu"); |
169 ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_pu"); |
162 } |
170 } |
163 break; |
171 break; |
164 } |
172 } |
165 OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_NETWORKMODETEXT_EXIT ); |
173 |
|
174 OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_NETWORKMODETEXT_EXIT); |
166 return ret; |
175 return ret; |
167 } |
176 } |
168 |
177 |
169 /*! |
178 /*! |
170 Gets localized security mode from the WlanWizardPrivate::ConfSecurityMode |
179 Gets localized security mode from the WlanWizardPrivate::ConfSecurityMode |
172 |
181 |
173 @return localized security mode text. |
182 @return localized security mode text. |
174 */ |
183 */ |
175 QString WlanWizardPageSummary::securityModeText() const |
184 QString WlanWizardPageSummary::securityModeText() const |
176 { |
185 { |
177 OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_SECURITYMODETEXT_ENTRY ); |
186 OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_SECURITYMODETEXT_ENTRY); |
|
187 |
178 QString ret; |
188 QString ret; |
179 int mode = mWizard->configuration(WlanWizardPrivate::ConfSecurityMode).toInt(); |
189 int mode = mWizard->configuration(WlanWizardPrivate::ConfSecurityMode).toInt(); |
180 switch (mode) { |
190 switch (mode) { |
181 case CMManagerShim::WlanSecMode802_1x: |
191 case CMManagerShim::WlanSecMode802_1x: |
182 ret = hbTrId("txt_occ_dblist_security_mode_val_8021x"); |
192 ret = hbTrId("txt_occ_dblist_security_mode_val_8021x"); |
205 default: |
215 default: |
206 Q_ASSERT(mode == CMManagerShim::WlanSecModeOpen); |
216 Q_ASSERT(mode == CMManagerShim::WlanSecModeOpen); |
207 ret = hbTrId("txt_occ_dblist_security_mode_val_open"); |
217 ret = hbTrId("txt_occ_dblist_security_mode_val_open"); |
208 break; |
218 break; |
209 } |
219 } |
210 OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_SECURITYMODETEXT_EXIT ); |
220 |
|
221 OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_SECURITYMODETEXT_EXIT); |
211 return ret; |
222 return ret; |
212 } |
223 } |
213 |
224 |
214 /*! |
225 /*! |
215 Adds dynamic content to the view. |
226 Adds dynamic content to the view. |
216 |
227 |
217 @param [in,out] row row to where insert happens. |
228 @param [in,out] row row to where insert happens. |
218 */ |
229 */ |
219 void WlanWizardPageSummary::addDynamicItems(int &row) |
230 void WlanWizardPageSummary::addDynamicItems(int &row) |
220 { |
231 { |
221 OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_ADDDYNAMICITEMS_ENTRY ); |
232 OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_ADDDYNAMICITEMS_ENTRY); |
|
233 |
222 if (mWizard->isEapEnabled()) { |
234 if (mWizard->isEapEnabled()) { |
223 appendToListPluginInfo(WlanWizardPlugin::SummaryEapOuterType, row); |
235 appendToListPluginInfo(WlanWizardPlugin::SummaryEapOuterType, row); |
224 appendToListPluginInfo(WlanWizardPlugin::SummaryEapInnerType, row); |
236 appendToListPluginInfo(WlanWizardPlugin::SummaryEapInnerType, row); |
225 appendToListPluginInfo(WlanWizardPlugin::SummaryEapFastProvisioningMode, row); |
237 appendToListPluginInfo(WlanWizardPlugin::SummaryEapFastProvisioningMode, row); |
226 } |
238 } |
242 Q_ASSERT(WlanQtUtils::IctHotspotPassed == |
254 Q_ASSERT(WlanQtUtils::IctHotspotPassed == |
243 mWizard->configuration(WlanWizardPrivate::ConfIctStatus).toInt()); |
255 mWizard->configuration(WlanWizardPrivate::ConfIctStatus).toInt()); |
244 // Add nothing to list. |
256 // Add nothing to list. |
245 break; |
257 break; |
246 } |
258 } |
247 OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_ADDDYNAMICITEMS_EXIT ); |
259 |
|
260 OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_ADDDYNAMICITEMS_EXIT); |
248 } |
261 } |
249 |
262 |
250 /*! |
263 /*! |
251 Appends new item to the end of the summary list |
264 Appends new item to the end of the summary list |
252 |
265 |
257 void WlanWizardPageSummary::appendToList( |
270 void WlanWizardPageSummary::appendToList( |
258 int &row, |
271 int &row, |
259 const QString title, |
272 const QString title, |
260 const QString value) |
273 const QString value) |
261 { |
274 { |
262 OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_APPENDTOLIST_ENTRY ); |
275 OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_APPENDTOLIST_ENTRY); |
|
276 |
263 HbListWidgetItem *item = new HbListWidgetItem(); |
277 HbListWidgetItem *item = new HbListWidgetItem(); |
264 item->setText(title); |
278 item->setText(title); |
265 item->setSecondaryText(value); |
279 item->setSecondaryText(value); |
266 mListWidget->insertItem(row++, item); |
280 mListWidget->insertItem(row++, item); |
267 OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_APPENDTOLIST_EXIT ); |
281 |
|
282 OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_APPENDTOLIST_EXIT); |
268 } |
283 } |
269 |
284 |
270 /*! |
285 /*! |
271 Appends new item to the end of the summary list |
286 Appends new item to the end of the summary list |
272 |
287 |
273 @param [in] id Plugin summary id |
288 @param [in] id Plugin summary id |
274 @param [in,out] row number to where the item is inserted |
289 @param [in,out] row number to where the item is inserted |
275 */ |
290 */ |
276 void WlanWizardPageSummary::appendToListPluginInfo( |
291 void WlanWizardPageSummary::appendToListPluginInfo( |
277 WlanWizardPlugin::Summary id, int &row ) |
292 WlanWizardPlugin::Summary id, |
278 { |
293 int &row) |
279 OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_APPENDTOLISTPLUGININFO_ENTRY ); |
294 { |
|
295 OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_APPENDTOLISTPLUGININFO_ENTRY); |
|
296 |
280 QString title; |
297 QString title; |
281 QString value; |
298 QString value; |
282 WlanWizardPlugin *plugin = mWizard->wlanWizardPlugin(); |
299 WlanWizardPlugin *plugin = mWizard->wlanWizardPlugin(); |
283 Q_ASSERT(plugin); |
300 Q_ASSERT(plugin); |
284 if (plugin->summary(id, title, value)) { |
301 if (plugin->summary(id, title, value)) { |
285 appendToList(row, title, value ); |
302 appendToList(row, title, value ); |
286 } |
303 } |
287 OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_APPENDTOLISTPLUGININFO_EXIT ); |
304 |
288 } |
305 OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_APPENDTOLISTPLUGININFO_EXIT); |
|
306 } |