feat: add copy callback (thx to 64Gram)

This commit is contained in:
ZavaruKitsu 2023-08-09 21:09:02 +00:00
parent caf19c1e21
commit 50c507640a
2 changed files with 14 additions and 2 deletions

View file

@ -3967,6 +3967,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_MessageSavingSaveMediaInPrivateChannels" = "…in private channels";
"ayu_MessageSavingSaveMediaInPublicGroups" = "…in public groups";
"ayu_MessageSavingSaveMediaInPrivateGroups" = "…in private groups";
"ayu_MaximumMediaSizeCellular" = "Media size limit (cellular data)";
"ayu_MaximumMediaSizeWiFi" = "Media size limit (WiFi)";
"ayu_MessageSavingOtherHeader" = "Other";
"ayu_MessageSavingSaveFormatting" = "Save formatting";
"ayu_MessageSavingSaveReactions" = "Save reactions";
@ -4021,6 +4023,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_WALMode" = "Enable WAL mode";
"ayu_ClearAyuDatabase" = "Clear Ayu Database";
"ayu_ClearAyuDatabaseNotification" = "AyuGram database cleared";
"ayu_ClearAyuAttachments" = "Clear Ayu Attachments";
"ayu_ClearAyuAttachmentsNotification" = "AyuGram attachments folder cleared";
"ayu_EraseLocalDatabase" = "Erase Local Database";
"ayu_ConfirmationsTitle" = "Confirmations";
"ayu_StickerConfirmation" = "Confirmation when sending stickers";
@ -4052,4 +4056,5 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_ContextCopyID" = "Copy ID";
"ayu_IDCopiedToast" = "ID copied to clipboard.";
"ayu_ContextHideMessage" = "Hide";
"ayu_ContextCopyCallbackData" = "Copy Callback Data";
"ayu_SettingsWatermark" = "AyuGram developed and maintained by Radolyn Labs.";

View file

@ -646,7 +646,14 @@ QString ReplyMarkupClickHandler::copyToClipboardText() const {
QString ReplyMarkupClickHandler::copyToClipboardContextItemText() const {
const auto button = getUrlButton();
return button ? tr::lng_context_copy_link(tr::now) : QString();
if (button) {
using Type = HistoryMessageMarkupButton::Type;
if (button->type == Type::Callback) {
return tr::ayu_ContextCopyCallbackData(tr::now);
}
return tr::lng_context_copy_link(tr::now);
}
return QString();
}
// Finds the corresponding button in the items markup struct.
@ -661,7 +668,7 @@ auto ReplyMarkupClickHandler::getUrlButton() const
-> const HistoryMessageMarkupButton* {
if (const auto button = getButton()) {
using Type = HistoryMessageMarkupButton::Type;
if (button->type == Type::Url || button->type == Type::Auth) {
if (button->type == Type::Url || button->type == Type::Auth || button->type == Type::Callback) {
return button;
}
}