1 /* 2 This file is part of Telegram Desktop, 3 the official desktop application for the Telegram messaging service. 4 5 For license and copyright information please follow this link: 6 https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL 7 */ 8 #pragma once 9 10 #include "ui/countryinput.h" 11 #include "intro/intro_step.h" 12 #include "base/timer.h" 13 14 namespace Ui { 15 class PhonePartInput; 16 class CountryCodeInput; 17 class RoundButton; 18 class FlatLabel; 19 } // namespace Ui 20 21 namespace Intro { 22 namespace details { 23 24 class PhoneWidget final : public Step { 25 public: 26 PhoneWidget( 27 QWidget *parent, 28 not_null<Main::Account*> account, 29 not_null<Data*> data); 30 31 void selectCountry(const QString &country); 32 33 void setInnerFocus() override; 34 void activate() override; 35 void finished() override; 36 void cancelled() override; 37 void submit() override; 38 hasBack()39 bool hasBack() const override { 40 return true; 41 } 42 43 protected: 44 void resizeEvent(QResizeEvent *e) override; 45 46 private: 47 void setupQrLogin(); 48 void phoneChanged(); 49 void checkRequest(); 50 void countryChanged(); 51 52 void phoneSubmitDone(const MTPauth_SentCode &result); 53 void phoneSubmitFail(const MTP::Error &error); 54 55 QString fullNumber() const; 56 void stopCheck(); 57 58 void showPhoneError(rpl::producer<QString> text); 59 void hidePhoneError(); 60 61 bool _changed = false; 62 63 object_ptr<CountryInput> _country; 64 object_ptr<Ui::CountryCodeInput> _code; 65 object_ptr<Ui::PhonePartInput> _phone; 66 67 QString _sentPhone; 68 mtpRequestId _sentRequest = 0; 69 70 base::Timer _checkRequestTimer; 71 72 }; 73 74 } // namespace details 75 } // namespace Intro 76