| 104 | } |
| 105 | |
| 106 | void PeerListBox::createMultiSelect() { |
| 107 | Expects(_select == nullptr); |
| 108 | |
| 109 | auto placeholder = _controller->searchPlaceholder(); |
| 110 | auto entity = object_ptr<Ui::MultiSelect>( |
| 111 | this, |
| 112 | (_controller->selectSt() |
| 113 | ? *_controller->selectSt() |
| 114 | : st::defaultMultiSelect), |
| 115 | placeholder ? std::move(placeholder) : tr::lng_participant_filter()); |
| 116 | _select.create(this, std::move(entity)); |
| 117 | _select->heightValue( |
| 118 | ) | rpl::on_next( |
| 119 | [this] { updateScrollSkips(); }, |
| 120 | lifetime()); |
| 121 | _select->entity()->setSubmittedCallback([=](Qt::KeyboardModifiers) { |
| 122 | content()->submitted(); |
| 123 | }); |
| 124 | _select->entity()->setQueryChangedCallback([=](const QString &query) { |
| 125 | if (_customQueryChangedCallback) { |
| 126 | _customQueryChangedCallback(query); |
| 127 | } |
| 128 | searchQueryChanged(query); |
| 129 | }); |
| 130 | _select->entity()->setItemRemovedCallback([=](uint64 itemId) { |
| 131 | if (_controller->handleDeselectForeignRow(itemId)) { |
| 132 | return; |
| 133 | } |
| 134 | if (const auto peer = _controller->session().data().peerLoaded(PeerId(itemId))) { |
| 135 | if (const auto row = peerListFindRow(itemId)) { |
| 136 | content()->changeCheckState(row, false, anim::type::normal); |
| 137 | update(); |
| 138 | } |
| 139 | _controller->itemDeselectedHook(peer); |
| 140 | } |
| 141 | }); |
| 142 | _select->resizeToWidth(_controller->contentWidth()); |
| 143 | _select->moveToLeft(0, topSelectSkip()); |
| 144 | } |
| 145 | |
| 146 | void PeerListBox::appendQueryChangedCallback(Fn<void(QString)> callback) { |
| 147 | _customQueryChangedCallback = std::move(callback); |
nothing calls this directly
no test coverage detected