From ed345e0823a1744ffdee9e49718f6b51987995c9 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 6 Sep 2023 13:26:36 +0300 Subject: [PATCH] Allowed to select loaded documents for bulk download menu item. --- .../SourceFiles/menu/menu_item_download_files.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Telegram/SourceFiles/menu/menu_item_download_files.cpp b/Telegram/SourceFiles/menu/menu_item_download_files.cpp index 3c4573e80..1735e8041 100644 --- a/Telegram/SourceFiles/menu/menu_item_download_files.cpp +++ b/Telegram/SourceFiles/menu/menu_item_download_files.cpp @@ -34,8 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Menu { namespace { -using DocumentViewPtr = std::shared_ptr; -using Documents = std::vector>; +using Documents = std::vector, FullMsgId>>; using Photos = std::vector>; [[nodiscard]] bool Added( @@ -52,12 +51,8 @@ using Photos = std::vector>; } } } else if (const auto document = media->document()) { - if (const auto view = document->activeMediaView()) { - if (!view->loaded()) { - documents.emplace_back(view, item->fullId()); - return true; - } - } + documents.emplace_back(document, item->fullId()); + return true; } } } @@ -131,9 +126,7 @@ void AddAction( } }; const auto saveDocuments = [=](const QString &folderPath) { - for (const auto &pair : documents) { - const auto &document = pair.first->owner(); - const auto &origin = pair.second; + for (const auto &[document, origin] : documents) { if (!folderPath.isEmpty()) { document->save(origin, folderPath + document->filename()); } else {