Skip to content

Clean up FlatpakPermissionModel and permissions.qml page

ivan tkachenko requested to merge work/ratijas/refactor into master

FlatpakPermissionModel: Factor out some permission loading code

Less repetitive usually also means less buggy. And overall it's easier to read with less access to shared variables.

QML: Drop all custom properties from delegate, require model object instead

The approach to copy all the model roles to custom properties clearly was a mess, and tend to only get worse over time. Not only we had to introduce few new ones, but none of them was marked as readonly either, and it wouldn't support writing back to a model (through setData) should we ever consider switching to that.

QML: Simplify bindings, remove needless component IDs

You don't need an id to refer to a property in a binding expression for the same component, so the code can be shortened like this.

QML: Refer to ListView in delegates through attached property, remove id

Using attached property is better for maintainability because it does not depend on any particular ListView name.

QML: Bump import version of org.kde.kcm

It's gonna be useful for KCM.SettingStateBinding later on.

FlatpakPermissionModel: Remove IsEnvironment model role

There are existing appropriate replacements using originType and section.


QML changes tested with Qt 6 and Qt 5. Both seem to work fine.

Edited by ivan tkachenko

Merge request reports

Loading