49 EapQtValidatorPacStorePassword::~EapQtValidatorPacStorePassword() |
50 EapQtValidatorPacStorePassword::~EapQtValidatorPacStorePassword() |
50 { |
51 { |
51 // nothing to do |
52 // nothing to do |
52 } |
53 } |
53 |
54 |
54 EapQtValidator::Status EapQtValidatorPacStorePassword::validate(const QVariant& /* value */) |
55 EapQtValidator::Status EapQtValidatorPacStorePassword::validate(const QVariant& value) |
55 { |
56 { |
56 qDebug("EapQtValidatorPacStorePassword::validate()"); |
57 Status status(StatusOk); |
57 // not supported |
58 const QString str = value.toString(); |
58 return EapQtValidator::StatusInvalidCharacters; |
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; |
59 } |
77 } |
60 |
78 |
61 void EapQtValidatorPacStorePassword::updateEditor(HbLineEdit* const edit) |
79 void EapQtValidatorPacStorePassword::updateEditor(HbLineEdit* const edit) |
62 { |
80 { |
63 qDebug("EapQtValidatorPacStorePassword::updateEditor()"); |
81 qDebug("EapQtValidatorPacStorePassword::updateEditor()"); |
64 |
82 |
65 Q_ASSERT(edit); |
83 Q_ASSERT(edit); |
66 |
84 |
67 edit->setMaxLength(EapQtConfigInterfacePrivate::StringMaxLength); |
85 edit->setMaxLength(EapQtConfigInterfacePrivate::PacPasswordMaxLength); |
68 edit->setInputMethodHints(Qt::ImhNoAutoUppercase | Qt::ImhPreferLowercase |
86 edit->setInputMethodHints(Qt::ImhNoAutoUppercase | Qt::ImhPreferLowercase |
69 | Qt::ImhNoPredictiveText); |
87 | Qt::ImhNoPredictiveText); |
70 |
88 |
71 // do not set editor class or auto completing since they might leak the pwd |
89 // do not set editor class or auto completing since they might leak the pwd |
72 HbEditorInterface editInterface(edit); |
90 HbEditorInterface editInterface(edit); |