34
|
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 |
*
|
36
|
14 |
* Description:
|
|
15 |
* EAP-MSCHAPv2 Old Password Input Dialog implementation
|
34
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
36
|
19 |
/*
|
49
|
20 |
* %version: 7 %
|
36
|
21 |
*/
|
|
22 |
|
|
23 |
// System includes
|
34
|
24 |
#include <HbAction>
|
|
25 |
#include <HbTranslator>
|
|
26 |
#include <eapqtvalidator.h>
|
|
27 |
#include <eapqtexpandedeaptype.h>
|
|
28 |
#include <eapqtconfiginterface.h>
|
|
29 |
#include <eapqtconfig.h>
|
36
|
30 |
|
|
31 |
// User includes
|
34
|
32 |
#include "eapmschapv2oldpwddialog.h"
|
|
33 |
#include "OstTraceDefinitions.h"
|
|
34 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
44
|
35 |
#include "eapmschapv2oldpwddialogTraces.h"
|
34
|
36 |
#endif
|
|
37 |
|
36
|
38 |
/*!
|
|
39 |
* \class EapMschapv2OldPwdDialog
|
|
40 |
* \brief Implements EAP-MSCHAPv2 Old Password Input Dialog.
|
|
41 |
*/
|
|
42 |
|
|
43 |
// External function prototypes
|
|
44 |
|
|
45 |
// Local constants
|
|
46 |
|
|
47 |
// ======== LOCAL FUNCTIONS ========
|
|
48 |
|
|
49 |
// ======== MEMBER FUNCTIONS ========
|
|
50 |
|
|
51 |
/*!
|
|
52 |
* Constructor.
|
|
53 |
*
|
|
54 |
* @param [in] parameters Parameters for the Constructor.
|
34
|
55 |
*/
|
|
56 |
EapMschapv2OldPwdDialog::EapMschapv2OldPwdDialog(const QVariantMap ¶meters)
|
|
57 |
:mEdit(NULL),
|
|
58 |
mPwdValidator(NULL),
|
|
59 |
mTranslator(new HbTranslator("eapprompts")),
|
|
60 |
mOkActionPressed(false),
|
|
61 |
mClose(false)
|
|
62 |
{
|
|
63 |
OstTraceFunctionEntry0( EAPMSCHAPV2OLDPWDDIALOG_EAPMSCHAPV2OLDPWDDIALOG_ENTRY );
|
|
64 |
qDebug("EapMschapv2OldPwdDialog::EapMschapv2OldPwdDialog ENTER");
|
|
65 |
|
|
66 |
createDialog(parameters);
|
|
67 |
|
|
68 |
OstTraceFunctionExit0( EAPMSCHAPV2OLDPWDDIALOG_EAPMSCHAPV2OLDPWDDIALOG_EXIT );
|
|
69 |
qDebug("EapMschapv2OldPwdDialog::EapMschapv2OldPwdDialog EXIT");
|
|
70 |
}
|
|
71 |
|
36
|
72 |
/*!
|
34
|
73 |
* The construction of the dialog
|
36
|
74 |
*
|
|
75 |
* @param [in] parameters Parameters for the Construction of the dialog.
|
34
|
76 |
*/
|
|
77 |
void EapMschapv2OldPwdDialog::createDialog(const QVariantMap ¶meters )
|
|
78 |
{
|
|
79 |
OstTraceFunctionEntry0( EAPMSCHAPV2OLDPWDDIALOG_CREATEDIALOG_ENTRY );
|
|
80 |
qDebug("EapMschapv2OldPwdDialog::createDialog ENTER");
|
|
81 |
|
|
82 |
QString labelText1(hbTrId("txt_occ_dialog_old_eapmschapv2_password"));
|
|
83 |
|
|
84 |
Q_UNUSED(parameters)
|
|
85 |
|
|
86 |
//Set the dialog to be on the screen until user reacts
|
|
87 |
//by pressing any of the Action buttons
|
|
88 |
this->setModal(true);
|
|
89 |
this->setTimeout(HbPopup::NoTimeout);
|
49
|
90 |
this->setDismissPolicy(HbPopup::NoDismiss);
|
|
91 |
this->setDismissOnAction(false);
|
34
|
92 |
this->setPromptText(labelText1, 0);
|
|
93 |
mEdit = this->lineEdit(0);
|
|
94 |
mEdit->setEchoMode(HbLineEdit::Password);
|
|
95 |
|
|
96 |
EapQtConfigInterface eap_config_if;
|
|
97 |
|
|
98 |
mPwdValidator.reset(eap_config_if.validatorEap(EapQtExpandedEapType::TypeEapMschapv2,
|
|
99 |
EapQtConfig::Password ));
|
|
100 |
Q_ASSERT( mPwdValidator.isNull() == false );
|
|
101 |
|
|
102 |
mPwdValidator->updateEditor(mEdit);
|
|
103 |
|
|
104 |
//Remove all default actions from the dialog
|
|
105 |
QList<QAction*> action_list = this->actions();
|
|
106 |
for ( int i = 0; i < action_list.count(); i++ ) {
|
|
107 |
this->removeAction(action_list.at(i));
|
|
108 |
}
|
|
109 |
|
|
110 |
//Add a new Ok button action
|
|
111 |
HbAction* actionOk = new HbAction(hbTrId("txt_common_button_ok"),this);
|
|
112 |
this->addAction(actionOk);
|
|
113 |
|
|
114 |
//Add a new Cancel button action
|
|
115 |
HbAction* actionCancel = new HbAction(hbTrId("txt_common_button_cancel"),this);
|
|
116 |
this->addAction(actionCancel);
|
|
117 |
|
49
|
118 |
//Connect to a SLOT owned by this class
|
34
|
119 |
bool connected = connect(actionOk, SIGNAL(triggered()), this, SLOT(okPressed()));
|
|
120 |
Q_ASSERT(connected == true);
|
|
121 |
|
49
|
122 |
//Connect to a SLOT owned by this class
|
34
|
123 |
connected = connect(actionCancel, SIGNAL(triggered()), this, SLOT(cancelPressed()));
|
|
124 |
Q_ASSERT(connected == true);
|
|
125 |
|
|
126 |
// Connect the about to close and hide signals, so that we are able to inform
|
|
127 |
// the caller that the dialog was closed
|
|
128 |
connected = connect(this, SIGNAL(aboutToClose()), this, SLOT(closingDialog()));
|
|
129 |
Q_ASSERT(connected == true);
|
|
130 |
connected = connect(this, SIGNAL(aboutToHide()), this, SLOT(closingDialog()));
|
|
131 |
Q_ASSERT(connected == true);
|
|
132 |
|
|
133 |
OstTraceFunctionExit0( DUP1_EAPMSCHAPV2OLDPWDDIALOG_CREATEDIALOG_EXIT );
|
|
134 |
qDebug("EapMschapv2OldPwdDialog::createDialog EXIT");
|
|
135 |
}
|
|
136 |
|
36
|
137 |
/*!
|
34
|
138 |
* Destructor
|
|
139 |
*/
|
|
140 |
EapMschapv2OldPwdDialog::~EapMschapv2OldPwdDialog()
|
|
141 |
{
|
|
142 |
OstTraceFunctionEntry0( EAPMSCHAPV2OLDPWDDIALOG_DEAPMSCHAPV2OLDPWDDIALOG_ENTRY );
|
|
143 |
|
|
144 |
// The dialog widgets are deleted as the dialog is deleted
|
|
145 |
// mPwdValidator: scoped pointer deleted automatically
|
|
146 |
|
|
147 |
OstTraceFunctionExit0( EAPMSCHAPV2OLDPWDDIALOG_DEAPMSCHAPV2OLDPWDDIALOG_EXIT );
|
|
148 |
}
|
|
149 |
|
36
|
150 |
/*!
|
34
|
151 |
* Line edit validator
|
36
|
152 |
*
|
|
153 |
* @return true if content is valid.
|
34
|
154 |
*/
|
|
155 |
bool EapMschapv2OldPwdDialog::validate() const
|
|
156 |
{
|
|
157 |
qDebug("EapMschapv2OldPwdDialog::validate ENTER");
|
|
158 |
|
|
159 |
bool valid = false;
|
|
160 |
|
|
161 |
if ( mPwdValidator->validate(mEdit->text())== EapQtValidator::StatusOk ) {
|
|
162 |
qDebug("EapMschapv2OldPwdDialog::validate: returns TRUE");
|
|
163 |
valid = true;
|
|
164 |
}
|
|
165 |
|
|
166 |
qDebug("EapMschapv2OldPwdDialog::validate EXIT");
|
|
167 |
return valid;
|
|
168 |
}
|
|
169 |
|
36
|
170 |
/*!
|
34
|
171 |
* Function is called when the Ok Action button is pressed
|
|
172 |
*/
|
|
173 |
void EapMschapv2OldPwdDialog::okPressed()
|
|
174 |
{
|
36
|
175 |
OstTraceFunctionEntry0( EAPMSCHAPV2OLDPWDDIALOG_OKPRESSED_ENTRY );
|
34
|
176 |
qDebug("EapMschapv2OldPwdDialog::okPressed ENTER");
|
|
177 |
|
|
178 |
if ( validate() == true && mOkActionPressed == false ) {
|
|
179 |
|
|
180 |
mOkActionPressed = true;
|
|
181 |
|
|
182 |
QVariantMap data;
|
|
183 |
|
|
184 |
data["password"] = mEdit->text();
|
|
185 |
|
|
186 |
qDebug("EapMschapv2OldPwdDialog::okPressed: emit deviceDialogData");
|
|
187 |
|
|
188 |
emit deviceDialogData(data);
|
|
189 |
closeDeviceDialog(true);
|
|
190 |
}
|
|
191 |
|
36
|
192 |
OstTraceFunctionExit0( EAPMSCHAPV2OLDPWDDIALOG_OKPRESSED_EXIT );
|
34
|
193 |
qDebug("EapMschapv2OldPwdDialog::okPressed EXIT");
|
|
194 |
}
|
|
195 |
|
36
|
196 |
/*!
|
34
|
197 |
* Function is called when the Cancel Action button is pressed
|
|
198 |
*/
|
|
199 |
void EapMschapv2OldPwdDialog::cancelPressed()
|
|
200 |
{
|
|
201 |
OstTraceFunctionEntry0( EAPMSCHAPV2OLDPWDDIALOG_CANCELPRESSED_ENTRY );
|
|
202 |
qDebug("EapMschapv2OldPwdDialog::cancelPressed ENTER");
|
|
203 |
|
|
204 |
if (!mClose) {
|
|
205 |
mClose = true;
|
|
206 |
closeDeviceDialog(true);
|
|
207 |
}
|
|
208 |
qDebug("EapMschapv2OldPwdDialog::cancelPressed EXIT");
|
|
209 |
OstTraceFunctionExit0( EAPMSCHAPV2OLDPWDDIALOG_CANCELPRESSED_EXIT );
|
|
210 |
}
|
|
211 |
|
36
|
212 |
/*!
|
34
|
213 |
* Function is called when the dialog is about to close
|
|
214 |
*/
|
|
215 |
void EapMschapv2OldPwdDialog::closingDialog()
|
|
216 |
{
|
|
217 |
OstTraceFunctionEntry0( EAPMSCHAPV2OLDPWDDIALOG_CLOSINGDIALOG_ENTRY );
|
|
218 |
qDebug("EapMschapv2OldPwdDialog::closingDialog ENTER");
|
|
219 |
|
|
220 |
|
|
221 |
qDebug("EapMschapv2OldPwdDialog::closingDialog EXIT");
|
|
222 |
OstTraceFunctionExit0( EAPMSCHAPV2OLDPWDDIALOG_CLOSINGDIALOG_EXIT );
|
|
223 |
}
|
|
224 |
|
36
|
225 |
/*!
|
|
226 |
* Device dialog parameters to be set while dialog is displayed.
|
|
227 |
* Not supported.
|
|
228 |
*
|
|
229 |
* @param [in] parameters NOT USED
|
|
230 |
* @return true always.
|
34
|
231 |
*/
|
|
232 |
bool EapMschapv2OldPwdDialog::setDeviceDialogParameters
|
|
233 |
(const QVariantMap ¶meters)
|
|
234 |
{
|
|
235 |
OstTraceFunctionEntry0( EAPMSCHAPV2OLDPWDDIALOG_SETDEVICEDIALOGPARAMETERS_ENTRY );
|
|
236 |
|
|
237 |
Q_UNUSED(parameters)
|
|
238 |
// changing the dialog after presenting it is not supported.
|
|
239 |
|
|
240 |
OstTraceFunctionExit0( EAPMSCHAPV2OLDPWDDIALOG_SETDEVICEDIALOGPARAMETERS_EXIT );
|
|
241 |
return true;
|
|
242 |
}
|
|
243 |
|
36
|
244 |
/*!
|
|
245 |
* Not supported
|
|
246 |
*
|
|
247 |
* @return 0 always returned.
|
34
|
248 |
*/
|
|
249 |
int EapMschapv2OldPwdDialog::deviceDialogError() const
|
|
250 |
{
|
|
251 |
OstTraceFunctionEntry0( EAPMSCHAPV2OLDPWDDIALOG_DEVICEDIALOGERROR_ENTRY );
|
|
252 |
OstTraceFunctionExit0( EAPMSCHAPV2OLDPWDDIALOG_DEVICEDIALOGERROR_EXIT);
|
|
253 |
return 0;
|
|
254 |
}
|
|
255 |
|
36
|
256 |
/*!
|
34
|
257 |
* Dialog is closed and the signal about closing is emitted
|
36
|
258 |
*
|
|
259 |
* @param [in] byClient indicates when the user closes the dialog
|
34
|
260 |
*/
|
|
261 |
void EapMschapv2OldPwdDialog::closeDeviceDialog(bool byClient)
|
|
262 |
{
|
|
263 |
OstTraceFunctionEntry0( EAPMSCHAPV2OLDPWDDIALOG_CLOSEDEVICEDIALOG_ENTRY );
|
|
264 |
qDebug("EapMschapv2OldPwdDialog::closeDeviceDialog ENTER");
|
|
265 |
|
|
266 |
//If the user closes the dialog, then the deviceDialogClosed is emitted
|
|
267 |
if ( byClient == true ) {
|
|
268 |
qDebug("EapMschapv2OldPwdDialog::closeDeviceDialog: emit deviceDialogClosed");
|
|
269 |
emit deviceDialogClosed();
|
|
270 |
}
|
|
271 |
|
|
272 |
qDebug("EapMschapv2OldPwdDialog::closeDeviceDialog EXIT");
|
|
273 |
OstTraceFunctionExit0( EAPMSCHAPV2OLDPWDDIALOG_CLOSEDEVICEDIALOG_EXIT );
|
|
274 |
}
|
|
275 |
|
36
|
276 |
/*!
|
34
|
277 |
* This dialog widget is returned to the caller
|
36
|
278 |
*
|
|
279 |
* @return this dialog widget
|
34
|
280 |
*/
|
|
281 |
HbPopup *EapMschapv2OldPwdDialog::deviceDialogWidget() const
|
|
282 |
{
|
|
283 |
OstTraceFunctionEntry0( EAPMSCHAPV2OLDPWDDIALOG_DEVICEDIALOGWIDGET_ENTRY );
|
|
284 |
OstTraceFunctionExit0( EAPMSCHAPV2OLDPWDDIALOG_DEVICEDIALOGWIDGET_EXIT );
|
|
285 |
|
|
286 |
return const_cast<EapMschapv2OldPwdDialog*>(this);
|
|
287 |
}
|
|
288 |
|