diff --git a/src/ui/components/VPNAlert.qml b/src/ui/components/VPNAlert.qml index c9641f5829..0875c4412d 100644 --- a/src/ui/components/VPNAlert.qml +++ b/src/ui/components/VPNAlert.qml @@ -31,6 +31,8 @@ Rectangle { property var duration: 0 // Delete itself after closing property var destructive: false + // Fixes the Y on show() if the alert does not use Layout + property var setY: 0 Layout.minimumHeight: style.alertHeight Layout.maximumHeight: style.alertHeight @@ -320,12 +322,16 @@ Rectangle { if (!isLayout) { height = style.alertHeight; width = Math.min(window.width - Theme.windowMargin, Theme.maxHorizontalContentWidth); - y = fullscreenRequired()? iosSafeAreaTopMargin.height + Theme.windowMargin : Theme.windowMargin; + if (setY > 0) { + y = setY; + } else { + y = fullscreenRequired() ? iosSafeAreaTopMargin.height + Theme.windowMargin : Theme.windowMargin; + } anchors.horizontalCenter = parent.horizontalCenter; anchors.margins = Theme.windowMargin / 2; } if(alertBox.duration > 0){ - console.log("Toasbox timer start") + console.log("Toastbox timer start") autoHideTimer.start() } } diff --git a/src/ui/settings/ViewAppPermissions.qml b/src/ui/settings/ViewAppPermissions.qml index f15e9b0a16..42c17a2bfe 100644 --- a/src/ui/settings/ViewAppPermissions.qml +++ b/src/ui/settings/ViewAppPermissions.qml @@ -72,8 +72,14 @@ Item { target: VPNAppPermissions function onNotification(type,message,action) { console.log("Got notification: "+type + " message:"+message); - var component = Qt.createComponent("qrc://components/components/VPNAlert.qml"); - component.createObject(root, { + var component = Qt.createComponent("qrc:/components/components/VPNAlert.qml"); + if(component.status !== Component.Ready) + { + if( component.status == Component.Error ) + console.debug("Error:"+ component.errorString() ); + + } + var alert = component.createObject(root, { isLayout:false, visible:true, alertText: message, @@ -81,8 +87,12 @@ Item { alertActionText: action, duration:type === "warning"? 0: 2000, destructive:true, + // Pin y hight to be below the alert bar as we can't render above it + setY: vpnFlickable.y+Theme.windowMargin, onActionPressed: ()=>{VPNAppPermissions.openFilePicker();}, }); + + alert.show(); } }