Skip to content

Commit b1b6f8b

Browse files
authored
fix: plugin docked into tray area (#1007)
Dragged the plugin from the quick panel, but it was not dropped into the tray area; instead, it was docked into the tray area as title Log: as title pms: BUG-284079
1 parent 19281d9 commit b1b6f8b

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

panels/dock/tray/package/TrayContainer.qml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,15 @@ Item {
141141
id: dropArea
142142
anchors.fill: parent
143143
keys: ["text/x-dde-shell-tray-dnd-surfaceId"]
144+
property bool isDropped: false
145+
property bool dragExited: false
146+
property string source: ""
147+
property string surfaceId: ""
144148
onEntered: function (dragEvent) {
145-
let surfaceId = dragEvent.getDataAsString("text/x-dde-shell-tray-dnd-surfaceId")
146-
let source = dragEvent.getDataAsString("text/x-dde-shell-tray-dnd-source")
149+
dragExited = false
150+
isDropped = false
151+
surfaceId = dragEvent.getDataAsString("text/x-dde-shell-tray-dnd-surfaceId")
152+
source = dragEvent.getDataAsString("text/x-dde-shell-tray-dnd-source")
147153
console.log(surfaceId, source)
148154
if (source !== "" && DDT.TraySortOrderModel.isDisplayedSurface(surfaceId)) {
149155
dragEvent.accepted = false
@@ -164,6 +170,7 @@ Item {
164170
if (!isStash) {
165171
if (dropHoverIndex !== 0) {
166172
dropTrayTimer.handleDrop = function() {
173+
if (isDropped || dragExited) return
167174
DDT.TraySortOrderModel.dropToDockTray(surfaceId, Math.floor(currentItemIndex), isBefore)
168175
}
169176
dropTrayTimer.start()
@@ -173,6 +180,7 @@ Item {
173180
}
174181
}
175182
onDropped: function (dropEvent) {
183+
isDropped = true
176184
let surfaceId = dropEvent.getDataAsString("text/x-dde-shell-tray-dnd-surfaceId")
177185
let dropIdx = DDT.TrayItemPositionManager.itemIndexByPoint(Qt.point(drag.x, drag.y))
178186
let currentItemIndex = dropIdx.index
@@ -182,6 +190,15 @@ Item {
182190
DDT.TraySortOrderModel.actionsAlwaysVisible = false
183191
}
184192

193+
onExited: function () {
194+
dragExited = true
195+
// dragging from quickPanel, entered trayContainer, but not dropped in this area
196+
if (source !== "" && !isDropped) {
197+
dropTrayTimer.stop()
198+
DDT.TraySortOrderModel.setSurfaceVisible(surfaceId, false)
199+
}
200+
}
201+
185202
Timer {
186203
id: dropTrayTimer
187204
interval: 50

0 commit comments

Comments
 (0)