From 69dc1899419260283cba12a39739d26bd5cec3eb Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 20 Sep 2023 14:41:40 +0200 Subject: [PATCH] Make PlasmoidItem accessible from HomeScreen it needs availableScreenRect which can be provided only from PlasmoidITem --- .../mobileshell/qml/homescreen/HomeScreen.qml | 13 +++++++++---- .../homescreens/folio/package/contents/ui/main.qml | 1 + .../halcyon/package/contents/ui/main.qml | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/components/mobileshell/qml/homescreen/HomeScreen.qml b/components/mobileshell/qml/homescreen/HomeScreen.qml index e9d8a3db..8b009f89 100644 --- a/components/mobileshell/qml/homescreen/HomeScreen.qml +++ b/components/mobileshell/qml/homescreen/HomeScreen.qml @@ -47,6 +47,11 @@ Item { */ readonly property bool overlayShown: startupFeedback.visible + /** + * The root PlasmoidItem of the containment this is used into + */ + property PlasmoidItem plasmoidItem + /** * Margins for the homescreen, taking panels into account. */ @@ -56,11 +61,11 @@ Item { property real rightMargin function evaluateMargins() { - topMargin = Plasmoid.availableScreenRect.y + topMargin = plasmoidItem.availableScreenRect.y // add a specific check for the nav panel for now, since the gesture mode still technically has height - bottomMargin = ShellSettings.Settings.navigationPanelEnabled ? root.height - (Plasmoid.availableScreenRect.y + Plasmoid.availableScreenRect.height) : 0; - leftMargin = Plasmoid.availableScreenRect.x - rightMargin = root.width - (Plasmoid.availableScreenRect.x + Plasmoid.availableScreenRect.width) + bottomMargin = ShellSettings.Settings.navigationPanelEnabled ? root.height - (plasmoidItem.availableScreenRect.y + plasmoidItem.availableScreenRect.height) : 0; + leftMargin = plasmoidItem.availableScreenRect.x + rightMargin = root.width - (plasmoidItem.availableScreenRect.x + plasmoidItem.availableScreenRect.width) } Connections { diff --git a/containments/homescreens/folio/package/contents/ui/main.qml b/containments/homescreens/folio/package/contents/ui/main.qml index bc1a572a..eff9dff1 100644 --- a/containments/homescreens/folio/package/contents/ui/main.qml +++ b/containments/homescreens/folio/package/contents/ui/main.qml @@ -59,6 +59,7 @@ ContainmentItem { MobileShell.HomeScreen { id: homeScreen + plasmoidItem: root onResetHomeScreenPosition: { folioHomeScreen.homeScreenState.animateGoToPageIndex(0, Kirigami.Units.longDuration); folioHomeScreen.homeScreenState.closeAppDrawer(); diff --git a/containments/homescreens/halcyon/package/contents/ui/main.qml b/containments/homescreens/halcyon/package/contents/ui/main.qml index fc4585b4..58ff451d 100644 --- a/containments/homescreens/halcyon/package/contents/ui/main.qml +++ b/containments/homescreens/halcyon/package/contents/ui/main.qml @@ -64,6 +64,7 @@ ContainmentItem { MobileShell.HomeScreen { id: homeScreen anchors.fill: parent + plasmoidItem: root onResetHomeScreenPosition: { halcyonHomeScreen.triggerHomescreen();