mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Improve search-in-topic closing.
This commit is contained in:
parent
5d76415a5d
commit
850746b0ba
3 changed files with 31 additions and 16 deletions
|
@ -416,9 +416,8 @@ void Widget::chosenRow(const ChosenRow &row) {
|
||||||
&& row.filteredRow;
|
&& row.filteredRow;
|
||||||
const auto history = row.key.history();
|
const auto history = row.key.history();
|
||||||
if (const auto topic = row.key.topic()) {
|
if (const auto topic = row.key.topic()) {
|
||||||
controller()->showRepliesForMessage(
|
controller()->showTopic(
|
||||||
topic->history(),
|
topic,
|
||||||
topic->rootId(),
|
|
||||||
row.message.fullId.msg,
|
row.message.fullId.msg,
|
||||||
Window::SectionShow::Way::ClearStack);
|
Window::SectionShow::Way::ClearStack);
|
||||||
} else if (history && history->peer->isForum() && !row.message.fullId) {
|
} else if (history && history->peer->isForum() && !row.message.fullId) {
|
||||||
|
@ -2309,32 +2308,34 @@ void Widget::clearSearchField() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Widget::cancelSearch() {
|
bool Widget::cancelSearch() {
|
||||||
bool clearing = !currentSearchQuery().isEmpty();
|
auto clearingQuery = !currentSearchQuery().isEmpty();
|
||||||
|
auto clearingInChat = false;
|
||||||
cancelSearchRequest();
|
cancelSearchRequest();
|
||||||
if (!clearing && _searchInChat) {
|
if (!clearingQuery && _searchInChat) {
|
||||||
if (controller()->adaptive().isOneColumn()) {
|
if (controller()->adaptive().isOneColumn()) {
|
||||||
if (const auto topic = _searchInChat.topic()) {
|
if (const auto topic = _searchInChat.topic()) {
|
||||||
//controller()->showTopic(topic); // #TODO forum search
|
controller()->showTopic(topic);
|
||||||
} else if (const auto peer = _searchInChat.peer()) {
|
} else if (const auto peer = _searchInChat.peer()) {
|
||||||
controller()->showPeer(peer, ShowAtUnreadMsgId);
|
controller()->showPeerHistory(peer);
|
||||||
} else {
|
} else {
|
||||||
Unexpected("Empty key in cancelSearch().");
|
Unexpected("Empty key in cancelSearch().");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setSearchInChat(Key());
|
setSearchInChat(Key());
|
||||||
clearing = true;
|
clearingInChat = true;
|
||||||
} else if (!clearing
|
}
|
||||||
|
if (!clearingQuery
|
||||||
&& _subsectionTopBar
|
&& _subsectionTopBar
|
||||||
&& _subsectionTopBar->toggleSearch(false, anim::type::normal)) {
|
&& _subsectionTopBar->toggleSearch(false, anim::type::normal)) {
|
||||||
setFocus();
|
setFocus();
|
||||||
return true;
|
clearingInChat = true;
|
||||||
}
|
}
|
||||||
_lastSearchPeer = nullptr;
|
_lastSearchPeer = nullptr;
|
||||||
_lastSearchId = _lastSearchMigratedId = 0;
|
_lastSearchId = _lastSearchMigratedId = 0;
|
||||||
_inner->clearFilter();
|
_inner->clearFilter();
|
||||||
clearSearchField();
|
clearSearchField();
|
||||||
applyFilterUpdate();
|
applyFilterUpdate();
|
||||||
return clearing;
|
return clearingQuery || clearingInChat;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::cancelSearchInChat() {
|
void Widget::cancelSearchInChat() {
|
||||||
|
@ -2345,9 +2346,9 @@ void Widget::cancelSearchInChat() {
|
||||||
&& !controller()->selectingPeer()
|
&& !controller()->selectingPeer()
|
||||||
&& currentSearchQuery().trimmed().isEmpty()) {
|
&& currentSearchQuery().trimmed().isEmpty()) {
|
||||||
if (const auto topic = _searchInChat.topic()) {
|
if (const auto topic = _searchInChat.topic()) {
|
||||||
// #TODO forum search
|
controller()->showTopic(topic);
|
||||||
} else if (const auto peer = _searchInChat.peer()) {
|
} else if (const auto peer = _searchInChat.peer()) {
|
||||||
Ui::showPeerHistory(peer, ShowAtUnreadMsgId);
|
controller()->showPeerHistory(peer);
|
||||||
} else {
|
} else {
|
||||||
Unexpected("Empty key in cancelSearchInPeer().");
|
Unexpected("Empty key in cancelSearchInPeer().");
|
||||||
}
|
}
|
||||||
|
|
|
@ -575,6 +575,17 @@ void SessionNavigation::showPeerInfo(
|
||||||
showPeerInfo(_session->data().peer(peerId), params);
|
showPeerInfo(_session->data().peer(peerId), params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SessionNavigation::showTopic(
|
||||||
|
not_null<Data::ForumTopic*> topic,
|
||||||
|
MsgId commentId,
|
||||||
|
const SectionShow ¶ms) {
|
||||||
|
return showRepliesForMessage(
|
||||||
|
topic->history(),
|
||||||
|
topic->rootId(),
|
||||||
|
commentId,
|
||||||
|
params);
|
||||||
|
}
|
||||||
|
|
||||||
void SessionNavigation::showPeerInfo(
|
void SessionNavigation::showPeerInfo(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
const SectionShow ¶ms) {
|
const SectionShow ¶ms) {
|
||||||
|
@ -1539,9 +1550,8 @@ void SessionController::showCalendar(Dialogs::Key chat, QDate requestedDate) {
|
||||||
SectionShow::Way::Forward,
|
SectionShow::Way::Forward,
|
||||||
id);
|
id);
|
||||||
} else if (const auto strongTopic = weakTopic.get()) {
|
} else if (const auto strongTopic = weakTopic.get()) {
|
||||||
strong->showRepliesForMessage(
|
strong->showTopic(
|
||||||
strongTopic->history(),
|
strongTopic,
|
||||||
strongTopic->rootId(),
|
|
||||||
id,
|
id,
|
||||||
SectionShow::Way::Forward);
|
SectionShow::Way::Forward);
|
||||||
strong->hideLayer(anim::type::normal);
|
strong->hideLayer(anim::type::normal);
|
||||||
|
|
|
@ -212,6 +212,10 @@ public:
|
||||||
MsgId rootId,
|
MsgId rootId,
|
||||||
MsgId commentId = 0,
|
MsgId commentId = 0,
|
||||||
const SectionShow ¶ms = SectionShow());
|
const SectionShow ¶ms = SectionShow());
|
||||||
|
void showTopic(
|
||||||
|
not_null<Data::ForumTopic*> topic,
|
||||||
|
MsgId commentId = 0,
|
||||||
|
const SectionShow ¶ms = SectionShow());
|
||||||
|
|
||||||
void showPeerInfo(
|
void showPeerInfo(
|
||||||
PeerId peerId,
|
PeerId peerId,
|
||||||
|
|
Loading…
Add table
Reference in a new issue