- 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.
This commit is contained in:
Roy Qu 2023-06-29 00:27:06 +08:00
parent 0e1decad65
commit 9dd654cc48
4 changed files with 26 additions and 0 deletions

View File

@ -13,6 +13,8 @@ Red Panda C++ Version 2.23
- enhancement: improve parsing result for function parameters like 'Node (&node)[10]' - 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 - 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: 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 Red Panda C++ Version 2.22

View File

@ -4412,6 +4412,13 @@ void MainWindow::onFilesViewRemoveFiles()
QMessageBox::Yes | QMessageBox::No, QMessageBox::No)!=QMessageBox::Yes) QMessageBox::Yes | QMessageBox::No, QMessageBox::No)!=QMessageBox::Yes)
return; return;
doFilesViewRemoveFile(index); 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 { } else {
if (QMessageBox::question(ui->treeFiles,tr("Delete") if (QMessageBox::question(ui->treeFiles,tr("Delete")
,tr("Do you really want to delete %1 files?").arg(indexList.count()), ,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?"), + tr("Do you really want to delete it?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No)!=QMessageBox::Yes) QMessageBox::Yes | QMessageBox::No, QMessageBox::No)!=QMessageBox::Yes)
return; return;
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
if (!QFile::moveToTrash(dir.absolutePath()))
dir.removeRecursively(); dir.removeRecursively();
#else
dir.removeRecursively();
#endif
} else { } else {
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
if (!QFile::moveToTrash(mFileSystemModel.filePath(index)))
QFile::remove(mFileSystemModel.filePath(index)); QFile::remove(mFileSystemModel.filePath(index));
#else
QFile::remove(mFileSystemModel.filePath(index));
#endif
} }
} }

View File

@ -525,7 +525,12 @@ bool Project::internalRemoveUnit(PProjectUnit& unit, bool doClose , bool removeF
} }
if (removeFile) { if (removeFile) {
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
if (!QFile::moveToTrash(unit->fileName()))
QFile::remove(unit->fileName()); QFile::remove(unit->fileName());
#else
QFile::remove(unit->fileName());
#endif
} }
//if not fUnits.GetItem(index).fNew then //if not fUnits.GetItem(index).fNew then

View File

@ -85,6 +85,8 @@ SystemConsts::SystemConsts(): mDefaultFileFilters()
mDefaultFileNameFilters.append("*.dat"); mDefaultFileNameFilters.append("*.dat");
mDefaultFileNameFilters.append("*.md"); mDefaultFileNameFilters.append("*.md");
mDefaultFileNameFilters.append("*.dev"); mDefaultFileNameFilters.append("*.dev");
mDefaultFileNameFilters.append("*.s");
mDefaultFileNameFilters.append("*.S");
} }
const QStringList &SystemConsts::defaultFileFilters() const noexcept const QStringList &SystemConsts::defaultFileFilters() const noexcept