Only create consent sheet if required

This commit is contained in:
Tobias Fella
2023-06-12 13:20:24 +02:00
parent 32ff22ba89
commit 80b451c27b

View File

@@ -259,8 +259,9 @@ Kirigami.ApplicationWindow {
} }
function onUserConsentRequired(url) { function onUserConsentRequired(url) {
consentSheet.url = url let consent = consentSheetComponent.createObject(QQC2.ApplicationWindow.overlay)
consentSheet.open() consent.url = url
consent.open()
} }
} }
@@ -301,23 +302,26 @@ Kirigami.ApplicationWindow {
} }
} }
Kirigami.OverlaySheet { Component {
id: consentSheet id: consentSheetComponent
Kirigami.OverlaySheet {
id: consentSheet
property string url: "" property string url: ""
title: i18n("User consent") title: i18n("User consent")
QQC2.Label { QQC2.Label {
id: label id: 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.") 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 wrapMode: Text.WordWrap
width: parent.width width: parent.width
} }
footer: QQC2.Button { footer: QQC2.Button {
text: i18n("Open") text: i18n("Open")
onClicked: UrlHelper.openUrl(consentSheet.url) onClicked: UrlHelper.openUrl(consentSheet.url)
}
} }
} }