Commit d9c7e984 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

[kcm] Improve service list delegates

Instead of a raw checkbox and some strings use something based on AbstractListItem that essentially reimplements half of BasicListItem.
parent e8b9956b
......@@ -111,32 +111,55 @@ ScrollViewKCM {
}
}
delegate: ColumnLayout {
Layout.fillWidth: true
Layout.leftMargin: Kirigami.Units.smallSpacing
spacing: 0
Controls.CheckBox {
id: serviceCheck
Layout.fillWidth: true
checked: model.enabled
text: model.displayName
Binding {
target: serviceCheck
property: "checked"
value: model.enabled
// Cheap copy of Kirigami.BasicListItem with CheckBox instead of Icon
delegate: Kirigami.AbstractListItem {
id: listItem
highlighted: false
onClicked: toggleIt()
function toggleIt() {
var job = serviceToggleJob.createObject(component, { "accountId": servicesList.model.accountId, "serviceId": model.name, "serviceEnabled": !model.enabled })
job.start()
}
RowLayout {
Controls.CheckBox {
id: serviceCheck
Layout.alignment: Qt.AlignVCenter
checked: model.enabled
Binding {
target: serviceCheck
property: "checked"
value: model.enabled
}
onClicked: toggleIt()
}
onClicked: {
var job = serviceToggleJob.createObject(component, { "accountId": servicesList.model.accountId, "serviceId": model.name, "serviceEnabled": !model.enabled })
job.start()
ColumnLayout {
spacing: 0
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
Controls.Label {
Layout.fillWidth: true
text: model.displayName
color: listItem.pressed ? listItem.activeTextColor : listItem.textColor
elide: Text.ElideRight
}
Controls.Label {
Layout.fillWidth: true
text: model.description
color: listItem.pressed ? listItem.activeTextColor : listItem.textColor
elide: Text.ElideRight
font: Kirigami.Theme.smallFont
opacity: 0.7
visible: text.length > 0
}
}
}
Controls.Label {
Layout.fillWidth: true
Layout.leftMargin: Kirigami.Units.iconSizes.small + Kirigami.Units.smallSpacing * 2
visible: text.length > 0
text: model.description
wrapMode: Text.Wrap
}
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment