diff --git a/components/dialogs/DesktopSystemDialog.qml b/components/dialogs/DesktopSystemDialog.qml index c1d32f53a..72589b1eb 100644 --- a/components/dialogs/DesktopSystemDialog.qml +++ b/components/dialogs/DesktopSystemDialog.qml @@ -47,6 +47,11 @@ Kirigami.AbstractApplicationWindow { * This property holds the QQC2 DialogButtonBox used in the footer of the dialog. */ readonly property alias dialogButtonBox: footerButtonBox + + /** + * Controls whether the accept button is enabled + */ + property bool acceptable: true width: column.implicitWidth height: column.implicitHeight + footer.implicitHeight @@ -132,7 +137,14 @@ Kirigami.AbstractApplicationWindow { spacing: Kirigami.Units.smallSpacing onAccepted: root.accept() onRejected: root.reject() - + + Binding { + target: footerButtonBox.standardButton(DialogButtonBox.Ok) + property: "enabled" + when: footerButtonBox.standardButton(DialogButtonBox.Ok) + value: root.acceptable + } + Repeater { model: root.actions diff --git a/components/dialogs/examples/test.qml b/components/dialogs/examples/test.qml index 45d71ad98..4e5d1c1dc 100644 --- a/components/dialogs/examples/test.qml +++ b/components/dialogs/examples/test.qml @@ -56,9 +56,9 @@ Kirigami.AbstractApplicationWindow { title: "Authentication Required" subtitle: "Authentication is needed to run `/usr/bin/ls` as the super user." iconName: "im-user-online" - + Kirigami.PasswordField {} - + actions: [ Kirigami.Action { text: "Details" @@ -77,6 +77,26 @@ Kirigami.AbstractApplicationWindow { } ] } + + DesktopSystemDialog { + id: xdgDialog + title: "Wallet access" + subtitle: "Share your wallet with 'Somebody'." + iconName: "kwallet" + acceptable: false + + dialogButtonBox.standardButtons: DialogButtonBox.Ok | DialogButtonBox.Ok + Component.onCompleted: { + dialogButtonBox.standardButton(DialogButtonBox.Ok).text = "Share" + } + actions: [ + Kirigami.Action { + text: "Something Happens" + iconName: "documentinfo" + onTriggered: xdgDialog.acceptable = true + } + ] + } DesktopCSDSystemDialog { id: desktopCSDPolkit @@ -293,6 +313,16 @@ Kirigami.AbstractApplicationWindow { } } } + Button { + text: "XDG dialog (Desktop)" + onClicked: { + if (checkbox.checked) { + xdgDialog.showFullScreen() + } else { + xdgDialog.show() + } + } + } Button { text: "Polkit dialog (Mobile)" onClicked: {