mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-20 09:22:15 -07:00
support multi delete deck
This commit is contained in:
parent
5aaf1232cb
commit
c8e5691404
1 changed files with 12 additions and 6 deletions
|
|
@ -244,16 +244,22 @@ void TabDeckStorage::uploadFinished(const Response &r, const CommandContainer &c
|
||||||
|
|
||||||
void TabDeckStorage::actDeleteLocalDeck()
|
void TabDeckStorage::actDeleteLocalDeck()
|
||||||
{
|
{
|
||||||
QModelIndex curLeft = localDirView->selectionModel()->currentIndex();
|
const QModelIndexList curLefts = localDirView->selectionModel()->selectedRows();
|
||||||
if (localDirModel->isDir(curLeft))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (QMessageBox::warning(this, tr("Delete local file"),
|
auto isDir = [&](const auto &curLeft) { return localDirModel->isDir(curLeft); };
|
||||||
tr("Are you sure you want to delete \"%1\"?").arg(localDirModel->fileName(curLeft)),
|
if (curLefts.isEmpty() || std::all_of(curLefts.begin(), curLefts.end(), isDir)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (QMessageBox::warning(this, tr("Delete local file"), tr("Are you sure you want to delete the selected files?"),
|
||||||
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
|
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
localDirModel->remove(curLeft);
|
for (const auto &curLeft : curLefts) {
|
||||||
|
if (!localDirModel->isDir(curLeft)) {
|
||||||
|
localDirModel->remove(curLeft);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDeckStorage::actOpenRemoteDeck()
|
void TabDeckStorage::actOpenRemoteDeck()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue