Added view-profile-in-chats-list-context-menu option.

This commit is contained in:
23rd 2022-02-01 18:19:47 +03:00
parent 74416568d6
commit 37cd4f51eb
3 changed files with 21 additions and 0 deletions

View file

@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/options.h"
#include "chat_helpers/tabbed_panel.h"
#include "lang/lang_keys.h"
#include "window/window_peer_menu.h"
#include "styles/style_settings.h"
#include "styles/style_layers.h"
@ -62,6 +63,10 @@ void SetupExperimental(
addToggle(ChatHelpers::kOptionTabbedPanelShowOnClick);
AddSkip(container, st::settingsCheckboxesSkip);
addToggle(Window::kOptionViewProfileInChatsListContextMenu);
AddSkip(container, st::settingsCheckboxesSkip);
}
} // namespace

View file

@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "api/api_chat_participants.h"
#include "lang/lang_keys.h"
#include "ui/boxes/confirm_box.h"
#include "base/options.h"
#include "boxes/delete_messages_box.h"
#include "boxes/max_invite_box.h"
#include "boxes/mute_settings_box.h"
@ -69,11 +70,21 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QAction>
namespace Window {
const char kOptionViewProfileInChatsListContextMenu[] =
"view-profile-in-chats-list-context-menu";
namespace {
constexpr auto kArchivedToastDuration = crl::time(5000);
constexpr auto kMaxUnreadWithoutConfirmation = 10000;
base::options::toggle ViewProfileInChatsListContextMenu({
.id = kOptionViewProfileInChatsListContextMenu,
.name = "Add \"View Profile\"",
.description = "Add \"View Profile\" to context menu in chats list",
});
void SetActionText(not_null<QAction*> action, rpl::producer<QString> &&text) {
const auto lifetime = Ui::CreateChild<rpl::lifetime>(action.get());
std::move(
@ -736,6 +747,9 @@ void Filler::fillChatsListActions() {
addHidePromotion();
addToggleArchive();
addTogglePin();
if (ViewProfileInChatsListContextMenu.value()) {
addInfo();
}
addToggleMute();
addToggleUnreadMark();
// addToFolder();

View file

@ -35,6 +35,8 @@ class Controller;
class SessionController;
class SessionNavigation;
extern const char kOptionViewProfileInChatsListContextMenu[];
using PeerMenuCallback = Fn<QAction*(
const QString &text,
Fn<void()> handler,