From 1d21c2ca8f000b501e35205e6edc21b975a82388 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 2 Feb 2023 22:49:11 +0300 Subject: [PATCH] Slightly improved input of phone code in PhoneWidget. --- Telegram/SourceFiles/intro/intro_phone.cpp | 10 ++++++++++ Telegram/SourceFiles/ui/countryinput.cpp | 1 + Telegram/SourceFiles/ui/countryinput.h | 12 +++--------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Telegram/SourceFiles/intro/intro_phone.cpp b/Telegram/SourceFiles/intro/intro_phone.cpp index 75c2e01b4..1e2560a8c 100644 --- a/Telegram/SourceFiles/intro/intro_phone.cpp +++ b/Telegram/SourceFiles/intro/intro_phone.cpp @@ -146,6 +146,16 @@ void PhoneWidget::submit() { return; } + { + const auto hasCodeButWaitingPhone = _code->hasFocus() + && (_code->getLastText().size() > 1) + && _phone->getLastText().isEmpty(); + if (hasCodeButWaitingPhone) { + _phone->hideError(); + _phone->setFocus(); + return; + } + } const auto phone = fullNumber(); if (!AllowPhoneAttempt(phone)) { showPhoneError(tr::lng_bad_phone()); diff --git a/Telegram/SourceFiles/ui/countryinput.cpp b/Telegram/SourceFiles/ui/countryinput.cpp index a757a6326..c140f7947 100644 --- a/Telegram/SourceFiles/ui/countryinput.cpp +++ b/Telegram/SourceFiles/ui/countryinput.cpp @@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "styles/style_layers.h" #include "styles/style_boxes.h" #include "styles/style_intro.h" +#include "styles/style_widgets.h" CountryInput::CountryInput( QWidget *parent, diff --git a/Telegram/SourceFiles/ui/countryinput.h b/Telegram/SourceFiles/ui/countryinput.h index c8130b8f4..986b741a5 100644 --- a/Telegram/SourceFiles/ui/countryinput.h +++ b/Telegram/SourceFiles/ui/countryinput.h @@ -8,11 +8,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #pragma once #include "ui/rp_widget.h" -#include "styles/style_widgets.h" -namespace Data { -struct Info; -} // namespace Data +namespace style { +struct InputField; +} // namespace style namespace Countries { struct Info; @@ -22,11 +21,6 @@ namespace Window { class Show; } // namespace Window -namespace Ui { -class MultiSelect; -class RippleAnimation; -} // namespace Ui - class CountryInput : public Ui::RpWidget { public: