MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / remove

Method remove

Telegram/SourceFiles/window/window_chat_switch_process.cpp:371–395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

369}
370
371void ChatSwitchProcess::remove(not_null<Data::Thread*> thread) {
372 _list.erase(ranges::remove(_list, thread), end(_list));
373
374 const auto i = ranges::find(_entries, thread, &Entry::thread);
375 if (i != end(_entries)) {
376 const auto selected = _selected;
377 const auto index = int(i - begin(_entries));
378 if (_selected > index) {
379 --_selected;
380 } else if (_selected == index) {
381 _selected = -1;
382 }
383
384 _entries.erase(i);
385 const auto weak = base::make_weak(_widget.get());
386 layout(_widget->size());
387 if (weak && _selected < 0 && selected > 0) {
388 if (_entries.empty()) {
389 _closeRequests.fire({});
390 } else {
391 setSelected(std::min(selected - 1, _shownCount - 1));
392 }
393 }
394 }
395}
396
397void ChatSwitchProcess::setupView() {
398 _widget->sizeValue() | rpl::on_next([=](QSize size) {

Callers 14

clearFromTopicMethod · 0.45
clearFromSublistMethod · 0.45
clearForThreadIfMethod · 0.45
showNextMethod · 0.45
~CachedUserpicsMethod · 0.45
clearMethod · 0.45
subscribeToSessionMethod · 0.45
ClearEditingPaletteFunction · 0.45
clearMethod · 0.45

Calls 5

eraseMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
fireMethod · 0.45

Tested by

no test coverage detected