D24379: [energy kcm] Fix Technology values

Alex Debus noreply at phabricator.kde.org
Thu Oct 3 12:06:02 BST 2019


alexde added a comment.


  As this it not in the scope of this patch, those values look suspicious to me too:
  
    switch(model.battery.type) {
    case 3: return i18n("Internal battery")
    case 2: return i18n("UPS battery")
    case 9: return i18n("Monitor battery")
    case 4: return i18n("Mouse battery")
    case 5: return i18n("Keyboard battery")
    case 1: return i18n("PDA battery")
    case 7: return i18n("Phone battery")
    default: return i18n("Unknown battery")
  
  Is there a special reason for the weired order? Is it correct that case 0 and 6 are missing and default to unknown? Maybe (I haven't looked deeper into it) this needs another patch.

INLINE COMMENTS

> main.qml:104
>          switch(value) {
> -        case 0: return i18n("Unknown Technology")
> -        case 1: return i18n("Lithium Ion")
> -        case 2: return i18n("Lithium Polymer")
> -        case 3: return i18n("Lithium Iron Phosphate")
> -        case 4: return i18n("LeadAcid")
> -        case 5: return i18n("Lead Acid")
> -        case 6: return i18n("Nickel Metal Hydride")
> +        case 0: return i18n("Unknown technology")
> +        case 1: return i18n("Lithium ion")

Wouldn't it be better to define 0 as a default value?

> main.qml:110
> +        case 6: return i18n("Nickel cadmium")
> +        case 6: return i18n("Nickel metal hydride")
>          }

Now you have two times the case 6

REPOSITORY
  R102 KInfoCenter

REVISION DETAIL
  https://phabricator.kde.org/D24379

To: meven, ngraham, ltoscano
Cc: alexde, plasma-devel, ltoscano, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20191003/b8e6327a/attachment.html>


More information about the Plasma-devel mailing list