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:
|
60
|
15 |
* WLAN Wizard Page: Processing settings, connection and running ICT.
|
31
|
16 |
*/
|
|
17 |
|
|
18 |
// System includes
|
|
19 |
#include <HbMainWindow>
|
|
20 |
#include <HbDocumentLoader>
|
|
21 |
#include <HbWidget>
|
|
22 |
#include <HbLabel>
|
|
23 |
#include <HbProgressBar>
|
39
|
24 |
#include <HbParameterLengthLimiter>
|
31
|
25 |
#include <wlanerrorcodes.h>
|
|
26 |
|
|
27 |
// User includes
|
|
28 |
#include "wlanwizardplugin.h"
|
|
29 |
#include "wlanqtutils.h"
|
|
30 |
#include "wlanwizard_p.h"
|
|
31 |
#include "wlanwizardpageprocessingsettings.h"
|
|
32 |
#include "OstTraceDefinitions.h"
|
|
33 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
34 |
#include "wlanwizardpageprocessingsettingsTraces.h"
|
|
35 |
#endif
|
|
36 |
|
|
37 |
/*!
|
|
38 |
\class WlanWizardPageProcessingSettings
|
|
39 |
\brief Implements Processing settings wizard page.
|
|
40 |
|
|
41 |
In this page
|
|
42 |
- possible wizard plugin settings are stored
|
|
43 |
- connection to the wlan ap is established
|
|
44 |
- ICT (Internet connectivity test) is run
|
|
45 |
*/
|
|
46 |
|
|
47 |
// External function prototypes
|
|
48 |
|
|
49 |
// Local constants
|
|
50 |
|
|
51 |
// ======== LOCAL FUNCTIONS ========
|
|
52 |
|
|
53 |
// ======== MEMBER FUNCTIONS ========
|
|
54 |
|
|
55 |
|
|
56 |
/*!
|
|
57 |
Constructor.
|
|
58 |
|
|
59 |
@param [in] parent pointer to private implementation of wizard.
|
|
60 |
*/
|
|
61 |
WlanWizardPageProcessingSettings::WlanWizardPageProcessingSettings(
|
|
62 |
WlanWizardPrivate* parent) :
|
|
63 |
WlanWizardPageInternal(parent),
|
|
64 |
mDocLoader(NULL),
|
|
65 |
mWidget(NULL),
|
|
66 |
mLabel(NULL),
|
|
67 |
mNextPageId(WlanWizardPageInternal::PageSummary)
|
|
68 |
{
|
60
|
69 |
OstTraceFunctionEntry0(WLANWIZARDPAGEPROCESSINGSETTINGS_WLANWIZARDPAGEPROCESSINGSETTINGS_ENTRY);
|
|
70 |
|
31
|
71 |
WlanQtUtils* utils = mWizard->wlanQtUtils();
|
|
72 |
|
|
73 |
bool ok;
|
|
74 |
ok = connect(
|
39
|
75 |
utils,
|
|
76 |
SIGNAL(wlanNetworkOpened(int)),
|
|
77 |
this,
|
|
78 |
SLOT(wlanNetworkOpened(int)));
|
31
|
79 |
Q_ASSERT(ok);
|
|
80 |
|
|
81 |
ok = connect(
|
39
|
82 |
utils,
|
|
83 |
SIGNAL(wlanNetworkClosed(int,int)),
|
|
84 |
this,
|
|
85 |
SLOT(wlanNetworkClosed(int,int)));
|
31
|
86 |
Q_ASSERT(ok);
|
|
87 |
|
|
88 |
ok = connect(
|
39
|
89 |
utils,
|
|
90 |
SIGNAL(ictResult(int,int)),
|
|
91 |
this,
|
|
92 |
SLOT(ictResult(int,int)));
|
|
93 |
Q_ASSERT(ok);
|
|
94 |
|
31
|
95 |
Q_UNUSED(ok);
|
|
96 |
Q_ASSERT(ok);
|
60
|
97 |
|
|
98 |
OstTraceFunctionExit0(WLANWIZARDPAGEPROCESSINGSETTINGS_WLANWIZARDPAGEPROCESSINGSETTINGS_EXIT);
|
31
|
99 |
}
|
|
100 |
|
|
101 |
/*!
|
|
102 |
Destructor.
|
|
103 |
*/
|
|
104 |
WlanWizardPageProcessingSettings::~WlanWizardPageProcessingSettings()
|
|
105 |
{
|
60
|
106 |
OstTraceFunctionEntry0(DUP1_WLANWIZARDPAGEPROCESSINGSETTINGS_WLANWIZARDPAGEPROCESSINGSETTINGS_ENTRY);
|
|
107 |
|
31
|
108 |
// signals are automatically disconnected
|
|
109 |
delete mDocLoader;
|
|
110 |
|
|
111 |
// Wizard framework deletes the visualization (owns mWidget).
|
60
|
112 |
|
|
113 |
OstTraceFunctionExit0(DUP1_WLANWIZARDPAGEPROCESSINGSETTINGS_WLANWIZARDPAGEPROCESSINGSETTINGS_EXIT);
|
31
|
114 |
}
|
|
115 |
|
|
116 |
/*!
|
|
117 |
See WlanWizardPage::initializePage()
|
|
118 |
*/
|
|
119 |
HbWidget* WlanWizardPageProcessingSettings::initializePage()
|
|
120 |
{
|
60
|
121 |
OstTraceFunctionEntry0(WLANWIZARDPAGEPROCESSINGSETTINGS_INITIALIZEPAGE_ENTRY);
|
|
122 |
|
31
|
123 |
if (!mWidget) {
|
|
124 |
mDocLoader = new HbDocumentLoader(mWizard->mainWindow());
|
|
125 |
|
|
126 |
bool ok;
|
|
127 |
mDocLoader->load(":/docml/occ_add_wlan_06.docml", &ok);
|
|
128 |
Q_ASSERT(ok);
|
|
129 |
loadDocmlSection(mWizard->mainWindow()->orientation());
|
|
130 |
|
|
131 |
mWidget = qobject_cast<HbWidget*> (mDocLoader->findWidget("occ_add_wlan_06"));
|
|
132 |
Q_ASSERT(mWidget != NULL);
|
|
133 |
|
|
134 |
mLabel = qobject_cast<HbLabel*> (mDocLoader->findWidget("dialog"));
|
|
135 |
Q_ASSERT(mLabel != NULL);
|
|
136 |
|
|
137 |
ok = connect(
|
|
138 |
mWizard->mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)),
|
|
139 |
this, SLOT(loadDocmlSection(Qt::Orientation)));
|
|
140 |
Q_ASSERT(ok);
|
|
141 |
}
|
|
142 |
|
39
|
143 |
mLabel->setPlainText(
|
|
144 |
HbParameterLengthLimiter(
|
49
|
145 |
"txt_occ_dialog_checking_connection_to_1").arg(
|
60
|
146 |
mWizard->configuration(WlanWizardPrivate::ConfName).toString()));
|
31
|
147 |
|
60
|
148 |
OstTraceFunctionExit0(WLANWIZARDPAGEPROCESSINGSETTINGS_INITIALIZEPAGE_EXIT);
|
31
|
149 |
return mWidget;
|
|
150 |
}
|
|
151 |
|
|
152 |
/*!
|
|
153 |
See WlanWizardPage::nextId()
|
|
154 |
|
|
155 |
@param [out] removeFromStack return value is always true
|
|
156 |
|
|
157 |
@return WlanWizardPageInternal::PageSummary
|
|
158 |
*/
|
|
159 |
int WlanWizardPageProcessingSettings::nextId(bool &removeFromStack) const
|
|
160 |
{
|
60
|
161 |
OstTraceFunctionEntry0(WLANWIZARDPAGEPROCESSINGSETTINGS_NEXTID_ENTRY);
|
|
162 |
|
31
|
163 |
removeFromStack = true;
|
60
|
164 |
|
|
165 |
OstTraceFunctionExit0(WLANWIZARDPAGEPROCESSINGSETTINGS_NEXTID_EXIT);
|
31
|
166 |
return mNextPageId;
|
|
167 |
}
|
|
168 |
|
|
169 |
|
|
170 |
/*!
|
|
171 |
See WlanWizardPage::showPage()
|
|
172 |
|
|
173 |
@return false. Next button is dimmed when the page is displayed.
|
|
174 |
*/
|
|
175 |
bool WlanWizardPageProcessingSettings::showPage()
|
|
176 |
{
|
60
|
177 |
OstTraceFunctionEntry0(WLANWIZARDPAGEPROCESSINGSETTINGS_SHOWPAGE_ENTRY);
|
|
178 |
OstTraceFunctionExit0(WLANWIZARDPAGEPROCESSINGSETTINGS_SHOWPAGE_EXIT);
|
31
|
179 |
return false;
|
|
180 |
}
|
|
181 |
|
|
182 |
/*!
|
|
183 |
Loads docml at initialization phase and when HbMainWindow sends orientation()
|
|
184 |
signal.
|
|
185 |
|
|
186 |
@param [in] orientation to be loaded.
|
|
187 |
*/
|
|
188 |
void WlanWizardPageProcessingSettings::loadDocmlSection(Qt::Orientation orientation)
|
|
189 |
{
|
60
|
190 |
OstTraceFunctionEntry0(WLANWIZARDPAGEPROCESSINGSETTINGS_LOADDOCMLSECTION_ENTRY);
|
|
191 |
|
39
|
192 |
WlanWizardPageInternal::loadDocmlSection(
|
|
193 |
mDocLoader,
|
|
194 |
orientation,
|
|
195 |
":/docml/occ_add_wlan_06.docml",
|
|
196 |
"portrait_section",
|
|
197 |
"landscape_section");
|
60
|
198 |
|
|
199 |
OstTraceFunctionExit0(WLANWIZARDPAGEPROCESSINGSETTINGS_LOADDOCMLSECTION_EXIT);
|
31
|
200 |
}
|
|
201 |
|
|
202 |
/*!
|
|
203 |
This method is connected to WlanQtUtils::wlanNetworkClosed(int, int) signal.
|
|
204 |
to get disconnected status events of currently established connection.
|
|
205 |
|
|
206 |
In case of failure, movement to generic error page is triggered.
|
|
207 |
|
|
208 |
@param [in] iapId IAP ID
|
|
209 |
@param [in] reason Symbian Error code.
|
|
210 |
*/
|
|
211 |
void WlanWizardPageProcessingSettings::wlanNetworkClosed(int iapId, int reason)
|
|
212 |
{
|
60
|
213 |
OstTraceFunctionEntry0(WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKCLOSED_ENTRY);
|
|
214 |
|
|
215 |
OstTraceExt2(
|
|
216 |
TRACE_BORDER,
|
31
|
217 |
WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKCLOSED,
|
|
218 |
"WlanWizardPageProcessingSettings::wlanNetworkClosed;iapId=%d;reason=%d",
|
60
|
219 |
iapId,
|
|
220 |
reason);
|
31
|
221 |
|
|
222 |
if (iapId != mWizard->configuration(WlanWizardHelper::ConfIapId).toInt()) {
|
60
|
223 |
OstTraceFunctionExit0(WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKCLOSED_EXIT);
|
31
|
224 |
return;
|
|
225 |
}
|
|
226 |
|
|
227 |
mWizard->setConfiguration(WlanWizardPrivate::ConfIctStatus, false);
|
|
228 |
mWizard->setConfiguration(WlanWizardPrivate::ConfConnected, false);
|
|
229 |
|
|
230 |
if (mWizard->isCurrentPage(mWidget)) {
|
|
231 |
QString errorText;
|
|
232 |
switch (reason) {
|
|
233 |
case KErrWlanOpenAuthFailed:
|
|
234 |
case KErrWlanSharedKeyAuthRequired:
|
|
235 |
case KErrWlanWpaAuthRequired:
|
|
236 |
case KErrWlanWpaAuthFailed:
|
|
237 |
case KErrWlan802dot1xAuthFailed:
|
|
238 |
case KErrWlanIllegalEncryptionKeys:
|
|
239 |
case KErrWlanPskModeRequired:
|
|
240 |
case KErrWlanEapModeRequired:
|
|
241 |
errorText = hbTrId("txt_occ_dialog_authentication_unsuccessful");
|
|
242 |
break;
|
|
243 |
|
|
244 |
case KErrWlanIllegalWpaPskKey:
|
|
245 |
errorText = hbTrId("txt_occ_dialog_incorrect_wpa_preshared_key_pleas");
|
|
246 |
break;
|
|
247 |
|
|
248 |
case KErrWlanSharedKeyAuthFailed:
|
|
249 |
errorText = hbTrId("txt_occ_dialog_incorrect_wep_key_please_check_the");
|
|
250 |
break;
|
39
|
251 |
|
31
|
252 |
default:
|
39
|
253 |
// Handles also KErrNone
|
31
|
254 |
// Get plugin specific localized error text if any
|
|
255 |
WlanWizardPlugin *plugin = mWizard->wlanWizardPlugin();
|
|
256 |
|
|
257 |
if (plugin){
|
|
258 |
errorText = plugin->errorString(reason);
|
|
259 |
}
|
|
260 |
if (errorText.length() == 0) {
|
|
261 |
errorText = hbTrId("txt_occ_dialog_connection_failed");
|
|
262 |
}
|
|
263 |
break;
|
|
264 |
}
|
|
265 |
mNextPageId = WlanWizardPageInternal::PageGenericError;
|
|
266 |
mWizard->setConfiguration(
|
|
267 |
WlanWizardHelper::ConfGenericErrorString, errorText);
|
39
|
268 |
|
|
269 |
mWizard->setConfiguration(
|
|
270 |
WlanWizardHelper::ConfGenericErrorPageStepsBackwards,
|
|
271 |
WlanWizardPage::OneStepBackwards);
|
|
272 |
|
31
|
273 |
mWizard->nextPage();
|
|
274 |
}
|
|
275 |
|
|
276 |
OstTrace0(
|
60
|
277 |
TRACE_BORDER,
|
|
278 |
WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKCLOSED_DONE,
|
|
279 |
"WlanWizardPageProcessingSettings::wlanNetworkClosed - Done");
|
|
280 |
|
|
281 |
OstTraceFunctionExit0(DUP1_WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKCLOSED_EXIT);
|
31
|
282 |
}
|
|
283 |
|
|
284 |
/*!
|
|
285 |
Handles ictResult(int, bool) signal from WlanQtUtils and calls
|
|
286 |
WlanWizardHelper::nextPage() to trigger movement to next page.
|
|
287 |
|
|
288 |
@param [in] iapId IAP ID
|
|
289 |
@param [in] reason ICT result, Symbian error code
|
|
290 |
*/
|
39
|
291 |
void WlanWizardPageProcessingSettings::ictResult(int iapId, int reason)
|
31
|
292 |
{
|
60
|
293 |
OstTraceFunctionEntry0(WLANWIZARDPAGEPROCESSINGSETTINGS_ICTRESULT_ENTRY);
|
|
294 |
|
31
|
295 |
OstTraceExt2(
|
|
296 |
TRACE_BORDER,
|
|
297 |
WLANWIZARDPAGEPROCESSINGSETTINGS_ICTRESULT,
|
|
298 |
"WlanWizardPageProcessingSettings::ictResult;iapId=%d;result=%d",
|
60
|
299 |
iapId,
|
|
300 |
reason);
|
31
|
301 |
|
|
302 |
if (iapId != mWizard->configuration(WlanWizardHelper::ConfIapId).toInt()) {
|
60
|
303 |
OstTraceFunctionExit0(WLANWIZARDPAGEPROCESSINGSETTINGS_ICTRESULT_EXIT);
|
31
|
304 |
return;
|
|
305 |
}
|
39
|
306 |
|
|
307 |
// Cast of result .
|
|
308 |
WlanQtUtils::IctStatus status =
|
|
309 |
static_cast<WlanQtUtils::IctStatus>(reason);
|
|
310 |
|
|
311 |
if(status == WlanQtUtils::IctCancelled) {
|
|
312 |
|
|
313 |
mNextPageId = WlanWizardPageInternal::PageNone;
|
|
314 |
mWizard->cancelTriggered();
|
31
|
315 |
}
|
39
|
316 |
else {
|
|
317 |
mWizard->setConfiguration(WlanWizardPrivate::ConfConnected, true);
|
|
318 |
}
|
|
319 |
mWizard->setConfiguration(WlanWizardPrivate::ConfIctStatus, status);
|
|
320 |
|
31
|
321 |
mWizard->nextPage();
|
|
322 |
|
60
|
323 |
OstTrace0(
|
|
324 |
TRACE_BORDER,
|
|
325 |
WLANWIZARDPAGEPROCESSINGSETTINGS_ICTRESULT_DONE,
|
|
326 |
"WlanWizardPageProcessingSettings::ictResult - Done");
|
|
327 |
|
|
328 |
OstTraceFunctionExit0(DUP1_WLANWIZARDPAGEPROCESSINGSETTINGS_ICTRESULT_EXIT);
|
31
|
329 |
}
|
|
330 |
|
|
331 |
/*!
|
|
332 |
Handles wlanNetworkOpened(int) signal from WlanQtUtils.
|
|
333 |
|
|
334 |
@param [in] iapId IAP ID
|
|
335 |
*/
|
|
336 |
void WlanWizardPageProcessingSettings::wlanNetworkOpened(int iapId)
|
|
337 |
{
|
60
|
338 |
OstTraceFunctionEntry0(WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKOPENED_ENTRY);
|
|
339 |
|
31
|
340 |
Q_UNUSED(iapId);
|
|
341 |
OstTrace1(
|
|
342 |
TRACE_BORDER,
|
|
343 |
WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKOPENED,
|
|
344 |
"WlanWizardPageProcessingSettings::wlanNetworkOpened;iapId=%d",
|
|
345 |
iapId);
|
60
|
346 |
|
|
347 |
OstTraceFunctionExit0(WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKOPENED_EXIT);
|
31
|
348 |
}
|
|
349 |
|
|
350 |
/*!
|
|
351 |
See WlanWizardPage::requiresStartOperation().
|
|
352 |
|
|
353 |
Indicates to framework that startOperation() needs to called.
|
|
354 |
*/
|
|
355 |
bool WlanWizardPageProcessingSettings::requiresStartOperation()
|
|
356 |
{
|
60
|
357 |
OstTraceFunctionEntry0(WLANWIZARDPAGEPROCESSINGSETTINGS_REQUIRESSTARTOPERATION_ENTRY);
|
|
358 |
OstTraceFunctionExit0(WLANWIZARDPAGEPROCESSINGSETTINGS_REQUIRESSTARTOPERATION_EXIT);
|
31
|
359 |
return true;
|
|
360 |
}
|
|
361 |
|
|
362 |
/*!
|
|
363 |
See WlanWizardPage::startOperation().
|
|
364 |
|
|
365 |
Starts the page operation.
|
|
366 |
*/
|
|
367 |
void WlanWizardPageProcessingSettings::startOperation()
|
|
368 |
{
|
60
|
369 |
OstTraceFunctionEntry0(WLANWIZARDPAGEPROCESSINGSETTINGS_STARTOPERATION_ENTRY);
|
|
370 |
|
31
|
371 |
if (mWizard->handleIap()) {
|
|
372 |
mNextPageId = WlanWizardPageInternal::PageSummary;
|
|
373 |
|
|
374 |
// in case wlan connection is already established disconnect it
|
|
375 |
// note that connectIap() disconnects implicitly connection when
|
|
376 |
// same IAP is already connected.
|
|
377 |
WlanQtUtils* utils = mWizard->wlanQtUtils();
|
|
378 |
int connectedIapId = utils->activeIap();
|
|
379 |
int iapId = mWizard->configuration(WlanWizardHelper::ConfIapId).toInt();
|
|
380 |
if (connectedIapId != iapId){
|
|
381 |
utils->disconnectIap(connectedIapId);
|
|
382 |
}
|
|
383 |
mWizard->wlanQtUtils()->connectIap( iapId, true);
|
|
384 |
} else {
|
|
385 |
mNextPageId = WlanWizardPageInternal::PageGenericError;
|
|
386 |
mWizard->setConfiguration(
|
|
387 |
WlanWizardHelper::ConfGenericErrorString,
|
|
388 |
hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret"));
|
39
|
389 |
|
|
390 |
mWizard->setConfiguration(
|
|
391 |
WlanWizardHelper::ConfGenericErrorPageStepsBackwards,
|
|
392 |
WlanWizardPage::OneStepBackwards);
|
31
|
393 |
mWizard->nextPage();
|
|
394 |
}
|
60
|
395 |
|
|
396 |
OstTraceFunctionExit0(WLANWIZARDPAGEPROCESSINGSETTINGS_STARTOPERATION_EXIT);
|
31
|
397 |
}
|