mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 22:57:11 +02:00
Moved regexp for excluding digits to single place.
This commit is contained in:
parent
0eec470387
commit
297fd0f0c8
6 changed files with 8 additions and 9 deletions
|
@ -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 @@
|
|||
Subproject commit 28fd4eea95f4012f1b864d385259ee2de2284ff9
|
||||
Subproject commit 3fea35ff19b52da94fa3ed17695f00b79bfb1917
|
Loading…
Add table
Reference in a new issue