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