2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Changed behavior to copy phone number from profile sections as trimmed.

This commit is contained in:
23rd
2024-10-16 13:40:52 +03:00
committed by John Preston
parent d85b668d4f
commit e5886862c3
2 changed files with 28 additions and 1 deletions

View File

@@ -1150,7 +1150,19 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
PhoneOrHiddenValue(user),
tr::lng_profile_copy_phone(tr::now)).text;
const auto hook = [=](Ui::FlatLabel::ContextMenuRequest request) {
phoneLabel->fillContextMenu(request);
if (request.selection.empty()) {
const auto callback = [=] {
auto phone = rpl::variable<TextWithEntities>(
PhoneOrHiddenValue(user)).current().text;
phone.replace(' ', QString()).replace('-', QString());
TextUtilities::SetClipboardText({ phone });
};
request.menu->addAction(
tr::lng_profile_copy_phone(tr::now),
callback);
} else {
phoneLabel->fillContextMenu(request);
}
AddPhoneMenu(request.menu, user);
};
phoneLabel->setContextMenuHook(hook);