mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added info to context menu for non-forwardable history.
This commit is contained in:
parent
5eafe96525
commit
c0a0ad4ec5
5 changed files with 57 additions and 1 deletions
|
@ -3576,6 +3576,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_context_animated_reactions_many#one" = "Reactions contain emoji from **{count} pack**.";
|
"lng_context_animated_reactions_many#one" = "Reactions contain emoji from **{count} pack**.";
|
||||||
"lng_context_animated_reactions_many#other" = "Reactions contain emoji from **{count} packs**.";
|
"lng_context_animated_reactions_many#other" = "Reactions contain emoji from **{count} packs**.";
|
||||||
|
|
||||||
|
"lng_context_noforwards_info_channel" = "Copying and forwarding is not allowed in this channel.";
|
||||||
|
"lng_context_noforwards_info_group" = "Copying and forwarding is not allowed in this group.";
|
||||||
|
"lng_context_noforwards_info_bot" = "Copying and forwarding is not allowed from this bot.";
|
||||||
|
|
||||||
"lng_context_spoiler_effect" = "Hide with Spoiler";
|
"lng_context_spoiler_effect" = "Hide with Spoiler";
|
||||||
"lng_context_disable_spoiler" = "Remove Spoiler";
|
"lng_context_disable_spoiler" = "Remove Spoiler";
|
||||||
"lng_context_make_paid" = "Make This Content Paid";
|
"lng_context_make_paid" = "Make This Content Paid";
|
||||||
|
|
|
@ -2935,11 +2935,20 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||||
if (_dragStateItem) {
|
if (_dragStateItem) {
|
||||||
const auto view = viewByItem(_dragStateItem);
|
const auto view = viewByItem(_dragStateItem);
|
||||||
const auto textItem = view ? view->textItem() : _dragStateItem;
|
const auto textItem = view ? view->textItem() : _dragStateItem;
|
||||||
|
const auto wasAmount = _menu->actions().size();
|
||||||
HistoryView::AddEmojiPacksAction(
|
HistoryView::AddEmojiPacksAction(
|
||||||
_menu,
|
_menu,
|
||||||
textItem ? textItem : _dragStateItem,
|
textItem ? textItem : _dragStateItem,
|
||||||
HistoryView::EmojiPacksSource::Message,
|
HistoryView::EmojiPacksSource::Message,
|
||||||
_controller);
|
_controller);
|
||||||
|
const auto added = (_menu->actions().size() > wasAmount);
|
||||||
|
if (!added) {
|
||||||
|
_menu->addSeparator();
|
||||||
|
}
|
||||||
|
HistoryView::AddSelectRestrictionAction(
|
||||||
|
_menu,
|
||||||
|
textItem ? textItem : _dragStateItem,
|
||||||
|
!added);
|
||||||
}
|
}
|
||||||
if (hasWhoReactedItem) {
|
if (hasWhoReactedItem) {
|
||||||
HistoryView::AddWhoReactedAction(
|
HistoryView::AddWhoReactedAction(
|
||||||
|
|
|
@ -68,6 +68,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_file_click_handler.h"
|
#include "data/data_file_click_handler.h"
|
||||||
#include "data/data_file_origin.h"
|
#include "data/data_file_origin.h"
|
||||||
#include "data/data_message_reactions.h"
|
#include "data/data_message_reactions.h"
|
||||||
|
#include "data/data_user.h"
|
||||||
#include "data/stickers/data_custom_emoji.h"
|
#include "data/stickers/data_custom_emoji.h"
|
||||||
#include "chat_helpers/message_field.h" // FactcheckFieldIniter.
|
#include "chat_helpers/message_field.h" // FactcheckFieldIniter.
|
||||||
#include "core/file_utilities.h"
|
#include "core/file_utilities.h"
|
||||||
|
@ -1270,6 +1271,7 @@ base::unique_qptr<Ui::PopupMenu> FillContextMenu(
|
||||||
}
|
}
|
||||||
AddMessageActions(result, request, list);
|
AddMessageActions(result, request, list);
|
||||||
|
|
||||||
|
const auto wasAmount = result->actions().size();
|
||||||
if (const auto textItem = view ? view->textItem() : item) {
|
if (const auto textItem = view ? view->textItem() : item) {
|
||||||
AddEmojiPacksAction(
|
AddEmojiPacksAction(
|
||||||
result,
|
result,
|
||||||
|
@ -1277,6 +1279,13 @@ base::unique_qptr<Ui::PopupMenu> FillContextMenu(
|
||||||
HistoryView::EmojiPacksSource::Message,
|
HistoryView::EmojiPacksSource::Message,
|
||||||
list->controller());
|
list->controller());
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
const auto added = (result->actions().size() > wasAmount);
|
||||||
|
if (!added) {
|
||||||
|
result->addSeparator();
|
||||||
|
}
|
||||||
|
AddSelectRestrictionAction(result, item, !added);
|
||||||
|
}
|
||||||
if (hasWhoReactedItem) {
|
if (hasWhoReactedItem) {
|
||||||
AddWhoReactedAction(result, list, item, list->controller());
|
AddWhoReactedAction(result, list, item, list->controller());
|
||||||
}
|
}
|
||||||
|
@ -1841,6 +1850,36 @@ void AddEmojiPacksAction(
|
||||||
controller);
|
controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddSelectRestrictionAction(
|
||||||
|
not_null<Ui::PopupMenu*> menu,
|
||||||
|
not_null<HistoryItem*> item,
|
||||||
|
bool addIcon) {
|
||||||
|
const auto peer = item->history()->peer;
|
||||||
|
if ((peer->allowsForwarding() && !item->forbidsForward())
|
||||||
|
|| item->isSponsored()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto button = base::make_unique_q<Ui::Menu::MultilineAction>(
|
||||||
|
menu->menu(),
|
||||||
|
menu->st().menu,
|
||||||
|
st::historyHasCustomEmoji,
|
||||||
|
addIcon
|
||||||
|
? st::historySponsoredAboutMenuLabelPosition
|
||||||
|
: st::historyHasCustomEmojiPosition,
|
||||||
|
(peer->isMegagroup()
|
||||||
|
? tr::lng_context_noforwards_info_group
|
||||||
|
: (peer->isChannel())
|
||||||
|
? tr::lng_context_noforwards_info_channel
|
||||||
|
: (peer->isUser() && peer->asUser()->isBot())
|
||||||
|
? tr::lng_context_noforwards_info_channel
|
||||||
|
: tr::lng_context_noforwards_info_bot)(
|
||||||
|
tr::now,
|
||||||
|
Ui::Text::RichLangValue),
|
||||||
|
addIcon ? &st::menuIconCopyright : nullptr);
|
||||||
|
button->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
|
menu->addAction(std::move(button));
|
||||||
|
}
|
||||||
|
|
||||||
TextWithEntities TransribedText(not_null<HistoryItem*> item) {
|
TextWithEntities TransribedText(not_null<HistoryItem*> item) {
|
||||||
const auto media = item->media();
|
const auto media = item->media();
|
||||||
const auto document = media ? media->document() : nullptr;
|
const auto document = media ? media->document() : nullptr;
|
||||||
|
|
|
@ -122,6 +122,10 @@ void AddEmojiPacksAction(
|
||||||
not_null<HistoryItem*> item,
|
not_null<HistoryItem*> item,
|
||||||
EmojiPacksSource source,
|
EmojiPacksSource source,
|
||||||
not_null<Window::SessionController*> controller);
|
not_null<Window::SessionController*> controller);
|
||||||
|
void AddSelectRestrictionAction(
|
||||||
|
not_null<Ui::PopupMenu*> menu,
|
||||||
|
not_null<HistoryItem*> item,
|
||||||
|
bool addIcon);
|
||||||
|
|
||||||
[[nodiscard]] TextWithEntities TransribedText(not_null<HistoryItem*> item);
|
[[nodiscard]] TextWithEntities TransribedText(not_null<HistoryItem*> item);
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 21b55b21cc5fcc243ec01a9c3201e24b24dfd458
|
Subproject commit f44ab56dddd431fabbb5f099006e2c92558d47f5
|
Loading…
Add table
Reference in a new issue