Commit 1a3cb256 authored by Ismael Asensio's avatar Ismael Asensio

[kcm/kwinrules] Improve export buttons

Summary:
Small UX improvements when exporting rules

Add a `Select All` button
Disable `Save` if no rules are selected
In export mode set button text to `Cancel Export`

Test Plan: {F8276279}

Reviewers: #kwin, #vdg, filipf

Reviewed By: #vdg, filipf

Subscribers: filipf, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29341
parent 3092043b
......@@ -79,11 +79,24 @@ ScrollViewKCM {
showCloseButton: true
text: i18n("Select the rules to export")
actions: [
Kirigami.Action {
iconName: "object-select-symbolic"
text: checked ? i18n("Unselect All") : i18n("Select All")
checkable: true
checked: selectedIndexes.length == ruleBookView.count
onToggled: {
if (checked) {
selectedIndexes = [...Array(ruleBookView.count).keys()]
} else {
selectedIndexes = [];
}
}
}
,
Kirigami.Action {
iconName: "document-save"
text: i18n("Save Rules")
// FIXME: It does not update on selection changes
// enabled: selectedIndexes.length > 0
enabled: selectedIndexes.length > 0
onTriggered: {
exportDialog.active = true;
}
......@@ -112,8 +125,8 @@ ScrollViewKCM {
}
}
QQC2.Button {
text: i18n("Export...")
icon.name: "document-export"
text: checked ? i18n("Cancel Export") : i18n("Export...")
icon.name: exportInfo.visible ? "dialog-cancel" : "document-export"
enabled: ruleBookView.count > 0
checkable: true
checked: exportInfo.visible
......@@ -213,6 +226,7 @@ ScrollViewKCM {
} else {
if (position >= 0) { selectedIndexes.splice(position, 1); }
}
selectedIndexesChanged();
}
}
}
......
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