mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 23:24:01 +02:00
Added ability to jump from code to phone input in intro with Space.
This commit is contained in:
parent
018f147de6
commit
71f34f4e31
3 changed files with 16 additions and 0 deletions
|
@ -80,6 +80,9 @@ PhoneWidget::PhoneWidget(
|
|||
) | rpl::start_with_next([=](const QString &added) {
|
||||
_phone->addedToNumber(added);
|
||||
}, _phone->lifetime());
|
||||
_code->spacePressed() | rpl::start_with_next([=] {
|
||||
submit();
|
||||
}, _code->lifetime());
|
||||
connect(_phone, &Ui::PhonePartInput::changed, [=] { phoneChanged(); });
|
||||
connect(_code, &Ui::CountryCodeInput::changed, [=] { phoneChanged(); });
|
||||
|
||||
|
|
|
@ -50,6 +50,14 @@ void CountryCodeInput::codeSelected(const QString &code) {
|
|||
changed();
|
||||
}
|
||||
|
||||
void CountryCodeInput::keyPressEvent(QKeyEvent *e) {
|
||||
if (e->key() == Qt::Key_Space) {
|
||||
_spacePressed.fire({});
|
||||
} else {
|
||||
MaskedInputField::keyPressEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
void CountryCodeInput::correctValue(
|
||||
const QString &was,
|
||||
int wasCursor,
|
||||
|
|
|
@ -23,10 +23,14 @@ public:
|
|||
[[nodiscard]] rpl::producer<QString> codeChanged() const {
|
||||
return _codeChanged.events();
|
||||
}
|
||||
[[nodiscard]] rpl::producer<> spacePressed() const {
|
||||
return _spacePressed.events();
|
||||
}
|
||||
|
||||
void codeSelected(const QString &code);
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
void correctValue(
|
||||
const QString &was,
|
||||
int wasCursor,
|
||||
|
@ -37,6 +41,7 @@ private:
|
|||
bool _nosignal = false;
|
||||
rpl::event_stream<QString> _addedToNumber;
|
||||
rpl::event_stream<QString> _codeChanged;
|
||||
rpl::event_stream<> _spacePressed;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue