Show copy-to-clipboard button tooltip.

This commit is contained in:
John Preston 2024-11-05 11:36:10 +04:00
parent 3fa88fad79
commit 89c35e8512
2 changed files with 9 additions and 0 deletions

View file

@ -5607,6 +5607,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_bot_earn_credits_out_minimal" = "You cannot withdraw less than {link}.";
"lng_bot_earn_credits_out_minimal_link#one" = "{count} star";
"lng_bot_earn_credits_out_minimal_link#other" = "{count} stars";
"lng_bot_copy_text_tooltip" = "Copy to Clipboard: {text}";
"lng_contact_add" = "Add";
"lng_contact_send_message" = "Message";

View file

@ -651,6 +651,14 @@ QString ReplyMarkupClickHandler::buttonText() const {
}
QString ReplyMarkupClickHandler::tooltip() const {
if (const auto button = getButton()) {
if (button->type == HistoryMessageMarkupButton::Type::CopyText) {
return tr::lng_bot_copy_text_tooltip(
tr::now,
lt_text,
st::wrap_rtl(QString::fromUtf8(button->data)));
}
}
const auto button = getUrlButton();
const auto url = button ? QString::fromUtf8(button->data) : QString();
const auto text = _fullDisplayed ? QString() : buttonText();