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: Private implementation.
|
|
16 |
*/
|
|
17 |
|
|
18 |
// System includes
|
|
19 |
#include <QLocale>
|
|
20 |
#include <QApplication>
|
|
21 |
#include <QGraphicsWidget>
|
|
22 |
#include <QTimer>
|
|
23 |
#include <QDebug>
|
|
24 |
#include <HbTranslator>
|
|
25 |
#include <HbDocumentLoader>
|
|
26 |
#include <HbMainWindow>
|
|
27 |
#include <HbDialog>
|
|
28 |
#include <HbStackedWidget>
|
|
29 |
#include <HbLabel>
|
|
30 |
#include <HbAction>
|
|
31 |
#include <HbStyleLoader>
|
|
32 |
|
|
33 |
// User includes
|
|
34 |
#ifdef WLAN_WIZARD_RND_EAP
|
|
35 |
#include "eapwizard.h"
|
|
36 |
#endif
|
|
37 |
|
|
38 |
#ifdef WLAN_WIZARD_RND_WPS
|
|
39 |
#include "wpswizard.h"
|
|
40 |
#endif
|
|
41 |
#include "wlanqtutils.h"
|
|
42 |
#include "wlanqtutilsap.h"
|
|
43 |
#include "wlanwizardplugin.h"
|
|
44 |
#include "wlanwizard.h"
|
|
45 |
#include "wlanwizard_p.h"
|
|
46 |
#include "wlanwizardutils.h"
|
|
47 |
#include "wlanwizardpagekeyquery.h"
|
|
48 |
#include "wlanwizardpagesummary.h"
|
|
49 |
#include "wlanwizardpageprocessingsettings.h"
|
|
50 |
#include "wlanwizardpagegenericerror.h"
|
|
51 |
|
|
52 |
#ifdef WLAN_WIZARD_RND
|
|
53 |
#include "wlanwizardpagessid.h"
|
|
54 |
#include "wlanwizardpagenetworkmode.h"
|
|
55 |
#include "wlanwizardpagescanning.h"
|
|
56 |
#include "wlanwizardpagesecuritymode.h"
|
|
57 |
#endif
|
|
58 |
|
|
59 |
#include "OstTraceDefinitions.h"
|
|
60 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
61 |
#include "wlanwizard_pTraces.h"
|
|
62 |
#endif
|
|
63 |
|
|
64 |
/*!
|
|
65 |
\class WlanWizardPrivate
|
|
66 |
\brief Private implementation of WlanWizard. Implements the interface
|
|
67 |
WlanWizardHelper to the wizard plugins.
|
|
68 |
*/
|
|
69 |
|
|
70 |
// External function prototypes
|
|
71 |
|
|
72 |
// Local constants
|
|
73 |
|
|
74 |
/*!
|
|
75 |
\var PageTimeout Timeout for timer protected pages. 1.5sec
|
|
76 |
*/
|
|
77 |
|
|
78 |
// ======== LOCAL FUNCTIONS ========
|
|
79 |
|
|
80 |
// ======== MEMBER FUNCTIONS ========
|
|
81 |
|
|
82 |
/*!
|
|
83 |
Constructor of private implementation.
|
|
84 |
|
|
85 |
@param [in] wizard Pointer to the API class.
|
|
86 |
@param [in] mainWindow pointer to mainwindow.
|
|
87 |
*/
|
|
88 |
WlanWizardPrivate::WlanWizardPrivate(
|
|
89 |
WlanWizard* wizard,
|
|
90 |
HbMainWindow *mainWindow) :
|
|
91 |
QObject(wizard),
|
|
92 |
q_ptr(wizard),
|
|
93 |
mMainWindow(mainWindow),
|
|
94 |
mPageTimer(new QTimer(this)),
|
|
95 |
mTitle(NULL),
|
|
96 |
mActionNext(NULL),
|
|
97 |
mActionPrevious(NULL),
|
|
98 |
mActionFinish(NULL),
|
|
99 |
mActionCancel(NULL),
|
|
100 |
mStackedWidget(NULL),
|
|
101 |
mDialog(NULL),
|
|
102 |
mTranslator(new HbTranslator("wlanwizard")),
|
|
103 |
mWlanQtUtils(new WlanQtUtils()),
|
|
104 |
mDocLoader(new HbDocumentLoader(mainWindow)),
|
|
105 |
mEapWizard(NULL),
|
|
106 |
mWpsWizard(NULL),
|
|
107 |
mFirstPageId(WlanWizardPageInternal::PageNone),
|
|
108 |
mPageFinished(false),
|
|
109 |
mClosed(false)
|
|
110 |
{
|
|
111 |
OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_WLANWIZARDPRIVATE,
|
|
112 |
"WlanWizardPrivate::WlanWizardPrivate;this=%x",
|
|
113 |
this );
|
|
114 |
|
|
115 |
// Set initial values for configurations
|
|
116 |
setConfiguration(ConfIapId, WlanQtUtils::IapIdNone);
|
|
117 |
setConfiguration(ConfConnected, false);
|
|
118 |
setConfiguration(ConfHiddenWlan, false);
|
|
119 |
setConfiguration(ConfProcessSettings, false);
|
|
120 |
setConfiguration(ConfIctStatus, false);
|
|
121 |
|
|
122 |
// Initialize timer for timer protected pages
|
|
123 |
mPageTimer->setSingleShot(true);
|
|
124 |
|
|
125 |
// Load the wizard frame (title, content, actions) from docml
|
|
126 |
loadDocml();
|
|
127 |
|
|
128 |
// Creates the control object of the wlan wizard pages.
|
|
129 |
createPages();
|
|
130 |
|
|
131 |
// First page is SSID query, unless client sets configurations via
|
|
132 |
// setParameters(), which decides the first page..
|
|
133 |
mFirstPageId = WlanWizardPageInternal::PageSsid;
|
|
134 |
|
|
135 |
OstTraceExt2( TRACE_BORDER, WLANWIZARDPRIVATE_WLANWIZARDPRIVATE_DONE,
|
|
136 |
"WlanWizardPrivate::WlanWizardPrivate - done;"
|
|
137 |
"this=%x;mFirstPageId=%{PageIds}",
|
|
138 |
( unsigned )this, mFirstPageId );
|
|
139 |
}
|
|
140 |
|
|
141 |
/*!
|
|
142 |
Destructor.
|
|
143 |
*/
|
|
144 |
WlanWizardPrivate::~WlanWizardPrivate()
|
|
145 |
{
|
|
146 |
OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_DWLANWIZARDPRIVATE,
|
|
147 |
"WlanWizardPrivate::~WlanWizardPrivate;this=%x",
|
|
148 |
this );
|
|
149 |
|
|
150 |
// Remove wizard pages from stackedwidgets, since stackedwidget owns the
|
|
151 |
// objects and all pages are deleted below.
|
|
152 |
while (mStackedWidget->count()) {
|
|
153 |
mStackedWidget->removeAt(0);
|
|
154 |
}
|
|
155 |
|
|
156 |
// Delete UI instances (HbWidget) of pages
|
|
157 |
QHashIterator<HbWidget*, WlanWizardPage*> i(mPageMapper);
|
|
158 |
while (i.hasNext()) {
|
|
159 |
i.next();
|
|
160 |
delete i.key();
|
|
161 |
}
|
|
162 |
mPageMapper.clear();
|
|
163 |
|
|
164 |
// WlanWizardPage objects are automatically deleted since this is the
|
|
165 |
// parent of the objects.
|
|
166 |
mPages.clear();
|
|
167 |
|
|
168 |
#ifdef WLAN_WIZARD_RND_EAP
|
|
169 |
delete mEapWizard;
|
|
170 |
#endif
|
|
171 |
#ifdef WLAN_WIZARD_RND_WPS
|
|
172 |
delete mWpsWizard;
|
|
173 |
#endif
|
|
174 |
// timer is cancelled/deleted automatically when the parent (this) is deleted
|
|
175 |
|
|
176 |
// TODO: See TSW Error: MTAA-854DK8 and loadDocml()
|
|
177 |
HbStyleLoader::unregisterFilePath(":/css/custom.css");
|
|
178 |
|
|
179 |
OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_DWLANWIZARDPRIVATE_DONE,
|
|
180 |
"WlanWizardPrivate::~WlanWizardPrivate-Done;this=%x",
|
|
181 |
this );
|
|
182 |
}
|
|
183 |
|
|
184 |
/*!
|
|
185 |
See WlanWizard::setParameters().
|
|
186 |
*/
|
|
187 |
void WlanWizardPrivate::setParameters(
|
|
188 |
const QString &ssid,
|
|
189 |
int networkMode,
|
|
190 |
int securityMode,
|
|
191 |
bool usePsk,
|
|
192 |
bool hidden,
|
|
193 |
bool wps)
|
|
194 |
{
|
|
195 |
OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_SETPARAMETERS,
|
|
196 |
"WlanWizardPrivate::setParameters;this=%x",
|
|
197 |
this );
|
|
198 |
|
|
199 |
mFirstPageId = getNextPageId(
|
|
200 |
ssid, networkMode, securityMode, usePsk, hidden, wps);
|
|
201 |
|
|
202 |
OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_SETPARAMETERS_DONE,
|
|
203 |
"WlanWizardPrivate::setParameters - Done;this=%x",
|
|
204 |
this );
|
|
205 |
}
|
|
206 |
|
|
207 |
/*!
|
|
208 |
See WlanWizard::show().
|
|
209 |
*/
|
|
210 |
void WlanWizardPrivate::show()
|
|
211 |
{
|
|
212 |
OstTraceExt2( TRACE_BORDER, WLANWIZARDPRIVATE_SHOW,
|
|
213 |
"WlanWizardPrivate::show;this=%x;mFirstPageId=%{PageIds}",
|
|
214 |
( unsigned )this, mFirstPageId );
|
|
215 |
|
|
216 |
Q_ASSERT(mClosed == false);
|
|
217 |
showPage(mFirstPageId, false);
|
|
218 |
mDialog->show();
|
|
219 |
|
|
220 |
OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_SHOW_DONE,
|
|
221 |
"WlanWizardPrivate::show - Done;this=%x;",
|
|
222 |
(unsigned)this );
|
|
223 |
}
|
|
224 |
|
|
225 |
/*!
|
|
226 |
See WlanWizard::setParameters() for descriptions of parameters.
|
|
227 |
|
|
228 |
Based on the provided parameters next page id is returned.
|
|
229 |
|
|
230 |
@return next page id based on provided configurations.
|
|
231 |
*/
|
|
232 |
int WlanWizardPrivate::getNextPageId(
|
|
233 |
const QString &ssid,
|
|
234 |
int networkMode,
|
|
235 |
int securityMode,
|
|
236 |
bool usePsk,
|
|
237 |
bool hidden,
|
|
238 |
bool wps)
|
|
239 |
{
|
|
240 |
setConfiguration(ConfProcessSettings, true);
|
|
241 |
setConfiguration(ConfSsid, ssid);
|
|
242 |
setConfiguration(ConfNetworkMode, networkMode);
|
|
243 |
setConfiguration(ConfSecurityMode, securityMode);
|
|
244 |
setConfiguration(ConfUsePsk, usePsk);
|
|
245 |
setConfiguration(ConfHiddenWlan, hidden);
|
|
246 |
|
|
247 |
OstTrace1( TRACE_NORMAL, WLANWIZARDPRIVATE_GETNEXTPAGEID,
|
|
248 |
"WlanWizardPrivate::getNextPageId;wps=%u",
|
|
249 |
wps );
|
|
250 |
|
|
251 |
return nextPageId(wps);
|
|
252 |
}
|
|
253 |
|
|
254 |
/*!
|
|
255 |
Utility method for WLAN Wizard pages to query the wlanqtutils class.
|
|
256 |
|
|
257 |
@return a valid pointer to WlanQtUtils class.
|
|
258 |
*/
|
|
259 |
WlanQtUtils* WlanWizardPrivate::wlanQtUtils() const
|
|
260 |
{
|
|
261 |
Q_ASSERT(mWlanQtUtils);
|
|
262 |
return mWlanQtUtils.data();
|
|
263 |
}
|
|
264 |
|
|
265 |
/*!
|
|
266 |
Utility method for WLAN Wizard pages to query active wizard plugin object
|
|
267 |
|
|
268 |
@return NULL in case plugin is not active.
|
|
269 |
*/
|
|
270 |
WlanWizardPlugin* WlanWizardPrivate::wlanWizardPlugin() const
|
|
271 |
{
|
|
272 |
WlanWizardPlugin* plugin = NULL;
|
|
273 |
|
|
274 |
if (isEapEnabled()) {
|
|
275 |
#ifdef WLAN_WIZARD_RND_EAP
|
|
276 |
plugin = mEapWizard;
|
|
277 |
Q_ASSERT(plugin);
|
|
278 |
#endif
|
|
279 |
}
|
|
280 |
|
|
281 |
OstTrace1( TRACE_NORMAL, WLANWIZARDPRIVATE_WLANWIZARDPLUGIN,
|
|
282 |
"WlanWizardPrivate::wlanWizardPlugin;plugin=%x",
|
|
283 |
plugin );
|
|
284 |
|
|
285 |
return plugin;
|
|
286 |
}
|
|
287 |
|
|
288 |
/*!
|
|
289 |
Utility method for WLAN Wizard pages to query if EAP mode is active at the
|
|
290 |
moment
|
|
291 |
|
|
292 |
@return true in case EAP is currently activated.
|
|
293 |
*/
|
|
294 |
bool WlanWizardPrivate::isEapEnabled() const
|
|
295 |
{
|
|
296 |
bool ret = false;
|
|
297 |
int secMode = configuration(ConfSecurityMode).toInt();
|
|
298 |
|
|
299 |
if (((secMode == CMManagerShim::WlanSecModeWpa ||
|
|
300 |
secMode == CMManagerShim::WlanSecModeWpa2) &&
|
|
301 |
!configuration(ConfUsePsk).toBool()) ||
|
|
302 |
secMode == CMManagerShim::WlanSecMode802_1x) {
|
|
303 |
ret = true;
|
|
304 |
}
|
|
305 |
|
|
306 |
OstTrace1( TRACE_NORMAL, WLANWIZARDPRIVATE_ISEAPENABLED,
|
|
307 |
"WlanWizardPrivate::isEapEnabled;ret=%u",
|
|
308 |
ret );
|
|
309 |
|
|
310 |
return ret;
|
|
311 |
}
|
|
312 |
|
|
313 |
/*!
|
|
314 |
Creates new iap or updates existing iap.
|
|
315 |
|
|
316 |
@return false in case IAP creation/update failed.
|
|
317 |
*/
|
|
318 |
bool WlanWizardPrivate::handleIap()
|
|
319 |
{
|
|
320 |
OstTrace0( TRACE_FLOW, WLANWIZARDPRIVATE_HANDLEIAP,
|
|
321 |
"WlanWizardPrivate::handleIap" );
|
|
322 |
|
|
323 |
bool ret = true;
|
|
324 |
bool usePsk = true;
|
|
325 |
int securityMode = configuration(ConfSecurityMode).toInt();
|
|
326 |
WlanQtUtilsAp wlanAp;
|
|
327 |
|
|
328 |
// Set configuration
|
|
329 |
wlanAp.setValue(WlanQtUtilsAp::ConfIdSsid, configuration(ConfSsid));
|
|
330 |
wlanAp.setValue(WlanQtUtilsAp::ConfIdConnectionMode,
|
|
331 |
configuration(ConfNetworkMode));
|
|
332 |
wlanAp.setValue(WlanQtUtilsAp::ConfIdSecurityMode, securityMode );
|
|
333 |
wlanAp.setValue(WlanQtUtilsAp::ConfIdHidden, configuration(ConfHiddenWlan));
|
|
334 |
|
|
335 |
switch (securityMode) {
|
|
336 |
case CMManagerShim::WlanSecModeWep:
|
|
337 |
wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey1, configuration(ConfKeyWep1));
|
|
338 |
wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey2, configuration(ConfKeyWep2));
|
|
339 |
wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey3, configuration(ConfKeyWep3));
|
|
340 |
wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey4, configuration(ConfKeyWep4));
|
|
341 |
wlanAp.setValue(
|
|
342 |
WlanQtUtilsAp::ConfIdWepDefaultIndex,
|
|
343 |
configuration(ConfKeyWepDefault));
|
|
344 |
break;
|
|
345 |
|
|
346 |
case CMManagerShim::WlanSecModeWpa:
|
|
347 |
case CMManagerShim::WlanSecModeWpa2:
|
|
348 |
usePsk = configuration(ConfUsePsk).toBool();
|
|
349 |
wlanAp.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, usePsk);
|
|
350 |
if (usePsk){
|
|
351 |
wlanAp.setValue(WlanQtUtilsAp::ConfIdWpaPsk, configuration(ConfKeyWpa));
|
|
352 |
}
|
|
353 |
break;
|
|
354 |
|
|
355 |
default:
|
|
356 |
Q_ASSERT(securityMode == CMManagerShim::WlanSecModeOpen ||
|
|
357 |
securityMode == CMManagerShim::WlanSecMode802_1x);
|
|
358 |
// No WLAN Specific configuration
|
|
359 |
break;
|
|
360 |
}
|
|
361 |
|
|
362 |
// Create IAP if does not exists or update the existing IAP
|
|
363 |
int referenceId = configuration(ConfIapId).toInt();
|
|
364 |
if (referenceId == WlanQtUtils::IapIdNone) {
|
|
365 |
OstTrace0( TRACE_FLOW, WLANWIZARDPRIVATE_HANDLEIAP_CREATE,
|
|
366 |
"WlanWizardPrivate::handleIap: Create IAP" );
|
|
367 |
|
|
368 |
referenceId = mWlanQtUtils->createIap(&wlanAp);
|
|
369 |
setConfiguration(ConfIapId, referenceId);
|
|
370 |
|
|
371 |
if (referenceId == WlanQtUtils::IapIdNone) {
|
|
372 |
ret = false;
|
|
373 |
}
|
|
374 |
} else {
|
|
375 |
OstTrace0( TRACE_FLOW, WLANWIZARDPRIVATE_HANDLEIAP_UPDATE,
|
|
376 |
"WlanWizardPrivate::handleIap: Update IAP" );
|
|
377 |
|
|
378 |
ret = mWlanQtUtils->updateIap(referenceId, &wlanAp);
|
|
379 |
}
|
|
380 |
|
|
381 |
if (ret) {
|
|
382 |
// Store Wizard plugin specific settings here.
|
|
383 |
WlanWizardPlugin* plugin = wlanWizardPlugin();
|
|
384 |
if (plugin) {
|
|
385 |
OstTrace0( TRACE_FLOW, WLANWIZARDPRIVATE_HANDLEIAP_PLUGIN,
|
|
386 |
"WlanWizardPrivate::handleIap: Plugin" );
|
|
387 |
// Plugin gets the IAP ID from configuration
|
|
388 |
ret = plugin->storeSettings();
|
|
389 |
}
|
|
390 |
}
|
|
391 |
|
|
392 |
OstTrace1( TRACE_FLOW, WLANWIZARDPRIVATE_HANDLEIAP_DONE,
|
|
393 |
"WlanWizardPrivate::handleIap: Done;ret=%d",
|
|
394 |
ret );
|
|
395 |
|
|
396 |
return ret;
|
|
397 |
}
|
|
398 |
|
|
399 |
/*!
|
|
400 |
See WlanWizardHelper::configuration().
|
|
401 |
*/
|
|
402 |
QVariant WlanWizardPrivate::configuration(ConfigurationId confId) const
|
|
403 |
{
|
|
404 |
Q_ASSERT(mConfigurations.contains(confId));
|
|
405 |
|
|
406 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
407 |
QString tmp;
|
|
408 |
QDebug tmpStream(&tmp);
|
|
409 |
tmpStream << mConfigurations[confId];
|
|
410 |
TPtrC16 string( tmp.utf16(), tmp.length() );
|
|
411 |
|
|
412 |
OstTraceExt2( TRACE_NORMAL, WLANWIZARDPRIVATE_CONFIGURATIONS,
|
|
413 |
"WlanWizardPrivate::configuration;confId=%{ConfigurationId};string=%S",
|
|
414 |
(uint)confId, string );
|
|
415 |
#endif
|
|
416 |
|
|
417 |
return mConfigurations[confId];
|
|
418 |
}
|
|
419 |
|
|
420 |
/*!
|
|
421 |
See WlanWizardHelper::setConfiguration().
|
|
422 |
*/
|
|
423 |
void WlanWizardPrivate::setConfiguration(
|
|
424 |
ConfigurationId confId,
|
|
425 |
const QVariant &value)
|
|
426 |
{
|
|
427 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
428 |
QString tmp;
|
|
429 |
QDebug tmpStream(&tmp);
|
|
430 |
tmpStream << value;
|
|
431 |
TPtrC16 string( tmp.utf16(), tmp.length() );
|
|
432 |
|
|
433 |
OstTraceExt2( TRACE_NORMAL, WLANWIZARDPRIVATE_SETCONFIGURATION,
|
|
434 |
"WlanWizardPrivate::setConfiguration;"
|
|
435 |
"confId=%{ConfigurationId};string=%S",
|
|
436 |
(uint)confId, string );
|
|
437 |
#endif
|
|
438 |
|
|
439 |
mConfigurations[confId] = value;
|
|
440 |
}
|
|
441 |
|
|
442 |
/*!
|
|
443 |
See WlanWizardHelper::enableNextButton().
|
|
444 |
*/
|
|
445 |
void WlanWizardPrivate::enableNextButton(bool enable)
|
|
446 |
{
|
|
447 |
OstTraceExt2( TRACE_FLOW, WLANWIZARDPRIVATE_ENABLENEXTBUTTON,
|
|
448 |
"WlanWizardPrivate::enableNextButton;this=%x;enable=%x",
|
|
449 |
(unsigned)this, (uint)enable );
|
|
450 |
mActionNext->setEnabled(enable);
|
|
451 |
}
|
|
452 |
|
|
453 |
/*!
|
|
454 |
See WlanWizardHelper::enablePrevButton().
|
|
455 |
*/
|
|
456 |
void WlanWizardPrivate::enablePrevButton(bool enable)
|
|
457 |
{
|
|
458 |
OstTraceExt2( TRACE_FLOW, WLANWIZARDPRIVATE_ENABLEPREVBUTTON,
|
|
459 |
"WlanWizardPrivate::enablePrevButton;this=%x;enable=%x",
|
|
460 |
(unsigned)this, (uint)(enable) );
|
|
461 |
|
|
462 |
mActionPrevious->setEnabled(enable);
|
|
463 |
}
|
|
464 |
|
|
465 |
/*!
|
|
466 |
See WlanWizardHelper::addPage().
|
|
467 |
*/
|
|
468 |
void WlanWizardPrivate::addPage(int pageId, WlanWizardPage *page)
|
|
469 |
{
|
|
470 |
OstTraceExt3( TRACE_FLOW, WLANWIZARDPRIVATE_ADDPAGE,
|
|
471 |
"WlanWizardPrivate::addPage;this=%x;pageId=%{PageIds};page=%x",
|
|
472 |
(unsigned)this, pageId, (uint)(page) );
|
|
473 |
|
|
474 |
Q_ASSERT(!mPages.contains(pageId));
|
|
475 |
mPages[pageId] = page;
|
|
476 |
}
|
|
477 |
|
|
478 |
/*!
|
|
479 |
See WlanWizardHelper::nextPage().
|
|
480 |
*/
|
|
481 |
void WlanWizardPrivate::nextPage()
|
|
482 |
{
|
|
483 |
OstTrace1( TRACE_FLOW, WLANWIZARDPRIVATE_NEXTPAGE,
|
|
484 |
"WlanWizardPrivate::nextPage;this=%x",
|
|
485 |
this );
|
|
486 |
|
|
487 |
mPageFinished = true;
|
|
488 |
toNextPage();
|
|
489 |
}
|
|
490 |
|
|
491 |
/*!
|
|
492 |
See WlanWizardHelper::mainWindow().
|
|
493 |
*/
|
|
494 |
HbMainWindow* WlanWizardPrivate::mainWindow() const
|
|
495 |
{
|
|
496 |
return mMainWindow;
|
|
497 |
}
|
|
498 |
|
|
499 |
/*!
|
|
500 |
See WlanWizardHelper::isCurrentPage().
|
|
501 |
*/
|
|
502 |
bool WlanWizardPrivate::isCurrentPage(const HbWidget *page) const
|
|
503 |
{
|
|
504 |
bool ret = false;
|
|
505 |
if (mStackedWidget->currentWidget() == page) {
|
|
506 |
ret = true;
|
|
507 |
}
|
|
508 |
|
|
509 |
OstTraceExt2( TRACE_FLOW, WLANWIZARDPRIVATE_ISCURRENTPAGE,
|
|
510 |
"WlanWizardPrivate::isCurrentPage;page=%x;ret=%d",
|
|
511 |
(uint)page, ret);
|
|
512 |
|
|
513 |
return ret;
|
|
514 |
}
|
|
515 |
|
|
516 |
/*!
|
|
517 |
See WlanWizardHelper::nextPageId()
|
|
518 |
*/
|
|
519 |
int WlanWizardPrivate::nextPageId(bool useWps)
|
|
520 |
{
|
|
521 |
int ret;
|
|
522 |
int secMode = configuration(WlanWizardHelper::ConfSecurityMode).toInt();
|
|
523 |
switch (secMode) {
|
|
524 |
case CMManagerShim::WlanSecModeWep:
|
|
525 |
ret = WlanWizardPageInternal::PageKeyQuery;
|
|
526 |
break;
|
|
527 |
|
|
528 |
case CMManagerShim::WlanSecModeWpa:
|
|
529 |
case CMManagerShim::WlanSecModeWpa2:
|
|
530 |
if (configuration(WlanWizardHelper::ConfUsePsk).toBool()) {
|
|
531 |
ret = WlanWizardPageInternal::PageKeyQuery;
|
|
532 |
} else {
|
|
533 |
#ifdef WLAN_WIZARD_RND_EAP
|
|
534 |
ret = WlanWizardPage::PageEapStart;
|
|
535 |
#else
|
|
536 |
ret = WlanWizardPageInternal::PageProcessSettings;
|
|
537 |
setConfiguration(ConfSecurityMode, CMManagerShim::WlanSecModeOpen);
|
|
538 |
#endif
|
|
539 |
|
|
540 |
}
|
|
541 |
break;
|
|
542 |
|
|
543 |
case CMManagerShim::WlanSecMode802_1x:
|
|
544 |
#ifdef WLAN_WIZARD_RND_EAP
|
|
545 |
ret = WlanWizardPage::PageEapStart;
|
|
546 |
#else
|
|
547 |
ret = WlanWizardPageInternal::PageProcessSettings;
|
|
548 |
setConfiguration(ConfSecurityMode, CMManagerShim::WlanSecModeOpen);
|
|
549 |
#endif
|
|
550 |
break;
|
|
551 |
|
|
552 |
case CMManagerShim::WlanSecModeWapi:
|
|
553 |
case CMManagerShim::WlanSecModeOpen:
|
|
554 |
default:
|
|
555 |
Q_ASSERT(
|
|
556 |
secMode == CMManagerShim::WlanSecModeOpen ||
|
|
557 |
secMode == CMManagerShim::WlanSecModeWapi);
|
|
558 |
|
|
559 |
setConfiguration(ConfSecurityMode, CMManagerShim::WlanSecModeOpen);
|
|
560 |
ret = WlanWizardPageInternal::PageProcessSettings;
|
|
561 |
break;
|
|
562 |
}
|
|
563 |
|
|
564 |
Q_UNUSED(useWps);
|
|
565 |
#ifdef WLAN_WIZARD_RND_WPS
|
|
566 |
// TODO: WPS: and switch case above to else branch
|
|
567 |
if (useWps) {
|
|
568 |
ret = WlanWizardPage::PageWpsStart;
|
|
569 |
}
|
|
570 |
#endif
|
|
571 |
|
|
572 |
OstTraceExt3( TRACE_NORMAL, WLANWIZARDPRIVATE_NEXTPAGEID,
|
|
573 |
"WlanWizardPrivate::nextPageId;this=%x;useWps=%x;ret=%{PageIds}",
|
|
574 |
( unsigned )this, ( TUint )( useWps ), ret );
|
|
575 |
|
|
576 |
return ret;
|
|
577 |
}
|
|
578 |
|
|
579 |
/*!
|
|
580 |
Called when Cancel toolbar button is pressed. In case IAP has been created
|
|
581 |
it will be disconnected and the IAP settings are deleted and finally the
|
|
582 |
wizard is closed.
|
|
583 |
|
|
584 |
Indicates also to the current wizard page that cancel has been pressed.
|
|
585 |
*/
|
|
586 |
void WlanWizardPrivate::cancelTriggered()
|
|
587 |
{
|
|
588 |
OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_CANCELTRIGGERED,
|
|
589 |
"WlanWizardPrivate::cancelTriggered;this=%x",
|
|
590 |
this );
|
|
591 |
|
|
592 |
// Disconnect receiving more signals from any actions
|
|
593 |
disconnectActions();
|
|
594 |
|
|
595 |
mPageTimer->stop();
|
|
596 |
|
|
597 |
HbWidget *widget = qobject_cast<HbWidget*>(mStackedWidget->currentWidget());
|
|
598 |
Q_ASSERT(widget);
|
|
599 |
mPageMapper[widget]->cancelTriggered();
|
|
600 |
|
|
601 |
int referenceId = configuration(ConfIapId).toInt();
|
|
602 |
if (referenceId != WlanQtUtils::IapIdNone) {
|
|
603 |
// call disconnect even if
|
|
604 |
// - connection is not open
|
|
605 |
// - connection establishment is ongoing
|
|
606 |
mWlanQtUtils->disconnectIap(referenceId);
|
|
607 |
|
|
608 |
// if IAP deletion fails, there is nothing we can do with it
|
|
609 |
mWlanQtUtils->deleteIap(referenceId);
|
|
610 |
WlanWizardPlugin* plugin = wlanWizardPlugin();
|
|
611 |
if (plugin) {
|
|
612 |
// if deletion of plugin specific configuration fails we are not
|
|
613 |
// able to do anything
|
|
614 |
plugin->deleteSettings();
|
|
615 |
}
|
|
616 |
setConfiguration(ConfIapId, WlanQtUtils::IapIdNone);
|
|
617 |
}
|
|
618 |
closeViews();
|
|
619 |
Q_ASSERT(q_ptr);
|
|
620 |
|
|
621 |
OstTrace0( TRACE_BORDER, WLANWIZARDPRIVATE_CANCELTRIGGERED_EMIT,
|
|
622 |
"WlanWizardPrivate::cancelTriggered - emit cancelled()" );
|
|
623 |
|
|
624 |
emit q_ptr->cancelled();
|
|
625 |
|
|
626 |
OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_CANCELTRIGGERED_DONE,
|
|
627 |
"WlanWizardPrivate::cancelTriggered - Done;this=%x", this );
|
|
628 |
}
|
|
629 |
|
|
630 |
/*!
|
|
631 |
Called when Previous toolbar button is pressed. Shows the previous wizard
|
|
632 |
page in stacked widget and indicates wizard page that previous has been
|
|
633 |
pressed.
|
|
634 |
*/
|
|
635 |
void WlanWizardPrivate::previousTriggered()
|
|
636 |
{
|
|
637 |
OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_PREVIOUSTRIGGERED,
|
|
638 |
"WlanWizardPrivate::previousTriggered;this=%x",
|
|
639 |
this );
|
|
640 |
|
|
641 |
mPageTimer->stop();
|
|
642 |
|
|
643 |
int index = mStackedWidget->currentIndex();
|
|
644 |
HbWidget *widget = qobject_cast<HbWidget*>(mStackedWidget->currentWidget());
|
|
645 |
Q_ASSERT(widget);
|
|
646 |
int back = mPageMapper[widget]->previousTriggered();
|
|
647 |
|
|
648 |
// check that at least one page is left in the stack
|
|
649 |
Q_ASSERT( back < mStackedWidget->count());
|
|
650 |
|
|
651 |
// When a widget which is last in the stack is removed the currentindex
|
|
652 |
// is automatically updated.
|
|
653 |
for (int i = 0; i < back; ++i) {
|
|
654 |
mStackedWidget->removeAt(index - i);
|
|
655 |
}
|
|
656 |
|
|
657 |
widget = qobject_cast<HbWidget*> (mStackedWidget->currentWidget());
|
|
658 |
Q_ASSERT(widget);
|
|
659 |
WlanWizardPage* page = mPageMapper[widget];
|
|
660 |
Q_ASSERT(page);
|
|
661 |
// In error case if page (value) is not found default contructed key is
|
|
662 |
// returned, in this case default value for int is 0 which means PageNone.
|
|
663 |
updateFrame(mPages.key(page));
|
|
664 |
enableNextButton(page->showPage());
|
|
665 |
|
|
666 |
OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_PREVIOUSTRIGGERED_DONE,
|
|
667 |
"WlanWizardPrivate::previousTriggered - Done;this=%x",
|
|
668 |
this );
|
|
669 |
}
|
|
670 |
|
|
671 |
/*!
|
|
672 |
Next toolbar button has been pressed. Wizard framework asks from the current
|
|
673 |
page what should be the next page id and shows it.
|
|
674 |
*/
|
|
675 |
void WlanWizardPrivate::nextTriggered()
|
|
676 |
{
|
|
677 |
OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_NEXTTRIGGERED,
|
|
678 |
"WlanWizardPrivate::nextTriggered;this=%x",
|
|
679 |
this );
|
|
680 |
|
|
681 |
mPageTimer->stop();
|
|
682 |
|
|
683 |
HbWidget *widget = qobject_cast<HbWidget*>(mStackedWidget->currentWidget());
|
|
684 |
Q_ASSERT(widget);
|
|
685 |
|
|
686 |
bool removeFromStack;
|
|
687 |
int pageId = mPageMapper[widget]->nextId(removeFromStack);
|
|
688 |
showPage(pageId, removeFromStack);
|
|
689 |
|
|
690 |
OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_NEXTTRIGGERED_DONE,
|
|
691 |
"WlanWizardPrivate::nextTriggered - Done;this=%x",
|
|
692 |
this );
|
|
693 |
}
|
|
694 |
|
|
695 |
/*!
|
|
696 |
Finish button has been pressed. Closes the wizard and sends finished()
|
|
697 |
signal to the client.
|
|
698 |
*/
|
|
699 |
void WlanWizardPrivate::finishTriggered()
|
|
700 |
{
|
|
701 |
OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_FINISHTRIGGERED,
|
|
702 |
"WlanWizardPrivate::finishTriggered;this=%x",
|
|
703 |
this );
|
|
704 |
|
|
705 |
// Disconnect receiving more signals from any actions
|
|
706 |
disconnectActions();
|
|
707 |
|
|
708 |
mPageTimer->stop();
|
|
709 |
closeViews();
|
|
710 |
|
|
711 |
Q_ASSERT(q_ptr);
|
|
712 |
emit q_ptr->finished(
|
|
713 |
configuration(ConfIapId).toInt(),
|
|
714 |
configuration(ConfConnected).toBool());
|
|
715 |
|
|
716 |
OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_FINISHTRIGGERED_DONE,
|
|
717 |
"WlanWizardPrivate::finishTriggered - Done;this=%x",
|
|
718 |
this );
|
|
719 |
}
|
|
720 |
|
|
721 |
/*!
|
|
722 |
In case wizard page is using timer protection for the page, this is the
|
|
723 |
slot to handle the callback from the timer.
|
|
724 |
*/
|
|
725 |
void WlanWizardPrivate::onTimeOut()
|
|
726 |
{
|
|
727 |
OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_ONTIMEOUT,
|
|
728 |
"WlanWizardPrivate::onTimeOut;this=%x",
|
|
729 |
this );
|
|
730 |
|
|
731 |
toNextPage();
|
|
732 |
|
|
733 |
OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_ONTIMEOUT_DONE,
|
|
734 |
"WlanWizardPrivate::onTimeOut - Done;this=%x",
|
|
735 |
this );
|
|
736 |
}
|
|
737 |
|
|
738 |
/*!
|
|
739 |
Slot to start wizard page operation asynchronous. Starts also the timer
|
|
740 |
to protect the wizard page.
|
|
741 |
*/
|
|
742 |
void WlanWizardPrivate::startPageOperation()
|
|
743 |
{
|
|
744 |
// Process this if wizard has not been closed
|
|
745 |
if (mClosed == false) {
|
|
746 |
OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_STARTPAGEOPERATION,
|
|
747 |
"WlanWizardPrivate::startPageOperation;this=%x",
|
|
748 |
this );
|
|
749 |
|
|
750 |
HbWidget *widget =
|
|
751 |
qobject_cast<HbWidget*>(mStackedWidget->currentWidget());
|
|
752 |
Q_ASSERT(widget);
|
|
753 |
mPageFinished = false;
|
|
754 |
mPageTimer->start(PageTimeout);
|
|
755 |
mPageMapper[widget]->startOperation();
|
|
756 |
|
|
757 |
OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_STARTPAGEOPERATION_DONE,
|
|
758 |
"WlanWizardPrivate::startPageOperation - DONE;this=%x",
|
|
759 |
this );
|
|
760 |
}
|
|
761 |
}
|
|
762 |
|
|
763 |
/*!
|
|
764 |
In case the wizard page uses timer protection this method determines when
|
|
765 |
the next page is shown.
|
|
766 |
*/
|
|
767 |
void WlanWizardPrivate::toNextPage()
|
|
768 |
{
|
|
769 |
if (mPageFinished && !(mPageTimer->isActive())) {
|
|
770 |
OstTrace1( TRACE_FLOW, WLANWIZARDPRIVATE_TONEXTPAGE,
|
|
771 |
"WlanWizardPrivate::toNextPage;this=%x",
|
|
772 |
this );
|
|
773 |
|
|
774 |
// process this asynchronous. Main purpose is to release the current
|
|
775 |
// call stack and process the page change using new call stack
|
|
776 |
QMetaObject::invokeMethod(this, "nextTriggered", Qt::QueuedConnection);
|
|
777 |
}
|
|
778 |
}
|
|
779 |
|
|
780 |
/*!
|
|
781 |
Show requested page and removes the current wizard page from the stack if
|
|
782 |
required. This method updates the title and toolbar accordingly.
|
|
783 |
|
|
784 |
See WlanWizardPage::nextId()
|
|
785 |
|
|
786 |
@param [in] pageId Wizard Page ID to be shown
|
|
787 |
@param [in] removeFromStack if true the current wizard page is removed from
|
|
788 |
the stackedwidget.
|
|
789 |
*/
|
|
790 |
void WlanWizardPrivate::showPage(int pageId, bool removeFromStack)
|
|
791 |
{
|
|
792 |
OstTraceExt3( TRACE_FLOW, WLANWIZARDPRIVATE_SHOWPAGE,
|
|
793 |
"WlanWizardPrivate::showPage;this=%x;"
|
|
794 |
"pageId=%{PageIds};removeFromStack=%x",
|
|
795 |
( unsigned )this, pageId, ( TUint )( removeFromStack ) );
|
|
796 |
|
|
797 |
// PageNone is returned by wizard pages when some validation of page content
|
|
798 |
// has not passed and the page does not want to process wizard to next page
|
|
799 |
if (pageId == WlanWizardPage::PageNone) {
|
|
800 |
return;
|
|
801 |
}
|
|
802 |
|
|
803 |
// PageProcessSettings is shown only when WLAN AP is found in scanning
|
|
804 |
// 1/ when client calls setParameters()
|
|
805 |
// 2/ scanning page has found match with given SSID
|
|
806 |
if (pageId == WlanWizardPage::PageProcessSettings) {
|
|
807 |
if (configuration(ConfProcessSettings).toBool() == false) {
|
|
808 |
if (handleIap()){
|
|
809 |
pageId = WlanWizardPageInternal::PageSummary;
|
|
810 |
} else {
|
|
811 |
pageId = WlanWizardPage::PageGenericError;
|
|
812 |
setConfiguration(
|
|
813 |
ConfGenericErrorString,
|
|
814 |
hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret"));
|
|
815 |
}
|
|
816 |
OstTraceExt2( TRACE_FLOW, WLANWIZARDPRIVATE_SHOWPAGE_UPDATE,
|
|
817 |
"WlanWizardPrivate::showPage - change page;this=%x;"
|
|
818 |
"pageId=%{PageIds}",
|
|
819 |
( unsigned )this, pageId);
|
|
820 |
}
|
|
821 |
}
|
|
822 |
|
|
823 |
#ifdef WLAN_WIZARD_RND_EAP
|
|
824 |
if (pageId == WlanWizardPage::PageEapStart) {
|
|
825 |
if (!mEapWizard) {
|
|
826 |
// EAP Wizard will add wizard pages at construction phase using
|
|
827 |
// WlanWizardHelper::addPage()
|
|
828 |
mEapWizard = new EapWizard(this);
|
|
829 |
}
|
|
830 |
}
|
|
831 |
#endif
|
|
832 |
#ifdef WLAN_WIZARD_RND_WPS
|
|
833 |
if (pageId == WlanWizardPage::PageWpsStart) {
|
|
834 |
if (!mWpsWizard) {
|
|
835 |
// WPS Wizard will add wizard pages at construction phase using
|
|
836 |
// WlanWizardHelper::addPage()
|
|
837 |
mWpsWizard = new WpsWizard(this);
|
|
838 |
}
|
|
839 |
}
|
|
840 |
#endif
|
|
841 |
|
|
842 |
// Create visualization of next page and store it to mappers
|
|
843 |
WlanWizardPage* page = mPages[pageId];
|
|
844 |
Q_ASSERT(page);
|
|
845 |
HbWidget* widget = page->initializePage();
|
|
846 |
Q_ASSERT(widget);
|
|
847 |
mPageMapper[widget] = page;
|
|
848 |
|
|
849 |
// index calculation has to be happened before adding new widget into
|
|
850 |
// the stacked widget. Since the internal implementation of stackedwidget
|
|
851 |
// sets the first widget in the stack to current widget..
|
|
852 |
// and when there are not any widgets in the stack the current index is
|
|
853 |
// -1. Valid index starts from 0.
|
|
854 |
int index = mStackedWidget->currentIndex();
|
|
855 |
|
|
856 |
if (removeFromStack) {
|
|
857 |
// widget is removed from the stacked widget, not deleted
|
|
858 |
mStackedWidget->removeAt(index);
|
|
859 |
} else {
|
|
860 |
index++;
|
|
861 |
}
|
|
862 |
mStackedWidget->addWidget(widget);
|
|
863 |
mStackedWidget->setCurrentIndex(index);
|
|
864 |
updateFrame(pageId);
|
|
865 |
enableNextButton(page->showPage());
|
|
866 |
|
|
867 |
// If wizard page needs to start some control operation trigger it
|
|
868 |
// asyncronously so that the UI gets more priority to get painted correctly
|
|
869 |
// before any operation takes place in wizard page. This is important for
|
|
870 |
// timer protected pages. Makes wizard to work smother from UI perspective
|
|
871 |
if (page->requiresStartOperation()) {
|
|
872 |
OstTrace0( TRACE_FLOW, WLANWIZARDPRIVATE_SHOWPAGE_INVOKE,
|
|
873 |
"WlanWizardPrivate::showPage - Invoke startOperation" );
|
|
874 |
|
|
875 |
QMetaObject::invokeMethod(this, "startPageOperation", Qt::QueuedConnection);
|
|
876 |
}
|
|
877 |
}
|
|
878 |
|
|
879 |
/*!
|
|
880 |
Creates all control objects of WLAN wizard pages which are inherited from
|
|
881 |
WlanWizardPage and adds those into a internal database.
|
|
882 |
*/
|
|
883 |
void WlanWizardPrivate::createPages()
|
|
884 |
{
|
|
885 |
OstTrace0( TRACE_NORMAL, WLANWIZARDPRIVATE_CREATEPAGES,
|
|
886 |
"WlanWizardPrivate::createPages" );
|
|
887 |
|
|
888 |
addPage(WlanWizardPageInternal::PageKeyQuery,
|
|
889 |
new WlanWizardPageKeyQuery(this));
|
|
890 |
|
|
891 |
addPage(WlanWizardPageInternal::PageProcessSettings,
|
|
892 |
new WlanWizardPageProcessingSettings(this));
|
|
893 |
|
|
894 |
addPage(WlanWizardPageInternal::PageSummary,
|
|
895 |
new WlanWizardPageSummary(this));
|
|
896 |
|
|
897 |
addPage(WlanWizardPageInternal::PageGenericError,
|
|
898 |
new WlanWizardPageGenericError(this));
|
|
899 |
|
|
900 |
#ifdef WLAN_WIZARD_RND
|
|
901 |
addPage(WlanWizardPageInternal::PageSsid, new WlanWizardPageSsid(this));
|
|
902 |
|
|
903 |
addPage(WlanWizardPageInternal::PageScanning,
|
|
904 |
new WlanWizardPageScanning(this));
|
|
905 |
|
|
906 |
addPage(WlanWizardPageInternal::PageNetworkMode,
|
|
907 |
new WlanWizardPageNetworkMode(this));
|
|
908 |
|
|
909 |
addPage(WlanWizardPageInternal::PageNetworkSecurity,
|
|
910 |
new WlanWizardPageSecurityMode(this));
|
|
911 |
#endif
|
|
912 |
}
|
|
913 |
|
|
914 |
/*!
|
|
915 |
Called when wizard is closed
|
|
916 |
- cancelled by the user
|
|
917 |
- finished by the user
|
|
918 |
*/
|
|
919 |
void WlanWizardPrivate::closeViews()
|
|
920 |
{
|
|
921 |
mClosed = true;
|
|
922 |
mDialog->close();
|
|
923 |
}
|
|
924 |
|
|
925 |
/*!
|
|
926 |
This method takes care of the title of wizard and toolbutton. Correct items
|
|
927 |
are selected based on the \a pageId and the amount of objects in the stacked
|
|
928 |
widget.
|
|
929 |
|
|
930 |
@param [in] pageId Wizard Page Id
|
|
931 |
*/
|
|
932 |
void WlanWizardPrivate::updateFrame(int pageId)
|
|
933 |
{
|
|
934 |
int currentIndex = mStackedWidget->currentIndex();
|
|
935 |
|
|
936 |
OstTraceExt3( TRACE_FLOW, WLANWIZARDPRIVATE_UPDATEFRAME,
|
|
937 |
"WlanWizardPrivate::updateFrame;this=%x;pageId=%{PageIds};currentIndex=%d",
|
|
938 |
(unsigned)this, pageId, (uint)(currentIndex) );
|
|
939 |
|
|
940 |
// For last page (summary) show Finish instead of Next button
|
|
941 |
if (pageId == WlanWizardPageInternal::PageSummary) {
|
|
942 |
mTitle->setPlainText(hbTrId("txt_occ_title_wlan_setup_wizard_summary"));
|
|
943 |
mActionFinish->setVisible(true);
|
|
944 |
mActionNext->setVisible(false);
|
|
945 |
mActionPrevious->setVisible(false);
|
|
946 |
} else {
|
|
947 |
// Index starts from zero, wizard page numbering starts from one.
|
|
948 |
mTitle->setPlainText(
|
|
949 |
hbTrId("txt_occ_title_wlan_setup_wizard_step_l1").arg(
|
|
950 |
currentIndex + 1));
|
|
951 |
mActionFinish->setVisible(false);
|
|
952 |
mActionNext->setVisible(true);
|
|
953 |
|
|
954 |
// If first page is shown then Previous button is disabled
|
|
955 |
if (currentIndex < 1) {
|
|
956 |
mActionPrevious->setVisible(false);
|
|
957 |
} else {
|
|
958 |
mActionPrevious->setVisible(true);
|
|
959 |
if (pageId == WlanWizardPage::PageProcessSettings) {
|
|
960 |
mActionPrevious->setEnabled(false);
|
|
961 |
} else {
|
|
962 |
mActionPrevious->setEnabled(true);
|
|
963 |
}
|
|
964 |
}
|
|
965 |
}
|
|
966 |
}
|
|
967 |
|
|
968 |
/*!
|
|
969 |
Loads widgets and objects from the docml file.
|
|
970 |
*/
|
|
971 |
void WlanWizardPrivate::loadDocml()
|
|
972 |
{
|
|
973 |
bool ok = true;
|
|
974 |
|
|
975 |
mDocLoader->load(":/docml/occ_wlan_wizard_main.docml", &ok);
|
|
976 |
Q_ASSERT(ok);
|
|
977 |
|
|
978 |
mDialog.reset( qobject_cast<HbDialog*> (mDocLoader->findWidget("dialog")) );
|
|
979 |
Q_ASSERT(mDialog != NULL);
|
|
980 |
|
|
981 |
mTitle = qobject_cast<HbLabel*> (mDocLoader->findWidget("title"));
|
|
982 |
Q_ASSERT(mTitle != NULL);
|
|
983 |
|
|
984 |
mStackedWidget =
|
|
985 |
qobject_cast<HbStackedWidget*> (mDocLoader->findWidget("stackedWidget"));
|
|
986 |
Q_ASSERT(mStackedWidget != NULL);
|
|
987 |
|
|
988 |
mActionNext = qobject_cast<HbAction*> (mDocLoader->findObject("actionNext"));
|
|
989 |
Q_ASSERT(mActionNext != NULL);
|
|
990 |
|
|
991 |
mActionPrevious =
|
|
992 |
qobject_cast<HbAction*> (mDocLoader->findObject("actionPrevious"));
|
|
993 |
Q_ASSERT(mActionPrevious != NULL);
|
|
994 |
|
|
995 |
mActionFinish =
|
|
996 |
qobject_cast<HbAction*> (mDocLoader->findObject("actionFinish"));
|
|
997 |
Q_ASSERT(mActionFinish != NULL);
|
|
998 |
|
|
999 |
mActionCancel =
|
|
1000 |
qobject_cast<HbAction*> (mDocLoader->findObject("actionCancel"));
|
|
1001 |
Q_ASSERT(mActionCancel != NULL);
|
|
1002 |
|
|
1003 |
// Actions are added from left to right to the toolbar of dialog
|
|
1004 |
mDialog->addAction(mActionPrevious);
|
|
1005 |
mDialog->addAction(mActionCancel);
|
|
1006 |
mDialog->addAction(mActionNext);
|
|
1007 |
mDialog->addAction(mActionFinish);
|
|
1008 |
|
|
1009 |
// TODO: workaround to prevent action to close the dialog
|
|
1010 |
disconnect(mActionPrevious, SIGNAL(triggered()), mDialog.data(), SLOT(close()));
|
|
1011 |
disconnect(mActionCancel, SIGNAL(triggered()), mDialog.data(), SLOT(close()));
|
|
1012 |
disconnect(mActionNext, SIGNAL(triggered()), mDialog.data(), SLOT(close()));
|
|
1013 |
disconnect(mActionFinish, SIGNAL(triggered()), mDialog.data(), SLOT(close()));
|
|
1014 |
|
|
1015 |
ok = true;
|
|
1016 |
ok = connect(mPageTimer, SIGNAL(timeout()), this, SLOT(onTimeOut()));
|
|
1017 |
Q_ASSERT(ok);
|
|
1018 |
|
|
1019 |
ok = connect(
|
|
1020 |
mActionNext, SIGNAL(triggered()),
|
|
1021 |
this, SLOT(nextTriggered()));
|
|
1022 |
Q_ASSERT(ok);
|
|
1023 |
|
|
1024 |
ok = connect(
|
|
1025 |
mActionPrevious, SIGNAL(triggered()),
|
|
1026 |
this, SLOT(previousTriggered()));
|
|
1027 |
Q_ASSERT(ok);
|
|
1028 |
|
|
1029 |
ok = connect(
|
|
1030 |
mActionFinish, SIGNAL(triggered()),
|
|
1031 |
this, SLOT(finishTriggered()));
|
|
1032 |
Q_ASSERT(ok);
|
|
1033 |
|
|
1034 |
ok = connect(
|
|
1035 |
mActionCancel, SIGNAL(triggered()),
|
|
1036 |
this, SLOT(cancelTriggered()));
|
|
1037 |
Q_ASSERT(ok);
|
|
1038 |
|
|
1039 |
// TODO: workaround for full screen dialog, with docml it is possible to
|
|
1040 |
// define fullscreen dialog, mut resize is not done correctly when orientation
|
|
1041 |
// is changed. See TSW Error: MTAA-854DK8
|
|
1042 |
ok = HbStyleLoader::registerFilePath(":/css/custom.css");
|
|
1043 |
Q_ASSERT(ok);
|
|
1044 |
}
|
|
1045 |
|
|
1046 |
/*!
|
|
1047 |
Disconnect receiving triggered() signal from any toolbar action.
|
|
1048 |
*/
|
|
1049 |
void WlanWizardPrivate::disconnectActions()
|
|
1050 |
{
|
|
1051 |
disconnect(
|
|
1052 |
mActionNext, SIGNAL(triggered()),
|
|
1053 |
this, SLOT(nextTriggered()));
|
|
1054 |
|
|
1055 |
disconnect(
|
|
1056 |
mActionPrevious, SIGNAL(triggered()),
|
|
1057 |
this, SLOT(previousTriggered()));
|
|
1058 |
|
|
1059 |
disconnect(
|
|
1060 |
mActionFinish, SIGNAL(triggered()),
|
|
1061 |
this, SLOT(finishTriggered()));
|
|
1062 |
|
|
1063 |
disconnect(
|
|
1064 |
mActionCancel, SIGNAL(triggered()),
|
|
1065 |
this, SLOT(cancelTriggered()));
|
|
1066 |
}
|