2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-23 10:47:11 +00:00
tdesktop/Telegram/SourceFiles/window/window_peer_menu.h

264 lines
7.9 KiB
C
Raw Normal View History

2017-11-06 22:03:20 +04:00
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
2017-11-06 22:03:20 +04:00
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
2017-11-06 22:03:20 +04:00
*/
#pragma once
#include "api/api_common.h"
#include "base/object_ptr.h"
2022-03-27 13:01:34 +03:00
#include "menu/menu_send.h"
#include "data/data_poll.h"
#include "ui/widgets/menu/menu_add_action_callback.h"
class History;
2019-06-12 15:26:04 +02:00
2025-02-25 14:53:23 +04:00
namespace Api {
struct SendOptions;
} // namespace Api
namespace Ui {
class RpWidget;
class BoxContent;
2019-09-18 14:19:05 +03:00
class GenericBox;
class Show;
} // namespace Ui
namespace Data {
2022-11-01 08:46:31 +04:00
class Forum;
2019-04-15 15:54:03 +04:00
class Folder;
class Session;
struct ForwardDraft;
2022-10-19 14:59:37 +04:00
class ForumTopic;
2025-05-13 18:18:24 +04:00
class SavedMessages;
class SavedSublist;
2022-10-28 09:19:27 +04:00
class Thread;
} // namespace Data
namespace Dialogs {
class MainList;
struct EntryState;
struct UnreadState;
class Key;
class Entry;
} // namespace Dialogs
namespace ChatHelpers {
class Show;
} // namespace ChatHelpers
namespace InlineBots {
enum class PeerType : uint8;
using PeerTypes = base::flags<PeerType>;
} // namespace InlineBots
2017-11-06 22:03:20 +04:00
namespace Window {
2019-06-12 15:26:04 +02:00
class Controller;
class SessionController;
2019-07-25 20:55:11 +02:00
class SessionNavigation;
2017-11-07 15:53:05 +04:00
extern const char kOptionViewProfileInChatsListContextMenu[];
using PeerMenuCallback = Ui::Menu::MenuCallback;
2017-11-06 22:03:20 +04:00
void FillDialogsEntryMenu(
not_null<SessionController*> controller,
Dialogs::EntryState request,
const PeerMenuCallback &addAction);
bool FillVideoChatMenu(
not_null<SessionController*> controller,
Dialogs::EntryState request,
2020-11-11 23:47:40 +03:00
const PeerMenuCallback &addAction);
2017-11-06 22:03:20 +04:00
void FillSenderUserpicMenu(
not_null<SessionController*> controller,
not_null<PeerData*> peer,
Ui::InputField *fieldForMention,
Dialogs::Key searchInEntry,
const PeerMenuCallback &addAction);
void MenuAddMarkAsReadAllChatsAction(
not_null<Main::Session*> session,
std::shared_ptr<Ui::Show> show,
const PeerMenuCallback &addAction);
void MenuAddMarkAsReadChatListAction(
not_null<Window::SessionController*> controller,
Fn<not_null<Dialogs::MainList*>()> &&list,
const PeerMenuCallback &addAction,
Fn<Dialogs::UnreadState()> customUnreadState = nullptr);
2025-03-11 16:09:34 +04:00
void PeerMenuExportChat(
not_null<Window::SessionController*> controller,
not_null<PeerData*> peer);
void PeerMenuDeleteContact(
not_null<Window::SessionController*> controller,
not_null<UserData*> user);
2019-07-25 20:55:11 +02:00
void PeerMenuShareContactBox(
not_null<Window::SessionNavigation*> navigation,
not_null<UserData*> user);
void PeerMenuAddChannelMembers(
not_null<Window::SessionNavigation*> navigation,
not_null<ChannelData*> channel);
void PeerMenuCreatePoll(
2020-06-10 22:08:17 +04:00
not_null<Window::SessionController*> controller,
not_null<PeerData*> peer,
2023-10-10 10:49:22 +04:00
FullReplyTo replyTo = FullReplyTo(),
2025-06-13 14:39:30 +04:00
SuggestPostOptions suggest = SuggestPostOptions(),
PollData::Flags chosen = PollData::Flags(),
PollData::Flags disabled = PollData::Flags(),
Api::SendType sendType = Api::SendType::Normal,
SendMenu::Details sendMenuDetails = SendMenu::Details());
2025-06-10 20:25:24 +04:00
enum class TodoWantsPremium {
Create,
Add,
Mark,
};
void PeerMenuTodoWantsPremium(TodoWantsPremium type);
2025-06-10 18:16:48 +04:00
void PeerMenuCreateTodoList(
not_null<Window::SessionController*> controller,
not_null<PeerData*> peer,
FullReplyTo replyTo = FullReplyTo(),
2025-06-13 14:39:30 +04:00
SuggestPostOptions suggest = SuggestPostOptions(),
2025-06-10 18:16:48 +04:00
Api::SendType sendType = Api::SendType::Normal,
SendMenu::Details sendMenuDetails = SendMenu::Details());
2025-06-12 18:41:01 +04:00
void PeerMenuEditTodoList(
not_null<Window::SessionController*> controller,
not_null<HistoryItem*> item);
2025-06-12 14:39:25 +04:00
[[nodiscard]] bool PeerMenuShowAddTodoListTasks(not_null<HistoryItem*> item);
2025-06-12 12:22:06 +04:00
void PeerMenuAddTodoListTasks(
not_null<Window::SessionController*> controller,
not_null<HistoryItem*> item);
2022-10-19 14:59:37 +04:00
void PeerMenuDeleteTopicWithConfirmation(
not_null<Window::SessionNavigation*> navigation,
not_null<Data::ForumTopic*> topic);
void PeerMenuDeleteTopic(
not_null<Window::SessionNavigation*> navigation,
not_null<Data::ForumTopic*> topic);
struct ClearChat {
};
struct ClearReply {
FullMsgId replyId;
};
2019-06-12 15:26:04 +02:00
void PeerMenuBlockUserBox(
2019-09-18 14:19:05 +03:00
not_null<Ui::GenericBox*> box,
2019-06-12 16:13:49 +02:00
not_null<Window::Controller*> window,
not_null<PeerData*> peer,
std::variant<v::null_t, bool> suggestReport,
std::variant<v::null_t, ClearChat, ClearReply> suggestClear);
void PeerMenuUnblockUserWithBotRestart(
std::shared_ptr<Ui::Show> show,
not_null<UserData*> user);
void BlockSenderFromRepliesBox(
not_null<Ui::GenericBox*> box,
not_null<Window::SessionController*> controller,
FullMsgId id);
void ToggleHistoryArchived(
std::shared_ptr<ChatHelpers::Show> show,
not_null<History*> history,
bool archived);
Fn<void()> ClearHistoryHandler(
not_null<Window::SessionController*> controller,
not_null<PeerData*> peer);
Fn<void()> DeleteAndLeaveHandler(
not_null<Window::SessionController*> controller,
not_null<PeerData*> peer);
Fn<void()> DeleteSublistHandler(
not_null<Window::SessionController*> controller,
not_null<Data::SavedSublist*> sublist);
object_ptr<Ui::BoxContent> PrepareChooseRecipientBox(
not_null<Main::Session*> session,
FnMut<bool(not_null<Data::Thread*>)> &&chosen,
rpl::producer<QString> titleOverride = nullptr,
FnMut<void()> &&successCallback = nullptr,
InlineBots::PeerTypes typesRestriction = 0,
2025-02-25 14:53:23 +04:00
Fn<void(
std::vector<not_null<Data::Thread*>>,
Api::SendOptions)> sendMany = nullptr);
2025-07-18 10:07:39 +04:00
base::weak_qptr<Ui::BoxContent> ShowChooseRecipientBox(
not_null<Window::SessionNavigation*> navigation,
FnMut<bool(not_null<Data::Thread*>)> &&chosen,
rpl::producer<QString> titleOverride = nullptr,
FnMut<void()> &&successCallback = nullptr,
InlineBots::PeerTypes typesRestriction = 0);
2025-07-18 10:07:39 +04:00
base::weak_qptr<Ui::BoxContent> ShowForwardMessagesBox(
std::shared_ptr<ChatHelpers::Show> show,
Data::ForwardDraft &&draft,
Fn<void()> &&successCallback = nullptr);
2025-07-18 10:07:39 +04:00
base::weak_qptr<Ui::BoxContent> ShowForwardMessagesBox(
not_null<Window::SessionNavigation*> navigation,
Data::ForwardDraft &&draft,
Fn<void()> &&successCallback = nullptr);
2025-07-18 10:07:39 +04:00
base::weak_qptr<Ui::BoxContent> ShowForwardMessagesBox(
2019-07-25 20:55:11 +02:00
not_null<Window::SessionNavigation*> navigation,
MessageIdsList &&items,
Fn<void()> &&successCallback = nullptr);
2025-07-18 10:07:39 +04:00
base::weak_qptr<Ui::BoxContent> ShowShareUrlBox(
not_null<Window::SessionNavigation*> navigation,
const QString &url,
const QString &text,
FnMut<void()> &&successCallback = nullptr);
2025-07-18 10:07:39 +04:00
base::weak_qptr<Ui::BoxContent> ShowShareGameBox(
not_null<Window::SessionNavigation*> navigation,
not_null<UserData*> bot,
QString shortName);
2025-07-18 10:07:39 +04:00
base::weak_qptr<Ui::BoxContent> ShowDropMediaBox(
2022-11-01 08:46:31 +04:00
not_null<Window::SessionNavigation*> navigation,
2022-11-01 11:18:56 +04:00
std::shared_ptr<QMimeData> data,
2022-11-01 08:46:31 +04:00
not_null<Data::Forum*> forum,
FnMut<void()> &&successCallback = nullptr);
2025-07-18 10:07:39 +04:00
base::weak_qptr<Ui::BoxContent> ShowDropMediaBox(
2025-05-13 18:18:24 +04:00
not_null<Window::SessionNavigation*> navigation,
std::shared_ptr<QMimeData> data,
not_null<Data::SavedMessages*> monoforum,
FnMut<void()> &&successCallback = nullptr);
2025-07-18 10:07:39 +04:00
base::weak_qptr<Ui::BoxContent> ShowSendNowMessagesBox(
not_null<Window::SessionNavigation*> navigation,
not_null<History*> history,
MessageIdsList &&items,
Fn<void()> &&successCallback = nullptr);
void ToggleMessagePinned(
not_null<Window::SessionNavigation*> navigation,
FullMsgId itemId,
bool pin);
void TogglePinnedThread(
not_null<Window::SessionController*> controller,
not_null<Dialogs::Entry*> entry,
2025-03-31 00:31:26 +03:00
FilterId filterId,
Fn<void()> onToggled);
void HidePinnedBar(
not_null<Window::SessionNavigation*> navigation,
not_null<PeerData*> peer,
2022-10-28 09:19:27 +04:00
MsgId topicRootId,
PeerId monoforumPeerId,
Fn<void()> onHidden);
void UnpinAllMessages(
not_null<Window::SessionNavigation*> navigation,
2022-10-28 09:19:27 +04:00
not_null<Data::Thread*> thread);
[[nodiscard]] bool IsUnreadThread(not_null<Data::Thread*> thread);
void MarkAsReadThread(not_null<Data::Thread*> thread);
void AddSeparatorAndShiftUp(const PeerMenuCallback &addAction);
[[nodiscard]] bool IsArchived(not_null<History*> history);
[[nodiscard]] bool CanArchive(History *history, PeerData *peer);
void PeerMenuConfirmToggleFee(
not_null<Window::SessionNavigation*> navigation,
std::shared_ptr<rpl::variable<int>> paidAmount,
not_null<PeerData*> peer,
not_null<UserData*> user,
bool removeFee);
2017-11-06 22:03:20 +04:00
} // namespace Window