2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Added ability to copy phone number from main menu.

This commit is contained in:
23rd
2022-04-28 17:29:31 +03:00
parent 1878061c9a
commit 3bdf1634a9
2 changed files with 24 additions and 2 deletions

View File

@@ -223,7 +223,7 @@ void ShowMenu(
QWidget *parent,
const QString &copyButton,
const QString &text) {
const auto menu = new Ui::PopupMenu(parent);
const auto menu = Ui::CreateChild<Ui::PopupMenu>(parent);
menu->addAction(copyButton, [=] {
QGuiApplication::clipboard()->setText(text);
@@ -568,6 +568,12 @@ void SetupAccountsWrap(
state->menu = base::make_unique_q<Ui::PopupMenu>(
raw,
st::popupMenuWithIcons);
addAction(tr::lng_profile_copy_phone(tr::now), [=] {
const auto phone = rpl::variable<TextWithEntities>(
Info::Profile::PhoneValue(session->user()));
QGuiApplication::clipboard()->setText(phone.current().text);
}, &st::menuIconCopy);
addAction(tr::lng_menu_activate(tr::now), [=] {
Core::App().domain().activate(&session->account());
}, &st::menuIconProfile);