2023-10-22 03:59:27 +00:00
|
|
|
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
|
|
|
|
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
|
|
|
|
|
|
import QtQuick 2.12
|
|
|
|
|
import QtQuick.Window 2.12
|
|
|
|
|
import QtQuick.Layouts 1.1
|
|
|
|
|
|
|
|
|
|
import org.kde.plasma.components 3.0 as PC3
|
2023-11-02 11:08:17 +00:00
|
|
|
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
2026-04-09 08:15:14 +00:00
|
|
|
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
|
|
|
|
import org.kde.taskmanager as TaskManager
|
2025-07-16 17:02:18 +00:00
|
|
|
import plasma.applet.org.kde.plasma.mobile.homescreen.folio as Folio
|
2023-11-02 11:08:17 +00:00
|
|
|
import org.kde.plasma.private.mobileshell as MobileShell
|
2026-03-07 03:08:07 +00:00
|
|
|
import org.kde.kirigami as Kirigami
|
2026-04-09 08:15:14 +00:00
|
|
|
import QtQuick.Controls as Controls
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2024-03-06 14:19:03 +00:00
|
|
|
import "./private"
|
2023-10-22 03:59:27 +00:00
|
|
|
import "./delegate"
|
|
|
|
|
|
2023-10-22 17:55:04 +00:00
|
|
|
MouseArea {
|
2023-10-22 03:59:27 +00:00
|
|
|
id: root
|
2024-06-21 04:42:14 +00:00
|
|
|
property Folio.HomeScreen folio
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
property MobileShell.MaskManager maskManager
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
property var homeScreen
|
|
|
|
|
|
|
|
|
|
signal delegateDragRequested(var item)
|
|
|
|
|
|
2026-04-09 08:15:14 +00:00
|
|
|
// Convergence mode: show running apps alongside favourites
|
|
|
|
|
readonly property bool convergenceMode: ShellSettings.Settings.convergenceModeEnabled
|
|
|
|
|
readonly property int totalItemCount: repeater.count + (convergenceMode ? taskRepeater.count : 0)
|
|
|
|
|
|
|
|
|
|
// In convergence mode, size icons to fit the dock bar instead of using page grid cells
|
|
|
|
|
readonly property real dockCellWidth: convergenceMode ? root.height : folio.HomeScreenState.pageCellWidth
|
|
|
|
|
readonly property real dockCellHeight: convergenceMode ? root.height : folio.HomeScreenState.pageCellHeight
|
|
|
|
|
|
|
|
|
|
// Navigation buttons width (used to offset center positioning)
|
|
|
|
|
readonly property real navButtonWidth: convergenceMode ? root.height : 0
|
|
|
|
|
|
|
|
|
|
// Center x for dock items (offset between nav buttons in convergence mode)
|
|
|
|
|
readonly property real dockCenterX: convergenceMode
|
|
|
|
|
? navButtonWidth + (root.width - 2 * navButtonWidth) / 2
|
|
|
|
|
: root.width / 2
|
|
|
|
|
|
|
|
|
|
// Home button (convergence mode, left end)
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: homeButton
|
|
|
|
|
visible: root.convergenceMode
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
width: root.navButtonWidth
|
|
|
|
|
color: "transparent"
|
|
|
|
|
|
|
|
|
|
Kirigami.Icon {
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
width: Math.min(parent.width, parent.height) * 0.75
|
|
|
|
|
height: width
|
|
|
|
|
source: "start-here-kde"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
onClicked: MobileShellState.ShellDBusClient.openHomeScreen()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Overview button (convergence mode, right end)
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: overviewButton
|
|
|
|
|
visible: root.convergenceMode
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
width: root.navButtonWidth
|
|
|
|
|
color: "transparent"
|
|
|
|
|
|
|
|
|
|
Kirigami.Icon {
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
width: Math.min(parent.width, parent.height) * 0.75
|
|
|
|
|
height: width
|
|
|
|
|
source: "view-grid-symbolic"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
onClicked: root.folio.triggerOverview()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TaskManager.VirtualDesktopInfo {
|
|
|
|
|
id: virtualDesktopInfo
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TaskManager.ActivityInfo {
|
|
|
|
|
id: activityInfo
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TaskManager.TasksModel {
|
|
|
|
|
id: tasksModel
|
|
|
|
|
filterByVirtualDesktop: true
|
|
|
|
|
filterByActivity: true
|
|
|
|
|
filterNotMaximized: false
|
|
|
|
|
filterByScreen: true
|
|
|
|
|
filterHidden: true
|
|
|
|
|
virtualDesktop: virtualDesktopInfo.currentDesktop
|
|
|
|
|
activity: activityInfo.currentActivity
|
|
|
|
|
groupMode: TaskManager.TasksModel.GroupDisabled
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-08 17:08:23 +00:00
|
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
|
|
|
|
2025-05-01 09:04:38 +00:00
|
|
|
onPressAndHold: {
|
|
|
|
|
folio.HomeScreenState.openSettingsView();
|
|
|
|
|
haptics.buttonVibrate();
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-08 17:08:23 +00:00
|
|
|
onClicked: (mouse) => {
|
|
|
|
|
// Right-click opens settings view (wallpaper/widgets), same as long-press
|
|
|
|
|
if (mouse.button === Qt.RightButton) {
|
|
|
|
|
folio.HomeScreenState.openSettingsView();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-27 04:14:26 +00:00
|
|
|
onDoubleClicked: {
|
|
|
|
|
if (folio.FolioSettings.doubleTapToLock) {
|
|
|
|
|
deviceLock.triggerLock();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-11 20:04:35 +00:00
|
|
|
onActiveFocusChanged: {
|
|
|
|
|
if (activeFocus) {
|
|
|
|
|
// Focus on first delegate when favorites bar focused
|
|
|
|
|
let firstDelegate = repeater.itemAt(0);
|
|
|
|
|
if (!firstDelegate) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
firstDelegate.keyboardFocus();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-01 09:04:38 +00:00
|
|
|
MobileShell.HapticsEffect {
|
|
|
|
|
id: haptics
|
|
|
|
|
}
|
2023-10-22 17:55:04 +00:00
|
|
|
|
2025-06-27 04:14:26 +00:00
|
|
|
MobileShell.DeviceLock {
|
|
|
|
|
id: deviceLock
|
2025-06-25 20:39:36 +00:00
|
|
|
}
|
|
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
Repeater {
|
2024-11-07 05:17:57 +00:00
|
|
|
id: repeater
|
2024-06-21 04:42:14 +00:00
|
|
|
model: folio.FavouritesModel
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
delegate: Item {
|
|
|
|
|
id: delegate
|
|
|
|
|
|
2024-11-07 05:17:57 +00:00
|
|
|
readonly property var delegateModel: model.delegate
|
|
|
|
|
readonly property int index: model.index
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2024-11-07 05:17:57 +00:00
|
|
|
readonly property var dragState: folio.HomeScreenState.dragState
|
|
|
|
|
readonly property bool isDropPositionThis: dragState.candidateDropPosition.location === Folio.DelegateDragPosition.Favourites &&
|
2025-08-11 20:04:35 +00:00
|
|
|
dragState.candidateDropPosition.favouritesPosition === delegate.index
|
2025-12-12 05:33:25 +00:00
|
|
|
readonly property bool isAppHoveredOver: folio.HomeScreenState.isDraggingDelegate &&
|
2025-08-11 20:04:35 +00:00
|
|
|
dragState.dropDelegate &&
|
|
|
|
|
dragState.dropDelegate.type === Folio.FolioDelegate.Application &&
|
|
|
|
|
isDropPositionThis
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2024-11-07 05:17:57 +00:00
|
|
|
readonly property bool isLocationBottom: folio.HomeScreenState.favouritesBarLocation === Folio.HomeScreenState.Bottom
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2024-11-07 05:17:57 +00:00
|
|
|
// get the normalized index position value from the center so we can animate it
|
2026-04-09 08:15:14 +00:00
|
|
|
property double fromCenterValue: model.index - (root.totalItemCount / 2)
|
2024-11-07 05:17:57 +00:00
|
|
|
Behavior on fromCenterValue {
|
2025-09-11 14:13:26 +00:00
|
|
|
NumberAnimation { duration: Kirigami.Units.longDuration; easing.type: Easing.InOutQuad; }
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
|
2024-11-07 05:17:57 +00:00
|
|
|
// multiply the 'fromCenterValue' by the cell size to get the actual position
|
2026-04-09 08:15:14 +00:00
|
|
|
readonly property int centerPosition: (isLocationBottom ? root.dockCellWidth : root.dockCellHeight) * fromCenterValue
|
2024-11-07 05:17:57 +00:00
|
|
|
|
2026-04-09 08:15:14 +00:00
|
|
|
x: isLocationBottom ? centerPosition + root.dockCenterX : (parent.width - width) / 2
|
|
|
|
|
y: isLocationBottom ? (parent.height - height) / 2 : parent.height / 2 - centerPosition - root.dockCellHeight
|
2024-11-07 05:17:57 +00:00
|
|
|
|
2026-04-09 08:15:14 +00:00
|
|
|
implicitWidth: root.dockCellWidth
|
|
|
|
|
implicitHeight: root.dockCellHeight
|
|
|
|
|
width: root.dockCellWidth
|
|
|
|
|
height: root.dockCellHeight
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2025-08-11 20:04:35 +00:00
|
|
|
// Keyboard navigation to other delegates
|
|
|
|
|
Keys.onPressed: (event) => {
|
|
|
|
|
switch (event.key) {
|
|
|
|
|
case Qt.Key_Up:
|
|
|
|
|
if (!isLocationBottom) {
|
|
|
|
|
let nextDelegate = repeater.itemAt(delegate.index - 1);
|
|
|
|
|
if (nextDelegate) {
|
|
|
|
|
nextDelegate.keyboardFocus();
|
|
|
|
|
event.accepted = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case Qt.Key_Down:
|
|
|
|
|
if (!isLocationBottom) {
|
|
|
|
|
let nextDelegate = repeater.itemAt(delegate.index + 1);
|
|
|
|
|
if (nextDelegate) {
|
|
|
|
|
nextDelegate.keyboardFocus();
|
|
|
|
|
event.accepted = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case Qt.Key_Left:
|
|
|
|
|
if (isLocationBottom) {
|
|
|
|
|
let nextDelegate = repeater.itemAt(delegate.index - 1);
|
|
|
|
|
if (nextDelegate) {
|
|
|
|
|
nextDelegate.keyboardFocus();
|
|
|
|
|
event.accepted = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case Qt.Key_Right:
|
|
|
|
|
if (isLocationBottom) {
|
|
|
|
|
let nextDelegate = repeater.itemAt(delegate.index + 1);
|
|
|
|
|
if (nextDelegate) {
|
|
|
|
|
nextDelegate.keyboardFocus();
|
|
|
|
|
event.accepted = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function keyboardFocus() {
|
|
|
|
|
if (loader.item) {
|
|
|
|
|
loader.item.keyboardFocus();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
Loader {
|
2025-08-11 20:04:35 +00:00
|
|
|
id: loader
|
2023-10-22 03:59:27 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
|
|
sourceComponent: {
|
|
|
|
|
if (delegate.delegateModel.type === Folio.FolioDelegate.Application) {
|
|
|
|
|
return appComponent;
|
|
|
|
|
} else if (delegate.delegateModel.type === Folio.FolioDelegate.Folder) {
|
|
|
|
|
return folderComponent;
|
|
|
|
|
} else {
|
|
|
|
|
// ghost entry
|
|
|
|
|
return placeholderComponent;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: placeholderComponent
|
|
|
|
|
|
2025-03-19 19:38:35 +00:00
|
|
|
// square that shows when hovering over a spot to drop a delegate on (ghost entry)
|
|
|
|
|
PlaceholderDelegate {
|
|
|
|
|
id: dragDropFeedback
|
|
|
|
|
folio: root.folio
|
2026-04-09 08:15:14 +00:00
|
|
|
width: root.dockCellWidth
|
|
|
|
|
height: root.dockCellHeight
|
2025-03-19 19:38:35 +00:00
|
|
|
}
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: appComponent
|
|
|
|
|
|
|
|
|
|
AppDelegate {
|
|
|
|
|
id: appDelegate
|
2024-06-21 04:42:14 +00:00
|
|
|
folio: root.folio
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
maskManager: root.maskManager
|
2023-10-22 03:59:27 +00:00
|
|
|
application: delegate.delegateModel.application
|
2024-06-21 04:42:14 +00:00
|
|
|
name: folio.FolioSettings.showFavouritesAppLabels ? delegate.delegateModel.application.name : ""
|
2023-10-22 03:59:27 +00:00
|
|
|
shadow: true
|
|
|
|
|
|
|
|
|
|
turnToFolder: delegate.isAppHoveredOver
|
2025-12-12 05:33:25 +00:00
|
|
|
turnToFolderAnimEnabled: folio.HomeScreenState.isDraggingDelegate
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
// do not show if the drop animation is running to this delegate
|
|
|
|
|
visible: !(root.homeScreen.dropAnimationRunning && delegate.isDropPositionThis)
|
|
|
|
|
|
|
|
|
|
// don't show label in drag and drop mode
|
|
|
|
|
labelOpacity: delegate.opacity
|
|
|
|
|
|
|
|
|
|
onPressAndHold: {
|
2025-04-21 14:01:54 +00:00
|
|
|
// prevent editing if lock layout is enabled
|
|
|
|
|
if (folio.FolioSettings.lockLayout) return;
|
|
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
let mappedCoords = root.homeScreen.prepareStartDelegateDrag(delegate.delegateModel, appDelegate.delegateItem);
|
2024-06-23 18:21:16 +00:00
|
|
|
folio.HomeScreenState.startDelegateFavouritesDrag(
|
2023-10-22 03:59:27 +00:00
|
|
|
mappedCoords.x,
|
|
|
|
|
mappedCoords.y,
|
2023-11-05 05:14:39 +00:00
|
|
|
appDelegate.pressPosition.x,
|
|
|
|
|
appDelegate.pressPosition.y,
|
2023-10-22 03:59:27 +00:00
|
|
|
delegate.index
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
contextMenu.open();
|
2025-05-01 09:04:38 +00:00
|
|
|
haptics.buttonVibrate();
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPressAndHoldReleased: {
|
|
|
|
|
// cancel the event if the delegate is not dragged
|
2024-06-21 04:42:14 +00:00
|
|
|
if (folio.HomeScreenState.swipeState === Folio.HomeScreenState.AwaitingDraggingDelegate) {
|
2023-10-22 03:59:27 +00:00
|
|
|
homeScreen.cancelDelegateDrag();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onRightMousePress: {
|
|
|
|
|
contextMenu.open();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContextMenuLoader {
|
|
|
|
|
id: contextMenu
|
|
|
|
|
|
|
|
|
|
// close menu when drag starts
|
|
|
|
|
Connections {
|
2024-06-21 04:42:14 +00:00
|
|
|
target: folio.HomeScreenState
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2025-12-12 05:33:25 +00:00
|
|
|
function onDelegateDragStarted() {
|
|
|
|
|
contextMenu.close();
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actions: [
|
|
|
|
|
Kirigami.Action {
|
|
|
|
|
icon.name: "emblem-favorite"
|
|
|
|
|
text: i18n("Remove")
|
2025-04-21 14:01:54 +00:00
|
|
|
enabled: !folio.FolioSettings.lockLayout
|
2024-06-21 04:42:14 +00:00
|
|
|
onTriggered: folio.FavouritesModel.removeEntry(delegate.index)
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: folderComponent
|
|
|
|
|
|
|
|
|
|
AppFolderDelegate {
|
|
|
|
|
id: appFolderDelegate
|
2024-06-21 04:42:14 +00:00
|
|
|
folio: root.folio
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
maskManager: root.maskManager
|
2023-10-22 03:59:27 +00:00
|
|
|
shadow: true
|
|
|
|
|
folder: delegate.delegateModel.folder
|
2024-06-21 04:42:14 +00:00
|
|
|
name: folio.FolioSettings.showFavouritesAppLabels ? delegate.delegateModel.folder.name : ""
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
// do not show if the drop animation is running to this delegate, and the drop delegate is a folder
|
|
|
|
|
visible: !(root.homeScreen.dropAnimationRunning &&
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
delegate.isDropPositionThis &&
|
|
|
|
|
delegate.dragState.dropDelegate.type === Folio.FolioDelegate.Folder)
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
appHoveredOver: delegate.isAppHoveredOver
|
|
|
|
|
|
|
|
|
|
// don't show label in drag and drop mode
|
|
|
|
|
labelOpacity: delegate.opacity
|
|
|
|
|
|
|
|
|
|
onAfterClickAnimation: {
|
|
|
|
|
const pos = homeScreen.prepareFolderOpen(appFolderDelegate.contentItem);
|
2024-06-21 04:42:14 +00:00
|
|
|
folio.HomeScreenState.openFolder(pos.x, pos.y, delegate.delegateModel.folder);
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPressAndHold: {
|
|
|
|
|
let mappedCoords = root.homeScreen.prepareStartDelegateDrag(delegate.delegateModel, appFolderDelegate.delegateItem);
|
2024-06-21 04:42:14 +00:00
|
|
|
folio.HomeScreenState.startDelegateFavouritesDrag(
|
2023-10-22 03:59:27 +00:00
|
|
|
mappedCoords.x,
|
|
|
|
|
mappedCoords.y,
|
2023-11-05 05:14:39 +00:00
|
|
|
appFolderDelegate.pressPosition.x,
|
|
|
|
|
appFolderDelegate.pressPosition.y,
|
2023-10-22 03:59:27 +00:00
|
|
|
delegate.index
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
contextMenu.open();
|
2025-05-01 09:04:38 +00:00
|
|
|
haptics.buttonVibrate();
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPressAndHoldReleased: {
|
|
|
|
|
// cancel the event if the delegate is not dragged
|
2024-06-21 04:42:14 +00:00
|
|
|
if (folio.HomeScreenState.swipeState === Folio.HomeScreenState.AwaitingDraggingDelegate) {
|
2023-10-22 03:59:27 +00:00
|
|
|
root.homeScreen.cancelDelegateDrag();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onRightMousePress: {
|
|
|
|
|
contextMenu.open();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContextMenuLoader {
|
|
|
|
|
id: contextMenu
|
|
|
|
|
|
|
|
|
|
// close menu when drag starts
|
|
|
|
|
Connections {
|
2024-06-21 04:42:14 +00:00
|
|
|
target: folio.HomeScreenState
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2025-12-12 05:33:25 +00:00
|
|
|
function onDelegateDragStarted() {
|
|
|
|
|
contextMenu.close();
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actions: [
|
|
|
|
|
Kirigami.Action {
|
|
|
|
|
icon.name: "emblem-favorite"
|
|
|
|
|
text: i18n("Remove")
|
2024-03-06 14:19:03 +00:00
|
|
|
onTriggered: deleteDialog.open()
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
]
|
2024-03-06 14:19:03 +00:00
|
|
|
|
|
|
|
|
ConfirmDeleteFolderDialogLoader {
|
|
|
|
|
id: deleteDialog
|
|
|
|
|
parent: root.homeScreen
|
2024-06-21 04:42:14 +00:00
|
|
|
onAccepted: folio.FavouritesModel.removeEntry(delegate.index)
|
2024-03-06 14:19:03 +00:00
|
|
|
}
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-04-09 08:15:14 +00:00
|
|
|
|
|
|
|
|
// Running-app task icons (convergence mode only)
|
|
|
|
|
Repeater {
|
|
|
|
|
id: taskRepeater
|
|
|
|
|
model: root.convergenceMode ? tasksModel : null
|
|
|
|
|
|
|
|
|
|
delegate: Item {
|
|
|
|
|
id: taskDelegate
|
|
|
|
|
|
|
|
|
|
required property int index
|
|
|
|
|
required property var model
|
|
|
|
|
|
|
|
|
|
readonly property bool isLocationBottom: folio.HomeScreenState.favouritesBarLocation === Folio.HomeScreenState.Bottom
|
|
|
|
|
|
|
|
|
|
// Position after all favourites
|
|
|
|
|
property double fromCenterValue: (repeater.count + taskDelegate.index) - (root.totalItemCount / 2)
|
|
|
|
|
Behavior on fromCenterValue {
|
|
|
|
|
NumberAnimation { duration: Kirigami.Units.longDuration; easing.type: Easing.InOutQuad; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
readonly property int centerPosition: (isLocationBottom ? root.dockCellWidth : root.dockCellHeight) * fromCenterValue
|
|
|
|
|
|
|
|
|
|
x: isLocationBottom ? centerPosition + root.dockCenterX : (parent.width - width) / 2
|
|
|
|
|
y: isLocationBottom ? (parent.height - height) / 2 : parent.height / 2 - centerPosition - root.dockCellHeight
|
|
|
|
|
|
|
|
|
|
implicitWidth: root.dockCellWidth
|
|
|
|
|
implicitHeight: root.dockCellHeight
|
|
|
|
|
width: root.dockCellWidth
|
|
|
|
|
height: root.dockCellHeight
|
|
|
|
|
|
|
|
|
|
// Task icon
|
|
|
|
|
Kirigami.Icon {
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
width: Math.min(parent.width, parent.height) * 0.6
|
|
|
|
|
height: width
|
|
|
|
|
source: taskDelegate.model.decoration
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Active-window indicator dot
|
|
|
|
|
Rectangle {
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
anchors.bottomMargin: Kirigami.Units.smallSpacing / 2
|
|
|
|
|
width: Kirigami.Units.smallSpacing * 2
|
|
|
|
|
height: width
|
|
|
|
|
radius: width / 2
|
|
|
|
|
color: Kirigami.Theme.highlightColor
|
|
|
|
|
visible: taskDelegate.model.IsActive === true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Click to activate
|
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
|
|
|
onClicked: (mouse) => {
|
|
|
|
|
if (mouse.button === Qt.RightButton) {
|
|
|
|
|
taskContextMenu.popup();
|
|
|
|
|
} else {
|
|
|
|
|
tasksModel.requestActivate(tasksModel.makeModelIndex(taskDelegate.index));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Controls.Menu {
|
|
|
|
|
id: taskContextMenu
|
|
|
|
|
Controls.MenuItem {
|
|
|
|
|
text: taskDelegate.model.IsMinimized ? i18n("Restore") : i18n("Minimize")
|
|
|
|
|
icon.name: taskDelegate.model.IsMinimized ? "window-restore" : "window-minimize"
|
|
|
|
|
onTriggered: tasksModel.requestToggleMinimized(tasksModel.makeModelIndex(taskDelegate.index))
|
|
|
|
|
}
|
|
|
|
|
Controls.MenuItem {
|
|
|
|
|
text: taskDelegate.model.IsMaximized ? i18n("Restore") : i18n("Maximize")
|
|
|
|
|
icon.name: taskDelegate.model.IsMaximized ? "window-restore" : "window-maximize"
|
|
|
|
|
onTriggered: tasksModel.requestToggleMaximized(tasksModel.makeModelIndex(taskDelegate.index))
|
|
|
|
|
}
|
|
|
|
|
Controls.MenuSeparator {}
|
|
|
|
|
Controls.MenuItem {
|
|
|
|
|
text: i18n("Close")
|
|
|
|
|
icon.name: "window-close"
|
|
|
|
|
onTriggered: tasksModel.requestClose(tasksModel.makeModelIndex(taskDelegate.index))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|