summaryrefslogtreecommitdiffstats
path: root/applications
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-02-21 23:47:02 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-02-21 23:47:02 +0100
commit6d2c64352773c32045acb92fd3947cf6bbfd3101 (patch)
tree494119625704a5b40bacf0b01f5d9352c192fddd /applications
parent35a511eb5ff57fc89ad94dcc3a03db836f8067fd (diff)
downloadkube-6d2c64352773c32045acb92fd3947cf6bbfd3101.tar.gz
kube-6d2c64352773c32045acb92fd3947cf6bbfd3101.zip
A somewhat ugly, but usable tree folder view
Diffstat (limited to 'applications')
-rw-r--r--applications/kube-mail/package/contents/ui/FolderListView.qml77
1 files changed, 45 insertions, 32 deletions
diff --git a/applications/kube-mail/package/contents/ui/FolderListView.qml b/applications/kube-mail/package/contents/ui/FolderListView.qml
index 1639fe70..1934932c 100644
--- a/applications/kube-mail/package/contents/ui/FolderListView.qml
+++ b/applications/kube-mail/package/contents/ui/FolderListView.qml
@@ -16,7 +16,8 @@
16 */ 16 */
17 17
18import QtQuick 2.4 18import QtQuick 2.4
19import QtQuick.Controls 1.3 19import QtQuick.Controls 1.4
20import QtQuick.Controls.Styles 1.4
20import QtQuick.Layouts 1.1 21import QtQuick.Layouts 1.1
21 22
22import org.kde.plasma.core 2.0 as PlasmaCore 23import org.kde.plasma.core 2.0 as PlasmaCore
@@ -27,6 +28,7 @@ import org.kde.kube.mail 1.0 as Mail
27Item { 28Item {
28 id: root 29 id: root
29 property variant currentFolder 30 property variant currentFolder
31 SystemPalette { id: colorPalette; colorGroup: SystemPalette.Active }
30 32
31 Item { 33 Item {
32 id: searchBox 34 id: searchBox
@@ -43,59 +45,70 @@ Item {
43 } 45 }
44 } 46 }
45 47
46 ScrollView { 48 TreeView {
47 49 id: treeView
48 anchors { 50 anchors {
49 top: searchBox.bottom 51 top: searchBox.bottom
50 left: parent.left 52 left: parent.left
51 right: parent.right 53 right: parent.right
52 bottom: parent.bottom 54 bottom: parent.bottom
53 } 55 }
54 56 TableViewColumn {
55 ListView { 57 title: "Name"
56 id: listView 58 role: "name"
57 59 width: treeView.width - 5
58 currentIndex: -1 60 }
59 61 model: Mail.FolderListModel { id: folderListModel }
60 clip: true 62 onCurrentIndexChanged: {
61 63 model.fetchMore(currentIndex)
62 model: Mail.FolderListModel {} 64 root.currentFolder = model.data(currentIndex, Mail.FolderListModel.DomainObject)
63 65 }
64 delegate: PlasmaComponents.ListItem { 66 backgroundVisible: false
65 67 headerVisible: false
66 width: root.width 68 style: TreeViewStyle {
69 activateItemOnSingleClick: true
70 rowDelegate: Rectangle {
67 height: unit.size * 10 71 height: unit.size * 10
68 72 color: "transparent"
69 enabled: true 73 }
70 checked: listView.currentIndex == index 74 itemDelegate: Rectangle {
71 75 radius: 5
72 onClicked: { 76 border.width: 1
73 listView.currentIndex = model.index 77 border.color: "lightgrey"
74 root.currentFolder = model.domainObject 78 color: styleData.selected ? colorPalette.highlight : colorPalette.button
75 }
76
77 PlasmaCore.IconItem { 79 PlasmaCore.IconItem {
78 id: iconItem 80 id: iconItem
79
80 anchors { 81 anchors {
81 verticalCenter: parent.verticalCenter 82 verticalCenter: parent.verticalCenter
82 left: parent.left 83 left: parent.left
83 leftMargin: unit.size * 3 84 leftMargin: unit.size * 3
84 } 85 }
85
86 source: model.icon 86 source: model.icon
87 } 87 }
88
89 Label { 88 Label {
90 id: label
91
92 anchors { 89 anchors {
93 verticalCenter: parent.verticalCenter 90 verticalCenter: parent.verticalCenter
94 left: iconItem.right 91 left: iconItem.right
95 leftMargin: unit.size * 3 92 leftMargin: unit.size * 3
96 } 93 }
97 94 renderType: Text.NativeRendering
98 text: model.name 95 text: styleData.value
96 font.pixelSize: 16
97 font.bold: true
98 color: styleData.selected ? colorPalette.highlightedText : colorPalette.text
99 }
100 }
101 branchDelegate: Item {
102 width: 16
103 height: 16
104 Text {
105 visible: styleData.column === 0 && styleData.hasChildren
106 text: styleData.isExpanded ? "\u25bc" : "\u25b6"
107 color: !control.activeFocus || styleData.selected ? styleData.textColor : "#666"
108 font.pointSize: 10
109 renderType: Text.NativeRendering
110 anchors.centerIn: parent
111 anchors.verticalCenterOffset: styleData.isExpanded ? 2 : 0
99 } 112 }
100 } 113 }
101 } 114 }