mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-09-09 21:44:15 +02:00
feat: copy pack ID & copy single emoji ID
This commit is contained in:
parent
1586386d6c
commit
aeb610ff70
1 changed files with 36 additions and 4 deletions
|
@ -768,12 +768,14 @@ void StickerSetBox::updateButtons() {
|
||||||
&st::menuIconManage);
|
&st::menuIconManage);
|
||||||
});
|
});
|
||||||
}();
|
}();
|
||||||
const auto addPackOwner = [=](const std::shared_ptr<base::unique_qptr<Ui::PopupMenu>> &menu)
|
const auto addPackIdActions = [=](const std::shared_ptr<base::unique_qptr<Ui::PopupMenu>> &menu)
|
||||||
{
|
{
|
||||||
if (type == Data::StickersType::Stickers || type == Data::StickersType::Emoji) {
|
if (type == Data::StickersType::Stickers || type == Data::StickersType::Emoji) {
|
||||||
|
const auto &settings = AyuSettings::getInstance();
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = Ui::MakeWeak(this);
|
||||||
const auto session = _session;
|
const auto session = _session;
|
||||||
const auto innerId = _inner->setId() >> 32;
|
const auto setId = _inner->setId();
|
||||||
|
const auto innerId = setId >> 32;
|
||||||
|
|
||||||
(*menu)->addAction(
|
(*menu)->addAction(
|
||||||
tr::ayu_MessageDetailsPackOwnerPC(tr::now),
|
tr::ayu_MessageDetailsPackOwnerPC(tr::now),
|
||||||
|
@ -816,6 +818,26 @@ void StickerSetBox::updateButtons() {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
&st::menuIconProfile);
|
&st::menuIconProfile);
|
||||||
|
|
||||||
|
if (settings.showPeerId != 0) {
|
||||||
|
(*menu)->addAction(
|
||||||
|
tr::ayu_ContextCopyID(tr::now),
|
||||||
|
[weak, session, setId]
|
||||||
|
{
|
||||||
|
if (!weak) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto strongInner = weak.data();
|
||||||
|
if (!strongInner) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QGuiApplication::clipboard()->setText(QString::number(setId));
|
||||||
|
strongInner->showToast(tr::ayu_IDCopiedToast(tr::now));
|
||||||
|
},
|
||||||
|
&st::menuIconCopy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (_inner->notInstalled()) {
|
if (_inner->notInstalled()) {
|
||||||
|
@ -865,7 +887,7 @@ void StickerSetBox::updateButtons() {
|
||||||
: tr::lng_stickers_share_pack)(tr::now),
|
: tr::lng_stickers_share_pack)(tr::now),
|
||||||
[=] { share(); closeBox(); },
|
[=] { share(); closeBox(); },
|
||||||
&st::menuIconShare);
|
&st::menuIconShare);
|
||||||
addPackOwner(menu);
|
addPackIdActions(menu);
|
||||||
(*menu)->popup(QCursor::pos());
|
(*menu)->popup(QCursor::pos());
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
@ -918,7 +940,7 @@ void StickerSetBox::updateButtons() {
|
||||||
archive,
|
archive,
|
||||||
&st::menuIconArchive);
|
&st::menuIconArchive);
|
||||||
}
|
}
|
||||||
addPackOwner(menu);
|
addPackIdActions(menu);
|
||||||
(*menu)->popup(QCursor::pos());
|
(*menu)->popup(QCursor::pos());
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
@ -1486,6 +1508,16 @@ void StickerSetBox::Inner::contextMenuEvent(QContextMenuEvent *e) {
|
||||||
QGuiApplication::clipboard()->setMimeData(data.release());
|
QGuiApplication::clipboard()->setMimeData(data.release());
|
||||||
}
|
}
|
||||||
}, &st::menuIconCopy);
|
}, &st::menuIconCopy);
|
||||||
|
|
||||||
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
if (settings.showPeerId != 0) {
|
||||||
|
_menu->addAction(tr::ayu_ContextCopyID(tr::now),
|
||||||
|
[=]
|
||||||
|
{
|
||||||
|
QGuiApplication::clipboard()->setText(QString::number(_pack[index]->id));
|
||||||
|
},
|
||||||
|
&st::menuIconCopy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (details.type != SendMenu::Type::Disabled) {
|
} else if (details.type != SendMenu::Type::Disabled) {
|
||||||
const auto document = _pack[index];
|
const auto document = _pack[index];
|
||||||
|
|
Loading…
Add table
Reference in a new issue