Moved regexp for excluding digits to single place.
This commit is contained in:
parent
0eec470387
commit
297fd0f0c8
|
@ -391,7 +391,7 @@ void CodeWidget::submitCode() {
|
||||||
const auto text = QString(
|
const auto text = QString(
|
||||||
_code->getLastText()
|
_code->getLastText()
|
||||||
).remove(
|
).remove(
|
||||||
QRegularExpression("[^\\d]")
|
TextUtilities::RegExpDigitsExclude()
|
||||||
).mid(0, getData()->codeLength);
|
).mid(0, getData()->codeLength);
|
||||||
|
|
||||||
if (_sentRequest
|
if (_sentRequest
|
||||||
|
|
|
@ -487,7 +487,9 @@ EditContactScheme GetContactScheme(Scope::Type type) {
|
||||||
return Ui::FormatPhone(value);
|
return Ui::FormatPhone(value);
|
||||||
};
|
};
|
||||||
result.postprocess = [](QString value) {
|
result.postprocess = [](QString value) {
|
||||||
return value.replace(QRegularExpression("[^\\d]"), QString());
|
return value.replace(
|
||||||
|
TextUtilities::RegExpDigitsExclude(),
|
||||||
|
QString());
|
||||||
};
|
};
|
||||||
return result;
|
return result;
|
||||||
} break;
|
} break;
|
||||||
|
|
|
@ -10,7 +10,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "countries/countries_instance.h"
|
#include "countries/countries_instance.h"
|
||||||
|
|
||||||
#include <QRegularExpression>
|
|
||||||
#include <QtCore/QLocale>
|
#include <QtCore/QLocale>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
|
@ -136,7 +136,7 @@ void PhonePartInput::correctValue(
|
||||||
int &nowCursor) {
|
int &nowCursor) {
|
||||||
if (!now.isEmpty() && (_lastDigits != now)) {
|
if (!now.isEmpty() && (_lastDigits != now)) {
|
||||||
_lastDigits = now;
|
_lastDigits = now;
|
||||||
_lastDigits.replace(QRegularExpression("[^\\d]"), QString());
|
_lastDigits.replace(TextUtilities::RegExpDigitsExclude(), QString());
|
||||||
updatePattern(_groupsCallback(_code + _lastDigits));
|
updatePattern(_groupsCallback(_code + _lastDigits));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ void PhoneInput::correctValue(
|
||||||
QString &now,
|
QString &now,
|
||||||
int &nowCursor) {
|
int &nowCursor) {
|
||||||
auto digits = now;
|
auto digits = now;
|
||||||
digits.replace(QRegularExpression("[^\\d]"), QString());
|
digits.replace(TextUtilities::RegExpDigitsExclude(), QString());
|
||||||
_pattern = _groupsCallback(digits);
|
_pattern = _groupsCallback(digits);
|
||||||
|
|
||||||
QString newPlaceholder;
|
QString newPlaceholder;
|
||||||
|
|
|
@ -34,9 +34,7 @@ void SentCodeField::setChangedCallback(Fn<void()> changedCallback) {
|
||||||
QString SentCodeField::getDigitsOnly() const {
|
QString SentCodeField::getDigitsOnly() const {
|
||||||
return QString(
|
return QString(
|
||||||
getLastText()
|
getLastText()
|
||||||
).remove(
|
).remove(TextUtilities::RegExpDigitsExclude());
|
||||||
QRegularExpression("[^\\d]")
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SentCodeField::fix() {
|
void SentCodeField::fix() {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 28fd4eea95f4012f1b864d385259ee2de2284ff9
|
Subproject commit 3fea35ff19b52da94fa3ed17695f00b79bfb1917
|
Loading…
Reference in New Issue