Commit afcf59b0 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[Notifications] When there is no thumbnail available, use file icon as drag pixmap

It's rare but it can happen that thumbnail generation fails, then there would be
no drag pixmap at all while dragging.

For consistency sync the drag pixmap icon size to the actual icon size shown in the view


(cherry picked from commit a98f7834)
parent 5c5b1ca2
Pipeline #205758 passed with stage
in 10 minutes and 56 seconds
......@@ -18,6 +18,7 @@ MouseArea {
property Item dragParent
property url dragUrl
property var dragPixmap
property int dragPixmapSize: PlasmaCore.Units.iconSizes.large
readonly property bool dragging: Notifications.DragHelper.dragActive
......@@ -43,7 +44,7 @@ MouseArea {
}
onPositionChanged: {
if (_pressX !== -1 && _pressY !== -1 && Notifications.DragHelper.isDrag(_pressX, _pressY, mouse.x, mouse.y)) {
Notifications.DragHelper.dragPixmapSize = PlasmaCore.Units.iconSizes.large;
Notifications.DragHelper.dragPixmapSize = area.dragPixmapSize;
Notifications.DragHelper.startDrag(area.dragParent, area.dragUrl, area.dragPixmap);
_pressX = -1;
_pressY = -1;
......
......@@ -44,7 +44,8 @@ DraggableFileArea {
dragParent: previewPixmap
dragUrl: thumbnailer.url
dragPixmap: thumbnailer.pixmap
dragPixmap: thumbnailer.hasPreview ? thumbnailer.pixmap : thumbnailer.iconName
dragPixmapSize: previewIcon.height
implicitHeight: Math.max(thumbnailActionRow.implicitHeight + 2 * thumbnailActionRow.anchors.topMargin,
Math.round(Math.min(width / 3, width / thumbnailer.ratio)))
......@@ -110,6 +111,7 @@ DraggableFileArea {
}
PlasmaCore.IconItem {
id: previewIcon
anchors.centerIn: parent
width: height
height: PlasmaCore.Units.roundToIconSize(parent.height)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment