kcms/desktop: Move "Add" button and row count to header actions

I swapped the order of "Add" and row count because (in LTR layouts)
row captions are on the left and an "Add" button on the right sits
right on top of the "Remove" buttons in the list view.
This commit is contained in:
Jakob Petsovits 2024-04-06 22:56:04 -04:00
parent 9cd067e4fd
commit d9d733924c

View file

@ -14,20 +14,46 @@ import org.kde.kirigami 2.20 as Kirigami
KCM.ScrollViewKCM {
id: root
Connections {
target: kcm.desktopsModel
function onReadyChanged() {
rowsSpinBox.value = kcm.desktopsModel.rows;
}
function onRowsChanged() {
rowsSpinBox.value = kcm.desktopsModel.rows;
}
}
implicitWidth: Kirigami.Units.gridUnit * 35
implicitHeight: Kirigami.Units.gridUnit * 30
actions: [
Kirigami.Action {
displayComponent: QQC2.SpinBox {
id: rowsSpinBox
from: 1
to: 20
editable: true
value: kcm.desktopsModel.rows
textFromValue: (value, locale) => i18np("1 Row", "%1 Rows", value)
valueFromText: (text, locale) => parseInt(text, 10)
onValueModified: kcm.desktopsModel.rows = value
KCM.SettingHighlighter {
highlight: kcm.desktopsModel.rows !== 2
}
Connections {
target: kcm.desktopsModel
function onReadyChanged() {
rowsSpinBox.value = kcm.desktopsModel.rows;
}
function onRowsChanged() {
rowsSpinBox.value = kcm.desktopsModel.rows;
}
}
}
},
Kirigami.Action {
text: i18nc("@action:button", "Add")
icon.name: "list-add"
onTriggered: kcm.desktopsModel.createDesktop()
}
]
Component {
id: desktopsListItemComponent
@ -164,37 +190,6 @@ KCM.ScrollViewKCM {
}
footer: ColumnLayout {
RowLayout {
QQC2.Button {
text: i18nc("@action:button", "Add")
icon.name: "list-add"
onClicked: kcm.desktopsModel.createDesktop()
}
Item { // Spacer
Layout.fillWidth: true
}
QQC2.SpinBox {
id: rowsSpinBox
from: 1
to: 20
editable: true
value: kcm.desktopsModel.rows
textFromValue: (value, locale) => i18np("1 Row", "%1 Rows", value)
valueFromText: (text, locale) => parseInt(text, 10)
onValueModified: kcm.desktopsModel.rows = value
KCM.SettingHighlighter {
highlight: kcm.desktopsModel.rows !== 2
}
}
}
Kirigami.FormLayout {
QQC2.CheckBox {