Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use proper dock DnD MIME data #449

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions qml/FolderGridViewPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,7 @@ Popup {
anchors.fill: parent
dndEnabled: true
displayFont: isWindowedMode ? DTK.fontManager.t9 : DTK.fontManager.t6
Drag.mimeData: {
"text/x-dde-launcher-dnd-desktopId": model.desktopId
}
Drag.mimeData: Helper.generateDragMimeData(model.desktopId)
visible: dndItem.currentlyDraggedId !== model.desktopId
iconSource: iconName

Expand Down
4 changes: 1 addition & 3 deletions qml/FullscreenFrame.qml
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,7 @@ InputEventItem {
margins: 5
}
dndEnabled: !folderGridViewPopup.opened
Drag.mimeData: {
"text/x-dde-launcher-dnd-desktopId": model.desktopId
}
Drag.mimeData: Helper.generateDragMimeData(model.desktopId)
visible: dndItem.currentlyDraggedId !== model.desktopId
iconSource: (iconName && iconName !== "") ? iconName : "application-x-desktop"
icons: folderIcons
Expand Down
10 changes: 10 additions & 0 deletions qml/Helper.qml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,14 @@ QtObject {
crystal: itemBackgroundColor.hoveredDarkColor
}
}

function generateDragMimeData(desktopId) {
// In some cases an app is not allowed to be pinned onto dock via drag-n-drop;
// We only insert the MIME data for dde-dock in those allowed cases.
var mime = { "text/x-dde-launcher-dnd-desktopId": desktopId }
if (!DesktopIntegration.appIsDummyPackage(desktopId)) {
mime["text/x-dde-dock-dnd-appid"] = desktopId
}
return mime
}
}
4 changes: 1 addition & 3 deletions qml/windowed/FreeSortListView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@ Item {
Drag.hotSpot.y: height / 2
Drag.dragType: Drag.Automatic
Drag.active: mouseArea.drag.active
Drag.mimeData: {
"text/x-dde-launcher-dnd-desktopId": model.desktopId
}
Drag.mimeData: Helper.generateDragMimeData(model.desktopId)

background: ItemBackground {
id: bg
Expand Down
Loading