2017-11-06 22:03:20 +04:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 13:23:14 +03:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2017-11-06 22:03:20 +04:00
|
|
|
|
2018-01-03 13:23:14 +03: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
|
|
|
|
|
2020-08-03 12:02:41 +03:00
|
|
|
#include "api/api_common.h"
|
2024-11-08 23:19:29 +04:00
|
|
|
#include "base/object_ptr.h"
|
2022-03-27 13:01:34 +03:00
|
|
|
#include "menu/menu_send.h"
|
2020-01-15 16:30:29 +03:00
|
|
|
#include "data/data_poll.h"
|
2022-06-03 20:07:33 +04:00
|
|
|
#include "ui/widgets/menu/menu_add_action_callback.h"
|
2020-01-15 16:30:29 +03:00
|
|
|
|
2019-09-13 09:06:02 +03:00
|
|
|
class History;
|
2019-06-12 15:26:04 +02:00
|
|
|
|
2025-02-25 14:53:23 +04:00
|
|
|
namespace Api {
|
|
|
|
struct SendOptions;
|
|
|
|
} // namespace Api
|
|
|
|
|
2017-12-09 19:13:06 +04:00
|
|
|
namespace Ui {
|
|
|
|
class RpWidget;
|
2022-02-27 14:14:39 +03:00
|
|
|
class BoxContent;
|
2019-09-18 14:19:05 +03:00
|
|
|
class GenericBox;
|
2024-04-01 17:54:44 +04:00
|
|
|
class Show;
|
2017-12-09 19:13:06 +04:00
|
|
|
} // namespace Ui
|
|
|
|
|
2018-01-05 18:57:18 +03:00
|
|
|
namespace Data {
|
2022-11-01 08:46:31 +04:00
|
|
|
class Forum;
|
2019-04-15 15:54:03 +04:00
|
|
|
class Folder;
|
2020-09-16 17:09:04 +03:00
|
|
|
class Session;
|
2021-08-31 19:47:38 +03:00
|
|
|
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;
|
2018-01-05 18:57:18 +03:00
|
|
|
} // namespace Data
|
|
|
|
|
2020-09-16 17:09:04 +03:00
|
|
|
namespace Dialogs {
|
|
|
|
class MainList;
|
2020-11-12 18:46:17 +03:00
|
|
|
struct EntryState;
|
2023-07-28 03:28:29 +03:00
|
|
|
struct UnreadState;
|
2024-11-04 16:54:01 +04:00
|
|
|
class Key;
|
2025-03-16 23:37:37 +03:00
|
|
|
class Entry;
|
2020-09-16 17:09:04 +03:00
|
|
|
} // namespace Dialogs
|
|
|
|
|
2023-05-02 13:33:19 +04:00
|
|
|
namespace ChatHelpers {
|
|
|
|
class Show;
|
|
|
|
} // namespace ChatHelpers
|
|
|
|
|
2023-05-24 19:36:58 +04:00
|
|
|
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;
|
2019-06-06 13:21:40 +03:00
|
|
|
class SessionController;
|
2019-07-25 20:55:11 +02:00
|
|
|
class SessionNavigation;
|
2017-11-07 15:53:05 +04:00
|
|
|
|
2022-02-01 18:19:47 +03:00
|
|
|
extern const char kOptionViewProfileInChatsListContextMenu[];
|
|
|
|
|
2022-06-03 20:07:33 +04:00
|
|
|
using PeerMenuCallback = Ui::Menu::MenuCallback;
|
2017-11-06 22:03:20 +04:00
|
|
|
|
2020-11-12 18:46:17 +03:00
|
|
|
void FillDialogsEntryMenu(
|
2019-06-06 13:21:40 +03:00
|
|
|
not_null<SessionController*> controller,
|
2022-10-28 17:21:11 +04:00
|
|
|
Dialogs::EntryState request,
|
|
|
|
const PeerMenuCallback &addAction);
|
|
|
|
bool FillVideoChatMenu(
|
|
|
|
not_null<SessionController*> controller,
|
2020-11-12 18:46:17 +03:00
|
|
|
Dialogs::EntryState request,
|
2020-11-11 23:47:40 +03:00
|
|
|
const PeerMenuCallback &addAction);
|
2017-11-06 22:03:20 +04:00
|
|
|
|
2024-11-04 16:54:01 +04:00
|
|
|
void FillSenderUserpicMenu(
|
|
|
|
not_null<SessionController*> controller,
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
Ui::InputField *fieldForMention,
|
|
|
|
Dialogs::Key searchInEntry,
|
|
|
|
const PeerMenuCallback &addAction);
|
|
|
|
|
2020-09-17 17:56:01 +03:00
|
|
|
void MenuAddMarkAsReadAllChatsAction(
|
2024-12-20 19:05:49 +03:00
|
|
|
not_null<Main::Session*> session,
|
|
|
|
std::shared_ptr<Ui::Show> show,
|
2020-09-17 17:56:01 +03:00
|
|
|
const PeerMenuCallback &addAction);
|
|
|
|
|
|
|
|
void MenuAddMarkAsReadChatListAction(
|
2022-02-21 04:17:19 +03:00
|
|
|
not_null<Window::SessionController*> controller,
|
2020-09-17 17:56:01 +03:00
|
|
|
Fn<not_null<Dialogs::MainList*>()> &&list,
|
2023-07-28 03:28:29 +03:00
|
|
|
const PeerMenuCallback &addAction,
|
|
|
|
Fn<Dialogs::UnreadState()> customUnreadState = nullptr);
|
2020-09-16 17:09:04 +03:00
|
|
|
|
2025-03-11 16:09:34 +04:00
|
|
|
void PeerMenuExportChat(
|
|
|
|
not_null<Window::SessionController*> controller,
|
|
|
|
not_null<PeerData*> peer);
|
2022-02-21 04:17:19 +03:00
|
|
|
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);
|
2020-01-15 16:30:29 +03:00
|
|
|
void PeerMenuCreatePoll(
|
2020-06-10 22:08:17 +04:00
|
|
|
not_null<Window::SessionController*> controller,
|
2020-01-15 16:30:29 +03:00
|
|
|
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(),
|
2020-01-15 16:30:29 +03:00
|
|
|
PollData::Flags chosen = PollData::Flags(),
|
2020-08-03 12:02:41 +03:00
|
|
|
PollData::Flags disabled = PollData::Flags(),
|
2020-11-20 20:04:50 +03:00
|
|
|
Api::SendType sendType = Api::SendType::Normal,
|
2024-05-10 14:10:53 +04:00
|
|
|
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);
|
2020-09-17 16:26:53 +03:00
|
|
|
|
|
|
|
struct ClearChat {
|
|
|
|
};
|
2020-09-25 15:31:36 +03:00
|
|
|
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,
|
2020-09-17 16:26:53 +03:00
|
|
|
not_null<PeerData*> peer,
|
|
|
|
std::variant<v::null_t, bool> suggestReport,
|
2020-09-25 15:31:36 +03:00
|
|
|
std::variant<v::null_t, ClearChat, ClearReply> suggestClear);
|
2024-04-01 17:54:44 +04:00
|
|
|
void PeerMenuUnblockUserWithBotRestart(
|
|
|
|
std::shared_ptr<Ui::Show> show,
|
|
|
|
not_null<UserData*> user);
|
2017-11-07 17:13:41 +04:00
|
|
|
|
2021-02-15 21:37:22 +04:00
|
|
|
void BlockSenderFromRepliesBox(
|
|
|
|
not_null<Ui::GenericBox*> box,
|
|
|
|
not_null<Window::SessionController*> controller,
|
|
|
|
FullMsgId id);
|
|
|
|
|
2023-12-21 02:32:07 +03:00
|
|
|
void ToggleHistoryArchived(
|
|
|
|
std::shared_ptr<ChatHelpers::Show> show,
|
|
|
|
not_null<History*> history,
|
|
|
|
bool archived);
|
2022-02-21 04:17:19 +03:00
|
|
|
Fn<void()> ClearHistoryHandler(
|
|
|
|
not_null<Window::SessionController*> controller,
|
|
|
|
not_null<PeerData*> peer);
|
|
|
|
Fn<void()> DeleteAndLeaveHandler(
|
|
|
|
not_null<Window::SessionController*> controller,
|
|
|
|
not_null<PeerData*> peer);
|
2025-05-30 15:00:33 +04:00
|
|
|
Fn<void()> DeleteSublistHandler(
|
|
|
|
not_null<Window::SessionController*> controller,
|
|
|
|
not_null<Data::SavedSublist*> sublist);
|
2017-12-06 18:39:27 +04:00
|
|
|
|
2024-11-08 23:19:29 +04:00
|
|
|
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,
|
2024-11-15 23:38:28 +04:00
|
|
|
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(
|
2022-11-30 16:02:40 +04:00
|
|
|
not_null<Window::SessionNavigation*> navigation,
|
|
|
|
FnMut<bool(not_null<Data::Thread*>)> &&chosen,
|
|
|
|
rpl::producer<QString> titleOverride = nullptr,
|
2023-05-24 19:36:58 +04:00
|
|
|
FnMut<void()> &&successCallback = nullptr,
|
|
|
|
InlineBots::PeerTypes typesRestriction = 0);
|
2025-07-18 10:07:39 +04:00
|
|
|
base::weak_qptr<Ui::BoxContent> ShowForwardMessagesBox(
|
2023-05-02 13:33:19 +04:00
|
|
|
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(
|
2021-08-31 19:47:38 +03:00
|
|
|
not_null<Window::SessionNavigation*> navigation,
|
|
|
|
Data::ForwardDraft &&draft,
|
2022-12-02 03:40:16 +03:00
|
|
|
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,
|
2017-12-06 14:13:38 +04:00
|
|
|
MessageIdsList &&items,
|
2022-12-02 03:40:16 +03:00
|
|
|
Fn<void()> &&successCallback = nullptr);
|
2025-07-18 10:07:39 +04:00
|
|
|
base::weak_qptr<Ui::BoxContent> ShowShareUrlBox(
|
2022-11-30 16:02:40 +04:00
|
|
|
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(
|
2022-11-01 13:00:17 +04:00
|
|
|
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);
|
2017-12-06 14:13:38 +04:00
|
|
|
|
2025-07-18 10:07:39 +04:00
|
|
|
base::weak_qptr<Ui::BoxContent> ShowSendNowMessagesBox(
|
2019-08-09 18:58:58 +01:00
|
|
|
not_null<Window::SessionNavigation*> navigation,
|
|
|
|
not_null<History*> history,
|
|
|
|
MessageIdsList &&items,
|
2022-02-27 11:28:16 +03:00
|
|
|
Fn<void()> &&successCallback = nullptr);
|
2019-08-09 18:58:58 +01:00
|
|
|
|
2020-10-21 17:41:13 +03:00
|
|
|
void ToggleMessagePinned(
|
|
|
|
not_null<Window::SessionNavigation*> navigation,
|
|
|
|
FullMsgId itemId,
|
|
|
|
bool pin);
|
2025-03-16 23:37:37 +03:00
|
|
|
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);
|
2020-10-22 10:53:56 +03:00
|
|
|
void HidePinnedBar(
|
|
|
|
not_null<Window::SessionNavigation*> navigation,
|
|
|
|
not_null<PeerData*> peer,
|
2022-10-28 09:19:27 +04:00
|
|
|
MsgId topicRootId,
|
2025-06-02 15:00:36 +04:00
|
|
|
PeerId monoforumPeerId,
|
2020-10-22 10:53:56 +03:00
|
|
|
Fn<void()> onHidden);
|
|
|
|
void UnpinAllMessages(
|
|
|
|
not_null<Window::SessionNavigation*> navigation,
|
2022-10-28 09:19:27 +04:00
|
|
|
not_null<Data::Thread*> thread);
|
2020-10-21 17:41:13 +03:00
|
|
|
|
2023-01-04 14:34:37 +04:00
|
|
|
[[nodiscard]] bool IsUnreadThread(not_null<Data::Thread*> thread);
|
|
|
|
void MarkAsReadThread(not_null<Data::Thread*> thread);
|
|
|
|
|
2023-02-03 19:32:25 +04:00
|
|
|
void AddSeparatorAndShiftUp(const PeerMenuCallback &addAction);
|
|
|
|
|
2025-03-16 23:37:37 +03:00
|
|
|
[[nodiscard]] bool IsArchived(not_null<History*> history);
|
2025-03-21 17:59:17 +03:00
|
|
|
[[nodiscard]] bool CanArchive(History *history, PeerData *peer);
|
2025-03-16 23:37:37 +03:00
|
|
|
|
2025-07-08 11:33:04 +04:00
|
|
|
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
|