mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Restrict saving files as if noforwards.
This commit is contained in:
parent
fd6751233e
commit
96c910190b
4 changed files with 33 additions and 19 deletions
|
@ -1776,9 +1776,11 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||||
showContextInFolder(document);
|
showContextInFolder(document);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_menu->addAction(lnkIsVideo ? tr::lng_context_save_video(tr::now) : (lnkIsVoice ? tr::lng_context_save_audio(tr::now) : (lnkIsAudio ? tr::lng_context_save_audio_file(tr::now) : tr::lng_context_save_file(tr::now))), App::LambdaDelayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [=] {
|
if (_peer->allowsForwarding()) {
|
||||||
saveDocumentToFile(itemId, document);
|
_menu->addAction(lnkIsVideo ? tr::lng_context_save_video(tr::now) : (lnkIsVoice ? tr::lng_context_save_audio(tr::now) : (lnkIsAudio ? tr::lng_context_save_audio_file(tr::now) : tr::lng_context_save_file(tr::now))), App::LambdaDelayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [=] {
|
||||||
}));
|
saveDocumentToFile(itemId, document);
|
||||||
|
}));
|
||||||
|
}
|
||||||
if (document->hasAttachedStickers()) {
|
if (document->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(
|
||||||
|
@ -1932,9 +1934,11 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||||
Api::ToggleFavedSticker(document, itemId);
|
Api::ToggleFavedSticker(document, itemId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_menu->addAction(tr::lng_context_save_image(tr::now), App::LambdaDelayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [=] {
|
if (_peer->allowsForwarding()) {
|
||||||
saveDocumentToFile(itemId, document);
|
_menu->addAction(tr::lng_context_save_image(tr::now), App::LambdaDelayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [=] {
|
||||||
}));
|
saveDocumentToFile(itemId, document);
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (const auto media = item->media()) {
|
if (const auto media = item->media()) {
|
||||||
|
|
|
@ -188,7 +188,11 @@ void ShowInFolder(not_null<DocumentData*> document) {
|
||||||
void AddSaveDocumentAction(
|
void AddSaveDocumentAction(
|
||||||
not_null<Ui::PopupMenu*> menu,
|
not_null<Ui::PopupMenu*> menu,
|
||||||
Data::FileOrigin origin,
|
Data::FileOrigin origin,
|
||||||
not_null<DocumentData*> document) {
|
not_null<DocumentData*> document,
|
||||||
|
not_null<ListWidget*> list) {
|
||||||
|
if (list->hasCopyRestriction()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const auto save = [=] {
|
const auto save = [=] {
|
||||||
DocumentSaveClickHandler::Save(
|
DocumentSaveClickHandler::Save(
|
||||||
origin,
|
origin,
|
||||||
|
@ -272,7 +276,7 @@ void AddDocumentActions(
|
||||||
tr::lng_context_attached_stickers(tr::now),
|
tr::lng_context_attached_stickers(tr::now),
|
||||||
std::move(callback));
|
std::move(callback));
|
||||||
}
|
}
|
||||||
AddSaveDocumentAction(menu, contextId, document);
|
AddSaveDocumentAction(menu, contextId, document, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddPostLinkAction(
|
void AddPostLinkAction(
|
||||||
|
|
|
@ -1595,15 +1595,17 @@ void ListWidget::showContextMenu(
|
||||||
document,
|
document,
|
||||||
DocumentSaveClickHandler::Mode::ToNewFile);
|
DocumentSaveClickHandler::Mode::ToNewFile);
|
||||||
});
|
});
|
||||||
_contextMenu->addAction(
|
if (_peer->allowsForwarding()) {
|
||||||
(isVideo
|
_contextMenu->addAction(
|
||||||
? tr::lng_context_save_video(tr::now)
|
(isVideo
|
||||||
: isVoice
|
? tr::lng_context_save_video(tr::now)
|
||||||
? tr::lng_context_save_audio(tr::now)
|
: isVoice
|
||||||
: isAudio
|
? tr::lng_context_save_audio(tr::now)
|
||||||
? tr::lng_context_save_audio_file(tr::now)
|
: isAudio
|
||||||
: tr::lng_context_save_file(tr::now)),
|
? tr::lng_context_save_audio_file(tr::now)
|
||||||
std::move(handler));
|
: tr::lng_context_save_file(tr::now)),
|
||||||
|
std::move(handler));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -727,7 +727,9 @@ void OverlayWidget::refreshNavVisibility() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OverlayWidget::contentCanBeSaved() const {
|
bool OverlayWidget::contentCanBeSaved() const {
|
||||||
if (_photo) {
|
if (hasCopyRestriction()) {
|
||||||
|
return false;
|
||||||
|
} else if (_photo) {
|
||||||
return _photo->hasVideo() || _photoMedia->loaded();
|
return _photo->hasVideo() || _photoMedia->loaded();
|
||||||
} else if (_document) {
|
} else if (_document) {
|
||||||
return _document->filepath(true).isEmpty() && !_document->loading();
|
return _document->filepath(true).isEmpty() && !_document->loading();
|
||||||
|
@ -943,7 +945,9 @@ void OverlayWidget::fillContextMenuActions(const MenuCallback &addAction) {
|
||||||
if (canDelete) {
|
if (canDelete) {
|
||||||
addAction(tr::lng_mediaview_delete(tr::now), [=] { deleteMedia(); });
|
addAction(tr::lng_mediaview_delete(tr::now), [=] { deleteMedia(); });
|
||||||
}
|
}
|
||||||
addAction(tr::lng_mediaview_save_as(tr::now), [=] { saveAs(); });
|
if (!hasCopyRestriction()) {
|
||||||
|
addAction(tr::lng_mediaview_save_as(tr::now), [=] { saveAs(); });
|
||||||
|
}
|
||||||
|
|
||||||
if (const auto overviewType = computeOverviewType()) {
|
if (const auto overviewType = computeOverviewType()) {
|
||||||
const auto text = _document
|
const auto text = _document
|
||||||
|
|
Loading…
Add table
Reference in a new issue