summaryrefslogtreecommitdiffstats
path: root/framework
diff options
context:
space:
mode:
Diffstat (limited to 'framework')
-rw-r--r--framework/qml/GridView.qml33
-rw-r--r--framework/qml/People.qml155
-rw-r--r--framework/qmldir1
3 files changed, 110 insertions, 79 deletions
diff --git a/framework/qml/GridView.qml b/framework/qml/GridView.qml
new file mode 100644
index 00000000..ed21ac78
--- /dev/null
+++ b/framework/qml/GridView.qml
@@ -0,0 +1,33 @@
1/*
2 * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsystems.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19import QtQuick 2.7
20import QtQuick.Controls 2
21import org.kube.framework 1.0 as Kube
22
23GridView {
24 id: root
25 Component.onCompleted: currentIndex = -1
26 keyNavigationEnabled: true
27 Kube.ScrollHelper {
28 id: scrollHelper
29 flickable: root
30 anchors.fill: root
31 }
32}
33
diff --git a/framework/qml/People.qml b/framework/qml/People.qml
index c2c6c9ef..472ba968 100644
--- a/framework/qml/People.qml
+++ b/framework/qml/People.qml
@@ -94,103 +94,100 @@ FocusScope {
94 id: peoplePageRoot 94 id: peoplePageRoot
95 color: Kube.Colors.viewBackgroundColor 95 color: Kube.Colors.viewBackgroundColor
96 96
97 Flickable { 97 Kube.GridView {
98 id: peopleFlickable 98 id: gridView
99 anchors {
100 fill: parent
101 margins: Kube.Units.largeSpacing
102 }
99 103
100 anchors.fill: parent 104 activeFocusOnTab: true
101 105
102 ScrollBar.vertical: ScrollBar { } 106 model: Kube.PeopleModel {
103 contentHeight: content.height 107 filter: searchBar.text
104 clip: true
105 Kube.ScrollHelper {
106 flickable: peopleFlickable
107 anchors.fill: parent
108 } 108 }
109 109
110 Item { 110 cellWidth: Kube.Units.gridUnit * 10
111 id: content 111 cellHeight: Kube.Units.gridUnit * 3
112 112
113 anchors { 113 onActiveFocusChanged: {
114 left: parent.left 114 if (currentIndex < 0) {
115 right: parent.right 115 currentIndex = 0
116 } 116 }
117 height: childrenRect.height 117 }
118 118
119 Flow { 119 function selectObject(domainObject) {
120 root.currentContact = domainObject
121 stack.push(personPage)
122 }
123
124 delegate: Item {
125 id: delegateRoot
120 126
121 anchors { 127 height: gridView.cellHeight - Kube.Units.smallSpacing * 2
122 top: parent.top 128 width: gridView.cellWidth - Kube.Units.smallSpacing * 2
123 topMargin: Kube.Units.largeSpacing 129
124 left: parent.left 130 MouseArea {
125 leftMargin: Kube.Units.largeSpacing 131 anchors.fill: parent
132 onClicked: {
133 parent.GridView.view.currentIndex = index
134 parent.GridView.view.selectObject(model.domainObject)
126 } 135 }
136 }
137 Keys.onReturnPressed: {
138 GridView.view.currentIndex = index
139 GridView.view.selectObject(model.domainObject)
140 }
127 141
128 spacing: Kube.Units.largeSpacing 142 Rectangle {
129 width: peoplePageRoot.width - Kube.Units.largeSpacing * 2 143 anchors.fill: parent
130 144
131 Repeater { 145 border.width: parent.GridView.view.currentIndex == index ? 2 : 1
146 border.color: parent.GridView.view.currentIndex == index ? Kube.Colors.highlightColor : Kube.Colors.buttonColor
132 147
133 model: Kube.PeopleModel { 148 Rectangle {
134 filter: searchBar.text 149 id: avatarPlaceholder
150 color: Kube.Colors.buttonColor
151 anchors {
152 top: parent.top
153 left: parent.left
154 bottom: parent.bottom
135 } 155 }
156 clip: true
136 157
137 delegate: Kube.AbstractButton { 158 width: height
138 id: delegateRoot 159 Kube.KubeImage {
160 anchors.fill: parent
161 visible: model.imageData != ""
162 imageData: model.imageData
163 }
164 Kube.Icon {
165 anchors.fill: parent
166 visible: model.imageData == ""
167 iconName: Kube.Icons.user
168 }
169 }
139 170
140 height: Kube.Units.gridUnit * 3 171 Column {
141 width: Kube.Units.gridUnit * 10 172 width: parent.width
173 anchors {
174 left: avatarPlaceholder.right
175 margins: Kube.Units.smallSpacing
176 verticalCenter: parent.verticalCenter
177 }
142 178
143 activeFocusOnTab: true 179 Kube.Label {
180 width: delegateRoot.width - avatarPlaceholder.width - Kube.Units.smallSpacing * 2
144 181
145 onClicked: { 182 text: model.firstName
146 root.currentContact = model.domainObject 183 elide: Text.ElideRight
147 stack.push(personPage) 184 }
148 }
149 185
150 contentItem: Item { 186 Kube.Label {
151 anchors.fill: parent 187 width: delegateRoot.width - avatarPlaceholder.width - Kube.Units.smallSpacing * 2
152 Item { 188
153 id: avatarPlaceholder 189 text: model.lastName
154 190 elide: Text.ElideRight
155 height: parent.height
156 width: height
157 Kube.KubeImage {
158 anchors.fill: parent
159 visible: model.imageData != ""
160 imageData: model.imageData
161 }
162 Kube.Icon {
163 anchors.fill: parent
164 visible: model.imageData == ""
165 iconName: Kube.Icons.user
166 }
167 }
168
169 Column {
170
171 width: parent.width
172
173 anchors {
174 left: avatarPlaceholder.right
175 margins: Kube.Units.smallSpacing
176 verticalCenter: parent.verticalCenter
177 }
178
179 Kube.Label {
180 width: delegateRoot.width - avatarPlaceholder.width - Kube.Units.smallSpacing * 2
181
182 text: model.firstName
183 elide: Text.ElideRight
184 }
185
186 Kube.Label {
187 width: delegateRoot.width - avatarPlaceholder.width - Kube.Units.smallSpacing * 2
188
189 text: model.lastName
190 elide: Text.ElideRight
191 }
192 }
193 }
194 } 191 }
195 } 192 }
196 } 193 }
diff --git a/framework/qmldir b/framework/qmldir
index a23e2475..748547fb 100644
--- a/framework/qmldir
+++ b/framework/qmldir
@@ -33,6 +33,7 @@ AutocompleteLineEdit 1.0 AutocompleteLineEdit.qml
33AttachmentDelegate 1.0 AttachmentDelegate.qml 33AttachmentDelegate 1.0 AttachmentDelegate.qml
34ListView 1.0 ListView.qml 34ListView 1.0 ListView.qml
35TreeView 1.0 TreeView.qml 35TreeView 1.0 TreeView.qml
36GridView 1.0 GridView.qml
36ScrollHelper 1.0 ScrollHelper.qml 37ScrollHelper 1.0 ScrollHelper.qml
37singleton Messages 1.0 Messages.qml 38singleton Messages 1.0 Messages.qml
38singleton Colors 1.0 Colors.qml 39singleton Colors 1.0 Colors.qml