Show information about downloads from cloud.

This commit is contained in:
John Preston 2022-03-01 18:59:59 +03:00
parent 3262c2d1b9
commit dd5aeeb65a
1 changed files with 11 additions and 1 deletions

View File

@ -1073,9 +1073,19 @@ void ListWidget::deleteItems(SelectedItems &&items, Fn<void()> confirmed) {
return;
} else if (_controller->isDownloads()) {
const auto count = items.list.size();
const auto allInCloud = ranges::all_of(items.list, [](
const SelectedItem &entry) {
const auto item = MessageByGlobalId(entry.globalId);
return item && item->isHistoryEntry();
});
const auto phrase = (count == 1)
? tr::lng_downloads_delete_sure_one(tr::now)
: tr::lng_downloads_delete_sure(tr::now, lt_count, count);
const auto added = !allInCloud
? QString()
: (count == 1
? tr::lng_downloads_delete_in_cloud_one(tr::now)
: tr::lng_downloads_delete_in_cloud(tr::now));
const auto deleteSure = [=] {
Ui::PostponeCall(this, [=] {
if (const auto box = _actionBoxWeak.data()) {
@ -1093,7 +1103,7 @@ void ListWidget::deleteItems(SelectedItems &&items, Fn<void()> confirmed) {
}
};
setActionBoxWeak(window->show(Ui::MakeConfirmBox({
.text = phrase,
.text = phrase + (added.isEmpty() ? QString() : "\n\n" + added),
.confirmed = deleteSure,
.confirmText = tr::lng_box_delete(tr::now),
.confirmStyle = &st::attentionBoxButton,