mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added ability to share QR code of bots.
This commit is contained in:
parent
fbaa79f168
commit
7cc9a0b9aa
1 changed files with 3 additions and 14 deletions
|
@ -1121,22 +1121,11 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
||||||
if (user) {
|
if (user) {
|
||||||
const auto copyUsername = Ui::CreateChild<Ui::IconButton>(
|
const auto copyUsername = Ui::CreateChild<Ui::IconButton>(
|
||||||
usernameLine.text->parentWidget(),
|
usernameLine.text->parentWidget(),
|
||||||
user->isBot()
|
st::infoProfileLabeledButtonQr);
|
||||||
? st::infoProfileLabeledButtonCopy
|
|
||||||
: st::infoProfileLabeledButtonQr);
|
|
||||||
fitLabelToButton(copyUsername, usernameLine.text);
|
fitLabelToButton(copyUsername, usernameLine.text);
|
||||||
copyUsername->setClickedCallback([=] {
|
copyUsername->setClickedCallback([=] {
|
||||||
if (!user->isBot()) {
|
controller->show(
|
||||||
controller->show(
|
Box(Ui::FillPeerQrBox, user, std::nullopt, nullptr));
|
||||||
Box(Ui::FillPeerQrBox, user, std::nullopt, nullptr));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const auto link = user->session().createInternalLinkFull(
|
|
||||||
user->username());
|
|
||||||
if (!link.isEmpty()) {
|
|
||||||
QGuiApplication::clipboard()->setText(link);
|
|
||||||
controller->showToast(tr::lng_username_copied(tr::now));
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue