Make PlasmoidItem accessible from HomeScreen

it needs availableScreenRect which can be provided only from
PlasmoidITem
This commit is contained in:
Marco Martin 2023-09-20 14:41:40 +02:00
parent 2a3f66f199
commit 69dc189941
3 changed files with 11 additions and 4 deletions

View file

@ -47,6 +47,11 @@ Item {
*/ */
readonly property bool overlayShown: startupFeedback.visible 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. * Margins for the homescreen, taking panels into account.
*/ */
@ -56,11 +61,11 @@ Item {
property real rightMargin property real rightMargin
function evaluateMargins() { 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 // 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; bottomMargin = ShellSettings.Settings.navigationPanelEnabled ? root.height - (plasmoidItem.availableScreenRect.y + plasmoidItem.availableScreenRect.height) : 0;
leftMargin = Plasmoid.availableScreenRect.x leftMargin = plasmoidItem.availableScreenRect.x
rightMargin = root.width - (Plasmoid.availableScreenRect.x + Plasmoid.availableScreenRect.width) rightMargin = root.width - (plasmoidItem.availableScreenRect.x + plasmoidItem.availableScreenRect.width)
} }
Connections { Connections {

View file

@ -59,6 +59,7 @@ ContainmentItem {
MobileShell.HomeScreen { MobileShell.HomeScreen {
id: homeScreen id: homeScreen
plasmoidItem: root
onResetHomeScreenPosition: { onResetHomeScreenPosition: {
folioHomeScreen.homeScreenState.animateGoToPageIndex(0, Kirigami.Units.longDuration); folioHomeScreen.homeScreenState.animateGoToPageIndex(0, Kirigami.Units.longDuration);
folioHomeScreen.homeScreenState.closeAppDrawer(); folioHomeScreen.homeScreenState.closeAppDrawer();

View file

@ -64,6 +64,7 @@ ContainmentItem {
MobileShell.HomeScreen { MobileShell.HomeScreen {
id: homeScreen id: homeScreen
anchors.fill: parent anchors.fill: parent
plasmoidItem: root
onResetHomeScreenPosition: { onResetHomeScreenPosition: {
halcyonHomeScreen.triggerHomescreen(); halcyonHomeScreen.triggerHomescreen();