mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 00:42:14 -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()
|
||||
{
|
||||
QModelIndex curLeft = localDirView->selectionModel()->currentIndex();
|
||||
if (localDirModel->isDir(curLeft))
|
||||
return;
|
||||
const QModelIndexList curLefts = localDirView->selectionModel()->selectedRows();
|
||||
|
||||
if (QMessageBox::warning(this, tr("Delete local file"),
|
||||
tr("Are you sure you want to delete \"%1\"?").arg(localDirModel->fileName(curLeft)),
|
||||
auto isDir = [&](const auto &curLeft) { return localDirModel->isDir(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)
|
||||
return;
|
||||
|
||||
localDirModel->remove(curLeft);
|
||||
for (const auto &curLeft : curLefts) {
|
||||
if (!localDirModel->isDir(curLeft)) {
|
||||
localDirModel->remove(curLeft);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TabDeckStorage::actOpenRemoteDeck()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue