diff --git a/NEWS.md b/NEWS.md
index b9640a7c..e9fb831a 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -4,6 +4,9 @@ Red Panda C++ Version 1.1.0
- enhancement: When the editing files is changed by other applications, only show one notification dialog for each file.
- fix: c files added to a project will be compiled as c++ file.
- enhancement: restore caret position after batch replace
+ - enhancement: rename in files view's context menu
+ - enhancement: delete in files view's context menu
+ - change: drag&drop in files view default to move
Red Panda C++ Version 1.0.10
- fix: modify watch doesn't work
diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp
index e8df72f4..3d1c8561 100644
--- a/RedPandaIDE/mainwindow.cpp
+++ b/RedPandaIDE/mainwindow.cpp
@@ -2533,6 +2533,12 @@ void MainWindow::buildContextMenus()
connect(mFilesView_CreateFile, &QAction::triggered,
this, &MainWindow::onFilesViewCreateFile);
+ mFilesView_Rename = createActionFor(
+ tr("Rename"),
+ ui->treeFiles);
+ connect(mFilesView_Rename, &QAction::triggered,
+ this, &MainWindow::onFilesViewRename);
+
mFilesView_RemoveFile = createActionFor(
tr("Delete"),
ui->treeFiles);
@@ -2994,6 +3000,8 @@ void MainWindow::onFilesViewContextMenu(const QPoint &pos)
menu.addSeparator();
menu.addAction(mFilesView_CreateFolder);
menu.addAction(mFilesView_CreateFile);
+ menu.addAction(mFilesView_RemoveFile);
+ menu.addAction(mFilesView_Rename);
menu.addSeparator();
if (pSettings->vcs().gitOk()) {
if (hasRepository) {
@@ -3017,6 +3025,8 @@ void MainWindow::onFilesViewContextMenu(const QPoint &pos)
mFilesView_OpenWithExternal->setEnabled(info.isFile());
mFilesView_OpenInTerminal->setEnabled(!path.isEmpty());
mFilesView_OpenInExplorer->setEnabled(!path.isEmpty());
+ mFilesView_Rename->setEnabled(!path.isEmpty());
+ mFilesView_RemoveFile->setEnabled(!path.isEmpty() || !ui->treeFiles->selectionModel()->selectedRows().isEmpty());
if (pSettings->vcs().gitOk() && hasRepository) {
mFileSystemModelIconProvider.update();
@@ -3497,6 +3507,13 @@ void MainWindow::onFilesViewRemoveFiles()
}
}
+void MainWindow::onFilesViewRename() {
+ QModelIndex index = ui->treeFiles->currentIndex();
+ if (!index.isValid())
+ return ;
+ ui->treeFiles->edit(index);
+}
+
void MainWindow::onProblemProperties()
{
QModelIndex idx = ui->lstProblemSet->currentIndex();
@@ -3657,9 +3674,11 @@ void MainWindow::onFilesViewOpen()
{
QString path = mFileSystemModel.filePath(ui->treeFiles->currentIndex());
if (!path.isEmpty() && QFileInfo(path).isFile()) {
- Editor *editor=mEditorList->getEditorByFilename(path);
- if (editor)
- editor->activate();
+ if (getFileType(path)==FileType::Project) {
+ openProject(path);
+ } else {
+ openFile(path);
+ }
}
}
@@ -6703,6 +6722,8 @@ void MainWindow::on_actionLocate_in_Files_View_triggered()
void MainWindow::on_treeFiles_doubleClicked(const QModelIndex &index)
{
+ if (index!=ui->treeFiles->currentIndex())
+ return;
QString filepath = mFileSystemModel.filePath(index);
QFileInfo file(filepath);
if (file.isFile()) {
diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h
index 95bdd01b..34636cb2 100644
--- a/RedPandaIDE/mainwindow.h
+++ b/RedPandaIDE/mainwindow.h
@@ -299,6 +299,7 @@ private slots:
void onFilesViewCreateFolder();
void onFilesViewCreateFile();
void onFilesViewRemoveFiles();
+ void onFilesViewRename();
void onProblemProperties();
void onProblemOpenSource();
void onLableProblemSetContextMenuRequested();
@@ -780,6 +781,7 @@ private:
QAction * mFilesView_CreateFolder;
QAction * mFilesView_CreateFile;
QAction * mFilesView_RemoveFile;
+ QAction * mFilesView_Rename;
//action for debug console
QAction * mDebugConsole_ShowDetailLog;
diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui
index ca002bc9..426b218a 100644
--- a/RedPandaIDE/mainwindow.ui
+++ b/RedPandaIDE/mainwindow.ui
@@ -463,7 +463,7 @@
QTabWidget::West
- 1
+ 0
true
@@ -535,7 +535,7 @@
QAbstractItemView::DragDrop
- Qt::CopyAction
+ Qt::MoveAction
QAbstractItemView::ExtendedSelection
diff --git a/RedPandaIDE/systemconsts.cpp b/RedPandaIDE/systemconsts.cpp
index 1d686612..c5ae56c7 100644
--- a/RedPandaIDE/systemconsts.cpp
+++ b/RedPandaIDE/systemconsts.cpp
@@ -74,6 +74,9 @@ SystemConsts::SystemConsts(): mDefaultFileFilters()
mDefaultFileNameFilters.append("*.vs");
mDefaultFileNameFilters.append("*.fs");
mDefaultFileNameFilters.append("*.txt");
+ mDefaultFileNameFilters.append("*.in");
+ mDefaultFileNameFilters.append("*.out");
+ mDefaultFileNameFilters.append("*.dat");
mDefaultFileNameFilters.append("*.md");
mDefaultFileNameFilters.append("*.dev");
}