Port UserConsentSheet to Kirigami.Dialog

This commit is contained in:
Tobias Fella
2024-04-26 22:51:48 +02:00
parent 7e4361bb5e
commit b1e338579d

View File

@@ -295,6 +295,7 @@ Kirigami.ApplicationWindow {
KeyVerificationDialog {}
}
Connections {
target: root.connection
@@ -309,32 +310,39 @@ Kirigami.ApplicationWindow {
});
}
function onUserConsentRequired(url) {
let consent = consentSheetComponent.createObject(this);
let consent = consentDialogComponent.createObject(this);
consent.url = url;
consent.open();
}
}
Component {
id: consentSheetComponent
Kirigami.OverlaySheet {
id: consentSheet
id: consentDialogComponent
Kirigami.Dialog {
id: consentDialog
property string url: ""
title: i18n("User consent")
width: Math.min(Kirigami.Units.gridUnit * 24, root.width)
height: Kirigami.Units.gridUnit * 8
leftPadding: Kirigami.Units.largeSpacing
rightPadding: Kirigami.Units.largeSpacing
QQC2.Label {
id: label
title: i18nc("@title:dialog", "User Consent")
contentItem: QQC2.Label {
text: i18n("Your homeserver requires you to agree to its terms and conditions before being able to use it. Please click the button below to read them.")
wrapMode: Text.WordWrap
width: parent.width
}
footer: QQC2.Button {
text: i18n("Open")
onClicked: UrlHelper.openUrl(consentSheet.url)
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
}
customFooterActions: [
Kirigami.Action {
text: i18n("Open")
icon.name: "internet-services"
onTriggered: UrlHelper.openUrl(consentDialog.url)
}
]
}
}