mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Added experimental option to force embedded search in chat.
This commit is contained in:
@@ -5709,7 +5709,9 @@ bool HistoryWidget::searchInChatEmbedded(
|
||||
Dialogs::Key chat,
|
||||
PeerData *searchFrom) {
|
||||
const auto peer = chat.peer(); // windows todo
|
||||
if (!peer || Window::SeparateId(peer) != controller()->windowId()) {
|
||||
if (!peer
|
||||
|| ((Window::SeparateId(peer) != controller()->windowId())
|
||||
&& !controller()->isPrimary())) {
|
||||
return false;
|
||||
} else if (_peer != peer) {
|
||||
const auto weak = base::make_weak(this);
|
||||
|
||||
@@ -70,6 +70,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "media/player/media_player_dropdown.h"
|
||||
#include "media/player/media_player_instance.h"
|
||||
#include "base/qthelp_regex.h"
|
||||
#include "base/options.h"
|
||||
#include "mtproto/mtproto_dc_options.h"
|
||||
#include "core/update_checker.h"
|
||||
#include "core/shortcuts.h"
|
||||
@@ -105,8 +106,16 @@ void ClearBotStartToken(PeerData *peer) {
|
||||
}
|
||||
}
|
||||
|
||||
base::options::toggle ForceComposeSearchOneColumn({
|
||||
.id = kForceComposeSearchOneColumn,
|
||||
.name = "Force embedded search in chats",
|
||||
.description = "Force in one-column mode the embedded search in chats.",
|
||||
});
|
||||
|
||||
} // namespace
|
||||
|
||||
const char kForceComposeSearchOneColumn[] = "force-compose-search-one-column";
|
||||
|
||||
enum StackItemType {
|
||||
HistoryStackItem,
|
||||
SectionStackItem,
|
||||
@@ -782,7 +791,8 @@ void MainWidget::searchMessages(
|
||||
return;
|
||||
}
|
||||
auto tags = Data::SearchTagsFromQuery(query);
|
||||
if (_dialogs) {
|
||||
if (_dialogs
|
||||
&& (!ForceComposeSearchOneColumn.value() || !isOneColumn())) {
|
||||
auto state = Dialogs::SearchState{
|
||||
.inChat = ((tags.empty() || inChat.sublist())
|
||||
? inChat
|
||||
|
||||
@@ -92,6 +92,8 @@ namespace Core {
|
||||
class Changelogs;
|
||||
} // namespace Core
|
||||
|
||||
extern const char kForceComposeSearchOneColumn[];
|
||||
|
||||
class MainWidget final
|
||||
: public Ui::RpWidget
|
||||
, private Media::Player::FloatDelegate {
|
||||
|
||||
@@ -28,6 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "info/profile/info_profile_actions.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "mainwindow.h"
|
||||
#include "mainwidget.h"
|
||||
#include "media/player/media_player_instance.h"
|
||||
#include "mtproto/session_private.h"
|
||||
#include "webview/webview_embed.h"
|
||||
@@ -175,6 +176,7 @@ void SetupExperimental(
|
||||
addToggle(Window::kOptionDisableTouchbar);
|
||||
addToggle(Info::kAlternativeScrollProcessing);
|
||||
addToggle(kModerateCommonGroups);
|
||||
addToggle(kForceComposeSearchOneColumn);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user