2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 09:05: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

@@ -65,6 +65,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtGui/QWindow>
#include <QtGui/QScreen>
#include <QtGui/QGuiApplication>
#include <QtGui/QClipboard>
namespace Window {
namespace {
@@ -568,7 +571,20 @@ void MainMenu::setupAccounts() {
void MainMenu::setupAccountsToggle() {
_toggleAccounts->show();
_toggleAccounts->setClickedCallback([=] { toggleAccounts(); });
_toggleAccounts->setAcceptBoth();
_toggleAccounts->addClickHandler([=](Qt::MouseButton button) {
if (button == Qt::LeftButton) {
toggleAccounts();
} else if (button == Qt::RightButton) {
const auto menu = Ui::CreateChild<Ui::PopupMenu>(
_toggleAccounts.data());
menu->addAction(tr::lng_profile_copy_phone(tr::now), [=] {
QGuiApplication::clipboard()->setText(_phoneText);
});
menu->popup(QCursor::pos());
}
});
}
void MainMenu::parentResized() {