mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix search by a hashtag from a topic.
This commit is contained in:
parent
98af2d3006
commit
7cf3babcbd
4 changed files with 28 additions and 2 deletions
|
@ -1466,6 +1466,16 @@ void Widget::showMainMenu() {
|
||||||
void Widget::searchMessages(
|
void Widget::searchMessages(
|
||||||
const QString &query,
|
const QString &query,
|
||||||
Key inChat) {
|
Key inChat) {
|
||||||
|
if (_childList) {
|
||||||
|
const auto forum = controller()->shownForum().current();
|
||||||
|
const auto topic = inChat.topic();
|
||||||
|
if ((forum && forum->channel() == inChat.peer())
|
||||||
|
|| (topic && topic->forum() == forum)) {
|
||||||
|
_childList->searchMessages(query, inChat);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
hideChildList();
|
||||||
|
}
|
||||||
const auto inChatChanged = [&] {
|
const auto inChatChanged = [&] {
|
||||||
const auto inPeer = inChat.peer();
|
const auto inPeer = inChat.peer();
|
||||||
const auto inTopic = inChat.topic();
|
const auto inTopic = inChat.topic();
|
||||||
|
@ -1482,12 +1492,12 @@ void Widget::searchMessages(
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}();
|
}();
|
||||||
if ((_filter->getLastText() != query) || inChatChanged) {
|
if ((currentSearchQuery() != query) || inChatChanged) {
|
||||||
if (inChat) {
|
if (inChat) {
|
||||||
cancelSearch();
|
cancelSearch();
|
||||||
setSearchInChat(inChat);
|
setSearchInChat(inChat);
|
||||||
}
|
}
|
||||||
_filter->setText(query);
|
setSearchQuery(query);
|
||||||
applyFilterUpdate(true);
|
applyFilterUpdate(true);
|
||||||
_searchTimer.cancel();
|
_searchTimer.cancel();
|
||||||
searchMessages();
|
searchMessages();
|
||||||
|
@ -2570,6 +2580,14 @@ void Widget::clearSearchField() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Widget::setSearchQuery(const QString &query) {
|
||||||
|
if (_subsectionTopBar) {
|
||||||
|
_subsectionTopBar->searchSetText(query);
|
||||||
|
} else {
|
||||||
|
_filter->setText(query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Widget::cancelSearch() {
|
bool Widget::cancelSearch() {
|
||||||
auto clearingQuery = !currentSearchQuery().isEmpty();
|
auto clearingQuery = !currentSearchQuery().isEmpty();
|
||||||
auto clearingInChat = false;
|
auto clearingInChat = false;
|
||||||
|
|
|
@ -166,6 +166,7 @@ private:
|
||||||
void showSearchFrom();
|
void showSearchFrom();
|
||||||
void showMainMenu();
|
void showMainMenu();
|
||||||
void clearSearchCache();
|
void clearSearchCache();
|
||||||
|
void setSearchQuery(const QString &query);
|
||||||
void updateControlsVisibility(bool fast = false);
|
void updateControlsVisibility(bool fast = false);
|
||||||
void updateLockUnlockVisibility();
|
void updateLockUnlockVisibility();
|
||||||
void updateLoadMoreChatsVisibility();
|
void updateLoadMoreChatsVisibility();
|
||||||
|
|
|
@ -1344,6 +1344,12 @@ void TopBarWidget::searchClear() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TopBarWidget::searchSetText(const QString &query) {
|
||||||
|
if (_searchMode) {
|
||||||
|
_searchField->setText(query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TopBarWidget::toggleSelectedControls(bool shown) {
|
void TopBarWidget::toggleSelectedControls(bool shown) {
|
||||||
_selectedShown.start(
|
_selectedShown.start(
|
||||||
[this] { slideAnimationCallback(); },
|
[this] { slideAnimationCallback(); },
|
||||||
|
|
|
@ -88,6 +88,7 @@ public:
|
||||||
[[nodiscard]] rpl::producer<QString> searchQuery() const;
|
[[nodiscard]] rpl::producer<QString> searchQuery() const;
|
||||||
[[nodiscard]] QString searchQueryCurrent() const;
|
[[nodiscard]] QString searchQueryCurrent() const;
|
||||||
void searchClear();
|
void searchClear();
|
||||||
|
void searchSetText(const QString &query);
|
||||||
|
|
||||||
[[nodiscard]] rpl::producer<> forwardSelectionRequest() const {
|
[[nodiscard]] rpl::producer<> forwardSelectionRequest() const {
|
||||||
return _forwardSelection.events();
|
return _forwardSelection.events();
|
||||||
|
|
Loading…
Add table
Reference in a new issue