allow delete button to delete folders

This commit is contained in:
RickyRister 2024-12-23 20:56:06 -08:00
parent 010baaf296
commit 88d51cca3e

View file

@ -272,8 +272,7 @@ void TabDeckStorage::actDeleteLocalDeck()
{ {
const QModelIndexList curLefts = localDirView->selectionModel()->selectedRows(); const QModelIndexList curLefts = localDirView->selectionModel()->selectedRows();
auto isDir = [&](const auto &curLeft) { return localDirModel->isDir(curLeft); }; if (curLefts.isEmpty()) {
if (curLefts.isEmpty() || std::all_of(curLefts.begin(), curLefts.end(), isDir)) {
return; return;
} }
@ -282,7 +281,7 @@ void TabDeckStorage::actDeleteLocalDeck()
return; return;
for (const auto &curLeft : curLefts) { for (const auto &curLeft : curLefts) {
if (!localDirModel->isDir(curLeft)) { if (curLeft.isValid()) {
localDirModel->remove(curLeft); localDirModel->remove(curLeft);
} }
} }