From ce0b02b823a40ada3cd4a12a257da9506e46dda1 Mon Sep 17 00:00:00 2001 From: Floris Bos Date: Thu, 18 Aug 2022 20:01:42 +0200 Subject: [PATCH] Prevent user from entering invalid characters in hostname field Implemented as "validator" which will cause that if an user presses a key that is not allowed, it will not register. Saves having to add an error message that would need to be translated to different languages. Closes #474 --- debian/changelog | 3 ++- src/OptionsPopup.qml | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 8264aa6be..d3b1a8930 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,8 +9,9 @@ rpi-imager (1.7.3) unstable; urgency=medium * Allow selecting file names without extension * Add possibility to outsource handling of custom settings to script at /usr/lib/raspberrypi-sys-mods/imager_custom + * Advanced settings: disallow invalid characters in hostname field - -- Floris Bos Sun, 31 Jul 2022 12:15:17 +0200 + -- Floris Bos Thu, 18 Aug 2022 20:04:37 +0200 rpi-imager (1.7.2) unstable; urgency=medium diff --git a/src/OptionsPopup.qml b/src/OptionsPopup.qml index 8fb97abcc..89bf54442 100644 --- a/src/OptionsPopup.qml +++ b/src/OptionsPopup.qml @@ -127,6 +127,9 @@ Popup { id: fieldHostname enabled: chkHostname.checked text: "raspberrypi" + /* FIXME: use RegularExpressionValidator instead when moving to newer Qt version. + It is not available in 5.12 that is still being used by Ubuntu 20 LTS though */ + validator: RegExpValidator { regExp: /[0-9A-Za-z][0-9A-Za-z-]{0,62}/ } } Text { text : ".local"