PushRuleSettingsPopup: spinner while saving/rming

This commit is contained in:
miruka 2021-02-28 14:43:52 -04:00
parent 656092cec4
commit c18ea2704b

View File

@ -17,6 +17,9 @@ HFlickableColumnPopup {
property var rule property var rule
property bool ruleExists: true property bool ruleExists: true
property string saveFutureId: ""
property string removeFutureId: ""
readonly property bool generalChecked: readonly property bool generalChecked:
overrideRadio.checked || underrideRadio.checked overrideRadio.checked || underrideRadio.checked
@ -61,12 +64,14 @@ HFlickableColumnPopup {
actions, actions,
] ]
py.callClientCoro(userId, "edit_pushrule", args, root.close) saveFutureId =
py.callClientCoro(userId, "edit_pushrule", args, root.close)
} }
function remove() { function remove() {
const args = [rule.kind, rule.rule_id] const args = [rule.kind, rule.rule_id]
py.callClientCoro(userId, "remove_pushrule", args, root.close) removeFutureId =
py.callClientCoro(userId, "remove_pushrule", args, root.close)
} }
page.implicitWidth: Math.min(maximumPreferredWidth, 550 * theme.uiScale) page.implicitWidth: Math.min(maximumPreferredWidth, 550 * theme.uiScale)
@ -75,6 +80,7 @@ HFlickableColumnPopup {
ApplyButton { ApplyButton {
text: qsTr("Save changes") text: qsTr("Save changes")
enabled: true // TODO enabled: true // TODO
loading: saveFutureId !== ""
onClicked: root.save() onClicked: root.save()
} }
@ -87,6 +93,7 @@ HFlickableColumnPopup {
icon.name: "pushrule-remove" icon.name: "pushrule-remove"
text: qsTr("Remove rule") text: qsTr("Remove rule")
enabled: ! root.rule.default enabled: ! root.rule.default
loading: removeFutureId !== ""
onClicked: root.remove() onClicked: root.remove()
} }
} }