window_peer_menu.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. #include "api/api_common.h"
  9. #include "base/object_ptr.h"
  10. #include "menu/menu_send.h"
  11. #include "data/data_poll.h"
  12. #include "ui/widgets/menu/menu_add_action_callback.h"
  13. class History;
  14. namespace Api {
  15. struct SendOptions;
  16. } // namespace Api
  17. namespace Ui {
  18. class RpWidget;
  19. class BoxContent;
  20. class GenericBox;
  21. class Show;
  22. } // namespace Ui
  23. namespace Data {
  24. class Forum;
  25. class Folder;
  26. class Session;
  27. struct ForwardDraft;
  28. class ForumTopic;
  29. class Thread;
  30. } // namespace Data
  31. namespace Dialogs {
  32. class MainList;
  33. struct EntryState;
  34. struct UnreadState;
  35. class Key;
  36. class Entry;
  37. } // namespace Dialogs
  38. namespace ChatHelpers {
  39. class Show;
  40. } // namespace ChatHelpers
  41. namespace InlineBots {
  42. enum class PeerType : uint8;
  43. using PeerTypes = base::flags<PeerType>;
  44. } // namespace InlineBots
  45. namespace Window {
  46. class Controller;
  47. class SessionController;
  48. class SessionNavigation;
  49. extern const char kOptionViewProfileInChatsListContextMenu[];
  50. using PeerMenuCallback = Ui::Menu::MenuCallback;
  51. void FillDialogsEntryMenu(
  52. not_null<SessionController*> controller,
  53. Dialogs::EntryState request,
  54. const PeerMenuCallback &addAction);
  55. bool FillVideoChatMenu(
  56. not_null<SessionController*> controller,
  57. Dialogs::EntryState request,
  58. const PeerMenuCallback &addAction);
  59. void FillSenderUserpicMenu(
  60. not_null<SessionController*> controller,
  61. not_null<PeerData*> peer,
  62. Ui::InputField *fieldForMention,
  63. Dialogs::Key searchInEntry,
  64. const PeerMenuCallback &addAction);
  65. void MenuAddMarkAsReadAllChatsAction(
  66. not_null<Main::Session*> session,
  67. std::shared_ptr<Ui::Show> show,
  68. const PeerMenuCallback &addAction);
  69. void MenuAddMarkAsReadChatListAction(
  70. not_null<Window::SessionController*> controller,
  71. Fn<not_null<Dialogs::MainList*>()> &&list,
  72. const PeerMenuCallback &addAction,
  73. Fn<Dialogs::UnreadState()> customUnreadState = nullptr);
  74. void PeerMenuExportChat(not_null<PeerData*> peer);
  75. void PeerMenuDeleteContact(
  76. not_null<Window::SessionController*> controller,
  77. not_null<UserData*> user);
  78. void PeerMenuShareContactBox(
  79. not_null<Window::SessionNavigation*> navigation,
  80. not_null<UserData*> user);
  81. void PeerMenuAddChannelMembers(
  82. not_null<Window::SessionNavigation*> navigation,
  83. not_null<ChannelData*> channel);
  84. void PeerMenuCreatePoll(
  85. not_null<Window::SessionController*> controller,
  86. not_null<PeerData*> peer,
  87. FullReplyTo replyTo = FullReplyTo(),
  88. PollData::Flags chosen = PollData::Flags(),
  89. PollData::Flags disabled = PollData::Flags(),
  90. Api::SendType sendType = Api::SendType::Normal,
  91. SendMenu::Details sendMenuDetails = SendMenu::Details());
  92. void PeerMenuDeleteTopicWithConfirmation(
  93. not_null<Window::SessionNavigation*> navigation,
  94. not_null<Data::ForumTopic*> topic);
  95. void PeerMenuDeleteTopic(
  96. not_null<Window::SessionNavigation*> navigation,
  97. not_null<Data::ForumTopic*> topic);
  98. struct ClearChat {
  99. };
  100. struct ClearReply {
  101. FullMsgId replyId;
  102. };
  103. void PeerMenuBlockUserBox(
  104. not_null<Ui::GenericBox*> box,
  105. not_null<Window::Controller*> window,
  106. not_null<PeerData*> peer,
  107. std::variant<v::null_t, bool> suggestReport,
  108. std::variant<v::null_t, ClearChat, ClearReply> suggestClear);
  109. void PeerMenuUnblockUserWithBotRestart(
  110. std::shared_ptr<Ui::Show> show,
  111. not_null<UserData*> user);
  112. void BlockSenderFromRepliesBox(
  113. not_null<Ui::GenericBox*> box,
  114. not_null<Window::SessionController*> controller,
  115. FullMsgId id);
  116. void ToggleHistoryArchived(
  117. std::shared_ptr<ChatHelpers::Show> show,
  118. not_null<History*> history,
  119. bool archived);
  120. Fn<void()> ClearHistoryHandler(
  121. not_null<Window::SessionController*> controller,
  122. not_null<PeerData*> peer);
  123. Fn<void()> DeleteAndLeaveHandler(
  124. not_null<Window::SessionController*> controller,
  125. not_null<PeerData*> peer);
  126. object_ptr<Ui::BoxContent> PrepareChooseRecipientBox(
  127. not_null<Main::Session*> session,
  128. FnMut<bool(not_null<Data::Thread*>)> &&chosen,
  129. rpl::producer<QString> titleOverride = nullptr,
  130. FnMut<void()> &&successCallback = nullptr,
  131. InlineBots::PeerTypes typesRestriction = 0,
  132. Fn<void(
  133. std::vector<not_null<Data::Thread*>>,
  134. Api::SendOptions)> sendMany = nullptr);
  135. QPointer<Ui::BoxContent> ShowChooseRecipientBox(
  136. not_null<Window::SessionNavigation*> navigation,
  137. FnMut<bool(not_null<Data::Thread*>)> &&chosen,
  138. rpl::producer<QString> titleOverride = nullptr,
  139. FnMut<void()> &&successCallback = nullptr,
  140. InlineBots::PeerTypes typesRestriction = 0);
  141. QPointer<Ui::BoxContent> ShowForwardMessagesBox(
  142. std::shared_ptr<ChatHelpers::Show> show,
  143. Data::ForwardDraft &&draft,
  144. Fn<void()> &&successCallback = nullptr);
  145. QPointer<Ui::BoxContent> ShowForwardMessagesBox(
  146. not_null<Window::SessionNavigation*> navigation,
  147. Data::ForwardDraft &&draft,
  148. Fn<void()> &&successCallback = nullptr);
  149. QPointer<Ui::BoxContent> ShowForwardMessagesBox(
  150. not_null<Window::SessionNavigation*> navigation,
  151. MessageIdsList &&items,
  152. Fn<void()> &&successCallback = nullptr);
  153. QPointer<Ui::BoxContent> ShowShareUrlBox(
  154. not_null<Window::SessionNavigation*> navigation,
  155. const QString &url,
  156. const QString &text,
  157. FnMut<void()> &&successCallback = nullptr);
  158. QPointer<Ui::BoxContent> ShowShareGameBox(
  159. not_null<Window::SessionNavigation*> navigation,
  160. not_null<UserData*> bot,
  161. QString shortName);
  162. QPointer<Ui::BoxContent> ShowDropMediaBox(
  163. not_null<Window::SessionNavigation*> navigation,
  164. std::shared_ptr<QMimeData> data,
  165. not_null<Data::Forum*> forum,
  166. FnMut<void()> &&successCallback = nullptr);
  167. QPointer<Ui::BoxContent> ShowSendNowMessagesBox(
  168. not_null<Window::SessionNavigation*> navigation,
  169. not_null<History*> history,
  170. MessageIdsList &&items,
  171. Fn<void()> &&successCallback = nullptr);
  172. void ToggleMessagePinned(
  173. not_null<Window::SessionNavigation*> navigation,
  174. FullMsgId itemId,
  175. bool pin);
  176. void TogglePinnedThread(
  177. not_null<Window::SessionController*> controller,
  178. not_null<Dialogs::Entry*> entry,
  179. FilterId filterId);
  180. void HidePinnedBar(
  181. not_null<Window::SessionNavigation*> navigation,
  182. not_null<PeerData*> peer,
  183. MsgId topicRootId,
  184. Fn<void()> onHidden);
  185. void UnpinAllMessages(
  186. not_null<Window::SessionNavigation*> navigation,
  187. not_null<Data::Thread*> thread);
  188. [[nodiscard]] bool IsUnreadThread(not_null<Data::Thread*> thread);
  189. void MarkAsReadThread(not_null<Data::Thread*> thread);
  190. void AddSeparatorAndShiftUp(const PeerMenuCallback &addAction);
  191. [[nodiscard]] bool IsArchived(not_null<History*> history);
  192. } // namespace Window