2014-05-30 12:53:19 +04:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 13:23:14 +03:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2018-01-03 13:23:14 +03:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2014-05-30 12:53:19 +04:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2016-04-07 22:05:28 +04:00
|
|
|
#include "ui/countryinput.h"
|
2019-11-26 14:10:44 +03:00
|
|
|
#include "intro/intro_step.h"
|
2019-11-27 11:33:18 +03:00
|
|
|
#include "base/timer.h"
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2016-11-04 22:50:35 +03:00
|
|
|
namespace Ui {
|
2016-11-15 14:56:49 +03:00
|
|
|
class PhonePartInput;
|
|
|
|
class CountryCodeInput;
|
2016-11-04 22:50:35 +03:00
|
|
|
class RoundButton;
|
2016-11-16 13:44:06 +03:00
|
|
|
class FlatLabel;
|
2016-11-04 22:50:35 +03:00
|
|
|
} // namespace Ui
|
|
|
|
|
2016-11-24 22:28:23 +03:00
|
|
|
namespace Intro {
|
2019-11-26 14:10:44 +03:00
|
|
|
namespace details {
|
2016-11-24 22:28:23 +03:00
|
|
|
|
2019-11-27 11:33:18 +03:00
|
|
|
class PhoneWidget final : public Step {
|
2014-05-30 12:53:19 +04:00
|
|
|
public:
|
2019-07-24 10:46:23 +02:00
|
|
|
PhoneWidget(
|
|
|
|
QWidget *parent,
|
|
|
|
not_null<Main::Account*> account,
|
2019-11-26 14:10:44 +03:00
|
|
|
not_null<Data*> data);
|
2014-05-30 12:53:19 +04:00
|
|
|
|
|
|
|
void selectCountry(const QString &country);
|
|
|
|
|
2016-11-24 22:28:23 +03:00
|
|
|
void setInnerFocus() override;
|
2016-03-14 19:59:18 +03:00
|
|
|
void activate() override;
|
|
|
|
void finished() override;
|
|
|
|
void cancelled() override;
|
2016-11-24 22:28:23 +03:00
|
|
|
void submit() override;
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2016-11-24 22:28:23 +03:00
|
|
|
bool hasBack() const override {
|
|
|
|
return true;
|
|
|
|
}
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2016-11-24 22:28:23 +03:00
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
|
2014-05-30 12:53:19 +04:00
|
|
|
private:
|
2019-11-27 12:45:23 +03:00
|
|
|
void setupQrLogin();
|
2019-11-27 11:33:18 +03:00
|
|
|
void phoneChanged();
|
|
|
|
void checkRequest();
|
2016-11-24 22:28:23 +03:00
|
|
|
void countryChanged();
|
|
|
|
|
|
|
|
void phoneSubmitDone(const MTPauth_SentCode &result);
|
2021-03-12 16:48:00 +04:00
|
|
|
void phoneSubmitFail(const MTP::Error &error);
|
2016-11-24 22:28:23 +03:00
|
|
|
|
2014-05-30 12:53:19 +04:00
|
|
|
QString fullNumber() const;
|
|
|
|
void stopCheck();
|
|
|
|
|
2019-06-18 18:53:27 +02:00
|
|
|
void showPhoneError(rpl::producer<QString> text);
|
2016-11-24 22:28:23 +03:00
|
|
|
void hidePhoneError();
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2016-11-04 22:50:35 +03:00
|
|
|
bool _changed = false;
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2016-12-13 20:07:56 +03:00
|
|
|
object_ptr<CountryInput> _country;
|
|
|
|
object_ptr<Ui::CountryCodeInput> _code;
|
|
|
|
object_ptr<Ui::PhonePartInput> _phone;
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2016-11-04 22:50:35 +03:00
|
|
|
QString _sentPhone;
|
|
|
|
mtpRequestId _sentRequest = 0;
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2019-11-27 11:33:18 +03:00
|
|
|
base::Timer _checkRequestTimer;
|
2014-05-30 12:53:19 +04:00
|
|
|
|
|
|
|
};
|
2016-11-24 22:28:23 +03:00
|
|
|
|
2019-11-26 14:10:44 +03:00
|
|
|
} // namespace details
|
2016-11-24 22:28:23 +03:00
|
|
|
} // namespace Intro
|