Ensure profile name length limit will work everywhere

(cherry picked from commit 93c5f6e6b2)
This commit is contained in:
Waqar Ahmed
2024-04-24 10:29:58 +05:00
parent 653e7b5255
commit 638b20de64

View File

@@ -333,6 +333,12 @@ bool EditProfileDialog::isProfileNameValid()
nameLenMax -= QStringLiteral(".profile").size(); 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) { if (_tempProfile->name().size() > nameLenMax) {
setMessageGeneralPage(i18nc("@info", "Profile name exceeded maximum allowed length (%1).", nameLenMax)); setMessageGeneralPage(i18nc("@info", "Profile name exceeded maximum allowed length (%1).", nameLenMax));
// Revert the name in the dialog // Revert the name in the dialog