mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Skip image context actions for not-loaded photos.
This commit is contained in:
parent
a2187a1d2b
commit
11b965e82e
2 changed files with 18 additions and 12 deletions
|
@ -1088,12 +1088,15 @@ void InnerWidget::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||||
}
|
}
|
||||||
if (lnkPhoto) {
|
if (lnkPhoto) {
|
||||||
const auto photo = lnkPhoto->photo();
|
const auto photo = lnkPhoto->photo();
|
||||||
_menu->addAction(tr::lng_context_save_image(tr::now), App::LambdaDelayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [=] {
|
const auto media = photo->activeMediaView();
|
||||||
savePhotoToFile(photo);
|
if (!photo->isNull() && media && media->loaded()) {
|
||||||
}));
|
_menu->addAction(tr::lng_context_save_image(tr::now), App::LambdaDelayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [=] {
|
||||||
_menu->addAction(tr::lng_context_copy_image(tr::now), [=] {
|
savePhotoToFile(photo);
|
||||||
copyContextImage(photo);
|
}));
|
||||||
});
|
_menu->addAction(tr::lng_context_copy_image(tr::now), [=] {
|
||||||
|
copyContextImage(photo);
|
||||||
|
});
|
||||||
|
}
|
||||||
if (photo->hasAttachedStickers()) {
|
if (photo->hasAttachedStickers()) {
|
||||||
const auto controller = _controller;
|
const auto controller = _controller;
|
||||||
auto callback = [=] {
|
auto callback = [=] {
|
||||||
|
|
|
@ -1579,12 +1579,15 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const auto addPhotoActions = [&](not_null<PhotoData*> photo) {
|
const auto addPhotoActions = [&](not_null<PhotoData*> photo) {
|
||||||
_menu->addAction(tr::lng_context_save_image(tr::now), App::LambdaDelayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [=] {
|
const auto media = photo->activeMediaView();
|
||||||
savePhotoToFile(photo);
|
if (!photo->isNull() && media && media->loaded()) {
|
||||||
}));
|
_menu->addAction(tr::lng_context_save_image(tr::now), App::LambdaDelayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [=] {
|
||||||
_menu->addAction(tr::lng_context_copy_image(tr::now), [=] {
|
savePhotoToFile(photo);
|
||||||
copyContextImage(photo);
|
}));
|
||||||
});
|
_menu->addAction(tr::lng_context_copy_image(tr::now), [=] {
|
||||||
|
copyContextImage(photo);
|
||||||
|
});
|
||||||
|
}
|
||||||
if (photo->hasAttachedStickers()) {
|
if (photo->hasAttachedStickers()) {
|
||||||
_menu->addAction(tr::lng_context_attached_stickers(tr::now), [=] {
|
_menu->addAction(tr::lng_context_attached_stickers(tr::now), [=] {
|
||||||
session->api().attachedStickers().requestAttachedStickerSets(
|
session->api().attachedStickers().requestAttachedStickerSets(
|
||||||
|
|
Loading…
Add table
Reference in a new issue