31
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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:
|
|
15 |
* Wlan Wizard Page: Summary
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
// System includes
|
|
20 |
#include <HbMainWindow>
|
|
21 |
#include <HbDocumentLoader>
|
|
22 |
#include <HbWidget>
|
|
23 |
#include <HbListWidget>
|
|
24 |
#include <HbListWidgetItem>
|
|
25 |
#include <HbStyleLoader>
|
|
26 |
|
|
27 |
// User includes
|
39
|
28 |
#include "wlanqtutils.h"
|
31
|
29 |
#include "wlanwizard_p.h"
|
|
30 |
#include "wlanwizardplugin.h"
|
|
31 |
#include "wlanwizardsummaryviewitem.h"
|
|
32 |
#include "wlanwizardpagesummary.h"
|
43
|
33 |
#include "OstTraceDefinitions.h"
|
|
34 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
35 |
#include "wlanwizardpagesummaryTraces.h"
|
|
36 |
#endif
|
|
37 |
|
31
|
38 |
|
|
39 |
/*!
|
|
40 |
\class WlanWizardPageSummary
|
|
41 |
\brief Implements Wizard summary page.
|
|
42 |
*/
|
|
43 |
|
|
44 |
// External function prototypes
|
|
45 |
|
|
46 |
// Local constants
|
|
47 |
|
|
48 |
//! Path for layout of custom list widget
|
|
49 |
static const char WlanWizardPageSummaryLayout[] = ":/wizardsummarylayout/";
|
|
50 |
|
|
51 |
// ======== LOCAL FUNCTIONS ========
|
|
52 |
|
|
53 |
// ======== MEMBER FUNCTIONS ========
|
|
54 |
|
|
55 |
/*!
|
|
56 |
Constructor.
|
|
57 |
|
|
58 |
@param [in] parent pointer to private implementation of wizard.
|
|
59 |
*/
|
|
60 |
WlanWizardPageSummary::WlanWizardPageSummary(WlanWizardPrivate* parent) :
|
|
61 |
WlanWizardPageInternal(parent),
|
|
62 |
mListWidget(NULL)
|
|
63 |
{
|
43
|
64 |
OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_ENTRY );
|
|
65 |
OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_EXIT );
|
31
|
66 |
}
|
|
67 |
|
|
68 |
/*!
|
|
69 |
Destructor.
|
|
70 |
*/
|
|
71 |
WlanWizardPageSummary::~WlanWizardPageSummary()
|
|
72 |
{
|
43
|
73 |
OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_ENTRY );
|
31
|
74 |
HbStyleLoader::unregisterFilePath(WlanWizardPageSummaryLayout);
|
|
75 |
|
|
76 |
// Wizard framework deletes the visualization (owns mListWidget).
|
43
|
77 |
OstTraceFunctionExit0( DUP1_WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_EXIT );
|
31
|
78 |
}
|
|
79 |
|
|
80 |
/*!
|
|
81 |
See WlanWizardPage::initializePage()
|
|
82 |
*/
|
|
83 |
HbWidget* WlanWizardPageSummary::initializePage()
|
|
84 |
{
|
43
|
85 |
OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_INITIALIZEPAGE_ENTRY );
|
31
|
86 |
// 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.
|
|
88 |
Q_ASSERT(!mListWidget);
|
|
89 |
|
|
90 |
loadDocml();
|
|
91 |
int row = 0;
|
|
92 |
|
|
93 |
appendToList(
|
|
94 |
row,
|
|
95 |
hbTrId("txt_occ_dblist_network_name"),
|
|
96 |
mWizard->configuration(WlanWizardPrivate::ConfSsid).toString());
|
|
97 |
|
|
98 |
appendToList(
|
|
99 |
row, hbTrId("txt_occ_dblist_network_mode"), networkModeText());
|
|
100 |
|
|
101 |
appendToList(
|
|
102 |
row, hbTrId("txt_occ_dblist_security_mode"), securityModeText());
|
|
103 |
|
|
104 |
addDynamicItems(row);
|
|
105 |
|
43
|
106 |
OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_INITIALIZEPAGE_EXIT );
|
31
|
107 |
return qobject_cast<HbWidget*>(mListWidget);
|
|
108 |
}
|
|
109 |
|
|
110 |
/*!
|
|
111 |
Loads docml.
|
|
112 |
*/
|
|
113 |
void WlanWizardPageSummary::loadDocml()
|
|
114 |
{
|
43
|
115 |
OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_LOADDOCML_ENTRY );
|
31
|
116 |
bool ok;
|
|
117 |
HbDocumentLoader docLoader(mWizard->mainWindow());
|
|
118 |
|
|
119 |
docLoader.load(":/docml/occ_add_wlan_05.docml", &ok);
|
|
120 |
Q_ASSERT(ok);
|
|
121 |
|
|
122 |
mListWidget = qobject_cast<HbListWidget *>(docLoader.findWidget("occ_add_wlan_05"));
|
|
123 |
Q_ASSERT(mListWidget != NULL);
|
|
124 |
|
|
125 |
// Set own list prototype handler to disable TAP gestures and selections
|
|
126 |
mListWidget->setItemPrototype(
|
|
127 |
new WlanWizardSummaryListViewItem(mListWidget));
|
|
128 |
|
|
129 |
// set the layout name to match the layout name in hblistviewitem.css file
|
|
130 |
mListWidget->setLayoutName("wlanwizardsummaryitem");
|
|
131 |
|
|
132 |
// Register the location of hblistviewitem.css and hblistviewitem.widgetml
|
|
133 |
ok = HbStyleLoader::registerFilePath(WlanWizardPageSummaryLayout);
|
|
134 |
Q_ASSERT(ok);
|
43
|
135 |
OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_LOADDOCML_EXIT );
|
31
|
136 |
}
|
|
137 |
|
|
138 |
/*!
|
|
139 |
Gets localized network mode from the WlanWizardPrivate::ConfNetworkMode
|
|
140 |
configuration.
|
|
141 |
|
|
142 |
@return localized network mode text.
|
|
143 |
*/
|
|
144 |
QString WlanWizardPageSummary::networkModeText() const
|
|
145 |
{
|
43
|
146 |
OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_NETWORKMODETEXT_ENTRY );
|
31
|
147 |
QString ret;
|
|
148 |
int mode = mWizard->configuration(
|
|
149 |
WlanWizardPrivate::ConfNetworkMode).toInt();
|
|
150 |
|
|
151 |
switch (mode) {
|
|
152 |
case CMManagerShim::Adhoc:
|
|
153 |
ret = hbTrId("txt_occ_dblist_network_mode_val_adhoc");
|
|
154 |
break;
|
|
155 |
|
|
156 |
default:
|
|
157 |
Q_ASSERT(mode == CMManagerShim::Infra);
|
|
158 |
if (mWizard->configuration(WlanWizardPrivate::ConfHiddenWlan).toBool()) {
|
|
159 |
ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_hi");
|
|
160 |
} else {
|
|
161 |
ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_pu");
|
|
162 |
}
|
|
163 |
break;
|
|
164 |
}
|
43
|
165 |
OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_NETWORKMODETEXT_EXIT );
|
31
|
166 |
return ret;
|
|
167 |
}
|
|
168 |
|
|
169 |
/*!
|
|
170 |
Gets localized security mode from the WlanWizardPrivate::ConfSecurityMode
|
|
171 |
configuration.
|
|
172 |
|
|
173 |
@return localized security mode text.
|
|
174 |
*/
|
|
175 |
QString WlanWizardPageSummary::securityModeText() const
|
|
176 |
{
|
43
|
177 |
OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_SECURITYMODETEXT_ENTRY );
|
31
|
178 |
QString ret;
|
|
179 |
int mode = mWizard->configuration(WlanWizardPrivate::ConfSecurityMode).toInt();
|
|
180 |
switch (mode) {
|
|
181 |
case CMManagerShim::WlanSecMode802_1x:
|
|
182 |
ret = hbTrId("txt_occ_dblist_security_mode_val_8021x");
|
|
183 |
break;
|
|
184 |
|
|
185 |
case CMManagerShim::WlanSecModeWep:
|
|
186 |
ret = hbTrId("txt_occ_dblist_security_mode_val_wep");
|
|
187 |
break;
|
|
188 |
|
|
189 |
case CMManagerShim::WlanSecModeWpa:
|
|
190 |
if (mWizard->configuration(WlanWizardPrivate::ConfUsePsk).toBool()) {
|
|
191 |
ret = hbTrId("txt_occ_dblist_security_mode_val_wpawpa2psk");
|
|
192 |
} else {
|
|
193 |
ret = hbTrId("txt_occ_dblist_security_mode_val_wpawpa2_with_eap");
|
|
194 |
}
|
|
195 |
break;
|
|
196 |
|
|
197 |
case CMManagerShim::WlanSecModeWpa2:
|
|
198 |
if (mWizard->configuration(WlanWizardPrivate::ConfUsePsk).toBool()) {
|
|
199 |
ret = hbTrId("txt_occ_dblist_security_mode_val_wpa2_with_passwor");
|
|
200 |
} else {
|
|
201 |
ret = hbTrId("txt_occ_dblist_security_mode_val_wpa2_with_eap");
|
|
202 |
}
|
|
203 |
break;
|
|
204 |
|
|
205 |
default:
|
|
206 |
Q_ASSERT(mode == CMManagerShim::WlanSecModeOpen);
|
|
207 |
ret = hbTrId("txt_occ_dblist_security_mode_val_open");
|
|
208 |
break;
|
|
209 |
}
|
43
|
210 |
OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_SECURITYMODETEXT_EXIT );
|
31
|
211 |
return ret;
|
|
212 |
}
|
|
213 |
|
|
214 |
/*!
|
|
215 |
Adds dynamic content to the view.
|
|
216 |
|
|
217 |
@param [in,out] row row to where insert happens.
|
|
218 |
*/
|
|
219 |
void WlanWizardPageSummary::addDynamicItems(int &row)
|
|
220 |
{
|
43
|
221 |
OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_ADDDYNAMICITEMS_ENTRY );
|
31
|
222 |
if (mWizard->isEapEnabled()) {
|
|
223 |
appendToListPluginInfo(WlanWizardPlugin::SummaryEapOuterType, row);
|
|
224 |
appendToListPluginInfo(WlanWizardPlugin::SummaryEapInnerType, row);
|
|
225 |
appendToListPluginInfo(WlanWizardPlugin::SummaryEapFastProvisioningMode, row);
|
|
226 |
}
|
|
227 |
|
|
228 |
QString value;
|
39
|
229 |
|
31
|
230 |
switch (mWizard->configuration(WlanWizardPrivate::ConfIctStatus).toInt()) {
|
39
|
231 |
case WlanQtUtils::IctPassed:
|
31
|
232 |
value = hbTrId("txt_occ_dblist_destination_val_internet");
|
|
233 |
appendToList(row, hbTrId("txt_occ_dblist_destination"), value);
|
|
234 |
break;
|
39
|
235 |
|
|
236 |
case WlanQtUtils::IctFailed:
|
31
|
237 |
value = hbTrId("txt_occ_dblist_destination_val_uncategorized");
|
|
238 |
appendToList(row, hbTrId("txt_occ_dblist_destination"), value);
|
39
|
239 |
break;
|
|
240 |
|
|
241 |
default:
|
43
|
242 |
Q_ASSERT(WlanQtUtils::IctHotspotPassed ==
|
|
243 |
mWizard->configuration(WlanWizardPrivate::ConfIctStatus).toInt());
|
39
|
244 |
// Add nothing to list.
|
|
245 |
break;
|
31
|
246 |
}
|
43
|
247 |
OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_ADDDYNAMICITEMS_EXIT );
|
31
|
248 |
}
|
|
249 |
|
|
250 |
/*!
|
|
251 |
Appends new item to the end of the summary list
|
|
252 |
|
|
253 |
@param [in,out] row number to where the item is inserted
|
|
254 |
@param [in] title title of the item
|
|
255 |
@param [in] value value of the item
|
|
256 |
*/
|
|
257 |
void WlanWizardPageSummary::appendToList(
|
|
258 |
int &row,
|
|
259 |
const QString title,
|
|
260 |
const QString value)
|
|
261 |
{
|
43
|
262 |
OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_APPENDTOLIST_ENTRY );
|
31
|
263 |
HbListWidgetItem *item = new HbListWidgetItem();
|
|
264 |
item->setText(title);
|
|
265 |
item->setSecondaryText(value);
|
|
266 |
mListWidget->insertItem(row++, item);
|
43
|
267 |
OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_APPENDTOLIST_EXIT );
|
31
|
268 |
}
|
|
269 |
|
|
270 |
/*!
|
|
271 |
Appends new item to the end of the summary list
|
|
272 |
|
|
273 |
@param [in] id Plugin summary id
|
|
274 |
@param [in,out] row number to where the item is inserted
|
|
275 |
*/
|
|
276 |
void WlanWizardPageSummary::appendToListPluginInfo(
|
|
277 |
WlanWizardPlugin::Summary id, int &row )
|
|
278 |
{
|
43
|
279 |
OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_APPENDTOLISTPLUGININFO_ENTRY );
|
31
|
280 |
QString title;
|
|
281 |
QString value;
|
|
282 |
WlanWizardPlugin *plugin = mWizard->wlanWizardPlugin();
|
|
283 |
Q_ASSERT(plugin);
|
|
284 |
if (plugin->summary(id, title, value)) {
|
|
285 |
appendToList(row, title, value );
|
|
286 |
}
|
43
|
287 |
OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_APPENDTOLISTPLUGININFO_EXIT );
|
31
|
288 |
}
|