From 638b20de64c0d97fb731b7f152f8b2ff7f28f012 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Wed, 24 Apr 2024 10:29:58 +0500 Subject: [PATCH] Ensure profile name length limit will work everywhere (cherry picked from commit 93c5f6e6b20187c30410ae6d0a5e931e39841bf3) --- src/widgets/EditProfileDialog.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/widgets/EditProfileDialog.cpp b/src/widgets/EditProfileDialog.cpp index 71018131a..d088ef277 100644 --- a/src/widgets/EditProfileDialog.cpp +++ b/src/widgets/EditProfileDialog.cpp @@ -333,6 +333,12 @@ bool EditProfileDialog::isProfileNameValid() nameLenMax -= QStringLiteral(".profile").size(); + // doesn't work on macOS and maybe other systems so make sure we have a sane value always + // See https://mail.kde.org/pipermail/kwrite-devel/2024-April/007139.html + if (nameLenMax < 0) { + nameLenMax = 100; + } + if (_tempProfile->name().size() > nameLenMax) { setMessageGeneralPage(i18nc("@info", "Profile name exceeded maximum allowed length (%1).", nameLenMax)); // Revert the name in the dialog