From d75ffef9bbccac3f4cf436cfd232ad2f9c0f2ce1 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sat, 7 Jan 2023 20:29:57 +0800 Subject: [PATCH] - fix: Can't save new file using filename with custom suffix. --- NEWS.md | 1 + RedPandaIDE/editor.cpp | 59 +++++++++++++++++++++++++----------- RedPandaIDE/systemconsts.cpp | 4 +++ 3 files changed, 46 insertions(+), 18 deletions(-) diff --git a/NEWS.md b/NEWS.md index 07f9fd39..b8b6b0db 100644 --- a/NEWS.md +++ b/NEWS.md @@ -19,6 +19,7 @@ Red Panda C++ Version 2.8 - enhancement: Correctly handle tab in the exported RTF. - change: Disable undo limit by default. - fix: "Goto declaration" / "Goto definition" / "Find occurences" not correctly disabled for non-c/c++ files. + - fix: Can't save new file using filename with custom suffix. Red Panda C++ Version 2.7 diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index bc073584..f808b46c 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -312,32 +312,55 @@ bool Editor::saveAs(const QString &name, bool fromProject){ QFileDialog dialog(this,tr("Save As"),extractFilePath(mFilename), pSystemConsts->defaultFileFilters().join(";;")); dialog.selectNameFilter(selectedFileFilter); - dialog.setDefaultSuffix(defaultExt); + //dialog.setDefaultSuffix(defaultExt); dialog.selectFile(mFilename); dialog.setFileMode(QFileDialog::AnyFile); dialog.setAcceptMode(QFileDialog::AcceptSave); - connect(&dialog, &QFileDialog::filterSelected, - [&dialog](const QString &filter){ - int pos = filter.indexOf("*."); - if (pos>=0) { - QString suffix; - pos+=2; - while (pos=0) { +// QString suffix; +// pos+=2; +// while (pos=0) { + QString suffix; + pos+=2; + while (pos