| 2862 | } |
| 2863 | |
| 2864 | void Widget::searchMessages(SearchState state) { |
| 2865 | if (const auto peer = state.inChat.peer()) { |
| 2866 | if (_openedForum && peer->forum() != _openedForum) { |
| 2867 | controller()->closeForum(); |
| 2868 | } |
| 2869 | } else if (state.query.isEmpty()) { |
| 2870 | if (_childList) { |
| 2871 | hideChildList(); |
| 2872 | } |
| 2873 | if (_openedForum) { |
| 2874 | controller()->closeForum(); |
| 2875 | } |
| 2876 | if (_layout == Layout::Main) { |
| 2877 | controller()->closeFolder(); |
| 2878 | } |
| 2879 | } |
| 2880 | applySearchState(std::move(state)); |
| 2881 | session().local().saveRecentSearchHashtags(_searchState.query); |
| 2882 | |
| 2883 | if (_childList) { |
| 2884 | _childList->setInnerFocus(); |
| 2885 | } else if (_subsectionTopBar) { |
| 2886 | if (!_subsectionTopBar->searchSetFocus() |
| 2887 | && !_subsectionTopBar->searchHasFocus()) { |
| 2888 | _subsectionTopBar->toggleSearch(true, anim::type::normal); |
| 2889 | } |
| 2890 | } else { |
| 2891 | _search->setFocus(); |
| 2892 | } |
| 2893 | } |
| 2894 | |
| 2895 | void Widget::searchTopics() { |
| 2896 | if (_topicSearchRequest || _topicSearchFull) { |
no test coverage detected