Bug 407999

Summary: Fragile comparison to i18n("None")
Product: [Frameworks and Libraries] frameworks-kdeclarative Reporter: Alexander Potashev <aspotashev>
Component: generalAssignee: Marco Martin <notmart>
Status: RESOLVED FIXED    
Severity: normal CC: bfeber, kdelibs-bugs, nate
Priority: NOR    
Version: 5.58.0   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 5.60.0
Sentry Crash Report:

Description Alexander Potashev 2019-05-27 13:42:47 UTC
SUMMARY
Fragile comparison to i18n("None") in kdeclarative/src/qmlcontrols/kcmcontrols/qml/GridDelegate.qml:108:
===
source: delegate.text === i18n("None") ? "edit-none" : "view-preview"
===

If the caller code translates "None" into the target language differently, this comparison will return false and behave not as intended. This component should probably use another boolean property to choose between these two icons, or just an "icon" property to specify a custom icon.

Please also describe this behaviour in the documentation. From the current documentation at https://api.kde.org/frameworks/kdeclarative/html/classorg_1_1kde_1_1kcm_1_1GridDelegate.html it's unclear how the component behaves and what icons it may use for what purposes.

STEPS TO REPRODUCE
1. 
2. 
3. 

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Björn Feber 2019-06-14 16:07:56 UTC
Git commit 43a7f102309a0aa93675c000797bdd9a434f0302 by Björn Feber.
Committed on 14/06/2019 at 16:04.
Pushed by bfeber into branch 'master'.

Fix fragile comparison to i18n("None") and describe behavior in docs
FIXED-IN: 5.60.0

M  +3    -2    src/qmlcontrols/kcmcontrols/qml/GridDelegate.qml

https://commits.kde.org/kdeclarative/43a7f102309a0aa93675c000797bdd9a434f0302