Fixes incorrect behaviour when using SevenTasks while it is configured to sort tasks manually.

Expected behaviour:

1. Dragging pinned tasks around should update their position correctly and keep that position permanently
2. Dragging items that are NOT tasks should focus the task that is being hovered over for easier drag and drop functionality

Actual behaviour:

1. Dragging pinned tasks around seemingly works, until the task manager is updated in any kind of way, at which point the positions are reverted back to the original state.
2. Dragging items that aren't tasks will only focus the hovered task if previous dragging actions didn't occur between two or more tasks. After that, trying to drag items onto the taskbar will cause the task that was dragged last time to move around according to the mouse's position.
このコミットが含まれているのは:
wackyideas 2022-09-12 20:37:06 +02:00
コミット 165fa81da4
7個のファイルの変更38行の追加14行の削除

バイナリファイルは表示されません。

バイナリファイルは表示されません。

ファイルの表示

@ -18,6 +18,7 @@ Item {
property Item target
property Item ignoredItem
property bool moved: false
property bool isGroupDialog: false
property alias hoveredItem: dropHandler.hoveredItem
property alias handleWheelEvents: wheelHandler.active
@ -65,12 +66,17 @@ Item {
return;
}
var above = target.childAt(event.x, event.y);
//var above = target.childAt(event.x, event.y);
let above;
if (isGroupDialog) {
above = target.itemAt(event.x, event.y);
} else {
above = target.childAt(event.x, event.y);
}
if (!above) {
hoveredItem = null;
activationTimer.stop();
return;
}
@ -101,9 +107,9 @@ Item {
var insertAt = TaskTools.insertIndexAt(above, event.x, event.y);
if (tasks.dragSource !== above && tasks.dragSource.itemIndex !== insertAt) {
if (groupDialog.visible && groupDialog.visualParent) {
if (!!tasks.groupDialog) {
tasksModel.move(tasks.dragSource.itemIndex, insertAt,
tasksModel.makeModelIndex(groupDialog.visualParent.itemIndex));
tasksModel.makeModelIndex(tasks.groupDialog.visualParent.itemIndex));
} else {
tasksModel.move(tasks.dragSource.itemIndex, insertAt);
}
@ -115,6 +121,7 @@ Item {
hoveredItem = above;
activationTimer.restart();
}
tasksModel.syncLaunchers();
}
onDragLeave: {

ファイルの表示

@ -151,9 +151,10 @@ MouseArea {
}
} else {
pressed = false;
//if(!ma.pressed) tasks.dragSource = null;
}
hoverEnabled = true;
}
onPressed: {
@ -216,13 +217,14 @@ MouseArea {
pressX = -1;
pressY = -1;
hoverEnabled = true;
}
onPressAndHold: {
}
onPositionChanged: { //hoverEnabled: true, but this event still doesn't fire at all
//unless i am pressing the left mouse button for a short period of time
if (pressX != -1 && mouse.buttons == Qt.LeftButton && dragHelper.isDrag(pressX, pressY, mouse.x, mouse.y)) {
if (pressX != -1 && mouse.buttons == Qt.LeftButton && dragHelper.isDrag(pressX, pressY, mouse.x, mouse.y)) {
tasks.dragSource = task;
dragHelper.startDrag(task, model.MimeType, model.MimeData,
@ -231,6 +233,10 @@ MouseArea {
pressY = -1;
return;
}
else
{
tasks.dragSource = null;
}
//code for dragging the task around

ファイルの表示

@ -23,8 +23,6 @@
/usr/share/plasma/plasmoids/org.kde.plasma.seventasks/contents/ui/ToolTipInstance.qml
/usr/share/plasma/plasmoids/org.kde.plasma.seventasks/contents/ui/ToolTipWindowMouseArea.qml
/usr/share/plasma/plasmoids/org.kde.plasma.seventasks/contents/ui/main.qml
/usr/share/plasma/plasmoids/org.kde.plasma.seventasks/contents/ui/MenuBackend.qml
/usr/share/plasma/plasmoids/org.kde.plasma.seventasks/contents/ui/ContextMenuBackend.qml
/usr/share/plasma/plasmoids/org.kde.plasma.seventasks/metadata.desktop
/usr/share/plasma/plasmoids/org.kde.plasma.seventasks/metadata.json
/usr/share/metainfo/org.kde.plasma.seventasks.appdata.xml

ファイルの表示

@ -18,6 +18,7 @@ Item {
property Item target
property Item ignoredItem
property bool moved: false
property bool isGroupDialog: false
property alias hoveredItem: dropHandler.hoveredItem
property alias handleWheelEvents: wheelHandler.active
@ -65,12 +66,17 @@ Item {
return;
}
var above = target.childAt(event.x, event.y);
//var above = target.childAt(event.x, event.y);
let above;
if (isGroupDialog) {
above = target.itemAt(event.x, event.y);
} else {
above = target.childAt(event.x, event.y);
}
if (!above) {
hoveredItem = null;
activationTimer.stop();
return;
}
@ -101,9 +107,9 @@ Item {
var insertAt = TaskTools.insertIndexAt(above, event.x, event.y);
if (tasks.dragSource !== above && tasks.dragSource.itemIndex !== insertAt) {
if (groupDialog.visible && groupDialog.visualParent) {
if (!!tasks.groupDialog) {
tasksModel.move(tasks.dragSource.itemIndex, insertAt,
tasksModel.makeModelIndex(groupDialog.visualParent.itemIndex));
tasksModel.makeModelIndex(tasks.groupDialog.visualParent.itemIndex));
} else {
tasksModel.move(tasks.dragSource.itemIndex, insertAt);
}
@ -115,6 +121,7 @@ Item {
hoveredItem = above;
activationTimer.restart();
}
tasksModel.syncLaunchers();
}
onDragLeave: {

ファイルの表示

@ -151,9 +151,10 @@ MouseArea {
}
} else {
pressed = false;
//if(!ma.pressed) tasks.dragSource = null;
}
hoverEnabled = true;
}
onPressed: {
@ -216,13 +217,14 @@ MouseArea {
pressX = -1;
pressY = -1;
hoverEnabled = true;
}
onPressAndHold: {
}
onPositionChanged: { //hoverEnabled: true, but this event still doesn't fire at all
//unless i am pressing the left mouse button for a short period of time
if (pressX != -1 && mouse.buttons == Qt.LeftButton && dragHelper.isDrag(pressX, pressY, mouse.x, mouse.y)) {
if (pressX != -1 && mouse.buttons == Qt.LeftButton && dragHelper.isDrag(pressX, pressY, mouse.x, mouse.y)) {
tasks.dragSource = task;
dragHelper.startDrag(task, model.MimeType, model.MimeData,
@ -231,6 +233,10 @@ MouseArea {
pressY = -1;
return;
}
else
{
tasks.dragSource = null;
}
//code for dragging the task around