mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-26 07:23:02 +02:00
Fix some search options.
This commit is contained in:
parent
154c777788
commit
77a09a0e59
4 changed files with 25 additions and 9 deletions
|
@ -3069,6 +3069,11 @@ void InnerWidget::clearSelection() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InnerWidget::fillSupportSearchMenu(not_null<Ui::PopupMenu*> menu) {
|
void InnerWidget::fillSupportSearchMenu(not_null<Ui::PopupMenu*> menu) {
|
||||||
|
const auto globalSearch = (_searchState.tab == ChatSearchTab::MyMessages)
|
||||||
|
|| (_searchState.tab == ChatSearchTab::PublicPosts);
|
||||||
|
if (!globalSearch && _searchState.inChat) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const auto all = session().settings().supportAllSearchResults();
|
const auto all = session().settings().supportAllSearchResults();
|
||||||
const auto text = all ? "Only one from chat" : "Show all messages";
|
const auto text = all ? "Only one from chat" : "Show all messages";
|
||||||
menu->addAction(text, [=] {
|
menu->addAction(text, [=] {
|
||||||
|
@ -3079,9 +3084,11 @@ void InnerWidget::fillSupportSearchMenu(not_null<Ui::PopupMenu*> menu) {
|
||||||
|
|
||||||
void InnerWidget::fillArchiveSearchMenu(not_null<Ui::PopupMenu*> menu) {
|
void InnerWidget::fillArchiveSearchMenu(not_null<Ui::PopupMenu*> menu) {
|
||||||
const auto folder = session().data().folderLoaded(Data::Folder::kId);
|
const auto folder = session().data().folderLoaded(Data::Folder::kId);
|
||||||
|
const auto globalSearch = (_searchState.tab == ChatSearchTab::MyMessages)
|
||||||
|
|| (_searchState.tab == ChatSearchTab::PublicPosts);
|
||||||
if (!folder
|
if (!folder
|
||||||
|| !folder->chatsList()->fullSize().current()
|
|| !folder->chatsList()->fullSize().current()
|
||||||
|| _searchState.inChat) {
|
|| (!globalSearch && _searchState.inChat)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto skip = session().settings().skipArchiveInSearch();
|
const auto skip = session().settings().skipArchiveInSearch();
|
||||||
|
@ -3796,7 +3803,7 @@ void InnerWidget::itemRemoved(not_null<const HistoryItem*> item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InnerWidget::uniqueSearchResults() const {
|
bool InnerWidget::uniqueSearchResults() const {
|
||||||
return _controller->uniqueChatsInSearchResults();
|
return _controller->uniqueChatsInSearchResults(_searchState);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InnerWidget::hasHistoryInResults(not_null<History*> history) const {
|
bool InnerWidget::hasHistoryInResults(not_null<History*> history) const {
|
||||||
|
@ -3854,7 +3861,8 @@ void InnerWidget::searchReceived(
|
||||||
? _searchState.inChat
|
? _searchState.inChat
|
||||||
: Key(_openedForum->history());
|
: Key(_openedForum->history());
|
||||||
if (inject
|
if (inject
|
||||||
&& (!_searchState.inChat
|
&& (globalSearch
|
||||||
|
|| !_searchState.inChat
|
||||||
|| inject->history() == _searchState.inChat.history())) {
|
|| inject->history() == _searchState.inChat.history())) {
|
||||||
Assert(_searchResults.empty());
|
Assert(_searchResults.empty());
|
||||||
Assert(!toPreview);
|
Assert(!toPreview);
|
||||||
|
|
|
@ -967,9 +967,9 @@ void Widget::chosenRow(const ChosenRow &row) {
|
||||||
return;
|
return;
|
||||||
} else if (history) {
|
} else if (history) {
|
||||||
const auto peer = history->peer;
|
const auto peer = history->peer;
|
||||||
const auto showAtMsgId = controller()->uniqueChatsInSearchResults()
|
const auto showAtMsgId = controller()->uniqueChatsInSearchResults(
|
||||||
? ShowAtUnreadMsgId
|
_searchState
|
||||||
: row.message.fullId.msg;
|
) ? ShowAtUnreadMsgId : row.message.fullId.msg;
|
||||||
auto params = Window::SectionShow(
|
auto params = Window::SectionShow(
|
||||||
Window::SectionShow::Way::ClearStack);
|
Window::SectionShow::Way::ClearStack);
|
||||||
params.highlightPart.text = _searchState.query;
|
params.highlightPart.text = _searchState.query;
|
||||||
|
|
|
@ -53,6 +53,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_peer_values.h"
|
#include "data/data_peer_values.h"
|
||||||
#include "data/data_premium_limits.h"
|
#include "data/data_premium_limits.h"
|
||||||
#include "data/data_web_page.h"
|
#include "data/data_web_page.h"
|
||||||
|
#include "dialogs/ui/chat_search_in.h"
|
||||||
#include "passport/passport_form_controller.h"
|
#include "passport/passport_form_controller.h"
|
||||||
#include "chat_helpers/tabbed_selector.h"
|
#include "chat_helpers/tabbed_selector.h"
|
||||||
#include "chat_helpers/emoji_interactions.h"
|
#include "chat_helpers/emoji_interactions.h"
|
||||||
|
@ -1803,10 +1804,13 @@ void SessionController::activateFirstChatsFilter() {
|
||||||
setActiveChatsFilter(session().data().chatsFilters().defaultId());
|
setActiveChatsFilter(session().data().chatsFilters().defaultId());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SessionController::uniqueChatsInSearchResults() const {
|
bool SessionController::uniqueChatsInSearchResults(
|
||||||
|
const Dialogs::SearchState &state) const {
|
||||||
|
const auto global = (state.tab == Dialogs::ChatSearchTab::MyMessages)
|
||||||
|
|| (state.tab == Dialogs::ChatSearchTab::PublicPosts);
|
||||||
return session().supportMode()
|
return session().supportMode()
|
||||||
&& !session().settings().supportAllSearchResults()
|
&& !session().settings().supportAllSearchResults()
|
||||||
&& !_searchInChat.current();
|
&& (global || !state.inChat);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SessionController::openFolderInDifferentWindow(
|
bool SessionController::openFolderInDifferentWindow(
|
||||||
|
|
|
@ -30,6 +30,10 @@ class SavedMessages;
|
||||||
enum class StorySourcesList : uchar;
|
enum class StorySourcesList : uchar;
|
||||||
} // namespace Data
|
} // namespace Data
|
||||||
|
|
||||||
|
namespace Dialogs {
|
||||||
|
struct SearchState;
|
||||||
|
} // namespace Dialogs
|
||||||
|
|
||||||
namespace ChatHelpers {
|
namespace ChatHelpers {
|
||||||
class TabbedSelector;
|
class TabbedSelector;
|
||||||
class EmojiInteractions;
|
class EmojiInteractions;
|
||||||
|
@ -404,7 +408,7 @@ public:
|
||||||
void setSearchInChat(Dialogs::Key value) {
|
void setSearchInChat(Dialogs::Key value) {
|
||||||
_searchInChat = value;
|
_searchInChat = value;
|
||||||
}
|
}
|
||||||
bool uniqueChatsInSearchResults() const;
|
bool uniqueChatsInSearchResults(const Dialogs::SearchState &state) const;
|
||||||
|
|
||||||
void openFolder(not_null<Data::Folder*> folder);
|
void openFolder(not_null<Data::Folder*> folder);
|
||||||
void closeFolder();
|
void closeFolder();
|
||||||
|
|
Loading…
Add table
Reference in a new issue