mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-18 10:26:15 +01:00
Validators: always force the input to upper case
This commit is contained in:
parent
d3f642567d
commit
18aa839f11
1 changed files with 12 additions and 4 deletions
|
@ -61,6 +61,8 @@ ChangeValidator::ChangeValidator(QObject *parent,
|
|||
|
||||
QValidator::State ChangeValidator::validate(QString &input, int &) const
|
||||
{
|
||||
input = input.toUpper();
|
||||
|
||||
// The string is invalid if it contains invalid input characters
|
||||
const wistring &winput = wfq(input);
|
||||
if (!m_dic.validateInputChars(winput))
|
||||
|
@ -302,7 +304,9 @@ QValidator::State RegexpValidator::validate(QString &input, int &) const
|
|||
if (input == "")
|
||||
return Intermediate;
|
||||
|
||||
wstring authorizedChars = L".[]()*+?:^";
|
||||
static const wstring authorizedChars = L".[]()*+?:^";
|
||||
|
||||
input = input.toUpper();
|
||||
|
||||
// The string is invalid if it contains invalid input characters
|
||||
const wistring &winput = wfq(input);
|
||||
|
@ -353,6 +357,8 @@ QValidator::State PlayWordValidator::validate(QString &input, int &) const
|
|||
if (input == "")
|
||||
return Intermediate;
|
||||
|
||||
input = input.toUpper();
|
||||
|
||||
const wistring &winput = wfq(input);
|
||||
// The string is invalid if it contains invalid input characters
|
||||
if (!m_dic.validateInputChars(winput, L"()") || input.contains('?'))
|
||||
|
@ -412,14 +418,16 @@ CoordsValidator::CoordsValidator(QObject *parent)
|
|||
|
||||
QValidator::State CoordsValidator::validate(QString &input, int &) const
|
||||
{
|
||||
input = input.toUpper();
|
||||
|
||||
// Only authorize characters part of a valid coordinate
|
||||
wstring copy = wfq(input.toUpper());
|
||||
wstring authorized = L"ABCDEFGHIJKLMNO1234567890";
|
||||
wstring copy = wfq(input);
|
||||
static const wstring authorized = L"ABCDEFGHIJKLMNO1234567890";
|
||||
if (copy.find_first_not_of(authorized) != wstring::npos)
|
||||
return Invalid;
|
||||
|
||||
// Check coordinates
|
||||
Coord c(wfq(input));
|
||||
Coord c(copy);
|
||||
if (!c.isValid())
|
||||
return Intermediate;
|
||||
|
||||
|
|
Loading…
Reference in a new issue