treeview: don't create desktop file names with invalid characters

.desktop file names are supposed to be "a sequence of non-empty elements separated by dots (U+002E FULL STOP), none of which starts with a digit, and each of which contains only characters from the set [A-Za-z0-9-_]". Kmenuedit, when creating a new entry, allows the user to specify a name and will use that as the desktop file name, only replacing the forward slash / with a hyphen -. All other characters not included in the allowed character set are used unchanged. This can break some applications handling desktop files, including the kicker backend, which in some cases tries to read the file name as an url, and so e.g. parts separated with a colon may be interpreted as url schemes and not function properly. While this should be fixed in kicker, we also should not produce invalid names.

Instead, replace all invalid characters with an underscore _. This only applies to the .desktop file name; in the menu the name will be used as entered by the user.

CCBUG: 520894

Merge request reports

Loading