Skip to content

Commit 190355c

Browse files
wjyrichBLumia
authored andcommitted
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
1 parent 63e810c commit 190355c

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

qml/FolderGridViewPopup.qml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,72 @@ Popup {
144144
Layout.fillWidth: true
145145
Layout.fillHeight: true
146146
color: "transparent"
147+
148+
DropArea {
149+
id: folderPageDropArea
150+
property int pageIntent: 0
151+
readonly property real paddingColumns: 0.3
152+
readonly property int horizontalPadding: contentRoot.width * paddingColumns
153+
anchors.fill: parent
154+
155+
156+
function checkDragMove() {
157+
if (drag.x < horizontalPadding) {
158+
pageIntent = -1
159+
} else if (drag.x > (width - horizontalPadding)) {
160+
let isLastPage = folderPagesView.currentIndex === folderPagesView.count - 1
161+
if (isLastPage) {
162+
return
163+
}
164+
pageIntent = 1
165+
} else {
166+
pageIntent = 0
167+
}
168+
}
169+
170+
keys: ["text/x-dde-launcher-dnd-desktopId"]
171+
onPositionChanged: {
172+
checkDragMove()
173+
}
174+
onDropped: (drop) => {
175+
// drop over the left or right boundary of the page, do nothing
176+
if (pageIntent !== 0) {
177+
pageIntent = 0
178+
return
179+
}
180+
// drop into current page
181+
let dragId = drop.getDataAsString("text/x-dde-launcher-dnd-desktopId")
182+
dropOnPage(dragId, "internal/folders/" + folderLoader.currentFolderId, folderPagesView.currentIndex)
183+
pageIntent = 0
184+
}
185+
onExited: {
186+
pageIntent = 0
187+
}
188+
onPageIntentChanged: {
189+
if (pageIntent !== 0) {
190+
folderDndMovePageTimer.restart()
191+
} else {
192+
folderDndMovePageTimer.stop()
193+
}
194+
}
195+
196+
Timer {
197+
id: folderDndMovePageTimer
198+
interval: 1000
199+
onTriggered: {
200+
if (parent.pageIntent > 0) {
201+
incrementPageIndex(folderPagesView)
202+
} else if (parent.pageIntent < 0) {
203+
decrementPageIndex(folderPagesView)
204+
}
205+
parent.pageIntent = 0
206+
if (folderPagesView.currentIndex !== 0) {
207+
parent.checkDragMove()
208+
}
209+
}
210+
}
211+
}
212+
147213
MouseArea {
148214
anchors.fill: parent
149215
scrollGestureEnabled: false

0 commit comments

Comments
 (0)