mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-23 16:56:55 +00:00
Added ability to see attached stickers from sections.
This commit is contained in:
parent
8d424f6eaf
commit
943593526f
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "history/view/history_view_context_menu.h"
|
||||
|
||||
#include "api/api_attached_stickers.h"
|
||||
#include "api/api_editing.h"
|
||||
#include "api/api_toggling_media.h" // Api::ToggleFavedSticker
|
||||
#include "base/unixtime.h"
|
||||
@ -137,7 +138,8 @@ void ToggleFavedSticker(
|
||||
|
||||
void AddPhotoActions(
|
||||
not_null<Ui::PopupMenu*> menu,
|
||||
not_null<PhotoData*> photo) {
|
||||
not_null<PhotoData*> photo,
|
||||
not_null<ListWidget*> list) {
|
||||
menu->addAction(
|
||||
tr::lng_context_save_image(tr::now),
|
||||
App::LambdaDelayed(
|
||||
@ -147,6 +149,16 @@ void AddPhotoActions(
|
||||
menu->addAction(tr::lng_context_copy_image(tr::now), [=] {
|
||||
CopyImage(photo);
|
||||
});
|
||||
if (photo->hasAttachedStickers()) {
|
||||
const auto controller = list->controller();
|
||||
auto callback = [=] {
|
||||
auto &attached = photo->session().api().attachedStickers();
|
||||
attached.requestAttachedStickerSets(controller, photo);
|
||||
};
|
||||
menu->addAction(
|
||||
tr::lng_context_attached_stickers(tr::now),
|
||||
std::move(callback));
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGif(not_null<Main::Session*> session, FullMsgId itemId) {
|
||||
@ -239,6 +251,16 @@ void AddDocumentActions(
|
||||
: tr::lng_context_show_in_folder(tr::now)),
|
||||
[=] { ShowInFolder(document); });
|
||||
}
|
||||
if (document->hasAttachedStickers()) {
|
||||
const auto controller = list->controller();
|
||||
auto callback = [=] {
|
||||
auto &attached = session->api().attachedStickers();
|
||||
attached.requestAttachedStickerSets(controller, document);
|
||||
};
|
||||
menu->addAction(
|
||||
tr::lng_context_attached_stickers(tr::now),
|
||||
std::move(callback));
|
||||
}
|
||||
AddSaveDocumentAction(menu, contextId, document);
|
||||
}
|
||||
|
||||
@ -768,7 +790,7 @@ base::unique_qptr<Ui::PopupMenu> FillContextMenu(
|
||||
|
||||
AddTopMessageActions(result, request, list);
|
||||
if (linkPhoto) {
|
||||
AddPhotoActions(result, photo);
|
||||
AddPhotoActions(result, photo, list);
|
||||
} else if (linkDocument) {
|
||||
AddDocumentActions(result, document, itemId, list);
|
||||
//} else if (linkPeer) { // #feed
|
||||
|
Loading…
Reference in New Issue
Block a user