diff --git a/Telegram/Resources/langs/rewrites/en.json b/Telegram/Resources/langs/rewrites/en.json index 9a4bf1191..3e32869fd 100644 --- a/Telegram/Resources/langs/rewrites/en.json +++ b/Telegram/Resources/langs/rewrites/en.json @@ -162,5 +162,7 @@ "ktg_settings_compress_images_default": "Compress images by default", "ktg_forward_quiz_unquoted": "Sorry, quizzes that are currently open and unvoted on cannot be forwarded unquoted.", "ktg_in_app_update_disabled": "In-app updater is disabled.", + "ktg_settings_view_profile_on_top": "Show \"View Profile\" first", + "ktg_settings_view_profile_on_top_about": "This option also enables \"Add \"View Profile\"\" from TDesktop's experimental settings.", "dummy_last_string": "" } diff --git a/Telegram/SourceFiles/kotato/kotato_settings.cpp b/Telegram/SourceFiles/kotato/kotato_settings.cpp index 5079445a8..9d9b32996 100644 --- a/Telegram/SourceFiles/kotato/kotato_settings.cpp +++ b/Telegram/SourceFiles/kotato/kotato_settings.cpp @@ -405,6 +405,9 @@ const std::map> DefinitionMap { { "remember_compress_images", { .type = SettingType::BoolSetting, .defaultValue = false, }}, + { "view_profile_on_top", { + .type = SettingType::BoolSetting, + .defaultValue = false, }}, }; using OldOptionKey = QString; diff --git a/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp b/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp index b13a36e1d..07231b917 100644 --- a/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp +++ b/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp @@ -255,6 +255,28 @@ void SetupKotatoChats( ::Kotato::JsonSettings::Write(); }, container->lifetime()); + AddButton( + container, + rktr("ktg_settings_view_profile_on_top"), + st::settingsButtonNoIcon + )->toggleOn( + rpl::single(::Kotato::JsonSettings::GetBool("view_profile_on_top")) + )->toggledValue( + ) | rpl::filter([](bool enabled) { + return (enabled != ::Kotato::JsonSettings::GetBool("view_profile_on_top")); + }) | rpl::start_with_next([](bool enabled) { + ::Kotato::JsonSettings::Set("view_profile_on_top", enabled); + if (enabled) { + auto &option = ::base::options::lookup(Window::kOptionViewProfileInChatsListContextMenu); + option.set(true); + } + ::Kotato::JsonSettings::Write(); + }, container->lifetime()); + + AddSkip(container); + AddDividerText(container, rktr("ktg_settings_view_profile_on_top_about")); + AddSkip(container); + AddSkip(container); AddDivider(container); diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index c935f7485..98ed8302c 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "window/window_peer_menu.h" +#include "kotato/kotato_settings.h" #include "menu/menu_check_item.h" #include "boxes/share_box.h" #include "chat_helpers/compose/compose_show.h" @@ -1143,7 +1144,6 @@ void Filler::fillChatsListActions() { return; } addCreateTopic(); - addInfo(); addViewAsMessages(); const auto &all = _peer->forum()->topicsList()->indexed()->all(); if (all.size() > kTopicsSearchMinCount) { @@ -1185,11 +1185,16 @@ void Filler::addVideoChat() { } void Filler::fillContextMenuActions() { + const auto profileEnabled = ViewProfileInChatsListContextMenu.value(); + const auto profileOnTop = ::Kotato::JsonSettings::GetBool("view_profile_on_top"); addNewWindow(); addHidePromotion(); + if (profileEnabled && profileOnTop) { + addInfo(); + } addToggleArchive(); addTogglePin(); - if (ViewProfileInChatsListContextMenu.value()) { + if (profileEnabled && !profileOnTop) { addInfo(); } addToggleMuteSubmenu(false);