broulik added inline comments.

INLINE COMMENTS

> batterymodel.h:47
>      Q_INVOKABLE Solid::Battery *get(int index) const;
> +    Q_INVOKABLE QString vendor(int index) const;
> +    Q_INVOKABLE QString product(int index) const;

As a cleanup measure (before or after, but separate of this patch), can you 
remove those separate invokables

1. Add `Q_ENUM(Roles)`
2. `qmlRegisterUncreatableType` the `BatteryModel`
3. from QML use `data()` which is invokable since Qt 5.5 (after this code was 
written iirc):

  kcm.batteries.data(kcm.batteries.index(0, 0), BatteryModel.VendorRole)

> main.qml:432
> +                                if (modelData.source) {
> +                                    if (modelData.source == "vendor") {
> +                                        value = currentVendor;

Can you make this more generic, e.g.

  value = root["current" + uppercasefirst(modelData.source)]

REPOSITORY
  R102 KInfoCenter

BRANCH
  arcpatch-D23152

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

To: meven, broulik, ngraham
Cc: plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, GB_2, 
ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, 
abetts, sebas, apol, mart

Reply via email to