From 9741e71001b004e914fd1398783d6e68901cf895 Mon Sep 17 00:00:00 2001 From: wjyrich <1071633242@qq.com> Date: Wed, 30 Apr 2025 11:52:47 +0800 Subject: [PATCH] feat: add Apps winthin folder are dragged across pages. Open the launcher app folder, drag the app icon on the first page to the right, leave the folder boundary (hide boundary), and drag across pages in the folder pms-bug-288691 --- qml/FolderGridViewPopup.qml | 66 +++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/qml/FolderGridViewPopup.qml b/qml/FolderGridViewPopup.qml index 0dd6f561..822eec6e 100644 --- a/qml/FolderGridViewPopup.qml +++ b/qml/FolderGridViewPopup.qml @@ -144,6 +144,72 @@ Popup { Layout.fillWidth: true Layout.fillHeight: true color: "transparent" + + DropArea { + id: folderPageDropArea + property int pageIntent: 0 + readonly property real paddingColumns: 0.3 + readonly property int horizontalPadding: contentRoot.width * paddingColumns + anchors.fill: parent + + + function checkDragMove() { + if (drag.x < horizontalPadding) { + pageIntent = -1 + } else if (drag.x > (width - horizontalPadding)) { + let isLastPage = folderPagesView.currentIndex === folderPagesView.count - 1 + if (isLastPage) { + return + } + pageIntent = 1 + } else { + pageIntent = 0 + } + } + + keys: ["text/x-dde-launcher-dnd-desktopId"] + onPositionChanged: { + checkDragMove() + } + onDropped: (drop) => { + // drop over the left or right boundary of the page, do nothing + if (pageIntent !== 0) { + pageIntent = 0 + return + } + // drop into current page + let dragId = drop.getDataAsString("text/x-dde-launcher-dnd-desktopId") + dropOnPage(dragId, "internal/folders/" + folderLoader.currentFolderId, folderPagesView.currentIndex) + pageIntent = 0 + } + onExited: { + pageIntent = 0 + } + onPageIntentChanged: { + if (pageIntent !== 0) { + folderDndMovePageTimer.restart() + } else { + folderDndMovePageTimer.stop() + } + } + + Timer { + id: folderDndMovePageTimer + interval: 1000 + onTriggered: { + if (parent.pageIntent > 0) { + incrementPageIndex(folderPagesView) + } else if (parent.pageIntent < 0) { + decrementPageIndex(folderPagesView) + } + parent.pageIntent = 0 + if (folderPagesView.currentIndex !== 0) { + parent.checkDragMove() + } + } + } + } + MouseArea { anchors.fill: parent scrollGestureEnabled: false