From 80b451c27bf9c460c5f508e20bd0283d85f36b6d Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Mon, 12 Jun 2023 13:20:24 +0200 Subject: [PATCH] Only create consent sheet if required --- src/qml/main.qml | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/qml/main.qml b/src/qml/main.qml index dd5e4675c..3c606ceac 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -259,8 +259,9 @@ Kirigami.ApplicationWindow { } function onUserConsentRequired(url) { - consentSheet.url = url - consentSheet.open() + let consent = consentSheetComponent.createObject(QQC2.ApplicationWindow.overlay) + consent.url = url + consent.open() } } @@ -301,23 +302,26 @@ Kirigami.ApplicationWindow { } } - Kirigami.OverlaySheet { - id: consentSheet + Component { + id: consentSheetComponent + Kirigami.OverlaySheet { + id: consentSheet - property string url: "" + property string url: "" - title: i18n("User consent") + title: i18n("User consent") - QQC2.Label { - id: label + QQC2.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.") - wrapMode: Text.WordWrap - width: parent.width - } - footer: QQC2.Button { - text: i18n("Open") - onClicked: UrlHelper.openUrl(consentSheet.url) + 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) + } } }