| 80 | } |
| 81 | |
| 82 | void PeerListsBox::createMultiSelect() { |
| 83 | Expects(_select == nullptr); |
| 84 | |
| 85 | auto entity = object_ptr<Ui::MultiSelect>( |
| 86 | this, |
| 87 | (firstController()->selectSt() |
| 88 | ? *firstController()->selectSt() |
| 89 | : st::defaultMultiSelect), |
| 90 | tr::lng_participant_filter()); |
| 91 | _select.create(this, std::move(entity)); |
| 92 | _select->heightValue( |
| 93 | ) | rpl::on_next( |
| 94 | [this] { updateScrollSkips(); }, |
| 95 | lifetime()); |
| 96 | _select->entity()->setSubmittedCallback([=](Qt::KeyboardModifiers) { |
| 97 | for (const auto &list : _lists) { |
| 98 | if (list.content->submitted()) { |
| 99 | break; |
| 100 | } |
| 101 | } |
| 102 | }); |
| 103 | _select->entity()->setQueryChangedCallback([=](const QString &query) { |
| 104 | searchQueryChanged(query); |
| 105 | }); |
| 106 | _select->entity()->setItemRemovedCallback([=](uint64 itemId) { |
| 107 | for (const auto &list : _lists) { |
| 108 | if (list.controller->handleDeselectForeignRow(itemId)) { |
| 109 | return; |
| 110 | } |
| 111 | } |
| 112 | const auto session = &firstController()->session(); |
| 113 | if (const auto peer = session->data().peerLoaded(PeerId(itemId))) { |
| 114 | const auto id = peer->id; |
| 115 | for (const auto &list : _lists) { |
| 116 | if (const auto row = list.delegate->peerListFindRow(id.value)) { |
| 117 | list.content->changeCheckState( |
| 118 | row, |
| 119 | false, |
| 120 | anim::type::normal); |
| 121 | update(); |
| 122 | } |
| 123 | list.controller->itemDeselectedHook(peer); |
| 124 | } |
| 125 | } |
| 126 | }); |
| 127 | _select->resizeToWidth(firstController()->contentWidth()); |
| 128 | _select->moveToLeft(0, 0); |
| 129 | } |
| 130 | |
| 131 | int PeerListsBox::getTopScrollSkip() const { |
| 132 | auto result = 0; |
nothing calls this directly
no test coverage detected