From af6cb6612e5d217d711068b6f699d0ef83f0b2e0 Mon Sep 17 00:00:00 2001 From: Arthur Milchior Date: Sun, 27 Dec 2020 08:51:58 +0100 Subject: [PATCH] Rejects field names starting with #, ^ and / --- ftl/core/fields.ftl | 1 + qt/aqt/fields.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/ftl/core/fields.ftl b/ftl/core/fields.ftl index ddeb41e33..1f3bd6a5e 100644 --- a/ftl/core/fields.ftl +++ b/ftl/core/fields.ftl @@ -12,3 +12,4 @@ fields-reverse-text-direction-rtl = Reverse text direction (RTL) fields-size = Size: fields-sort-by-this-field-in-the = Sort by this field in the browser fields-that-field-name-is-already-used = That field name is already used. +fields-name-first-letter-not-valid = The field name should not start with #, ^ or /. \ No newline at end of file diff --git a/qt/aqt/fields.py b/qt/aqt/fields.py index 2319942e4..06f40b9a5 100644 --- a/qt/aqt/fields.py +++ b/qt/aqt/fields.py @@ -85,6 +85,9 @@ class FieldDialog(QDialog): txt = getOnlyText(prompt, default=old).replace('"', "").strip() if not txt: return + if txt[0] in "#^/": + showWarning(tr(TR.FIELDS_NAME_FIRST_LETTER_NOT_VALID)) + return for f in self.model["flds"]: if ignoreOrd is not None and f["ord"] == ignoreOrd: continue