Slightly improved input of phone code in PhoneWidget.

This commit is contained in:
23rd 2023-02-02 22:49:11 +03:00
parent e0cba40410
commit 1d21c2ca8f
3 changed files with 14 additions and 9 deletions

View file

@ -146,6 +146,16 @@ void PhoneWidget::submit() {
return; return;
} }
{
const auto hasCodeButWaitingPhone = _code->hasFocus()
&& (_code->getLastText().size() > 1)
&& _phone->getLastText().isEmpty();
if (hasCodeButWaitingPhone) {
_phone->hideError();
_phone->setFocus();
return;
}
}
const auto phone = fullNumber(); const auto phone = fullNumber();
if (!AllowPhoneAttempt(phone)) { if (!AllowPhoneAttempt(phone)) {
showPhoneError(tr::lng_bad_phone()); showPhoneError(tr::lng_bad_phone());

View file

@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_layers.h" #include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_intro.h" #include "styles/style_intro.h"
#include "styles/style_widgets.h"
CountryInput::CountryInput( CountryInput::CountryInput(
QWidget *parent, QWidget *parent,

View file

@ -8,11 +8,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#pragma once #pragma once
#include "ui/rp_widget.h" #include "ui/rp_widget.h"
#include "styles/style_widgets.h"
namespace Data { namespace style {
struct Info; struct InputField;
} // namespace Data } // namespace style
namespace Countries { namespace Countries {
struct Info; struct Info;
@ -22,11 +21,6 @@ namespace Window {
class Show; class Show;
} // namespace Window } // namespace Window
namespace Ui {
class MultiSelect;
class RippleAnimation;
} // namespace Ui
class CountryInput : public Ui::RpWidget { class CountryInput : public Ui::RpWidget {
public: public: