mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Allowed to select loaded documents for bulk download menu item.
This commit is contained in:
parent
90adc2d97c
commit
ed345e0823
1 changed files with 4 additions and 11 deletions
|
@ -34,8 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
namespace Menu {
|
namespace Menu {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using DocumentViewPtr = std::shared_ptr<Data::DocumentMedia>;
|
using Documents = std::vector<std::pair<not_null<DocumentData*>, FullMsgId>>;
|
||||||
using Documents = std::vector<std::pair<DocumentViewPtr, FullMsgId>>;
|
|
||||||
using Photos = std::vector<std::shared_ptr<Data::PhotoMedia>>;
|
using Photos = std::vector<std::shared_ptr<Data::PhotoMedia>>;
|
||||||
|
|
||||||
[[nodiscard]] bool Added(
|
[[nodiscard]] bool Added(
|
||||||
|
@ -52,12 +51,8 @@ using Photos = std::vector<std::shared_ptr<Data::PhotoMedia>>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (const auto document = media->document()) {
|
} else if (const auto document = media->document()) {
|
||||||
if (const auto view = document->activeMediaView()) {
|
documents.emplace_back(document, item->fullId());
|
||||||
if (!view->loaded()) {
|
return true;
|
||||||
documents.emplace_back(view, item->fullId());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,9 +126,7 @@ void AddAction(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const auto saveDocuments = [=](const QString &folderPath) {
|
const auto saveDocuments = [=](const QString &folderPath) {
|
||||||
for (const auto &pair : documents) {
|
for (const auto &[document, origin] : documents) {
|
||||||
const auto &document = pair.first->owner();
|
|
||||||
const auto &origin = pair.second;
|
|
||||||
if (!folderPath.isEmpty()) {
|
if (!folderPath.isEmpty()) {
|
||||||
document->save(origin, folderPath + document->filename());
|
document->save(origin, folderPath + document->filename());
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue