mirror of
https://github.com/vale981/tdesktop
synced 2025-03-05 17:51:41 -05:00
Allow closing CreatePollBox by escape.
This commit is contained in:
parent
c7c1deab81
commit
b6a3bb4080
1 changed files with 4 additions and 4 deletions
|
@ -588,7 +588,10 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
|
||||||
const auto options = lifetime().make_state<Options>(
|
const auto options = lifetime().make_state<Options>(
|
||||||
getDelegate()->outerContainer(),
|
getDelegate()->outerContainer(),
|
||||||
container);
|
container);
|
||||||
auto limit = options->usedCount() | rpl::map([=](int count) {
|
auto limit = options->usedCount() | rpl::after_next([=](int count) {
|
||||||
|
setCloseByEscape(!count);
|
||||||
|
setCloseByOutsideClick(!count);
|
||||||
|
}) | rpl::map([=](int count) {
|
||||||
return (count < kMaxOptionsCount)
|
return (count < kMaxOptionsCount)
|
||||||
? lng_polls_create_limit(lt_count, kMaxOptionsCount - count)
|
? lng_polls_create_limit(lt_count, kMaxOptionsCount - count)
|
||||||
: lang(lng_polls_create_maximum);
|
: lang(lng_polls_create_maximum);
|
||||||
|
@ -666,7 +669,4 @@ void CreatePollBox::prepare() {
|
||||||
const auto inner = setInnerWidget(setupContent());
|
const auto inner = setInnerWidget(setupContent());
|
||||||
|
|
||||||
setDimensionsToContent(st::boxWideWidth, inner);
|
setDimensionsToContent(st::boxWideWidth, inner);
|
||||||
|
|
||||||
setCloseByEscape(false);
|
|
||||||
setCloseByOutsideClick(false);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue