summaryrefslogtreecommitdiffstats
path: root/framework/qml
diff options
context:
space:
mode:
Diffstat (limited to 'framework/qml')
-rw-r--r--framework/qml/FolderListView.qml34
-rw-r--r--framework/qml/TreeView.qml33
2 files changed, 33 insertions, 34 deletions
diff --git a/framework/qml/FolderListView.qml b/framework/qml/FolderListView.qml
index 25c6cbe5..a24a9ff6 100644
--- a/framework/qml/FolderListView.qml
+++ b/framework/qml/FolderListView.qml
@@ -30,6 +30,33 @@ Kube.TreeView {
30 Controls1.TableViewColumn { 30 Controls1.TableViewColumn {
31 title: "Name" 31 title: "Name"
32 role: "name" 32 role: "name"
33 delegate: Item {
34 DropArea {
35 anchors.fill: parent
36 Rectangle {
37 anchors.fill: parent
38 color: Kube.Colors.viewBackgroundColor
39 opacity: 0.3
40 visible: parent.containsDrag
41 }
42 onDropped: {
43 Kube.Fabric.postMessage(Kube.Messages.moveToFolder, {"mail": drop.source.mail, "folder": model.domainObject})
44 drop.accept(Qt.MoveAction)
45 drop.source.visible = false
46 }
47 }
48
49 Kube.Label {
50 anchors {
51 verticalCenter: parent.verticalCenter
52 left: parent.left
53 right: parent.right
54 }
55 text: styleData.value
56 elide: Qt.ElideRight
57 color: model.hasNewData ? Kube.Colors.highlightColor : Kube.Colors.viewBackgroundColor
58 }
59 }
33 } 60 }
34 61
35 model: Kube.FolderListModel { 62 model: Kube.FolderListModel {
@@ -43,11 +70,4 @@ Kube.TreeView {
43 Kube.Fabric.postMessage(Kube.Messages.folderSelection, {"folder": model.data(index, Kube.FolderListModel.DomainObject), 70 Kube.Fabric.postMessage(Kube.Messages.folderSelection, {"folder": model.data(index, Kube.FolderListModel.DomainObject),
44 "trash": model.data(index, Kube.FolderListModel.Trash)}); 71 "trash": model.data(index, Kube.FolderListModel.Trash)});
45 } 72 }
46
47
48 onDropped: {
49 Kube.Fabric.postMessage(Kube.Messages.moveToFolder, {"mail": drop.source.mail, "folder": model.domainObject})
50 drop.accept(Qt.MoveAction)
51 drop.source.visible = false
52 }
53} 73}
diff --git a/framework/qml/TreeView.qml b/framework/qml/TreeView.qml
index eb140514..7b9a1103 100644
--- a/framework/qml/TreeView.qml
+++ b/framework/qml/TreeView.qml
@@ -36,12 +36,16 @@ FocusScope {
36 * FIXME: This is what QItemSelectionModel selection vs current selection are for. Try to use that instead. 36 * FIXME: This is what QItemSelectionModel selection vs current selection are for. Try to use that instead.
37 */ 37 */
38 property var activeIndex: null 38 property var activeIndex: null
39 signal dropped(var drop, var model)
40 signal activated(var index) 39 signal activated(var index)
41 onActivated: { 40 onActivated: {
42 activeIndex = index 41 activeIndex = index
43 } 42 }
44 43
44 function indexFromRow(row) {
45 //FIXME Uses internal API to get to the model index
46 return treeView.__model.mapRowToModelIndex(row)
47 }
48
45 Flickable { 49 Flickable {
46 id: flickableItem 50 id: flickableItem
47 51
@@ -115,8 +119,7 @@ FocusScope {
115 style: TreeViewStyle { 119 style: TreeViewStyle {
116 rowDelegate: Controls2.Control { 120 rowDelegate: Controls2.Control {
117 id: delegateRoot 121 id: delegateRoot
118 //FIXME Uses internal API to get to the model index 122 property bool isActive: root.activeIndex === indexFromRow(styleData.row)
119 property bool isActive: root.activeIndex === treeView.__model.mapRowToModelIndex(styleData.row)
120 height: Kube.Units.gridUnit * 1.5 123 height: Kube.Units.gridUnit * 1.5
121 //FIXME This is the only way I could find to get the correct width. parent.width is way to wide 124 //FIXME This is the only way I could find to get the correct width. parent.width is way to wide
122 width: parent.parent.parent ? parent.parent.parent.width : 0 125 width: parent.parent.parent ? parent.parent.parent.width : 0
@@ -145,30 +148,6 @@ FocusScope {
145 text: styleData.isExpanded ? "-" : "+" 148 text: styleData.isExpanded ? "-" : "+"
146 } 149 }
147 150
148 itemDelegate: Item {
149 DropArea {
150 anchors.fill: parent
151 Rectangle {
152 anchors.fill: parent
153 color: Kube.Colors.viewBackgroundColor
154 opacity: 0.3
155 visible: parent.containsDrag
156 }
157 onDropped: root.dropped(drop, model)
158 }
159
160 Kube.Label {
161 anchors {
162 verticalCenter: parent.verticalCenter
163 left: parent.left
164 right: parent.right
165 }
166 text: styleData.value
167 elide: Qt.ElideRight
168 color: Kube.Colors.viewBackgroundColor
169 }
170 }
171
172 backgroundColor: Kube.Colors.textColor 151 backgroundColor: Kube.Colors.textColor
173 highlightedTextColor: Kube.Colors.highlightedTextColor 152 highlightedTextColor: Kube.Colors.highlightedTextColor
174 } 153 }