MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / CodeWidget

Method CodeWidget

Telegram/SourceFiles/intro/intro_code.cpp:30–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28namespace details {
29
30CodeWidget::CodeWidget(
31 QWidget *parent,
32 not_null<Main::Account*> account,
33 not_null<Data*> data)
34: Step(parent, account, data)
35, _noTelegramCode(this, tr::lng_code_no_telegram(tr::now), st::introLink)
36, _code(this)
37, _callTimer([=] { sendCall(); })
38, _callStatus(getData()->callStatus)
39, _callTimeout(getData()->callTimeout)
40, _callLabel(this, st::introDescription)
41, _checkRequestTimer([=] { checkRequest(); }) {
42 Lang::Updated(
43 ) | rpl::on_next([=] {
44 refreshLang();
45 }, lifetime());
46
47 _noTelegramCode->addClickHandler([=] { noTelegramCode(); });
48
49 _code->setDigitsCountMax(getData()->codeLength);
50
51 updateDescText();
52 setTitleText(_isFragment.value(
53 ) | rpl::map([=](bool isFragment) {
54 return !isFragment
55 ? rpl::single(Ui::FormatPhone(getData()->phone))
56 : tr::lng_intro_fragment_title();
57 }) | rpl::flatten_latest());
58
59 account->setHandleLoginCode([=](const QString &code) {
60 _code->setCode(code);
61 _code->requestCode();
62 });
63
64 _code->codeCollected(
65 ) | rpl::on_next([=](const QString &code) {
66 hideError();
67 submitCode(code);
68 }, lifetime());
69}
70
71void CodeWidget::refreshLang() {
72 if (_noTelegramCode) {

Callers

nothing calls this directly

Calls 8

FormatPhoneFunction · 0.85
setDigitsCountMaxMethod · 0.80
setHandleLoginCodeMethod · 0.80
setCodeMethod · 0.80
requestCodeMethod · 0.80
codeCollectedMethod · 0.80
UpdatedFunction · 0.50
valueMethod · 0.45

Tested by

no test coverage detected