diff --git a/Telegram/SourceFiles/ui/boxes/confirm_box.cpp b/Telegram/SourceFiles/ui/boxes/confirm_box.cpp index 92d3a05e2..cad5137eb 100644 --- a/Telegram/SourceFiles/ui/boxes/confirm_box.cpp +++ b/Telegram/SourceFiles/ui/boxes/confirm_box.cpp @@ -42,13 +42,23 @@ void ConfirmBox(not_null box, ConfirmBoxArgs &&args) { const auto &defaultButtonStyle = box->getDelegate()->style().button; - box->addButton( + const auto confirmButton = box->addButton( v::text::take_plain(std::move(args.confirmText), tr::lng_box_ok()), [=, c = prepareCallback(args.confirmed)]() { lifetime->destroy(); c(); }, args.confirmStyle ? *args.confirmStyle : defaultButtonStyle); + box->events( + ) | rpl::start_with_next([=](not_null e) { + if ((e->type() != QEvent::KeyPress) || !confirmButton) { + return; + } + const auto k = static_cast(e.get()); + if (k->key() == Qt::Key_Enter || k->key() == Qt::Key_Return) { + confirmButton->clicked(Qt::KeyboardModifiers(), Qt::LeftButton); + } + }, box->lifetime()); if (!args.inform) { const auto cancelButton = box->addButton(