diff options
-rw-r--r-- | applications/kube-mail/package/contents/ui/FolderListView.qml | 77 | ||||
-rw-r--r-- | framework/mail/folderlistmodel.cpp | 3 | ||||
-rw-r--r-- | framework/mail/folderlistmodel.h | 1 |
3 files changed, 48 insertions, 33 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 | ||
18 | import QtQuick 2.4 | 18 | import QtQuick 2.4 |
19 | import QtQuick.Controls 1.3 | 19 | import QtQuick.Controls 1.4 |
20 | import QtQuick.Controls.Styles 1.4 | ||
20 | import QtQuick.Layouts 1.1 | 21 | import QtQuick.Layouts 1.1 |
21 | 22 | ||
22 | import org.kde.plasma.core 2.0 as PlasmaCore | 23 | import org.kde.plasma.core 2.0 as PlasmaCore |
@@ -27,6 +28,7 @@ import org.kde.kube.mail 1.0 as Mail | |||
27 | Item { | 28 | Item { |
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 | } |
diff --git a/framework/mail/folderlistmodel.cpp b/framework/mail/folderlistmodel.cpp index d00f8f10..ce6fb4fd 100644 --- a/framework/mail/folderlistmodel.cpp +++ b/framework/mail/folderlistmodel.cpp | |||
@@ -25,7 +25,8 @@ FolderListModel::FolderListModel(QObject *parent) : QIdentityProxyModel() | |||
25 | { | 25 | { |
26 | Sink::Query query; | 26 | Sink::Query query; |
27 | query.liveQuery = true; | 27 | query.liveQuery = true; |
28 | query.requestedProperties << "name" << "icon"; | 28 | query.requestedProperties << "name" << "icon" << "parent"; |
29 | query.parentProperty = "parent"; | ||
29 | mModel = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); | 30 | mModel = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
30 | setSourceModel(mModel.data()); | 31 | setSourceModel(mModel.data()); |
31 | } | 32 | } |
diff --git a/framework/mail/folderlistmodel.h b/framework/mail/folderlistmodel.h index d412c29c..7844e59a 100644 --- a/framework/mail/folderlistmodel.h +++ b/framework/mail/folderlistmodel.h | |||
@@ -41,6 +41,7 @@ public: | |||
41 | Id, | 41 | Id, |
42 | DomainObject | 42 | DomainObject |
43 | }; | 43 | }; |
44 | Q_ENUMS(Roles) | ||
44 | 45 | ||
45 | QHash<int, QByteArray> roleNames() const; | 46 | QHash<int, QByteArray> roleNames() const; |
46 | 47 | ||