mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Moved regexp for excluding digits to single place.
This commit is contained in:
@@ -391,7 +391,7 @@ void CodeWidget::submitCode() {
|
||||
const auto text = QString(
|
||||
_code->getLastText()
|
||||
).remove(
|
||||
QRegularExpression("[^\\d]")
|
||||
TextUtilities::RegExpDigitsExclude()
|
||||
).mid(0, getData()->codeLength);
|
||||
|
||||
if (_sentRequest
|
||||
|
||||
@@ -487,7 +487,9 @@ EditContactScheme GetContactScheme(Scope::Type type) {
|
||||
return Ui::FormatPhone(value);
|
||||
};
|
||||
result.postprocess = [](QString value) {
|
||||
return value.replace(QRegularExpression("[^\\d]"), QString());
|
||||
return value.replace(
|
||||
TextUtilities::RegExpDigitsExclude(),
|
||||
QString());
|
||||
};
|
||||
return result;
|
||||
} break;
|
||||
|
||||
@@ -10,7 +10,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "lang/lang_keys.h"
|
||||
#include "countries/countries_instance.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
#include <QtCore/QLocale>
|
||||
#include <locale>
|
||||
#include <sstream>
|
||||
|
||||
@@ -136,7 +136,7 @@ void PhonePartInput::correctValue(
|
||||
int &nowCursor) {
|
||||
if (!now.isEmpty() && (_lastDigits != now)) {
|
||||
_lastDigits = now;
|
||||
_lastDigits.replace(QRegularExpression("[^\\d]"), QString());
|
||||
_lastDigits.replace(TextUtilities::RegExpDigitsExclude(), QString());
|
||||
updatePattern(_groupsCallback(_code + _lastDigits));
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ void PhoneInput::correctValue(
|
||||
QString &now,
|
||||
int &nowCursor) {
|
||||
auto digits = now;
|
||||
digits.replace(QRegularExpression("[^\\d]"), QString());
|
||||
digits.replace(TextUtilities::RegExpDigitsExclude(), QString());
|
||||
_pattern = _groupsCallback(digits);
|
||||
|
||||
QString newPlaceholder;
|
||||
|
||||
@@ -34,9 +34,7 @@ void SentCodeField::setChangedCallback(Fn<void()> changedCallback) {
|
||||
QString SentCodeField::getDigitsOnly() const {
|
||||
return QString(
|
||||
getLastText()
|
||||
).remove(
|
||||
QRegularExpression("[^\\d]")
|
||||
);
|
||||
).remove(TextUtilities::RegExpDigitsExclude());
|
||||
}
|
||||
|
||||
void SentCodeField::fix() {
|
||||
|
||||
+1
-1
Submodule Telegram/lib_ui updated: 28fd4eea95...3fea35ff19
Reference in New Issue
Block a user