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: Inner 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 <HbParameterLengthLimiter>
|
|
26 |
#include <eapqtpluginhandle.h>
|
|
27 |
#include <eapqtplugininfo.h>
|
|
28 |
#include <eapqtconfiginterface.h>
|
|
29 |
|
|
30 |
// User includes
|
|
31 |
#include "wlanwizardhelper.h"
|
|
32 |
#include "eapwizardpageinnertype.h"
|
|
33 |
#include "eapwizard_p.h"
|
43
|
34 |
#include "OstTraceDefinitions.h"
|
|
35 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
36 |
#include "eapwizardpageinnertypeTraces.h"
|
|
37 |
#endif
|
|
38 |
|
39
|
39 |
|
|
40 |
|
|
41 |
/*!
|
|
42 |
\class EapWizardPageInnerType
|
|
43 |
\brief Implements EAP wizard page: Inner 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.
|
43
|
57 |
|
39
|
58 |
@param [in] parent Pointer to EAP Wizard private implementation.
|
|
59 |
@param [in] outerType Identifies the outer type: Peap or EapTtls
|
|
60 |
*/
|
|
61 |
EapWizardPageInnerType::EapWizardPageInnerType(
|
|
62 |
EapWizardPrivate* parent, int outerType) :
|
|
63 |
EapWizardPage(parent),
|
|
64 |
mWidget(NULL),
|
|
65 |
mRadio(NULL),
|
|
66 |
mTitle(NULL),
|
|
67 |
mDocumentLoader(NULL),
|
|
68 |
mOuterType(outerType),
|
|
69 |
mValid(false)
|
|
70 |
{
|
43
|
71 |
OstTraceFunctionEntry0( EAPWIZARDPAGEINNERTYPE_EAPWIZARDPAGEINNERTYPE_ENTRY );
|
|
72 |
OstTraceFunctionExit0( EAPWIZARDPAGEINNERTYPE_EAPWIZARDPAGEINNERTYPE_EXIT );
|
39
|
73 |
}
|
|
74 |
|
|
75 |
/*!
|
|
76 |
Destructor.
|
|
77 |
*/
|
|
78 |
EapWizardPageInnerType::~EapWizardPageInnerType()
|
|
79 |
{
|
43
|
80 |
OstTraceFunctionEntry0( DUP1_EAPWIZARDPAGEINNERTYPE_EAPWIZARDPAGEINNERTYPE_ENTRY );
|
|
81 |
OstTraceFunctionExit0( DUP1_EAPWIZARDPAGEINNERTYPE_EAPWIZARDPAGEINNERTYPE_EXIT );
|
39
|
82 |
}
|
|
83 |
|
|
84 |
/*!
|
|
85 |
See WlanWizardPage.
|
|
86 |
*/
|
|
87 |
HbWidget* EapWizardPageInnerType::initializePage()
|
|
88 |
{
|
43
|
89 |
OstTraceFunctionEntry0( EAPWIZARDPAGEINNERTYPE_INITIALIZEPAGE_ENTRY );
|
39
|
90 |
if (!mWidget) {
|
|
91 |
bool ok;
|
|
92 |
mDocumentLoader.reset(
|
|
93 |
new HbDocumentLoader(mWizard->wizardHelper()->mainWindow()));
|
|
94 |
mDocumentLoader->load(":/docml/occ_eap_wizard_01_02_04.docml", &ok);
|
|
95 |
Q_ASSERT(ok);
|
|
96 |
|
|
97 |
loadDocmlSection(mWizard->wizardHelper()->mainWindow()->orientation());
|
43
|
98 |
|
39
|
99 |
mWidget = qobject_cast<HbWidget*> (mDocumentLoader->findWidget("occ_eap_wizard_01"));
|
|
100 |
Q_ASSERT(mWidget);
|
|
101 |
|
|
102 |
mTitle = qobject_cast<HbLabel*> (mDocumentLoader->findWidget("title"));
|
|
103 |
Q_ASSERT(mTitle);
|
|
104 |
|
|
105 |
mRadio = qobject_cast<HbRadioButtonList*> (mDocumentLoader->findWidget("list"));
|
|
106 |
Q_ASSERT(mRadio);
|
43
|
107 |
|
39
|
108 |
ok = connect(
|
|
109 |
mWizard->wizardHelper()->mainWindow(),
|
|
110 |
SIGNAL(orientationChanged(Qt::Orientation)),
|
|
111 |
this,
|
|
112 |
SLOT(loadDocmlSection(Qt::Orientation)));
|
|
113 |
Q_ASSERT(ok);
|
43
|
114 |
|
39
|
115 |
QStringList list;
|
|
116 |
switch (mOuterType){
|
|
117 |
case EapQtPluginHandle::PluginPeap:
|
|
118 |
appendToList(list, EapQtPluginHandle::PluginEapMschapv2);
|
|
119 |
break;
|
43
|
120 |
|
39
|
121 |
default:
|
|
122 |
Q_ASSERT(mOuterType == EapQtPluginHandle::PluginEapTtls);
|
|
123 |
appendToList(list, EapQtPluginHandle::PluginPlainMschapv2);
|
|
124 |
appendToList(list, EapQtPluginHandle::PluginPap);
|
|
125 |
break;
|
|
126 |
}
|
|
127 |
appendToList(list, EapQtPluginHandle::PluginEapGtc);
|
|
128 |
mRadio->setItems(list);
|
43
|
129 |
|
39
|
130 |
ok = connect(mRadio, SIGNAL(itemSelected(int)), this, SLOT(itemSelected(int)));
|
|
131 |
Q_ASSERT(ok);
|
|
132 |
}
|
|
133 |
|
|
134 |
mTitle->setPlainText(
|
49
|
135 |
HbParameterLengthLimiter("txt_occ_title_select_innear_eap_type_for_1").arg(
|
|
136 |
mWizard->eapTypeToString(
|
|
137 |
mWizard->configurations(
|
|
138 |
EapWizardPrivate::OuterType).toInt())));
|
39
|
139 |
|
43
|
140 |
OstTraceFunctionExit0( EAPWIZARDPAGEINNERTYPE_INITIALIZEPAGE_EXIT );
|
39
|
141 |
return mWidget;
|
|
142 |
}
|
|
143 |
|
|
144 |
/*!
|
|
145 |
Loads the required orientation of docml.
|
43
|
146 |
|
39
|
147 |
@param [in] orientation Orientation to be loaded.
|
|
148 |
*/
|
|
149 |
void EapWizardPageInnerType::loadDocmlSection(Qt::Orientation orientation)
|
|
150 |
{
|
43
|
151 |
OstTraceFunctionEntry0( EAPWIZARDPAGEINNERTYPE_LOADDOCMLSECTION_ENTRY );
|
39
|
152 |
EapWizardPage::loadDocmlSection(
|
|
153 |
mDocumentLoader.data(),
|
|
154 |
orientation,
|
|
155 |
":/docml/occ_eap_wizard_01_02_04.docml",
|
|
156 |
"portrait_section",
|
|
157 |
"landscape_section");
|
43
|
158 |
OstTraceFunctionExit0( EAPWIZARDPAGEINNERTYPE_LOADDOCMLSECTION_EXIT );
|
39
|
159 |
}
|
|
160 |
|
|
161 |
/*!
|
|
162 |
See WlanWizardPage.
|
43
|
163 |
|
39
|
164 |
@return next wizard page: EapWizardPage::PageUsernamePassword
|
|
165 |
*/
|
|
166 |
int EapWizardPageInnerType::nextId() const
|
|
167 |
{
|
43
|
168 |
OstTraceFunctionEntry0( EAPWIZARDPAGEINNERTYPE_NEXTID_ENTRY );
|
39
|
169 |
mWizard->setConfigurations(
|
|
170 |
EapWizardPrivate::InnerType,
|
|
171 |
mEapTypes.at(mRadio->selected()));
|
43
|
172 |
|
|
173 |
OstTraceFunctionExit0( EAPWIZARDPAGEINNERTYPE_NEXTID_EXIT );
|
39
|
174 |
return EapWizardPage::PageUsernamePassword;
|
|
175 |
}
|
|
176 |
|
|
177 |
/*!
|
|
178 |
See WlanWizardPage.
|
43
|
179 |
|
39
|
180 |
Validates the content of the page.
|
43
|
181 |
|
39
|
182 |
@return true if content is valid.
|
|
183 |
*/
|
|
184 |
bool EapWizardPageInnerType::showPage()
|
|
185 |
{
|
43
|
186 |
OstTraceFunctionEntry0( EAPWIZARDPAGEINNERTYPE_SHOWPAGE_ENTRY );
|
|
187 |
OstTraceFunctionExit0( EAPWIZARDPAGEINNERTYPE_SHOWPAGE_EXIT );
|
39
|
188 |
return mValid;
|
|
189 |
}
|
|
190 |
|
|
191 |
/*!
|
|
192 |
Handler for itemsSelected() signal from HbRadioButtonList.
|
43
|
193 |
|
39
|
194 |
@param [in] index NOT USED
|
|
195 |
*/
|
|
196 |
void EapWizardPageInnerType::itemSelected(int index )
|
|
197 |
{
|
43
|
198 |
OstTraceFunctionEntry0( EAPWIZARDPAGEINNERTYPE_ITEMSELECTED_ENTRY );
|
39
|
199 |
Q_UNUSED(index);
|
|
200 |
mValid = true;
|
|
201 |
mWizard->wizardHelper()->enableNextButton(mValid);
|
43
|
202 |
OstTraceFunctionExit0( EAPWIZARDPAGEINNERTYPE_ITEMSELECTED_EXIT );
|
39
|
203 |
}
|
|
204 |
|
|
205 |
/*!
|
|
206 |
Appends given method to radiobutton list if plugin (method) is supported
|
43
|
207 |
|
39
|
208 |
@param [in,out] items the content of radiobutton list
|
|
209 |
@param [in] pluginHandle EAP Type plugin handle to be added.
|
|
210 |
*/
|
|
211 |
void EapWizardPageInnerType::appendToList(
|
|
212 |
QStringList &items,
|
|
213 |
EapQtPluginHandle::Plugin innerType)
|
|
214 |
{
|
43
|
215 |
OstTraceFunctionEntry0( EAPWIZARDPAGEINNERTYPE_APPENDTOLIST_ENTRY );
|
39
|
216 |
if (mWizard->eapConfigurationInterface()->isSupportedInnerType(
|
|
217 |
static_cast<EapQtPluginHandle::Plugin>(mOuterType), innerType)) {
|
|
218 |
items << mWizard->eapTypeToString(innerType);
|
|
219 |
mEapTypes.append(innerType);
|
|
220 |
}
|
43
|
221 |
OstTraceFunctionExit0( EAPWIZARDPAGEINNERTYPE_APPENDTOLIST_EXIT );
|
39
|
222 |
}
|