Close chats search when selecting a folder.
This commit is contained in:
parent
e8a929bdbd
commit
23a13ab54e
|
@ -675,9 +675,12 @@ void Widget::setupMoreChatsBar() {
|
|||
controller()->activeChatsFilter(
|
||||
) | rpl::start_with_next([=](FilterId id) {
|
||||
storiesToggleExplicitExpand(false);
|
||||
if (!_searchState.inChat) {
|
||||
cancelSearch();
|
||||
const auto cancelled = cancelSearch(true);
|
||||
const auto guard = gsl::finally([&] {
|
||||
if (cancelled) {
|
||||
controller()->content()->dialogsCancelled();
|
||||
}
|
||||
});
|
||||
|
||||
if (!id) {
|
||||
_moreChatsBar = nullptr;
|
||||
|
@ -1385,7 +1388,7 @@ void Widget::changeOpenedFolder(Data::Folder *folder, anim::type animated) {
|
|||
return;
|
||||
}
|
||||
changeOpenedSubsection([&] {
|
||||
cancelSearch();
|
||||
cancelSearch(true);
|
||||
closeChildList(anim::type::instant);
|
||||
controller()->closeForum();
|
||||
_openedFolder = folder;
|
||||
|
@ -1439,7 +1442,7 @@ void Widget::changeOpenedForum(Data::Forum *forum, anim::type animated) {
|
|||
return;
|
||||
}
|
||||
changeOpenedSubsection([&] {
|
||||
cancelSearch();
|
||||
cancelSearch(true);
|
||||
closeChildList(anim::type::instant);
|
||||
_openedForum = forum;
|
||||
_searchState.tab = forum
|
||||
|
@ -2777,7 +2780,7 @@ void Widget::showForum(
|
|||
changeOpenedForum(forum, params.animated);
|
||||
return;
|
||||
}
|
||||
cancelSearch();
|
||||
cancelSearch(true);
|
||||
openChildList(forum, params);
|
||||
}
|
||||
|
||||
|
@ -3652,17 +3655,18 @@ void Widget::setSearchQuery(const QString &query, int cursorPosition) {
|
|||
}
|
||||
}
|
||||
|
||||
bool Widget::cancelSearch() {
|
||||
bool Widget::cancelSearch(bool forceFullCancel) {
|
||||
cancelSearchRequest();
|
||||
auto updatedState = _searchState;
|
||||
const auto clearingQuery = !updatedState.query.isEmpty();
|
||||
auto clearingInChat = !clearingQuery
|
||||
auto clearingInChat = (forceFullCancel || !clearingQuery)
|
||||
&& (updatedState.inChat
|
||||
|| updatedState.fromPeer
|
||||
|| !updatedState.tags.empty());
|
||||
if (clearingQuery) {
|
||||
updatedState.query = QString();
|
||||
} else if (clearingInChat) {
|
||||
}
|
||||
if (clearingInChat) {
|
||||
if (updatedState.inChat && controller()->adaptive().isOneColumn()) {
|
||||
if (const auto thread = updatedState.inChat.thread()) {
|
||||
controller()->showThread(thread);
|
||||
|
@ -3680,7 +3684,7 @@ bool Widget::cancelSearch() {
|
|||
setInnerFocus(true);
|
||||
clearingInChat = true;
|
||||
}
|
||||
const auto clearSearchFocus = !updatedState.inChat
|
||||
const auto clearSearchFocus = (forceFullCancel || !updatedState.inChat)
|
||||
&& (_searchHasFocus || _searchSuggestionsLocked);
|
||||
if (!updatedState.inChat && _suggestions) {
|
||||
_suggestions->clearPersistance();
|
||||
|
|
|
@ -131,7 +131,7 @@ public:
|
|||
bool floatPlayerHandleWheelEvent(QEvent *e) override;
|
||||
QRect floatPlayerAvailableRect() override;
|
||||
|
||||
bool cancelSearch();
|
||||
bool cancelSearch(bool forceFullCancel = false);
|
||||
bool cancelSearchByMouseBack();
|
||||
|
||||
QVariant inputMethodQuery(Qt::InputMethodQuery query) const override;
|
||||
|
|
Loading…
Reference in New Issue