mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-06-13 09:47:42 +00:00
The eventual goal is to have as few singletons with state as possible in the mobileshell component when it is imported into components such as the lockscreen. This doesn't fully accomplish it, but moves the audio provider singleton to MobileShellState, which will eventually need to be prevented from importing into non plasmashell processes. This also disables the sound feedback when changing volume, since it can be a source of lag when showing the applet.
128 lines
3.6 KiB
QML
128 lines
3.6 KiB
QML
// SPDX-FileCopyrightText: 2022-2023 Devin Lin <devin@kde.org>
|
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
import QtQuick
|
|
import QtQuick.Controls as QQC2
|
|
import QtQuick.Layouts
|
|
import QtQuick.Window
|
|
|
|
import org.kde.plasma.plasmoid
|
|
import org.kde.plasma.core as PlasmaCore
|
|
import org.kde.plasma.extras as PlasmaExtras
|
|
import org.kde.plasma.components 3.0 as PC3
|
|
import org.kde.draganddrop as DragDrop
|
|
|
|
import org.kde.kirigami as Kirigami
|
|
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
|
import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin
|
|
|
|
Item {
|
|
id: root
|
|
|
|
required property real topMargin
|
|
required property real bottomMargin
|
|
required property real leftMargin
|
|
required property real rightMargin
|
|
|
|
required property bool interactive
|
|
required property var searchWidget
|
|
|
|
property alias page: swipeView.currentIndex
|
|
|
|
function triggerHomescreen() {
|
|
swipeView.setCurrentIndex(0);
|
|
swipeView.focusChild();
|
|
favoritesView.closeFolder();
|
|
favoritesView.goToBeginning();
|
|
gridAppList.goToBeginning();
|
|
}
|
|
|
|
function openConfigure() {
|
|
plasmoid.action("configure").trigger();
|
|
plasmoid.editMode = false;
|
|
}
|
|
|
|
Connections {
|
|
target: MobileShellState.HomeScreenControls
|
|
|
|
function onHomeScreenVisibleChanged(){
|
|
if (WindowPlugin.WindowUtil.allWindowsMinimized) {
|
|
swipeView.focusChild();
|
|
}
|
|
}
|
|
}
|
|
|
|
QQC2.SwipeView {
|
|
id: swipeView
|
|
opacity: 1 - searchWidget.openFactor
|
|
interactive: root.interactive
|
|
|
|
anchors.fill: parent
|
|
anchors.topMargin: root.topMargin
|
|
anchors.bottomMargin: root.bottomMargin
|
|
anchors.leftMargin: root.leftMargin
|
|
anchors.rightMargin: root.rightMargin
|
|
|
|
function focusChild() {
|
|
currentItem.focusRequested();
|
|
}
|
|
|
|
onCurrentIndexChanged: focusChild()
|
|
|
|
Item {
|
|
height: swipeView.height
|
|
width: swipeView.width
|
|
|
|
signal focusRequested()
|
|
|
|
// open wallpaper menu when held on click
|
|
TapHandler {
|
|
onPressedChanged: {
|
|
if (pressed) {
|
|
favoritesView.resetHighlight();
|
|
}
|
|
}
|
|
|
|
onLongPressed: root.openConfigure()
|
|
}
|
|
|
|
FavoritesView {
|
|
id: favoritesView
|
|
anchors.fill: parent
|
|
searchWidget: root.searchWidget
|
|
interactive: root.interactive
|
|
onOpenConfigureRequested: root.openConfigure()
|
|
|
|
onPageForwardRequested: {
|
|
swipeView.setCurrentIndex(1);
|
|
swipeView.focusChild();
|
|
resetHighlight();
|
|
}
|
|
}
|
|
}
|
|
|
|
Item {
|
|
width: swipeView.width
|
|
height: swipeView.height
|
|
|
|
signal focusRequested()
|
|
|
|
GridAppList {
|
|
id: gridAppList
|
|
|
|
anchors.fill: parent
|
|
|
|
property int horizontalMargin: Math.round(swipeView.width * 0.05)
|
|
interactive: root.interactive
|
|
leftMargin: horizontalMargin
|
|
rightMargin: horizontalMargin
|
|
|
|
leftEdgeCallback: () => {
|
|
swipeView.setCurrentIndex(0);
|
|
swipeView.focusChild();
|
|
currentIndex = -1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|