check if node is a dir before deletion (#4165)

This commit is contained in:
ebbit1q 2020-11-13 20:55:01 +01:00 committed by GitHub
parent f11f072e0a
commit 68074b0f74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -196,6 +196,9 @@ void TabDeckStorage::uploadFinished(const Response &r, const CommandContainer &c
void TabDeckStorage::actDeleteLocalDeck() void TabDeckStorage::actDeleteLocalDeck()
{ {
QModelIndex curLeft = localDirView->selectionModel()->currentIndex(); QModelIndex curLeft = localDirView->selectionModel()->currentIndex();
if (localDirModel->isDir(curLeft))
return;
if (QMessageBox::warning(this, tr("Delete local file"), if (QMessageBox::warning(this, tr("Delete local file"),
tr("Are you sure you want to delete \"%1\"?").arg(localDirModel->fileName(curLeft)), tr("Are you sure you want to delete \"%1\"?").arg(localDirModel->fileName(curLeft)),
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)