From e52b89cb84046d8fd010ecc1bf18649f299ee146 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Sat, 10 Oct 2026 23:56:19 +1300 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_019Wga9B92BNurDEtxxtCDxf --- sources/projectview.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/sources/projectview.cpp b/sources/projectview.cpp index bcfd1294b..81ad2a6f7 100644 --- a/sources/projectview.cpp +++ b/sources/projectview.cpp @@ -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) {