Save As: a name typed as .qetz is a .qetz whatever the selected type

Typing "plan.qetz" over the selected "untitled" of "untitled.qet" gives
"plan.qetz.qet" with the GTK dialog, which saved a plain .qet named
.qetz.qet. Every trailing .qet/.qetz is stripped, and the project is
zipped when the .qetz file type is chosen or the typed name says .qetz.
Checked in the GUI: Save As, "saved.qetz" typed, writes saved.qetz, a
zip; launching on it shows the project.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Wga9B92BNurDEtxxtCDxf
This commit is contained in:
ispyisail
2026-10-10 23:56:19 +13:00
parent a44e816d59
commit e52b89cb84
+15 -8
View File
@@ -364,14 +364,21 @@ QString ProjectView::askUserForFilePath(bool assign) {
// extension at all whenever the portal didn't (bugtracker #270).
// Stripping any existing suffix first and re-appending it once is
// correct either way.
// A .qetz is kept as typed, or chosen through its filter.
const bool zipped = filepath.endsWith(".qetz", Qt::CaseInsensitive)
|| (selected_filter == qetz_filter
&& !filepath.endsWith(".qet", Qt::CaseInsensitive));
if (filepath.endsWith(".qetz", Qt::CaseInsensitive))
filepath.chop(5);
else if (filepath.endsWith(".qet", Qt::CaseInsensitive))
filepath.chop(4);
// Zipped (.qetz) when that file type is chosen, or when the name typed
// says .qetz anywhere in its trailing extensions: typing "plan.qetz"
// over the selected "untitled" of "untitled.qet" gives "plan.qetz.qet"
// with the GTK dialog, and still means a .qetz.
bool zipped = selected_filter == qetz_filter;
for (;;) {
if (filepath.endsWith(".qetz", Qt::CaseInsensitive)) {
filepath.chop(5);
zipped = true;
} else if (filepath.endsWith(".qet", Qt::CaseInsensitive)) {
filepath.chop(4);
} else {
break;
}
}
filepath += zipped ? ".qetz" : ".qet";
if (assign) {