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 |
*
|
|
14 |
* Description:
|
|
15 |
* EAP-FAST PAC store password format validator
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
/*
|
49
|
20 |
* %version: 8 %
|
34
|
21 |
*/
|
|
22 |
|
|
23 |
// System includes
|
|
24 |
#include <HbEditorInterface>
|
|
25 |
#include <HbLineEdit>
|
|
26 |
|
|
27 |
// User includes
|
|
28 |
#include "eapqtvalidatorpacstorepassword.h"
|
|
29 |
#include "eapqtconfiginterface_p.h"
|
|
30 |
|
|
31 |
/*!
|
|
32 |
* \class EapQtValidatorPacStorePassword
|
|
33 |
* \brief EAP-FAST PAC store password format validator
|
|
34 |
*/
|
|
35 |
|
|
36 |
// External function prototypes
|
|
37 |
|
|
38 |
// Local constants
|
49
|
39 |
static const unsigned int MinPacStorePasswordSize = 6;
|
34
|
40 |
|
|
41 |
// ======== LOCAL FUNCTIONS ========
|
|
42 |
|
|
43 |
// ======== MEMBER FUNCTIONS ========
|
|
44 |
|
|
45 |
EapQtValidatorPacStorePassword::EapQtValidatorPacStorePassword()
|
|
46 |
{
|
|
47 |
// nothing to do
|
|
48 |
}
|
|
49 |
|
|
50 |
EapQtValidatorPacStorePassword::~EapQtValidatorPacStorePassword()
|
|
51 |
{
|
|
52 |
// nothing to do
|
|
53 |
}
|
|
54 |
|
49
|
55 |
EapQtValidator::Status EapQtValidatorPacStorePassword::validate(const QVariant& value)
|
34
|
56 |
{
|
49
|
57 |
Status status(StatusOk);
|
|
58 |
const QString str = value.toString();
|
|
59 |
|
|
60 |
// input must be of correct type
|
|
61 |
if (value.type() != QVariant::String) {
|
|
62 |
status = StatusInvalid;
|
|
63 |
}
|
|
64 |
// check minimum length
|
|
65 |
else if (str.length() < MinPacStorePasswordSize) {
|
|
66 |
status = StatusTooShort;
|
|
67 |
}
|
|
68 |
// check maximum length
|
|
69 |
else if (str.length() > EapQtConfigInterfacePrivate::PacPasswordMaxLength) {
|
|
70 |
status = StatusTooLong;
|
|
71 |
}
|
|
72 |
|
|
73 |
// any character is ok for passwords
|
|
74 |
qDebug("EapQtValidatorPacStorePassword::validate - return status: %d", status);
|
|
75 |
|
|
76 |
return status;
|
34
|
77 |
}
|
|
78 |
|
|
79 |
void EapQtValidatorPacStorePassword::updateEditor(HbLineEdit* const edit)
|
|
80 |
{
|
|
81 |
qDebug("EapQtValidatorPacStorePassword::updateEditor()");
|
|
82 |
|
|
83 |
Q_ASSERT(edit);
|
|
84 |
|
49
|
85 |
edit->setMaxLength(EapQtConfigInterfacePrivate::PacPasswordMaxLength);
|
34
|
86 |
edit->setInputMethodHints(Qt::ImhNoAutoUppercase | Qt::ImhPreferLowercase
|
|
87 |
| Qt::ImhNoPredictiveText);
|
|
88 |
|
|
89 |
// do not set editor class or auto completing since they might leak the pwd
|
|
90 |
HbEditorInterface editInterface(edit);
|
|
91 |
editInterface.setSmileyTheme(HbSmileyTheme());
|
|
92 |
}
|