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: Common Username & password query.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
// System includes
|
|
20 |
#include <HbDocumentLoader>
|
|
21 |
#include <HbMainWindow>
|
|
22 |
#include <HbWidget>
|
|
23 |
#include <HbLineEdit>
|
|
24 |
#include <HbLabel>
|
|
25 |
#include <HbEditorInterface>
|
|
26 |
#include <HbParameterLengthLimiter>
|
|
27 |
#include <eapqtexpandedeaptype.h>
|
|
28 |
#include <eapqtpluginhandle.h>
|
|
29 |
#include <eapqtconfiginterface.h>
|
|
30 |
#include <eapqtvalidator.h>
|
|
31 |
|
|
32 |
// User includes
|
|
33 |
#include "wlanwizardhelper.h"
|
|
34 |
#include "eapwizardpageusernamepassword.h"
|
|
35 |
#include "eapwizard_p.h"
|
43
|
36 |
#include "OstTraceDefinitions.h"
|
|
37 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
38 |
#include "eapwizardpageusernamepasswordTraces.h"
|
|
39 |
#endif
|
|
40 |
|
39
|
41 |
|
|
42 |
/*!
|
|
43 |
\class EapWizardPageUsernamePassword
|
|
44 |
\brief Implements EAP wizard page: Generic Username & Password page
|
|
45 |
*/
|
|
46 |
|
|
47 |
// External function prototypes
|
|
48 |
|
|
49 |
// Local constants
|
|
50 |
|
|
51 |
// ======== LOCAL FUNCTIONS ========
|
|
52 |
|
|
53 |
// ======== MEMBER FUNCTIONS ========
|
|
54 |
|
|
55 |
|
|
56 |
/*!
|
|
57 |
Constructor.
|
43
|
58 |
|
39
|
59 |
@param [in] parent Pointer to EAP Wizard private implementation.
|
|
60 |
*/
|
|
61 |
EapWizardPageUsernamePassword::EapWizardPageUsernamePassword(
|
|
62 |
EapWizardPrivate* parent) :
|
|
63 |
EapWizardPage(parent),
|
|
64 |
mDocumentLoader(NULL),
|
|
65 |
mValidatorUsername(NULL),
|
|
66 |
mValidatorPassword(NULL),
|
|
67 |
mWidget(NULL),
|
|
68 |
mEditUsername(NULL),
|
|
69 |
mEditPassword(NULL),
|
|
70 |
mTitleUsername(NULL),
|
|
71 |
mTitlePassword(NULL)
|
|
72 |
{
|
43
|
73 |
OstTraceFunctionEntry0( EAPWIZARDPAGEUSERNAMEPASSWORD_EAPWIZARDPAGEUSERNAMEPASSWORD_ENTRY );
|
|
74 |
OstTraceFunctionExit0( EAPWIZARDPAGEUSERNAMEPASSWORD_EAPWIZARDPAGEUSERNAMEPASSWORD_EXIT );
|
39
|
75 |
}
|
|
76 |
|
|
77 |
/*!
|
|
78 |
Destructor.
|
|
79 |
*/
|
|
80 |
EapWizardPageUsernamePassword::~EapWizardPageUsernamePassword()
|
|
81 |
{
|
43
|
82 |
OstTraceFunctionEntry0( DUP1_EAPWIZARDPAGEUSERNAMEPASSWORD_EAPWIZARDPAGEUSERNAMEPASSWORD_ENTRY );
|
|
83 |
OstTraceFunctionExit0( DUP1_EAPWIZARDPAGEUSERNAMEPASSWORD_EAPWIZARDPAGEUSERNAMEPASSWORD_EXIT );
|
39
|
84 |
}
|
|
85 |
|
|
86 |
/*!
|
|
87 |
See WlanWizardPage.
|
|
88 |
*/
|
|
89 |
HbWidget* EapWizardPageUsernamePassword::initializePage()
|
|
90 |
{
|
43
|
91 |
OstTraceFunctionEntry0( EAPWIZARDPAGEUSERNAMEPASSWORD_INITIALIZEPAGE_ENTRY );
|
39
|
92 |
if (!mWidget) {
|
|
93 |
bool ok = true;
|
|
94 |
mDocumentLoader.reset(
|
|
95 |
new HbDocumentLoader(mWizard->wizardHelper()->mainWindow()));
|
|
96 |
mDocumentLoader->load(":/docml/occ_eap_wizard_05_07.docml", &ok);
|
|
97 |
Q_ASSERT(ok);
|
|
98 |
loadDocmlSection(mWizard->wizardHelper()->mainWindow()->orientation());
|
|
99 |
|
|
100 |
mWidget = qobject_cast<HbWidget*> (mDocumentLoader->findWidget("view"));
|
|
101 |
Q_ASSERT(mWidget);
|
|
102 |
|
|
103 |
mTitleUsername = qobject_cast<HbLabel*> (mDocumentLoader->findWidget("setlabel_55"));
|
|
104 |
Q_ASSERT(mTitleUsername);
|
|
105 |
|
|
106 |
mTitlePassword = qobject_cast<HbLabel*> (mDocumentLoader->findWidget("setlabel_56"));
|
|
107 |
Q_ASSERT(mTitlePassword);
|
|
108 |
|
|
109 |
mEditUsername = qobject_cast<HbLineEdit*> (mDocumentLoader->findWidget("lineEditUsername"));
|
|
110 |
Q_ASSERT(mEditUsername);
|
|
111 |
|
|
112 |
mEditPassword = qobject_cast<HbLineEdit*> (mDocumentLoader->findWidget("lineEditPassword"));
|
|
113 |
Q_ASSERT(mEditPassword);
|
43
|
114 |
|
39
|
115 |
mTitlePassword->setPlainText(hbTrId("txt_occ_setlabel_eap_password"));
|
43
|
116 |
|
39
|
117 |
ok = connect(
|
|
118 |
mWizard->wizardHelper()->mainWindow(),
|
|
119 |
SIGNAL(orientationChanged(Qt::Orientation)),
|
|
120 |
this,
|
|
121 |
SLOT(loadDocmlSection(Qt::Orientation)));
|
|
122 |
Q_ASSERT(ok);
|
43
|
123 |
|
39
|
124 |
ok = connect(
|
|
125 |
mEditUsername, SIGNAL(textChanged(const QString &)),
|
|
126 |
this, SLOT(textChanged(const QString &)));
|
|
127 |
Q_ASSERT(ok);
|
43
|
128 |
|
39
|
129 |
ok = connect(
|
|
130 |
mEditPassword, SIGNAL(textChanged(const QString &)),
|
|
131 |
this, SLOT(textChanged(const QString &)));
|
|
132 |
Q_ASSERT(ok);
|
|
133 |
}
|
|
134 |
|
|
135 |
int eapType = mWizard->configurations(EapWizardPrivate::OuterType).toInt();
|
|
136 |
|
|
137 |
if (eapType != EapQtPluginHandle::PluginLeap) {
|
|
138 |
eapType = mWizard->configurations(EapWizardPrivate::InnerType).toInt();
|
|
139 |
}
|
43
|
140 |
|
39
|
141 |
EapQtPluginHandle plugin(static_cast<EapQtPluginHandle::Plugin>(eapType));
|
|
142 |
|
|
143 |
mValidatorUsername.reset(
|
|
144 |
mWizard->eapConfigurationInterface()->validatorEap(
|
|
145 |
plugin.type(),
|
|
146 |
EapQtConfig::Username));
|
|
147 |
Q_ASSERT(mValidatorUsername.data());
|
|
148 |
mValidatorUsername->updateEditor(mEditUsername);
|
|
149 |
|
|
150 |
mValidatorPassword.reset(
|
|
151 |
mWizard->eapConfigurationInterface()->validatorEap(
|
|
152 |
plugin.type(),
|
|
153 |
EapQtConfig::Password));
|
|
154 |
Q_ASSERT(mValidatorPassword.data());
|
|
155 |
mValidatorPassword->updateEditor(mEditPassword);
|
43
|
156 |
|
39
|
157 |
mTitleUsername->setPlainText(
|
49
|
158 |
HbParameterLengthLimiter("txt_occ_setlabel_user_name_for_1").arg(
|
|
159 |
mWizard->eapTypeToString(eapType)));
|
39
|
160 |
|
43
|
161 |
OstTraceFunctionExit0( EAPWIZARDPAGEUSERNAMEPASSWORD_INITIALIZEPAGE_EXIT );
|
39
|
162 |
return mWidget;
|
|
163 |
}
|
|
164 |
|
|
165 |
/*!
|
|
166 |
Loads the required orientation of docml.
|
43
|
167 |
|
39
|
168 |
@param [in] orientation Orientation to be loaded.
|
|
169 |
*/
|
|
170 |
void EapWizardPageUsernamePassword::loadDocmlSection(Qt::Orientation orientation)
|
|
171 |
{
|
43
|
172 |
OstTraceFunctionEntry0( EAPWIZARDPAGEUSERNAMEPASSWORD_LOADDOCMLSECTION_ENTRY );
|
39
|
173 |
EapWizardPage::loadDocmlSection(
|
|
174 |
mDocumentLoader.data(),
|
|
175 |
orientation,
|
|
176 |
":/docml/occ_eap_wizard_05_07.docml",
|
|
177 |
"portrait_section",
|
|
178 |
"landscape_section");
|
43
|
179 |
OstTraceFunctionExit0( EAPWIZARDPAGEUSERNAMEPASSWORD_LOADDOCMLSECTION_EXIT );
|
39
|
180 |
}
|
|
181 |
|
|
182 |
/*!
|
|
183 |
See WlanWizardPage.
|
43
|
184 |
|
39
|
185 |
Validates the content of the page.
|
43
|
186 |
|
39
|
187 |
@return true if content is valid.
|
|
188 |
*/
|
|
189 |
bool EapWizardPageUsernamePassword::showPage()
|
|
190 |
{
|
43
|
191 |
OstTraceFunctionEntry0( EAPWIZARDPAGEUSERNAMEPASSWORD_SHOWPAGE_ENTRY );
|
39
|
192 |
bool valid = false;
|
|
193 |
if (mValidatorUsername->validate(mEditUsername->text()) ==
|
|
194 |
EapQtValidator::StatusOk &&
|
|
195 |
mValidatorPassword->validate(mEditPassword->text()) ==
|
43
|
196 |
EapQtValidator::StatusOk) {
|
39
|
197 |
valid = true;
|
|
198 |
}
|
43
|
199 |
OstTraceFunctionExit0( EAPWIZARDPAGEUSERNAMEPASSWORD_SHOWPAGE_EXIT );
|
39
|
200 |
return valid;
|
|
201 |
}
|
|
202 |
|
|
203 |
/*!
|
|
204 |
See WlanWizardPage.
|
43
|
205 |
|
39
|
206 |
@return next wizard page: EapWizardPage::PageProcessSettings
|
|
207 |
*/
|
|
208 |
int EapWizardPageUsernamePassword::nextId() const
|
|
209 |
{
|
43
|
210 |
OstTraceFunctionEntry0( EAPWIZARDPAGEUSERNAMEPASSWORD_NEXTID_ENTRY );
|
39
|
211 |
mWizard->setConfigurations(EapWizardPrivate::Username, mEditUsername->text());
|
|
212 |
mWizard->setConfigurations(EapWizardPrivate::Password, mEditPassword->text());
|
43
|
213 |
OstTraceFunctionExit0( EAPWIZARDPAGEUSERNAMEPASSWORD_NEXTID_EXIT );
|
39
|
214 |
return EapWizardPage::PageProcessSettings;
|
|
215 |
}
|
|
216 |
|
|
217 |
/*!
|
|
218 |
Slot for textChanged() signal from HbLineEdit.
|
43
|
219 |
|
39
|
220 |
@param [in] text NOT USED.
|
|
221 |
*/
|
|
222 |
void EapWizardPageUsernamePassword::textChanged(const QString & text )
|
|
223 |
{
|
43
|
224 |
OstTraceFunctionEntry0( EAPWIZARDPAGEUSERNAMEPASSWORD_TEXTCHANGED_ENTRY );
|
39
|
225 |
Q_UNUSED(text);
|
|
226 |
mWizard->wizardHelper()->enableNextButton(showPage());
|
43
|
227 |
OstTraceFunctionExit0( EAPWIZARDPAGEUSERNAMEPASSWORD_TEXTCHANGED_EXIT );
|
39
|
228 |
}
|