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 |
* EAP Wizard Page: Outer type selection
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
// System includes
|
|
20 |
#include <HbDocumentLoader>
|
|
21 |
#include <HbMainWindow>
|
|
22 |
#include <HbWidget>
|
|
23 |
#include <HbRadioButtonList>
|
|
24 |
#include <HbLabel>
|
|
25 |
#include <eapqtpluginhandle.h>
|
|
26 |
#include <eapqtplugininfo.h>
|
|
27 |
#include <eapqtconfiginterface.h>
|
|
28 |
#include <eapqtconfig.h>
|
|
29 |
#include <eapqtpacstoreconfig.h>
|
|
30 |
|
|
31 |
// User includes
|
|
32 |
#include "wlanwizardhelper.h"
|
|
33 |
#include "eapwizard_p.h"
|
|
34 |
#include "eapwizardpageoutertype.h"
|
43
|
35 |
#include "OstTraceDefinitions.h"
|
|
36 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
37 |
#include "eapwizardpageoutertypeTraces.h"
|
|
38 |
#endif
|
|
39 |
|
39
|
40 |
|
|
41 |
/*!
|
|
42 |
\class EapWizardPageOuterType
|
|
43 |
\brief Implements EAP wizard page: Outer EAP type selection
|
|
44 |
*/
|
|
45 |
|
|
46 |
// External function prototypes
|
|
47 |
|
|
48 |
// Local constants
|
|
49 |
|
|
50 |
// ======== LOCAL FUNCTIONS ========
|
|
51 |
|
|
52 |
// ======== MEMBER FUNCTIONS ========
|
|
53 |
|
|
54 |
|
|
55 |
/*!
|
|
56 |
Constructor.
|
|
57 |
|
|
58 |
@param [in] parent Pointer to EAP Wizard private implementation.
|
|
59 |
*/
|
|
60 |
EapWizardPageOuterType::EapWizardPageOuterType(EapWizardPrivate* parent) :
|
|
61 |
EapWizardPage(parent),
|
|
62 |
mWidget(NULL),
|
|
63 |
mRadio(NULL),
|
|
64 |
mTitle(NULL),
|
|
65 |
mDocumentLoader(NULL),
|
|
66 |
mValid(false)
|
|
67 |
{
|
43
|
68 |
OstTraceFunctionEntry0( EAPWIZARDPAGEOUTERTYPE_EAPWIZARDPAGEOUTERTYPE_ENTRY );
|
|
69 |
OstTraceFunctionExit0( EAPWIZARDPAGEOUTERTYPE_EAPWIZARDPAGEOUTERTYPE_EXIT );
|
39
|
70 |
}
|
|
71 |
|
|
72 |
/*!
|
|
73 |
Destructor.
|
|
74 |
*/
|
|
75 |
EapWizardPageOuterType::~EapWizardPageOuterType()
|
|
76 |
{
|
43
|
77 |
OstTraceFunctionEntry0( DUP1_EAPWIZARDPAGEOUTERTYPE_EAPWIZARDPAGEOUTERTYPE_ENTRY );
|
|
78 |
OstTraceFunctionExit0( DUP1_EAPWIZARDPAGEOUTERTYPE_EAPWIZARDPAGEOUTERTYPE_EXIT );
|
39
|
79 |
}
|
|
80 |
|
|
81 |
/*!
|
|
82 |
See WlanWizardPage.
|
|
83 |
*/
|
|
84 |
HbWidget* EapWizardPageOuterType::initializePage()
|
|
85 |
{
|
43
|
86 |
OstTraceFunctionEntry0( EAPWIZARDPAGEOUTERTYPE_INITIALIZEPAGE_ENTRY );
|
39
|
87 |
if (!mWidget) {
|
|
88 |
bool ok;
|
|
89 |
mDocumentLoader.reset(
|
|
90 |
new HbDocumentLoader(mWizard->wizardHelper()->mainWindow()));
|
|
91 |
mDocumentLoader->load(":/docml/occ_eap_wizard_01_02_04.docml", &ok);
|
|
92 |
Q_ASSERT(ok);
|
|
93 |
|
|
94 |
loadDocmlSection(mWizard->wizardHelper()->mainWindow()->orientation());
|
|
95 |
|
|
96 |
mWidget = qobject_cast<HbWidget*> (mDocumentLoader->findWidget("occ_eap_wizard_01"));
|
|
97 |
Q_ASSERT(mWidget);
|
|
98 |
|
|
99 |
mRadio = qobject_cast<HbRadioButtonList*> (mDocumentLoader->findWidget("list"));
|
|
100 |
Q_ASSERT(mRadio);
|
|
101 |
|
|
102 |
mTitle = qobject_cast<HbLabel*> (mDocumentLoader->findWidget("title"));
|
|
103 |
Q_ASSERT(mTitle);
|
|
104 |
|
|
105 |
mTitle->setPlainText(hbTrId("txt_occ_title_select_eap_type"));
|
|
106 |
|
|
107 |
QStringList items;
|
|
108 |
appendToList(items, EapQtPluginHandle::PluginPeap);
|
|
109 |
appendToList(items, EapQtPluginHandle::PluginEapTtls);
|
|
110 |
appendToList(items, EapQtPluginHandle::PluginEapTls);
|
|
111 |
appendToList(items, EapQtPluginHandle::PluginEapFast);
|
|
112 |
appendToList(items, EapQtPluginHandle::PluginLeap);
|
|
113 |
appendToList(items, EapQtPluginHandle::PluginEapAka);
|
|
114 |
appendToList(items, EapQtPluginHandle::PluginEapSim);
|
|
115 |
mRadio->setItems(items);
|
|
116 |
|
|
117 |
ok = connect(
|
|
118 |
mRadio, SIGNAL(itemSelected(int)),
|
|
119 |
this, SLOT(itemSelected(int)));
|
|
120 |
Q_ASSERT(ok);
|
|
121 |
|
|
122 |
ok = connect(
|
|
123 |
mWizard->wizardHelper()->mainWindow(),
|
|
124 |
SIGNAL(orientationChanged(Qt::Orientation)),
|
|
125 |
this,
|
|
126 |
SLOT(loadDocmlSection(Qt::Orientation)));
|
|
127 |
Q_ASSERT(ok);
|
|
128 |
}
|
43
|
129 |
OstTraceFunctionExit0( EAPWIZARDPAGEOUTERTYPE_INITIALIZEPAGE_EXIT );
|
39
|
130 |
return mWidget;
|
|
131 |
}
|
|
132 |
|
|
133 |
/*!
|
|
134 |
Loads the required orientation of docml.
|
|
135 |
|
|
136 |
@param [in] orientation Orientation to be loaded.
|
|
137 |
*/
|
|
138 |
void EapWizardPageOuterType::loadDocmlSection(Qt::Orientation orientation)
|
|
139 |
{
|
43
|
140 |
OstTraceFunctionEntry0( EAPWIZARDPAGEOUTERTYPE_LOADDOCMLSECTION_ENTRY );
|
39
|
141 |
EapWizardPage::loadDocmlSection(
|
|
142 |
mDocumentLoader.data(),
|
|
143 |
orientation,
|
|
144 |
":/docml/occ_eap_wizard_01_02_04.docml",
|
|
145 |
"portrait_section",
|
|
146 |
"landscape_section");
|
43
|
147 |
OstTraceFunctionExit0( EAPWIZARDPAGEOUTERTYPE_LOADDOCMLSECTION_EXIT );
|
39
|
148 |
}
|
|
149 |
|
|
150 |
/*!
|
|
151 |
See WlanWizardPage.
|
|
152 |
|
|
153 |
@return next wizard page:
|
|
154 |
- WlanWizardPage::PageProcessSettings: For EAP-AKA and EAP-SIM
|
|
155 |
- EapWizardPage::PageCertificateCa: For PEAP, EAP-TLS and EAP-TTLS
|
|
156 |
- EapWizardPage::PageUsernamePassword: For LEAP and EAP-FAST (pac confirmed)
|
|
157 |
- EapWizardPage::PageNewPacStorePassword: For EAP-FAST (no pac store)
|
|
158 |
- EapWizardPage::PagePromptPacStorePassword: For EAP-FAST (confirm pac store)
|
|
159 |
*/
|
|
160 |
int EapWizardPageOuterType::nextId() const
|
|
161 |
{
|
43
|
162 |
OstTraceFunctionEntry0( EAPWIZARDPAGEOUTERTYPE_NEXTID_ENTRY );
|
39
|
163 |
int id = WlanWizardPage::PageNone;
|
|
164 |
EapQtPluginHandle::Plugin handle =
|
|
165 |
static_cast<EapQtPluginHandle::Plugin>(mEapTypes.at(mRadio->selected()));
|
|
166 |
switch (handle) {
|
|
167 |
case EapQtPluginHandle::PluginPeap:
|
|
168 |
case EapQtPluginHandle::PluginEapTtls:
|
|
169 |
case EapQtPluginHandle::PluginEapTls:
|
|
170 |
id = EapWizardPage::PageCertificateCa;
|
|
171 |
break;
|
|
172 |
|
|
173 |
case EapQtPluginHandle::PluginEapFast:
|
|
174 |
id = nextIdForEapFast();
|
|
175 |
break;
|
|
176 |
|
|
177 |
case EapQtPluginHandle::PluginLeap:
|
|
178 |
id = EapWizardPage::PageUsernamePassword;
|
|
179 |
break;
|
|
180 |
|
|
181 |
default:
|
|
182 |
Q_ASSERT(EapQtPluginHandle::PluginEapAka == handle ||
|
|
183 |
EapQtPluginHandle::PluginEapSim == handle);
|
|
184 |
id = WlanWizardPage::PageProcessSettings;
|
|
185 |
break;
|
|
186 |
}
|
|
187 |
|
|
188 |
mWizard->setConfigurations(EapWizardPrivate::OuterType, handle);
|
|
189 |
|
43
|
190 |
OstTraceFunctionExit0( EAPWIZARDPAGEOUTERTYPE_NEXTID_EXIT );
|
39
|
191 |
return id;
|
|
192 |
}
|
|
193 |
|
|
194 |
/*!
|
|
195 |
See WlanWizardPage.
|
|
196 |
|
|
197 |
Validates the content of the page.
|
|
198 |
|
|
199 |
@return true if content is valid.
|
|
200 |
*/
|
|
201 |
bool EapWizardPageOuterType::showPage()
|
|
202 |
{
|
43
|
203 |
OstTraceFunctionEntry0( EAPWIZARDPAGEOUTERTYPE_SHOWPAGE_ENTRY );
|
|
204 |
OstTraceFunctionExit0( EAPWIZARDPAGEOUTERTYPE_SHOWPAGE_EXIT );
|
39
|
205 |
return mValid;
|
|
206 |
}
|
|
207 |
|
|
208 |
/*!
|
|
209 |
Slot for itemSelected() signal from HbRadioButtonList.
|
|
210 |
|
|
211 |
@param [in] index NOT USED.
|
|
212 |
*/
|
|
213 |
void EapWizardPageOuterType::itemSelected(int index)
|
|
214 |
{
|
43
|
215 |
OstTraceFunctionEntry0( EAPWIZARDPAGEOUTERTYPE_ITEMSELECTED_ENTRY );
|
39
|
216 |
Q_UNUSED(index);
|
|
217 |
mValid = true;
|
|
218 |
mWizard->wizardHelper()->enableNextButton(mValid);
|
43
|
219 |
OstTraceFunctionExit0( EAPWIZARDPAGEOUTERTYPE_ITEMSELECTED_EXIT );
|
39
|
220 |
}
|
|
221 |
|
|
222 |
/*!
|
|
223 |
Appends given method to radiobutton list if plugin (method) is supported
|
|
224 |
|
|
225 |
@param [in,out] items the content of radiobutton list
|
|
226 |
@param [in] pluginHandle EAP Type plugin handle to be added.
|
|
227 |
*/
|
|
228 |
void EapWizardPageOuterType::appendToList(
|
|
229 |
QStringList &items, int pluginHandle)
|
|
230 |
{
|
43
|
231 |
OstTraceFunctionEntry0( EAPWIZARDPAGEOUTERTYPE_APPENDTOLIST_ENTRY );
|
39
|
232 |
if (mWizard->eapConfigurationInterface()->isSupportedOuterType(
|
|
233 |
(EapQtPluginHandle::Plugin)pluginHandle)) {
|
|
234 |
items << mWizard->eapTypeToString(pluginHandle);
|
|
235 |
mEapTypes.append(pluginHandle);
|
|
236 |
}
|
43
|
237 |
OstTraceFunctionExit0( EAPWIZARDPAGEOUTERTYPE_APPENDTOLIST_EXIT );
|
39
|
238 |
}
|
|
239 |
|
|
240 |
/*
|
|
241 |
Getter for next page id when outer eap type is EAP-FAST.
|
|
242 |
|
|
243 |
@return Page ID.
|
|
244 |
*/
|
|
245 |
int EapWizardPageOuterType::nextIdForEapFast() const
|
|
246 |
{
|
43
|
247 |
OstTraceFunctionEntry0( EAPWIZARDPAGEOUTERTYPE_NEXTIDFOREAPFAST_ENTRY );
|
39
|
248 |
int pageId;
|
|
249 |
|
|
250 |
mWizard->setConfigurations(EapWizardPrivate::InnerType,
|
|
251 |
EapQtPluginHandle::PluginEapMschapv2);
|
|
252 |
|
|
253 |
EapQtPacStoreConfig pacStoreConf;
|
|
254 |
int pacStoreState = EapQtPacStoreConfig::PacStoreStateStoreNotExists;
|
|
255 |
|
|
256 |
if (mWizard->eapConfigurationInterface()->readPacStoreConfiguration(pacStoreConf)) {
|
|
257 |
pacStoreState = pacStoreConf.value(EapQtPacStoreConfig::PacStoreState).toInt();
|
|
258 |
} else {
|
|
259 |
pacStoreConf.clear();
|
|
260 |
pacStoreConf.setValue(EapQtPacStoreConfig::PacStoreReset, true);
|
|
261 |
mWizard->eapConfigurationInterface()->savePacStoreConfiguration(pacStoreConf);
|
|
262 |
}
|
|
263 |
|
|
264 |
mWizard->setConfigurations(EapWizardPrivate::PacStoreState, pacStoreState);
|
|
265 |
|
|
266 |
switch (pacStoreState) {
|
|
267 |
case EapQtPacStoreConfig::PacStoreStateStoreNotExists:
|
|
268 |
pageId = EapWizardPage::PageNewPacStorePassword;
|
|
269 |
break;
|
|
270 |
|
|
271 |
case EapQtPacStoreConfig::PacStoreStatePasswordRequired:
|
|
272 |
pageId = EapWizardPage::PagePromptPacStorePassword;
|
|
273 |
break;
|
|
274 |
|
|
275 |
default:
|
|
276 |
Q_ASSERT(pacStoreState == EapQtPacStoreConfig::PacStoreStatePasswordStored);
|
|
277 |
pageId = EapWizardPage::PageUsernamePassword;
|
|
278 |
break;
|
|
279 |
}
|
|
280 |
|
43
|
281 |
OstTraceFunctionExit0( EAPWIZARDPAGEOUTERTYPE_NEXTIDFOREAPFAST_EXIT );
|
39
|
282 |
return pageId;
|
|
283 |
}
|