2023-10-22 03:59:27 +00:00
|
|
|
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
|
|
|
|
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
2015-02-25 18:26:04 +00:00
|
|
|
|
2021-12-25 01:17:08 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
|
import QtQuick.Window 2.15
|
2015-02-25 18:38:34 +00:00
|
|
|
import QtQuick.Layouts 1.1
|
2015-02-25 18:26:04 +00:00
|
|
|
|
2023-07-25 01:13:52 +00:00
|
|
|
import org.kde.kirigami 2.20 as Kirigami
|
|
|
|
|
|
2015-02-25 18:26:04 +00:00
|
|
|
import org.kde.plasma.plasmoid 2.0
|
2019-09-04 16:39:31 +00:00
|
|
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
2015-02-25 18:26:04 +00:00
|
|
|
|
2020-07-22 15:17:10 +00:00
|
|
|
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
2022-11-11 16:21:12 +00:00
|
|
|
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState
|
2023-03-06 19:13:48 +00:00
|
|
|
import org.kde.private.mobile.homescreen.folio 1.0 as Folio
|
2023-03-16 07:21:01 +00:00
|
|
|
import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin
|
2020-07-22 15:17:10 +00:00
|
|
|
|
2023-06-12 23:58:17 +00:00
|
|
|
ContainmentItem {
|
2015-02-25 18:26:04 +00:00
|
|
|
id: root
|
|
|
|
|
|
2019-09-04 16:39:31 +00:00
|
|
|
Component.onCompleted: {
|
2023-10-22 03:59:27 +00:00
|
|
|
Folio.FolioSettings.load();
|
|
|
|
|
Folio.ApplicationListModel.load();
|
|
|
|
|
Folio.FavouritesModel.load();
|
|
|
|
|
Folio.PageListModel.load();
|
|
|
|
|
|
2021-10-18 18:56:37 +00:00
|
|
|
// ensure the gestures work immediately on load
|
|
|
|
|
forceActiveFocus();
|
2015-03-05 12:37:39 +00:00
|
|
|
}
|
2023-06-12 23:58:17 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
function homeAction() {
|
|
|
|
|
const isInWindow = (!WindowPlugin.WindowUtil.isShowingDesktop && WindowPlugin.WindowMaximizedTracker.showingWindow);
|
2023-03-20 01:32:19 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
if (isInWindow) {
|
|
|
|
|
Folio.HomeScreenState.closeFolder();
|
|
|
|
|
Folio.HomeScreenState.closeSearchWidget();
|
|
|
|
|
Folio.HomeScreenState.closeAppDrawer();
|
|
|
|
|
Folio.HomeScreenState.goToPage(0);
|
|
|
|
|
} else {
|
|
|
|
|
switch (Folio.HomeScreenState.viewState) {
|
|
|
|
|
case Folio.HomeScreenState.PageView:
|
|
|
|
|
if (Folio.HomeScreenState.currentPage === 0) {
|
|
|
|
|
Folio.HomeScreenState.openAppDrawer();
|
|
|
|
|
} else {
|
|
|
|
|
Folio.HomeScreenState.goToPage(0);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case Folio.HomeScreenState.AppDrawerView:
|
|
|
|
|
Folio.HomeScreenState.closeAppDrawer();
|
|
|
|
|
break;
|
|
|
|
|
case Folio.HomeScreenState.SearchWidgetView:
|
|
|
|
|
Folio.HomeScreenState.closeSearchWidget();
|
|
|
|
|
break;
|
|
|
|
|
case Folio.HomeScreenState.FolderView:
|
|
|
|
|
Folio.HomeScreenState.closeFolder();
|
|
|
|
|
break;
|
|
|
|
|
}
|
2023-03-20 01:32:19 +00:00
|
|
|
}
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
2023-03-20 01:32:19 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
Plasmoid.onActivated: homeAction()
|
2023-06-12 23:58:17 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
Rectangle {
|
|
|
|
|
id: appDrawerBackground
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
color: Qt.rgba(0, 0, 0, 0.6)
|
2023-06-12 23:58:17 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
opacity: Folio.HomeScreenState.appDrawerOpenProgress
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: searchWidgetBackground
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
color: Qt.rgba(0, 0, 0, 0.3)
|
|
|
|
|
|
|
|
|
|
opacity: Folio.HomeScreenState.searchWidgetOpenProgress
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: settingsViewBackground
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
color: Qt.rgba(0, 0, 0, 0.3)
|
|
|
|
|
|
|
|
|
|
opacity: Folio.HomeScreenState.settingsOpenProgress
|
2019-09-04 16:39:31 +00:00
|
|
|
}
|
2023-06-12 23:58:17 +00:00
|
|
|
|
|
|
|
|
MobileShell.HomeScreen {
|
|
|
|
|
id: homeScreen
|
2023-10-22 03:59:27 +00:00
|
|
|
anchors.fill: parent
|
2023-06-12 23:58:17 +00:00
|
|
|
|
2023-09-20 12:41:40 +00:00
|
|
|
plasmoidItem: root
|
2023-06-12 23:58:17 +00:00
|
|
|
onResetHomeScreenPosition: {
|
2023-10-22 03:59:27 +00:00
|
|
|
// NOTE: empty, because this is handled by homeAction()
|
2022-04-06 21:59:36 +00:00
|
|
|
}
|
2023-06-12 23:58:17 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
onHomeTriggered: root.homeAction()
|
2023-06-12 23:58:17 +00:00
|
|
|
|
|
|
|
|
contentItem: Item {
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2023-06-12 23:58:17 +00:00
|
|
|
// homescreen component
|
|
|
|
|
HomeScreen {
|
|
|
|
|
id: folioHomeScreen
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
|
|
topMargin: homeScreen.topMargin
|
|
|
|
|
bottomMargin: homeScreen.bottomMargin
|
|
|
|
|
leftMargin: homeScreen.leftMargin
|
|
|
|
|
rightMargin: homeScreen.rightMargin
|
|
|
|
|
|
|
|
|
|
// make the homescreen not interactable when task switcher or startup feedback is on
|
|
|
|
|
interactive: !homeScreen.overlayShown
|
|
|
|
|
}
|
2021-12-25 01:17:08 +00:00
|
|
|
}
|
2023-06-12 23:58:17 +00:00
|
|
|
|
|
|
|
|
// listen to app launch errors
|
|
|
|
|
Connections {
|
|
|
|
|
target: Folio.ApplicationListModel
|
|
|
|
|
function onLaunchError(msg) {
|
|
|
|
|
MobileShellState.ShellDBusClient.closeAppLaunchAnimation()
|
|
|
|
|
}
|
2022-04-06 16:04:57 +00:00
|
|
|
}
|
|
|
|
|
}
|
2015-06-20 21:45:19 +00:00
|
|
|
}
|
2023-10-22 03:59:27 +00:00
|
|
|
|