diff --git a/containments/homescreen2/package/contents/ui/launcher/Delegate.qml b/containments/homescreen2/package/contents/ui/launcher/Delegate.qml index 72b01d95..e0f42b94 100644 --- a/containments/homescreen2/package/contents/ui/launcher/Delegate.qml +++ b/containments/homescreen2/package/contents/ui/launcher/Delegate.qml @@ -64,7 +64,7 @@ ContainmentLayoutManager.ItemContainer { onUserDrag: { dragCenterX = dragCenter.x; dragCenterY = dragCenter.y; - launcherDragManager.dragItem(delegate, index, dragCenter.x, dragCenter.y); + launcherDragManager.dragItem(delegate, dragCenter.x, dragCenter.y); } contentItem: MouseArea { diff --git a/containments/homescreen2/package/contents/ui/launcher/LauncherDragManager.qml b/containments/homescreen2/package/contents/ui/launcher/LauncherDragManager.qml index f32e738b..3f037b2e 100644 --- a/containments/homescreen2/package/contents/ui/launcher/LauncherDragManager.qml +++ b/containments/homescreen2/package/contents/ui/launcher/LauncherDragManager.qml @@ -39,7 +39,7 @@ QtObject { internal.showSpacer(item, 0, 0); } - function dragItem(delegate, index, dragCenterX, dragCenterY) { + function dragItem(delegate, dragCenterX, dragCenterY) { // newPosition var newRow = 0; @@ -50,15 +50,15 @@ QtObject { var pos = favoriteStrip.mapFromItem(delegate, 0, 0); newRow = Math.floor((pos.x + dragCenterX) / delegate.width); - plasmoid.nativeInterface.applicationListModel.setLocation(index, ApplicationListModel.Favorites); + plasmoid.nativeInterface.applicationListModel.setLocation(delegate.modelData.index, ApplicationListModel.Favorites); internal.showSpacer(delegate, dragCenterX, dragCenterY); - plasmoid.nativeInterface.applicationListModel.moveItem(modelData.index, newRow); + plasmoid.nativeInterface.applicationListModel.moveItem(delegate.modelData.index, newRow); // Put it on desktop } else if (newContainer == appletsLayout) { var pos = appletsLayout.mapFromItem(delegate, 0, 0); - plasmoid.nativeInterface.applicationListModel.setLocation(index, ApplicationListModel.Desktop); + plasmoid.nativeInterface.applicationListModel.setLocation(delegate.modelData.index, ApplicationListModel.Desktop); internal.showSpacer(delegate, dragCenterX, dragCenterY); return; @@ -67,14 +67,11 @@ QtObject { } else { newRow = Math.round(newContainer.flow.width / delegate.width) * Math.floor((delegate.y + dragCenterY) / delegate.height) + Math.floor((delegate.x + dragCenterX) / delegate.width) + favoriteStrip.count; - plasmoid.nativeInterface.applicationListModel.setLocation(index, ApplicationListModel.Grid); + plasmoid.nativeInterface.applicationListModel.setLocation(delegate.modelData.index, ApplicationListModel.Grid); internal.showSpacer(delegate, dragCenterX, dragCenterY); - plasmoid.nativeInterface.applicationListModel.moveItem(modelData.index, newRow); + plasmoid.nativeInterface.applicationListModel.moveItem(delegate.modelData.index, newRow); } - - internal.showSpacer(delegate, dragCenterX, dragCenterY); - plasmoid.nativeInterface.applicationListModel.moveItem(modelData.index, newRow); } function dropItem(item, dragCenterX, dragCenterY) {