summaryrefslogtreecommitdiffstats
path: root/components/package/contents/ui/FolderListView.qml
diff options
context:
space:
mode:
authorMichael Bohlender <michael.bohlender@kdemail.net>2016-06-08 14:35:16 +0200
committerMichael Bohlender <michael.bohlender@kdemail.net>2016-06-08 14:35:16 +0200
commit656a7aebd7cba046aec113716f72015a33a9a477 (patch)
tree6344d3d7aacd223544483c6afaeda71b09776c48 /components/package/contents/ui/FolderListView.qml
parentdcdc95b6d709616498de00389bd19926625b20f2 (diff)
downloadkube-656a7aebd7cba046aec113716f72015a33a9a477.tar.gz
kube-656a7aebd7cba046aec113716f72015a33a9a477.zip
go back to the classic folder view
Diffstat (limited to 'components/package/contents/ui/FolderListView.qml')
-rw-r--r--components/package/contents/ui/FolderListView.qml176
1 files changed, 13 insertions, 163 deletions
diff --git a/components/package/contents/ui/FolderListView.qml b/components/package/contents/ui/FolderListView.qml
index 62960fb9..c8284b0a 100644
--- a/components/package/contents/ui/FolderListView.qml
+++ b/components/package/contents/ui/FolderListView.qml
@@ -27,173 +27,23 @@ import org.kube.framework.theme 1.0
27 27
28Item { 28Item {
29 id: root 29 id: root
30
30 property variant currentFolder 31 property variant currentFolder
31 SystemPalette { id: colorPalette; colorGroup: SystemPalette.Active } 32 property variant accountId
32 33
33 Rectangle { 34 TreeView {
34 anchors.fill: parent 35 anchors.fill: parent
35 36 id: treeView
36 color: "white" 37 TableViewColumn {
37 ScrollView { 38 title: "Name"
38 anchors.fill: parent 39 role: "name"
39 ListView {
40 id: listView
41 anchors.fill: parent
42 delegate: accountDelegate
43 model: KubeFramework.AccountsModel { id: accountsModel }
44 }
45 } 40 }
46 } 41 model: KubeFramework.FolderListModel { id: folderListModel} //; accountId: wrapper.accountId }
47 42 onCurrentIndexChanged: {
48 Component { 43 model.fetchMore(currentIndex)
49 id: accountDelegate 44 root.currentFolder = model.data(currentIndex, KubeFramework.FolderListModel.DomainObject)
50
51 Item {
52 id: wrapper
53
54 property var accountId: model.accountId
55
56 width: listView.width
57 height: 30
58
59 Rectangle {
60 id: headerView
61 anchors.left: parent.left
62 anchors.right: parent.right
63 anchors.top: parent.top
64
65 height: 30
66
67 color: "#333"
68 border.color: Qt.lighter(color, 1.2)
69 Kirigami.Icon {
70 id: iconItem
71 anchors.left: parent.left
72 anchors.verticalCenter: parent.verticalCenter
73 anchors.leftMargin: 4
74 source: model.icon
75 }
76 Text {
77 anchors.left: iconItem.right
78 anchors.verticalCenter: parent.verticalCenter
79 anchors.leftMargin: 4
80
81 font.pixelSize: parent.height-4
82 color: '#fff'
83
84 text: name
85 }
86 }
87
88 MouseArea {
89 anchors.fill: parent
90 onClicked: {
91 if (parent.state != "expanded") {
92 parent.state = "expanded";
93 } else {
94 parent.state = ""
95 }
96 }
97 }
98
99 Item {
100 id: folderView
101
102 anchors.top: headerView.bottom
103 anchors.left: parent.left
104 anchors.right: parent.right
105 anchors.bottom: parent.bottom
106
107 opacity: 0
108 visible: false
109
110 Rectangle {
111 anchors.fill: parent
112 TreeView {
113 anchors.fill: parent
114 id: treeView
115 TableViewColumn {
116 title: "Name"
117 role: "name"
118 width: treeView.width - 5
119 }
120 model: KubeFramework.FolderListModel { id: folderListModel; accountId: wrapper.accountId }
121 onCurrentIndexChanged: {
122 model.fetchMore(currentIndex)
123 root.currentFolder = model.data(currentIndex, KubeFramework.FolderListModel.DomainObject)
124 }
125 backgroundVisible: false
126 headerVisible: false
127 style: TreeViewStyle {
128 activateItemOnSingleClick: true
129 rowDelegate: Rectangle {
130 height: Unit.size * 10
131 color: "transparent"
132 }
133 itemDelegate: Rectangle {
134 radius: 5
135 border.width: 1
136 border.color: "lightgrey"
137 color: styleData.selected ? colorPalette.highlight : colorPalette.button
138 Kirigami.Icon {
139 id: iconItem
140 anchors {
141 verticalCenter: parent.verticalCenter
142 left: parent.left
143 leftMargin: Unit.size * 3
144 }
145 source: model.icon
146 }
147 Label {
148 anchors {
149 verticalCenter: parent.verticalCenter
150 left: iconItem.right
151 leftMargin: Unit.size * 3
152 }
153 renderType: Text.NativeRendering
154 text: styleData.value
155 font.pixelSize: 16
156 font.bold: true
157 color: styleData.selected ? colorPalette.highlightedText : colorPalette.text
158 }
159 }
160 branchDelegate: Item {
161 width: 16
162 height: 16
163 Text {
164 visible: styleData.column === 0 && styleData.hasChildren
165 text: styleData.isExpanded ? "\u25bc" : "\u25b6"
166 color: !control.activeFocus || styleData.selected ? styleData.textColor : "#666"
167 font.pointSize: 10
168 renderType: Text.NativeRendering
169 anchors.centerIn: parent
170 anchors.verticalCenterOffset: styleData.isExpanded ? 2 : 0
171 }
172 }
173 }
174 }
175 }
176 }
177
178 states: [
179 State {
180 name: "expanded"
181
182 PropertyChanges { target: wrapper; height: listView.height - accountsModel.rowCount() * 30 }
183 PropertyChanges { target: folderView; opacity: 1; visible: true }
184 PropertyChanges { target: wrapper.ListView.view; contentY: wrapper.y; interactive: false }
185 }
186 ]
187
188 transitions: [
189 Transition {
190 NumberAnimation {
191 duration: 150;
192 properties: "height,width,anchors.rightMargin,anchors.topMargin,opacity,contentY"
193 }
194 }
195 ]
196 } 45 }
46 alternatingRowColors: false
47 headerVisible: false
197 } 48 }
198
199} 49}