2023-03-05 02:40:06 +00:00
|
|
|
// SPDX-FileCopyrightText: 2022-2023 Devin Lin <devin@kde.org>
|
2022-06-08 22:09:35 +00:00
|
|
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
|
|
2023-03-05 02:40:06 +00:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls as QQC2
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import QtQuick.Window
|
2022-06-08 22:09:35 +00:00
|
|
|
|
2023-03-05 02:40:06 +00:00
|
|
|
import org.kde.plasma.plasmoid
|
|
|
|
|
import org.kde.plasma.core as PlasmaCore
|
|
|
|
|
import org.kde.plasma.extras as PlasmaExtras
|
2022-06-08 22:09:35 +00:00
|
|
|
import org.kde.plasma.components 3.0 as PC3
|
2023-03-05 02:40:06 +00:00
|
|
|
import org.kde.draganddrop as DragDrop
|
2022-06-08 22:09:35 +00:00
|
|
|
|
2023-03-05 02:40:06 +00:00
|
|
|
import org.kde.kirigami as Kirigami
|
|
|
|
|
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
2023-03-16 07:21:01 +00:00
|
|
|
import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin
|
2022-06-08 22:09:35 +00:00
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: root
|
|
|
|
|
|
2022-12-11 02:05:13 +00:00
|
|
|
required property real topMargin
|
|
|
|
|
required property real bottomMargin
|
|
|
|
|
required property real leftMargin
|
|
|
|
|
required property real rightMargin
|
|
|
|
|
|
|
|
|
|
required property bool interactive
|
2022-06-28 04:43:40 +00:00
|
|
|
required property var searchWidget
|
2022-06-08 22:09:35 +00:00
|
|
|
|
|
|
|
|
property alias page: swipeView.currentIndex
|
|
|
|
|
|
|
|
|
|
function triggerHomescreen() {
|
|
|
|
|
swipeView.setCurrentIndex(0);
|
2023-03-12 19:41:55 +00:00
|
|
|
swipeView.focusChild();
|
2022-07-12 02:39:33 +00:00
|
|
|
favoritesView.closeFolder();
|
|
|
|
|
favoritesView.goToBeginning();
|
|
|
|
|
gridAppList.goToBeginning();
|
2022-06-08 22:09:35 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-21 03:23:11 +00:00
|
|
|
function openConfigure() {
|
2023-03-06 06:38:43 +00:00
|
|
|
plasmoid.action("configure").trigger();
|
|
|
|
|
plasmoid.editMode = false;
|
2022-06-21 03:23:11 +00:00
|
|
|
}
|
2023-03-12 19:41:55 +00:00
|
|
|
|
|
|
|
|
Connections {
|
2023-03-17 06:40:32 +00:00
|
|
|
target: WindowPlugin.WindowUtil
|
2023-03-12 19:41:55 +00:00
|
|
|
|
2023-03-17 06:40:32 +00:00
|
|
|
function onAllWindowsMinimizedChanged(){
|
2023-03-16 07:21:01 +00:00
|
|
|
if (WindowPlugin.WindowUtil.allWindowsMinimized) {
|
2023-03-12 19:41:55 +00:00
|
|
|
swipeView.focusChild();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-08 22:09:35 +00:00
|
|
|
QQC2.SwipeView {
|
|
|
|
|
id: swipeView
|
|
|
|
|
opacity: 1 - searchWidget.openFactor
|
|
|
|
|
interactive: root.interactive
|
|
|
|
|
|
|
|
|
|
anchors.fill: parent
|
2022-12-11 02:05:13 +00:00
|
|
|
anchors.topMargin: root.topMargin
|
|
|
|
|
anchors.bottomMargin: root.bottomMargin
|
|
|
|
|
anchors.leftMargin: root.leftMargin
|
|
|
|
|
anchors.rightMargin: root.rightMargin
|
2023-03-12 19:41:55 +00:00
|
|
|
|
|
|
|
|
function focusChild() {
|
2023-03-13 10:44:56 +00:00
|
|
|
currentItem.focusRequested();
|
2023-03-12 19:41:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onCurrentIndexChanged: focusChild()
|
|
|
|
|
|
2022-06-08 22:09:35 +00:00
|
|
|
Item {
|
|
|
|
|
height: swipeView.height
|
|
|
|
|
width: swipeView.width
|
2023-03-12 19:41:55 +00:00
|
|
|
|
2023-03-13 10:44:56 +00:00
|
|
|
signal focusRequested()
|
2023-03-12 19:41:55 +00:00
|
|
|
|
2022-06-21 03:23:11 +00:00
|
|
|
// open wallpaper menu when held on click
|
|
|
|
|
TapHandler {
|
2023-03-12 19:41:55 +00:00
|
|
|
onPressedChanged: {
|
|
|
|
|
if (pressed) {
|
|
|
|
|
favoritesView.resetHighlight();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-21 03:23:11 +00:00
|
|
|
onLongPressed: root.openConfigure()
|
|
|
|
|
}
|
2022-06-30 04:40:22 +00:00
|
|
|
|
|
|
|
|
FavoritesView {
|
2022-07-12 02:39:33 +00:00
|
|
|
id: favoritesView
|
2022-06-08 22:09:35 +00:00
|
|
|
anchors.fill: parent
|
2022-06-28 04:43:40 +00:00
|
|
|
searchWidget: root.searchWidget
|
2023-03-17 15:33:10 +00:00
|
|
|
interactive: root.interactive && swipeView.contentItem.contentX === 0
|
2022-06-28 04:43:40 +00:00
|
|
|
onOpenConfigureRequested: root.openConfigure()
|
2023-03-14 00:21:37 +00:00
|
|
|
|
|
|
|
|
onPageForwardRequested: {
|
|
|
|
|
swipeView.setCurrentIndex(1);
|
|
|
|
|
swipeView.focusChild();
|
|
|
|
|
resetHighlight();
|
|
|
|
|
}
|
2022-06-08 22:09:35 +00:00
|
|
|
}
|
|
|
|
|
}
|
2023-03-12 19:41:55 +00:00
|
|
|
|
|
|
|
|
Item {
|
2022-06-08 22:09:35 +00:00
|
|
|
width: swipeView.width
|
2022-07-13 01:02:04 +00:00
|
|
|
height: swipeView.height
|
2022-11-07 22:54:00 +00:00
|
|
|
|
2023-03-13 10:44:56 +00:00
|
|
|
signal focusRequested()
|
2022-11-07 22:54:00 +00:00
|
|
|
|
2022-07-13 01:02:04 +00:00
|
|
|
GridAppList {
|
|
|
|
|
id: gridAppList
|
2022-09-05 20:09:50 +00:00
|
|
|
|
2023-03-12 19:41:55 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
|
|
2022-09-05 20:09:50 +00:00
|
|
|
property int horizontalMargin: Math.round(swipeView.width * 0.05)
|
2022-07-13 01:02:04 +00:00
|
|
|
interactive: root.interactive
|
|
|
|
|
leftMargin: horizontalMargin
|
|
|
|
|
rightMargin: horizontalMargin
|
2023-03-14 00:21:37 +00:00
|
|
|
|
|
|
|
|
leftEdgeCallback: () => {
|
2023-03-17 06:40:32 +00:00
|
|
|
swipeView.setCurrentIndex(0);
|
|
|
|
|
swipeView.focusChild();
|
|
|
|
|
currentIndex = -1;
|
|
|
|
|
}
|
2022-06-08 22:09:35 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|