2015-06-11 22:35:46 +00:00
|
|
|
/*
|
2021-03-01 20:03:25 +00:00
|
|
|
* SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
|
2021-10-18 03:50:59 +00:00
|
|
|
* SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
|
2015-06-11 22:35:46 +00:00
|
|
|
*
|
2021-03-01 20:03:25 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2015-06-11 22:35:46 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import QtQuick 2.4
|
|
|
|
|
import QtQuick.Layouts 1.1
|
2022-02-13 04:23:57 +00:00
|
|
|
import QtQuick.Window 2.15
|
2020-02-05 19:25:52 +00:00
|
|
|
import QtGraphicalEffects 1.12
|
2015-06-11 22:35:46 +00:00
|
|
|
|
2016-06-27 16:34:20 +00:00
|
|
|
import org.kde.taskmanager 0.1 as TaskManager
|
2015-06-11 22:35:46 +00:00
|
|
|
import org.kde.plasma.plasmoid 2.0
|
|
|
|
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
|
|
|
|
import org.kde.kquickcontrolsaddons 2.0
|
|
|
|
|
|
2020-06-26 21:18:04 +00:00
|
|
|
import org.kde.plasma.private.nanoshell 2.0 as NanoShell
|
2020-07-22 15:17:10 +00:00
|
|
|
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
2021-02-24 01:05:41 +00:00
|
|
|
import org.kde.plasma.phone.taskpanel 1.0 as TaskPanel
|
2020-07-22 15:17:10 +00:00
|
|
|
|
2015-06-18 23:31:26 +00:00
|
|
|
PlasmaCore.ColorScope {
|
|
|
|
|
id: root
|
2022-02-13 04:23:57 +00:00
|
|
|
width: 360
|
2021-12-25 03:31:33 +00:00
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
// contrasting colour
|
2022-04-06 21:18:20 +00:00
|
|
|
colorGroup: !MobileShell.WindowUtil.allWindowsMinimized ? PlasmaCore.Theme.NormalColorGroup : PlasmaCore.Theme.ComplementaryColorGroup
|
2019-10-11 09:49:18 +00:00
|
|
|
|
2021-12-29 05:08:32 +00:00
|
|
|
readonly property color backgroundColor: PlasmaCore.ColorScope.backgroundColor
|
2015-09-16 11:35:55 +00:00
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
Plasmoid.backgroundHints: PlasmaCore.Types.NoBackground
|
|
|
|
|
|
|
|
|
|
// toggle visibility of navigation bar (show, or use gestures only)
|
|
|
|
|
Binding {
|
|
|
|
|
target: plasmoid.Window.window // assumed to be plasma-workspace "PanelView" component
|
|
|
|
|
property: "visibilityMode"
|
|
|
|
|
// 0 - VisibilityMode.NormalPanel
|
|
|
|
|
// 3 - VisibilityMode.WindowsGoBelow
|
|
|
|
|
value: MobileShell.MobileShellSettings.navigationPanelEnabled ? 0 : 3
|
|
|
|
|
}
|
2022-04-08 02:08:36 +00:00
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
Binding {
|
|
|
|
|
target: plasmoid.Window.window // assumed to be plasma-workspace "PanelView" component
|
|
|
|
|
property: "thickness"
|
|
|
|
|
// height of panel:
|
|
|
|
|
// - if navigation panel is enabled: PlasmaCore.Units.gridUnit * 2
|
|
|
|
|
// - if gestures only is enabled: 8 (just large enough for touch swipe to register, without blocking app content)
|
|
|
|
|
value: MobileShell.MobileShellSettings.navigationPanelEnabled ? PlasmaCore.Units.gridUnit * 2 : 8
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-08 02:08:36 +00:00
|
|
|
Binding {
|
|
|
|
|
target: plasmoid.Window.window
|
|
|
|
|
property: "location"
|
|
|
|
|
value: {
|
|
|
|
|
if (MobileShell.Shell.orientation === MobileShell.Shell.Portrait) {
|
|
|
|
|
return PlasmaCore.Types.BottomEdge;
|
|
|
|
|
} else if (MobileShell.Shell.orientation === MobileShell.Shell.Landscape) {
|
|
|
|
|
return MobileShell.MobileShellSettings.navigationPanelEnabled ? PlasmaCore.Types.RightEdge : PlasmaCore.Types.BottomEdge
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// HACK: really really really make sure the dimensions are set properly
|
|
|
|
|
function setBindings() {
|
|
|
|
|
plasmoid.Window.window.offset = Qt.binding(() => {
|
|
|
|
|
return (MobileShell.Shell.orientation === MobileShell.Shell.Landscape) ? MobileShell.TopPanelControls.panelHeight : 0;
|
|
|
|
|
});
|
|
|
|
|
plasmoid.Window.window.thickness = Qt.binding(() => {
|
|
|
|
|
return MobileShell.MobileShellSettings.navigationPanelEnabled ? PlasmaCore.Units.gridUnit * 2 : 8
|
|
|
|
|
});
|
|
|
|
|
plasmoid.Window.window.length = Qt.binding(() => {
|
|
|
|
|
return MobileShell.Shell.orientation === MobileShell.Shell.Portrait ? Screen.width : Screen.height;
|
|
|
|
|
});
|
|
|
|
|
plasmoid.Window.window.maximumLength = Qt.binding(() => {
|
|
|
|
|
return MobileShell.Shell.orientation === MobileShell.Shell.Portrait ? Screen.width : Screen.height;
|
|
|
|
|
});
|
|
|
|
|
plasmoid.Window.window.minimumLength = Qt.binding(() => {
|
|
|
|
|
return MobileShell.Shell.orientation === MobileShell.Shell.Portrait ? Screen.width : Screen.height;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
|
target: plasmoid.Window.window
|
|
|
|
|
function onThicknessChanged() {
|
|
|
|
|
root.setBindings();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component.onCompleted: setBindings();
|
|
|
|
|
|
2021-12-25 03:31:33 +00:00
|
|
|
//BEGIN API implementation
|
2020-07-22 12:22:10 +00:00
|
|
|
|
2021-12-25 03:31:33 +00:00
|
|
|
Binding {
|
|
|
|
|
target: MobileShell.TaskPanelControls
|
|
|
|
|
property: "isPortrait"
|
|
|
|
|
value: Screen.width <= Screen.height
|
2020-07-22 12:22:10 +00:00
|
|
|
}
|
2021-12-25 03:31:33 +00:00
|
|
|
Binding {
|
|
|
|
|
target: MobileShell.TaskPanelControls
|
|
|
|
|
property: "panelHeight"
|
2022-02-13 04:23:57 +00:00
|
|
|
value: MobileShell.MobileShellSettings.navigationPanelEnabled ? root.height : 0
|
2021-12-25 03:31:33 +00:00
|
|
|
}
|
|
|
|
|
Binding {
|
|
|
|
|
target: MobileShell.TaskPanelControls
|
|
|
|
|
property: "panelWidth"
|
2022-02-13 04:23:57 +00:00
|
|
|
value: MobileShell.MobileShellSettings.navigationPanelEnabled ? root.width : 0
|
2021-10-31 04:11:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Connections {
|
2022-04-06 21:18:20 +00:00
|
|
|
target: MobileShell.WindowUtil
|
|
|
|
|
function onAllWindowsMinimizedChanged() {
|
|
|
|
|
MobileShell.HomeScreenControls.homeScreenVisible = MobileShell.WindowUtil.allWindowsMinimized
|
2021-10-31 04:11:10 +00:00
|
|
|
}
|
|
|
|
|
}
|
2022-02-13 04:23:57 +00:00
|
|
|
|
|
|
|
|
//END API implementation
|
2021-10-31 04:11:10 +00:00
|
|
|
|
|
|
|
|
Window.onWindowChanged: {
|
2022-04-08 02:08:36 +00:00
|
|
|
if (!Window.window) {
|
2021-10-31 04:11:10 +00:00
|
|
|
return;
|
2022-04-08 02:08:36 +00:00
|
|
|
}
|
2021-10-31 04:11:10 +00:00
|
|
|
}
|
2021-12-25 05:11:28 +00:00
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
// bottom navigation panel component
|
|
|
|
|
Component {
|
|
|
|
|
id: navigationPanel
|
|
|
|
|
NavigationPanelComponent {
|
|
|
|
|
taskSwitcher: MobileShell.HomeScreenControls.taskSwitcher
|
2021-12-25 05:11:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
// bottom navigation gesture area component
|
|
|
|
|
Component {
|
|
|
|
|
id: navigationGesture
|
|
|
|
|
MobileShell.NavigationGestureArea {
|
|
|
|
|
taskSwitcher: MobileShell.HomeScreenControls.taskSwitcher
|
2021-12-25 05:11:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
// load appropriate system navigation component
|
|
|
|
|
Loader {
|
|
|
|
|
id: navigationLoader
|
2021-10-31 04:11:10 +00:00
|
|
|
anchors.fill: parent
|
2022-02-13 04:23:57 +00:00
|
|
|
sourceComponent: MobileShell.MobileShellSettings.navigationPanelEnabled ? navigationPanel : navigationGesture
|
2015-06-11 22:35:46 +00:00
|
|
|
}
|
2015-06-12 22:18:24 +00:00
|
|
|
}
|