Warning, /plasma/plasma-mobile/containments/homescreens/halcyon/package/contents/ui/main.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2022-2023 Devin Lin <devin@kde.org>
0002 // SPDX-License-Identifier: LGPL-2.0-or-later
0003 
0004 import QtQuick
0005 import QtQuick.Window
0006 import QtQuick.Layouts
0007 
0008 import org.kde.plasma.plasmoid
0009 import org.kde.plasma.components 3.0 as PlasmaComponents
0010 import org.kde.kirigami 2.20 as Kirigami
0011 
0012 import org.kde.plasma.private.mobileshell as MobileShell
0013 import org.kde.plasma.private.mobileshell.state as MobileShellState
0014 import org.kde.private.mobile.homescreen.halcyon as Halcyon
0015 import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin
0016 
0017 ContainmentItem {
0018     id: root
0019     
0020     Component.onCompleted: {
0021         Halcyon.ApplicationListModel.loadApplications();
0022         Halcyon.PinnedModel.applet = root.plasmoid;
0023         forceActiveFocus();
0024     }
0025     
0026     Plasmoid.onActivated: {
0027         // there's a couple of steps:
0028         // - minimize windows (only if we are in an app)
0029         // - open app drawer
0030         // - close app drawer and, if necessary, restore windows
0031 
0032         // Always close action drawer
0033         if (MobileShellState.ShellDBusClient.isActionDrawerOpen) {
0034             MobileShellState.ShellDBusClient.closeActionDrawer();
0035         }
0036 
0037         if (!WindowPlugin.WindowUtil.isShowingDesktop && WindowPlugin.WindowMaximizedTracker.showingWindow || search.isOpen) {
0038             // Always close the search widget as well
0039             if (search.isOpen) {
0040                 search.close();
0041             }
0042 
0043             halcyonHomeScreen.page = 0;
0044 
0045             WindowPlugin.WindowUtil.isShowingDesktop = true;
0046         } else if (halcyonHomeScreen.page == 0) {
0047             halcyonHomeScreen.page = 1;
0048         } else {
0049             WindowPlugin.WindowUtil.isShowingDesktop = false;
0050             halcyonHomeScreen.page = 0;
0051         }
0052     }
0053 
0054     Rectangle {
0055         id: darkenBackground
0056         color: homeScreen.overlayShown ? 'transparent' : (halcyonHomeScreen.page == 1 ? Qt.rgba(0, 0, 0, 0.7) : Qt.rgba(0, 0, 0, 0.2))
0057         anchors.fill: parent
0058         z: -1
0059         Behavior on color {
0060             ColorAnimation { duration: Kirigami.Units.longDuration }
0061         }
0062     }
0063 
0064     Rectangle {
0065         id: darkenSettingsBackground
0066         color: Qt.rgba(0, 0, 0, 0.7)
0067         opacity: halcyonHomeScreen.settingsOpenFactor
0068         anchors.fill: parent
0069         z: -1
0070         Behavior on color {
0071             ColorAnimation { duration: Kirigami.Units.longDuration }
0072         }
0073     }
0074 
0075     MobileShell.HomeScreen {
0076         id: homeScreen
0077         anchors.fill: parent
0078         plasmoidItem: root
0079 
0080         onResetHomeScreenPosition: {
0081             halcyonHomeScreen.triggerHomescreen();
0082         }
0083 
0084         onHomeTriggered: {
0085             search.close();
0086         }
0087 
0088         // homescreen component
0089         contentItem: Item {
0090             HomeScreen {
0091                 id: halcyonHomeScreen
0092                 anchors.fill: parent
0093 
0094                 topMargin: homeScreen.topMargin
0095                 bottomMargin: homeScreen.bottomMargin
0096                 leftMargin: homeScreen.leftMargin
0097                 rightMargin: homeScreen.rightMargin
0098 
0099                 // make the homescreen not interactable when task switcher or startup feedback is on
0100                 interactive: !homeScreen.overlayShown
0101                 searchWidget: search
0102             }
0103 
0104             // search component
0105             MobileShell.KRunnerWidget {
0106                 id: search
0107                 anchors.fill: parent
0108                 visible: openFactor > 0
0109 
0110                 onActionTriggered: search.close()
0111 
0112                 topMargin: homeScreen.topMargin
0113                 bottomMargin: homeScreen.bottomMargin
0114                 leftMargin: homeScreen.leftMargin
0115                 rightMargin: homeScreen.rightMargin
0116             }
0117         }
0118     }
0119 }
0120 
0121