summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-01-25 18:36:36 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-01-25 18:43:23 +0100
commit1e8da2a350ed25ce6cddfc93e287e5bafa633f0f (patch)
treed5fa205b38fb9e51197799b2d979f4581fd75738
parenta06a26736fe80d535082a4894da676015a5b0ffe (diff)
downloadkube-1e8da2a350ed25ce6cddfc93e287e5bafa633f0f.tar.gz
kube-1e8da2a350ed25ce6cddfc93e287e5bafa633f0f.zip
Implement move to folder per D&D
We have to trigger the drop explicitly in onReleased. Interestingly if we use "Drag.dragType: Drag.Automatic" then we don't need to explicitly call drop() and the drag and drop behaviour works as expected, but we end up no longer dragging the actual item from the listview, which is what we wanted to do (although we'll have to deal with the item reappering in the list only to then vanish from the actual move). It seems Drag.Automatic triggers a new style of drag that is now recommended but entirely undocumented, and we're doing some old-style/ backwardscompatible drag...
-rw-r--r--components/package/contents/ui/FolderListView.qml6
-rw-r--r--components/package/contents/ui/MailListView.qml4
2 files changed, 10 insertions, 0 deletions
diff --git a/components/package/contents/ui/FolderListView.qml b/components/package/contents/ui/FolderListView.qml
index e7db2905..bc2932de 100644
--- a/components/package/contents/ui/FolderListView.qml
+++ b/components/package/contents/ui/FolderListView.qml
@@ -135,6 +135,12 @@ Rectangle {
135 135
136 visible: parent.containsDrag 136 visible: parent.containsDrag
137 } 137 }
138 onDropped: {
139 folderController.folder = model.domainObject
140 folderController.mail = drop.source.mail
141 folderController.moveToFolderAction.execute()
142 drop.accept(Qt.MoveAction)
143 }
138 } 144 }
139 145
140 Text { 146 Text {
diff --git a/components/package/contents/ui/MailListView.qml b/components/package/contents/ui/MailListView.qml
index 63d285e8..a26dcc2b 100644
--- a/components/package/contents/ui/MailListView.qml
+++ b/components/package/contents/ui/MailListView.qml
@@ -141,6 +141,8 @@ Item {
141 Item { 141 Item {
142 id: delegateRoot 142 id: delegateRoot
143 143
144 property variant mail : model.domainObject
145
144 width: scrollbar.visible ? listView.width - scrollbar.width : listView.width 146 width: scrollbar.visible ? listView.width - scrollbar.width : listView.width
145 height: Kirigami.Units.gridUnit * 5 147 height: Kirigami.Units.gridUnit * 5
146 148
@@ -185,6 +187,7 @@ Item {
185 Drag.active: mouseArea.drag.active 187 Drag.active: mouseArea.drag.active
186 Drag.hotSpot.x: mouseArea.mouseX 188 Drag.hotSpot.x: mouseArea.mouseX
187 Drag.hotSpot.y: mouseArea.mouseY 189 Drag.hotSpot.y: mouseArea.mouseY
190 Drag.source: delegateRoot
188 191
189 MouseArea { 192 MouseArea {
190 id: mouseArea 193 id: mouseArea
@@ -197,6 +200,7 @@ Item {
197 onClicked: { 200 onClicked: {
198 listView.currentIndex = index 201 listView.currentIndex = index
199 } 202 }
203 onReleased: parent.Drag.drop()
200 } 204 }
201 205
202 Rectangle { 206 Rectangle {