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
/**
* 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 {

View file

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

View file

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