applets/kicker: sometimes use normalizedId when unfavoriting

Reason for the change

Kicker backend uses the normalized id when favoriting things, and the unnormalized id when unfavoriting them. This is because the normalized id may no longer work, for example if a folder is favorited and then deleted (see bug 474120). This however, breaks on malformed desktop file names with a capital letter and colon, such as "Test: 1.desktop". We do a QString -> QUrl -> QString round trip, "Test:" is interpreted as an url scheme, and while this is maintained, it is (correctly) case-folded as the schemes are case-insensitive and their canonical form is lower case. When such a desktop file is favorited, it is correctly added (as the normalized id already contains the "applications:" url scheme, and so the "Test:" part is not interpreted as one, but can't be removed anymore as it will try to remove "test: 1.desktop" instead, which is not a favorite.

Instead, use the normalizedId in case [a] the post-round trip string only differs in case from the unnormalized id (where the scheme bug can happen) [b] we're not dealing with a local file (where the post-deletion bug can happen) and [c] we don't already have an "applications:" scheme (for good measure). This should handle both the malformed name and post-deletion file case, and hopefully not affect any other schemes, which I think should end up with the same id and normalized id anyway.

Test plan

  1. Create a file "Test: 1.desktop" in a suitable directory. (kmenuedit does not produce them anymore since yesterday, but you can use an older kmenuedit to do it).
  2. Add this to your favorites in kickoff, kicker, or kickerdash
  3. Try to remove it from your favorites

Screenshots or screen recordings

N/A

Bugs fixed

BUG: 520894


At some point we should clean up the ids that are used here - ideally there's just one format that works, rather than several that we need to constantly convert between.

This is a very niche bug, fix does not need to be in 6.7.0.

Merge request reports

Loading