39
|
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 Login engine class implementation
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
// System includes
|
|
20 |
#include <QObject>
|
|
21 |
#include <QString>
|
|
22 |
#include <QUrl>
|
|
23 |
#include <HbMessagebox>
|
|
24 |
#include <HbAction>
|
|
25 |
#include <qnetworkconfigmanager.h>
|
|
26 |
#include <qnetworkconfiguration.h>
|
|
27 |
#include <qnetworksession.h>
|
|
28 |
|
|
29 |
//User includes
|
|
30 |
#include "wlanloginengine.h"
|
|
31 |
#include "wlanloginapplication.h"
|
|
32 |
#include "wlanloginmainwindow.h"
|
|
33 |
#include "ictsqtwrapper.h"
|
|
34 |
#include "wlanloginnetworkaccessmanager.h"
|
|
35 |
|
|
36 |
#include "OstTraceDefinitions.h"
|
|
37 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
38 |
#include "wlanloginengineTraces.h"
|
|
39 |
#endif
|
|
40 |
|
|
41 |
/*!
|
|
42 |
\class WlanLoginEngine
|
|
43 |
\brief WLAN Login engine class implementation.
|
|
44 |
*/
|
|
45 |
|
|
46 |
// External function prototypes
|
|
47 |
|
|
48 |
// Local constants
|
43
|
49 |
const QString iapIdentifierPrefix = "I_";
|
39
|
50 |
|
|
51 |
// ======== LOCAL FUNCTIONS ========
|
|
52 |
|
|
53 |
// ======== MEMBER FUNCTIONS ========
|
|
54 |
|
|
55 |
/*!
|
|
56 |
Constructor.
|
|
57 |
*/
|
|
58 |
WlanLoginEngine::WlanLoginEngine(QObject *parent):
|
|
59 |
QObject(parent),
|
|
60 |
mEngineState(WaitingForStart),
|
53
|
61 |
mStartRequestCompleted(false),
|
39
|
62 |
mNetConfigurationManager(new QNetworkConfigurationManager(this)),
|
|
63 |
mNetworkAccessManager(new WlanLoginNetworkAccessManager(this)),
|
|
64 |
mNetworkSession(NULL),
|
|
65 |
mIctsWrapper(NULL),
|
|
66 |
mIctsFirstRun(true),
|
|
67 |
mIap(0),
|
|
68 |
mNetId(0),
|
|
69 |
mRedirectionUrl(QUrl(""))
|
|
70 |
{
|
|
71 |
OstTraceFunctionEntry0(WLANLOGINENGINE_WLANLOGINENGINE_ENTRY);
|
|
72 |
|
|
73 |
bool connectStatus = connect(
|
|
74 |
mNetConfigurationManager,
|
|
75 |
SIGNAL(updateCompleted()),
|
|
76 |
this,
|
|
77 |
SLOT(handleUpdateCompleted()));
|
|
78 |
Q_ASSERT(connectStatus == true);
|
|
79 |
|
|
80 |
OstTraceFunctionExit0(WLANLOGINENGINE_WLANLOGINENGINE_EXIT);
|
|
81 |
}
|
|
82 |
|
|
83 |
|
|
84 |
/*!
|
|
85 |
Destructor.
|
|
86 |
*/
|
|
87 |
WlanLoginEngine::~WlanLoginEngine()
|
|
88 |
{
|
|
89 |
OstTraceFunctionEntry0(WLANLOGINENGINE_DESTRUCTOR_ENTRY);
|
43
|
90 |
|
|
91 |
if (mNetworkSession) {
|
|
92 |
mNetworkSession->close();
|
|
93 |
}
|
39
|
94 |
|
|
95 |
OstTraceFunctionExit0(WLANLOGINENGINE_DESTRUCTOR_EXIT);
|
|
96 |
}
|
|
97 |
|
|
98 |
|
|
99 |
/*!
|
|
100 |
Function that returns pointer to network access manager.
|
|
101 |
|
|
102 |
@return Pointer to WlanLoginNetworkAccessManager
|
|
103 |
*/
|
|
104 |
WlanLoginNetworkAccessManager* WlanLoginEngine::networkAccessManager() const
|
|
105 |
{
|
53
|
106 |
OstTraceFunctionEntry0(WLANLOGINENGINE_NETWORKACCESSMANAGER_ENTRY);
|
|
107 |
OstTraceFunctionExit0(WLANLOGINENGINE_NETWORKACCESSMANAGER_EXIT);
|
|
108 |
|
39
|
109 |
return mNetworkAccessManager;
|
53
|
110 |
|
39
|
111 |
}
|
|
112 |
|
|
113 |
|
|
114 |
/*!
|
|
115 |
Function that returns current state of the engine.
|
|
116 |
|
|
117 |
@return engine state
|
|
118 |
*/
|
|
119 |
WlanLoginEngine::EngineState WlanLoginEngine::engineState()
|
|
120 |
{
|
53
|
121 |
OstTraceFunctionEntry0(WLANLOGINENGINE_ENGINESTATE_ENTRY);
|
|
122 |
OstTraceFunctionExit0(WLANLOGINENGINE_ENGINESTATE_EXIT);
|
|
123 |
|
|
124 |
return mEngineState;
|
39
|
125 |
}
|
|
126 |
|
|
127 |
|
|
128 |
/*!
|
|
129 |
Function that sets the current state of the engine.
|
|
130 |
|
|
131 |
@param [in] newState New state of the engine to be set
|
|
132 |
*/
|
|
133 |
void WlanLoginEngine::setEngineState(WlanLoginEngine::EngineState newState)
|
|
134 |
{
|
53
|
135 |
OstTraceFunctionEntry0(WLANLOGINENGINE_SETENGINESTATE_ENTRY);
|
|
136 |
|
39
|
137 |
mEngineState = newState;
|
53
|
138 |
OstTrace1(
|
|
139 |
TRACE_NORMAL,
|
|
140 |
WLANLOGINENGINE_SETENGINESTATE_STATE_TRACE,
|
|
141 |
"WlanLoginEngine::setEngineState;mEngineState=%d",
|
|
142 |
mEngineState);
|
|
143 |
|
|
144 |
OstTraceFunctionExit0(WLANLOGINENGINE_SETENGINESTATE_EXIT);
|
39
|
145 |
}
|
|
146 |
|
|
147 |
|
|
148 |
/*!
|
|
149 |
This slot handles startLogin signal from Qt Highway service provider
|
|
150 |
|
|
151 |
@param [in] iapId Internet access point ID for a connection that we should attach to'
|
|
152 |
@param [in] netId Network Id for the connection to be used
|
|
153 |
@param [in] redirectionUrl The URL that we were redirected to by the first internet connectivity test
|
|
154 |
|
|
155 |
*/
|
|
156 |
void WlanLoginEngine::handleStartLogin(int iapId, int netId, QUrl redirectionUrl)
|
|
157 |
{
|
|
158 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESTARTLOGIN_ENTRY);
|
|
159 |
|
|
160 |
mIap = iapId;
|
|
161 |
OstTrace1(
|
|
162 |
TRACE_NORMAL,
|
|
163 |
WLANLOGINENGINE_HANDLESTARTLOGIN_IAP_TRACE,
|
|
164 |
"WlanLoginEngine::handleStartLogin;mIap=%d",
|
|
165 |
mIap);
|
|
166 |
|
|
167 |
mNetId = netId;
|
|
168 |
OstTrace1(
|
|
169 |
TRACE_NORMAL,
|
|
170 |
WLANLOGINENGINE_HANDLESTARTLOGIN_NETID_TRACE,
|
|
171 |
"WlanLoginEngine::handleStartLogin;mNetId=%d",
|
|
172 |
mNetId);
|
|
173 |
|
|
174 |
mRedirectionUrl = redirectionUrl;
|
|
175 |
|
|
176 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
177 |
QString url = mRedirectionUrl.toString();
|
|
178 |
TPtrC tmp(url.utf16(),url.length() );
|
|
179 |
|
|
180 |
OstTraceExt1(
|
|
181 |
TRACE_NORMAL,
|
|
182 |
WLANLOGINENGINE_HANDLESTARTLOGIN_URL_TRACE,
|
|
183 |
"WlanLoginEngine::handleStartLogin;mRedirectionUrl=%S",
|
|
184 |
tmp);
|
|
185 |
#endif
|
|
186 |
|
|
187 |
//Create ICTS instance as we know needed parameters now
|
|
188 |
mIctsWrapper = new IctsWrapper(mIap, mNetId, this);
|
|
189 |
|
|
190 |
bool connectStatus = connect(
|
|
191 |
mIctsWrapper,
|
|
192 |
SIGNAL(connectivityTestResult(IctsWrapper::ConnectivityTestResult, QUrl)),
|
|
193 |
this,
|
|
194 |
SLOT(handleConnectivityTestResult(IctsWrapper::ConnectivityTestResult, QUrl)));
|
|
195 |
Q_ASSERT(connectStatus == true);
|
|
196 |
|
|
197 |
//Update network configurations as only states of the cellular IAP's are reliable
|
|
198 |
//after creating network configuration manager
|
|
199 |
|
|
200 |
setEngineState(UpdatingNetworkConfigurations);
|
|
201 |
mNetConfigurationManager->updateConfigurations();
|
|
202 |
|
|
203 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESTARTLOGIN_EXIT);
|
|
204 |
}
|
|
205 |
|
|
206 |
/*!
|
|
207 |
This slot handles stopLogin signal from Qt Highway service provider
|
|
208 |
|
|
209 |
*/
|
|
210 |
void WlanLoginEngine::handleStopLogin()
|
|
211 |
{
|
|
212 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESTOPLOGIN_ENTRY);
|
|
213 |
|
|
214 |
// Exit application
|
|
215 |
qApp->quit();
|
|
216 |
|
|
217 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESTOPLOGIN_EXIT);
|
|
218 |
}
|
|
219 |
|
|
220 |
|
|
221 |
/*!
|
|
222 |
This slot handles updateCompleted signal from QNetworkConfigManager
|
|
223 |
|
|
224 |
*/
|
|
225 |
void WlanLoginEngine::handleUpdateCompleted()
|
|
226 |
{
|
|
227 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLEUPDATECOMPLETED_ENTRY);
|
|
228 |
|
|
229 |
//States of the available configurations are now updated and
|
|
230 |
//we can open the network session to provided IAP
|
|
231 |
|
53
|
232 |
//Check that cancel has not been pressed
|
|
233 |
if (engineState() != WaitingForStopRequest) {
|
|
234 |
openSession();
|
|
235 |
}
|
|
236 |
|
39
|
237 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLEUPDATECOMPLETED_EXIT);
|
|
238 |
}
|
|
239 |
|
|
240 |
/*!
|
|
241 |
This function handles opening of the network session to the specified IAP.
|
|
242 |
If IAP is not already in connected state, function completes service request
|
|
243 |
with connection dropped status and show a message box to user.
|
|
244 |
|
|
245 |
*/
|
|
246 |
void WlanLoginEngine::openSession()
|
|
247 |
{
|
|
248 |
OstTraceFunctionEntry0(WLANLOGINENGINE_OPENSESSION_ENTRY);
|
|
249 |
|
|
250 |
setEngineState(WlanLoginEngine::OpeningNetworkSession);
|
|
251 |
|
|
252 |
//Get configuration that matches the provided IAP
|
43
|
253 |
//Note that identifier must be given in format I_ + IAP ID
|
|
254 |
QNetworkConfiguration netConfiguration = mNetConfigurationManager->configurationFromIdentifier(iapIdentifierPrefix + QString::number(mIap));
|
39
|
255 |
|
|
256 |
OstTrace1(
|
|
257 |
TRACE_NORMAL,
|
|
258 |
WLANLOGINENGINE_OPENSESSION_CONFIGURATION_IDENTIFIER_TRACE,
|
|
259 |
"WlanLoginEngine::openSession;netConfiguration identifier=%d",
|
|
260 |
netConfiguration.identifier().toInt());
|
|
261 |
|
|
262 |
OstTrace1(TRACE_NORMAL,
|
|
263 |
WLANLOGINENGINE_OPENSESSION_CONFIGURATION_STATE_TRACE,
|
|
264 |
"WlanLoginEngine::openSession;netConfiguration state=%d",
|
|
265 |
netConfiguration.state());
|
|
266 |
|
|
267 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
268 |
QString string = netConfiguration.name();
|
|
269 |
TPtrC tmp(string.utf16(),string.length() );
|
|
270 |
|
|
271 |
OstTraceExt1(
|
|
272 |
TRACE_NORMAL,
|
|
273 |
WLANLOGINENGINE_OPENSESSION_CONFIGURATION_NAME_TRACE,
|
|
274 |
"WlanLoginEngine::openSession;netConfiguration name=%S",
|
|
275 |
tmp );
|
|
276 |
|
|
277 |
string = netConfiguration.bearerName();
|
|
278 |
tmp.Set(string.utf16(),string.length());
|
|
279 |
|
|
280 |
OstTraceExt1(
|
|
281 |
TRACE_NORMAL,
|
|
282 |
WLANLOGINENGINE_OPENSESSION_CONFIGURATION_BEARER_NAME_TRACE,
|
|
283 |
"WlanLoginEngine::openSession;netConfiguration bearerName=%S",
|
|
284 |
tmp );
|
|
285 |
#endif
|
|
286 |
|
|
287 |
//Check that configuration state is active before opening session
|
|
288 |
//Otherwise show disconnected message box
|
|
289 |
|
|
290 |
if (netConfiguration.state() == QNetworkConfiguration::Active)
|
|
291 |
{
|
|
292 |
//Create network session to IAP that was provided in startup
|
|
293 |
mNetworkSession = new QNetworkSession(netConfiguration, this);
|
|
294 |
|
|
295 |
bool connectStatus = connect(
|
|
296 |
mNetworkSession,
|
|
297 |
SIGNAL(opened()),
|
|
298 |
this,
|
|
299 |
SLOT(handleSessionOpened()));
|
|
300 |
Q_ASSERT(connectStatus == true);
|
|
301 |
|
|
302 |
connectStatus = connect(
|
|
303 |
mNetworkSession,
|
|
304 |
SIGNAL(stateChanged(QNetworkSession::State)),
|
|
305 |
this,
|
|
306 |
SLOT(handleSessionStateChanged(QNetworkSession::State)));
|
|
307 |
Q_ASSERT(connectStatus == true);
|
|
308 |
|
|
309 |
connectStatus = connect(
|
|
310 |
mNetworkSession,
|
|
311 |
SIGNAL(error(QNetworkSession::SessionError)),
|
|
312 |
this,
|
|
313 |
SLOT(handleSessionError(QNetworkSession::SessionError)));
|
|
314 |
Q_ASSERT(connectStatus == true);
|
|
315 |
|
|
316 |
mNetworkSession->open();
|
|
317 |
} else {
|
|
318 |
showConnectionDroppedMessageBox();
|
|
319 |
}
|
|
320 |
|
|
321 |
OstTraceFunctionExit0(WLANLOGINENGINE_OPENSESSION_EXIT);
|
|
322 |
}
|
|
323 |
|
|
324 |
|
|
325 |
/*!
|
|
326 |
This function handles sessionOpened signal from QNetworkSession. It informs view that
|
|
327 |
connection is ready to be used.
|
|
328 |
|
|
329 |
*/
|
|
330 |
void WlanLoginEngine::handleSessionOpened()
|
|
331 |
{
|
|
332 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESESSIONOPENED_ENTRY);
|
|
333 |
|
53
|
334 |
//Check that cancel has not been pressed
|
|
335 |
if (engineState() != WaitingForStopRequest) {
|
|
336 |
setEngineState(NetworkSessionOpened);
|
|
337 |
//Send indication to view that connection is ready
|
|
338 |
emit connectionReady(mRedirectionUrl);
|
|
339 |
}
|
39
|
340 |
|
|
341 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESESSIONOPENED_EXIT);
|
|
342 |
}
|
|
343 |
|
|
344 |
|
|
345 |
/*!
|
|
346 |
This function handles sessionStateChanged signal from QNetworkSession.
|
|
347 |
@param [in] newState New state of the session
|
|
348 |
*/
|
|
349 |
void WlanLoginEngine::handleSessionStateChanged(QNetworkSession::State newState)
|
|
350 |
{
|
|
351 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESESSIONSTATECHANGED_ENTRY);
|
|
352 |
|
|
353 |
OstTrace1(
|
|
354 |
TRACE_NORMAL,
|
|
355 |
WLANLOGINENGINE_HANDLESESSIONSTATECHANGED_STATE_TRACE,
|
|
356 |
"WlanLoginEngine::handleSessionStateChanged;newState=%d",
|
|
357 |
newState );
|
|
358 |
|
|
359 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESESSIONSTATECHANGED_EXIT);
|
|
360 |
}
|
|
361 |
|
|
362 |
|
|
363 |
/*!
|
|
364 |
This function handles sessionError signal from QNetworkSession
|
|
365 |
@param [in] error session error
|
|
366 |
*/
|
|
367 |
void WlanLoginEngine::handleSessionError(QNetworkSession::SessionError error)
|
|
368 |
{
|
|
369 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESESSIONERROR_ENTRY);
|
|
370 |
|
|
371 |
OstTrace1(
|
|
372 |
TRACE_NORMAL,
|
|
373 |
WLANLOGINENGINE_SESSION_ERROR_TRACE,
|
|
374 |
"WlanLoginEngine::handleSessionError;error=%d",
|
|
375 |
error);
|
|
376 |
|
|
377 |
switch (engineState()) {
|
|
378 |
case OpeningNetworkSession:
|
|
379 |
showConnectionDroppedMessageBox();
|
|
380 |
break;
|
|
381 |
|
|
382 |
case NetworkSessionOpened:
|
53
|
383 |
case IctsOk:
|
|
384 |
case IctsFailed:
|
39
|
385 |
if (error == QNetworkSession::SessionAbortedError ) {
|
|
386 |
showConnectionDroppedMessageBox();
|
|
387 |
}
|
|
388 |
break;
|
|
389 |
|
|
390 |
case RunningIcts:
|
|
391 |
if (error == QNetworkSession::SessionAbortedError ) {
|
|
392 |
stopIcts();
|
|
393 |
showConnectionDroppedMessageBox();
|
|
394 |
}
|
|
395 |
break;
|
|
396 |
|
|
397 |
default:
|
|
398 |
break;
|
|
399 |
}
|
|
400 |
|
|
401 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESESSIONERROR_EXIT);
|
|
402 |
}
|
|
403 |
|
|
404 |
/*!
|
|
405 |
This function handles startIcts signal and starts connectivity test in polling mode
|
|
406 |
|
|
407 |
*/
|
|
408 |
void WlanLoginEngine::handleStartIcts()
|
|
409 |
{
|
|
410 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESTARTICTS_ENTRY);
|
|
411 |
|
|
412 |
if (!mIctsWrapper->isPolling()) {
|
|
413 |
setEngineState(RunningIcts);
|
|
414 |
mIctsWrapper->startPolling(totalPollingTime, pollingInterval);
|
|
415 |
}
|
|
416 |
|
|
417 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESTARTICTS_EXIT);
|
|
418 |
}
|
|
419 |
|
|
420 |
/*!
|
|
421 |
This function stops internet connectivity test
|
|
422 |
|
|
423 |
*/
|
|
424 |
void WlanLoginEngine::stopIcts()
|
|
425 |
{
|
|
426 |
OstTraceFunctionEntry0(WLANLOGINENGINE_STOPICTS_ENTRY);
|
|
427 |
|
|
428 |
if (mIctsWrapper->isPolling()) {
|
|
429 |
mIctsWrapper->stopPolling();
|
|
430 |
}
|
|
431 |
|
|
432 |
OstTraceFunctionExit0(WLANLOGINENGINE_STOPICTS_EXIT);
|
|
433 |
}
|
|
434 |
|
|
435 |
/*!
|
|
436 |
This slot handles connectivityTestResult signal from ICTS wrapper
|
|
437 |
@param [in] result Result of the internet connectivity test
|
|
438 |
@param [in] redirectionUrl The URL that we are being redirected, valid only if result is HttpAuthenticationNeeded
|
|
439 |
*/
|
|
440 |
|
|
441 |
void WlanLoginEngine::handleConnectivityTestResult(IctsWrapper::ConnectivityTestResult result, QUrl redirectUrl)
|
|
442 |
{
|
|
443 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLECONNECTIVITYTESTRESULT_ENTRY);
|
|
444 |
|
|
445 |
Q_UNUSED(redirectUrl);
|
|
446 |
|
|
447 |
mIctsFirstRun = false;
|
|
448 |
|
|
449 |
if (result == IctsWrapper::ConnectionOk){
|
53
|
450 |
setEngineState(IctsOk);
|
39
|
451 |
emit ictsOk();
|
53
|
452 |
} else {
|
|
453 |
setEngineState(IctsFailed);
|
39
|
454 |
}
|
|
455 |
|
|
456 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLECONNECTIVITYTESTRESULT_EXIT);
|
|
457 |
}
|
|
458 |
|
|
459 |
/*!
|
|
460 |
This slot handles cancelTriggered signal from the view
|
|
461 |
|
|
462 |
*/
|
|
463 |
void WlanLoginEngine::handleCancelTriggered()
|
|
464 |
{
|
|
465 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLECANCELTRIGGERED_ENTRY);
|
|
466 |
|
53
|
467 |
//Check if Qt Highway request is completed
|
|
468 |
if (mStartRequestCompleted == false){
|
|
469 |
|
|
470 |
switch (engineState()) {
|
|
471 |
|
|
472 |
case UpdatingNetworkConfigurations:
|
|
473 |
case OpeningNetworkSession:
|
|
474 |
case NetworkSessionOpened:
|
|
475 |
setEngineState(WaitingForStopRequest);
|
|
476 |
emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusCancel);
|
|
477 |
break;
|
|
478 |
|
|
479 |
case RunningIcts:
|
|
480 |
stopIcts();
|
|
481 |
setEngineState(WaitingForStopRequest);
|
|
482 |
if (mIctsFirstRun) {
|
|
483 |
emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusCancel);
|
|
484 |
} else {
|
|
485 |
emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusFailed);
|
|
486 |
}
|
|
487 |
break;
|
|
488 |
|
|
489 |
case IctsFailed:
|
|
490 |
setEngineState(WaitingForStopRequest);
|
|
491 |
emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusFailed);
|
|
492 |
break;
|
|
493 |
|
|
494 |
default:
|
|
495 |
break;
|
|
496 |
}
|
39
|
497 |
} else {
|
53
|
498 |
//Check race condition
|
|
499 |
if(engineState() != WaitingForStopRequest) {
|
|
500 |
qApp->exit();
|
|
501 |
}
|
39
|
502 |
}
|
|
503 |
|
|
504 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLECANCELTRIGGERED_EXIT);
|
|
505 |
}
|
|
506 |
|
|
507 |
/*!
|
|
508 |
This slot handles nextTriggered signal from the view
|
|
509 |
|
|
510 |
*/
|
|
511 |
void WlanLoginEngine::handleNextTriggered()
|
|
512 |
{
|
|
513 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLENEXTTRIGGERED_ENTRY);
|
53
|
514 |
|
|
515 |
if (mStartRequestCompleted == false ) {
|
|
516 |
emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusNext);
|
|
517 |
}
|
39
|
518 |
|
|
519 |
//put application to background:
|
|
520 |
WlanLoginApplication* app = static_cast<WlanLoginApplication *>(this->parent());
|
|
521 |
app->mainWindow()->lower();
|
|
522 |
|
|
523 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLENEXTTRIGGERED_EXIT);
|
|
524 |
}
|
|
525 |
|
|
526 |
/*!
|
|
527 |
This function shows connection dropped message box to the user
|
|
528 |
|
|
529 |
*/
|
|
530 |
void WlanLoginEngine::showConnectionDroppedMessageBox()
|
|
531 |
{
|
|
532 |
OstTraceFunctionEntry0(WLANLOGINENGINE_SHOWCONNECTIONDROPPEDMESSAGEBOX_ENTRY);
|
|
533 |
|
|
534 |
HbMessageBox *messageBox = new HbMessageBox(hbTrId("txt_occ_info_wlan_connection_closed_login_applica"));
|
|
535 |
messageBox->setAttribute(Qt::WA_DeleteOnClose);
|
|
536 |
messageBox->setTimeout(messageBoxTimeout);
|
|
537 |
messageBox->open(this,SLOT(connectionDroppedMessageBoxClosed(HbAction*)));
|
|
538 |
|
|
539 |
OstTraceFunctionExit0(WLANLOGINENGINE_SHOWCONNECTIONDROPPEDMESSAGEBOX_EXIT);
|
|
540 |
}
|
|
541 |
|
|
542 |
void WlanLoginEngine::connectionDroppedMessageBoxClosed(HbAction* action)
|
|
543 |
{
|
|
544 |
OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLEMESSAGEBOXCLOSED_ENTRY);
|
|
545 |
|
|
546 |
Q_UNUSED(action);
|
|
547 |
|
53
|
548 |
if (mStartRequestCompleted == false ) {
|
39
|
549 |
emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusConnectionDropped);
|
|
550 |
|
|
551 |
} else {
|
|
552 |
//If Qt Highway service request is already completed when connection drops, we have to make exit by our own
|
|
553 |
qApp->exit();
|
|
554 |
}
|
|
555 |
|
53
|
556 |
OstTraceFunctionExit0(WLANLOGINENGINE_HANDLEMESSAGEBOXCLOSED_EXIT);
|
39
|
557 |
}
|
|
558 |
|
|
559 |
/*!
|
|
560 |
This function completes Qt Highway service request
|
|
561 |
@param [in] status completeing status of the service request
|
|
562 |
*/
|
|
563 |
void WlanLoginEngine::emitCompleteServiceRequest(WlanLoginService::WlanLoginStatus status )
|
|
564 |
{
|
|
565 |
OstTraceFunctionEntry0(WLANLOGINENGINE_EMITCOMPLETESERVICEREQUEST_ENTRY);
|
|
566 |
|
53
|
567 |
mStartRequestCompleted = true;
|
39
|
568 |
OstTrace1(
|
|
569 |
TRACE_BORDER,
|
|
570 |
WLANLOGINENGINE_EMITCOMPLETESERVICEREQUEST_EMIT_TRACE,
|
|
571 |
"WlanLoginEngine::emitCompleteServiceRequest with status:;status=%d",
|
|
572 |
status);
|
|
573 |
emit completeServiceRequest(status);
|
|
574 |
|
|
575 |
OstTraceFunctionExit0(WLANLOGINENGINE_EMITCOMPLETESERVICEREQUEST_EXIT);
|
|
576 |
}
|