Skip to content

Fix file rating being unreadable in certain themes

Felix Ernst requested to merge (removed):indistinguishable_stars into master

Typically, a rating on a file is represented by five stars in a row. If the first 3 stars are filled and the other 2 aren't, that represents a 3/5 star rating.

When a theme only provides the filled stars (i.e. "rating") icon but no unfilled stars (i.e. "rating-unrated") icon, KRatingPainter would always paint all five stars as filled no matter if the actual rating was 1/5 or 5/5 because the automatic fallback of the "rating-unrated" icon is the "rating" icon as stated by the icon theme spec.

This commit fixes this by having KRatingPainter use a generated replacement "rating-unrated" icon (a de-saturated and grey-scaled "rating" icon), if the theme does not provide a "rating-unrated" icon already.

BUG: 339863


Test plan:

  1. Either find a theme that only provides a "rating" icon but no "rating-unrated" icon, or temporarily rename all "rating-unrated" icons in your current theme: sudo find /usr/share/icons/$THEMENAME/ -type f -regex '.*atin.*' -exec rename 's/rating-unrated/\(renamed\)rating-unrated/' {} \; (You can later change it back using this command: sudo find /usr/share/icons/$THEMENAME/ -type f -regex '.*atin.*' -exec rename 's/\(renamed\)rating-unrated/rating-unrated/' {} \;)
  2. Notice that the "rating" field in Dolphin in the information panel or in the "rating" column in details view now all show a five-star rating.
  3. Do the same with a Dolphin using a KWidgetsAddons framework containing this commit. Notice everything is fine now like this:

grafik

Merge request reports