diff --git a/NEWS.md b/NEWS.md index e114f181..9789ebdc 100644 --- a/NEWS.md +++ b/NEWS.md @@ -13,6 +13,8 @@ Red Panda C++ Version 2.23 - enhancement: improve parsing result for function parameters like 'Node (&node)[10]' - fix: Can't copy by ctrl+dray&drop to current selection's begin/end - enhancement: Support debug executable files generated by mingw-w64 gcc 13.1 and filepath contains non-ascii chars. + - enhancement: When deleteing files in the files view, try moving to the trash bin instead. + - fix: GNU assembly files (.s) are not shown in the files view. Red Panda C++ Version 2.22 diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 99db5398..7f5e5700 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -4412,6 +4412,13 @@ void MainWindow::onFilesViewRemoveFiles() QMessageBox::Yes | QMessageBox::No, QMessageBox::No)!=QMessageBox::Yes) return; doFilesViewRemoveFile(index); + } else if (indexList.count()==1) { + QModelIndex index = indexList[0]; + if (QMessageBox::question(ui->treeFiles,tr("Delete") + ,tr("Do you really want to delete %1?").arg(mFileSystemModel.fileName(index)), + QMessageBox::Yes | QMessageBox::No, QMessageBox::No)!=QMessageBox::Yes) + return; + doFilesViewRemoveFile(index); } else { if (QMessageBox::question(ui->treeFiles,tr("Delete") ,tr("Do you really want to delete %1 files?").arg(indexList.count()), @@ -7445,9 +7452,19 @@ void MainWindow::doFilesViewRemoveFile(const QModelIndex &index) + tr("Do you really want to delete it?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No)!=QMessageBox::Yes) return; +#if QT_VERSION >= QT_VERSION_CHECK(5,15,2) + if (!QFile::moveToTrash(dir.absolutePath())) + dir.removeRecursively(); +#else dir.removeRecursively(); +#endif } else { +#if QT_VERSION >= QT_VERSION_CHECK(5,15,2) + if (!QFile::moveToTrash(mFileSystemModel.filePath(index))) + QFile::remove(mFileSystemModel.filePath(index)); +#else QFile::remove(mFileSystemModel.filePath(index)); +#endif } } diff --git a/RedPandaIDE/project.cpp b/RedPandaIDE/project.cpp index d214f1e8..95592a45 100644 --- a/RedPandaIDE/project.cpp +++ b/RedPandaIDE/project.cpp @@ -525,7 +525,12 @@ bool Project::internalRemoveUnit(PProjectUnit& unit, bool doClose , bool removeF } if (removeFile) { +#if QT_VERSION >= QT_VERSION_CHECK(5,15,2) + if (!QFile::moveToTrash(unit->fileName())) + QFile::remove(unit->fileName()); +#else QFile::remove(unit->fileName()); +#endif } //if not fUnits.GetItem(index).fNew then diff --git a/RedPandaIDE/systemconsts.cpp b/RedPandaIDE/systemconsts.cpp index a885b2fc..37edce9e 100644 --- a/RedPandaIDE/systemconsts.cpp +++ b/RedPandaIDE/systemconsts.cpp @@ -85,6 +85,8 @@ SystemConsts::SystemConsts(): mDefaultFileFilters() mDefaultFileNameFilters.append("*.dat"); mDefaultFileNameFilters.append("*.md"); mDefaultFileNameFilters.append("*.dev"); + mDefaultFileNameFilters.append("*.s"); + mDefaultFileNameFilters.append("*.S"); } const QStringList &SystemConsts::defaultFileFilters() const noexcept