summaryrefslogtreecommitdiffstats
path: root/components/package/contents/ui
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-03-10 21:50:08 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-03-10 21:50:48 +0100
commite52a02bb77c5292a016d2c14e0730d44d25d4000 (patch)
treebb67d615bd8d699ca0ff2c5996253acf46d5389a /components/package/contents/ui
parentca120180460c7eeefaec9b1f31e5ad8aee32df2d (diff)
downloadkube-e52a02bb77c5292a016d2c14e0730d44d25d4000.tar.gz
kube-e52a02bb77c5292a016d2c14e0730d44d25d4000.zip
Simple peoplemodel for addressbook
Currently just queries for a flat list of contacts. Read-only.
Diffstat (limited to 'components/package/contents/ui')
-rw-r--r--components/package/contents/ui/People.qml35
1 files changed, 31 insertions, 4 deletions
diff --git a/components/package/contents/ui/People.qml b/components/package/contents/ui/People.qml
index 860609e0..ec017f1b 100644
--- a/components/package/contents/ui/People.qml
+++ b/components/package/contents/ui/People.qml
@@ -1,5 +1,6 @@
1 /* 1 /*
2 Copyright (C) 2017 Michael Bohlender, <michael.bohlender@kdemail.net> 2 Copyright (C) 2017 Michael Bohlender, <michael.bohlender@kdemail.net>
3 Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
3 4
4 This program is free software; you can redistribute it and/or modify 5 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 it under the terms of the GNU General Public License as published by
@@ -27,12 +28,17 @@ import org.kube.framework.domain 1.0 as KubeFramework
27 28
28Popup { 29Popup {
29 30
31 id: popup
30 modal: true 32 modal: true
31 33
34 property variant currentContact: null
35
32 Controls.SplitView { 36 Controls.SplitView {
33 anchors.fill: parent 37 anchors.fill: parent
34 38
35 Item { 39 Item {
40 id: contactList
41
36 height: parent.height 42 height: parent.height
37 width: Kirigami.Units.gridUnit * 14 43 width: Kirigami.Units.gridUnit * 14
38 44
@@ -75,19 +81,40 @@ Popup {
75 topMargin: Kirigami.Units.smallSpacing 81 topMargin: Kirigami.Units.smallSpacing
76 } 82 }
77 83
78 model: 15 84 model: KubeFramework.PeopleModel{}
79 clip: true 85 clip: true
80 86
81 ScrollBar.vertical: ScrollBar { 87 ScrollBar.vertical: ScrollBar {
82 id: scroll 88 id: scroll
83 } 89 }
84 90
91 onCurrentItemChanged: {
92 popup.currentContact = currentItem.currentData.domainObject;
93 }
94
85 delegate: Kirigami.AbstractListItem { 95 delegate: Kirigami.AbstractListItem {
86 height: Kirigami.Units.gridUnit * 2.5 96 height: Kirigami.Units.gridUnit * 2.5
87 width: listView.width - scroll.width 97 width: listView.width - scroll.width
88 98
99 property variant currentData: model
100
89 clip: true 101 clip: true
90 102
103 states: [
104 State {
105 name: "selected"
106 when: ListView.isCurrentItem
107 PropertyChanges {target: background; color: Kirigami.Theme.highlightColor}
108 PropertyChanges {target: name; color: Kirigami.Theme.highlightedTextColor}
109 },
110 State {
111 name: "hovered"
112 when: mouseArea.containsMouse
113 PropertyChanges {target: background; color: Kirigami.Theme.buttonHoverColor; opacity: 0.7}
114 PropertyChanges {target: name; color: Kirigami.Theme.highlightedTextColor}
115 }
116 ]
117
91 Avatar { 118 Avatar {
92 id: avatar 119 id: avatar
93 120
@@ -100,7 +127,7 @@ Popup {
100 height: parent.height * 0.9 127 height: parent.height * 0.9
101 width: height 128 width: height
102 129
103 name: "Wolfgang Rosenzweig" 130 name: model.name
104 } 131 }
105 132
106 Text { 133 Text {
@@ -112,7 +139,7 @@ Popup {
112 verticalCenter: avatar.verticalCenter 139 verticalCenter: avatar.verticalCenter
113 } 140 }
114 141
115 text: "Wolfgang Rosenzweig" 142 text: model.name
116 color: Kirigami.Theme.textColor 143 color: Kirigami.Theme.textColor
117 } 144 }
118 } 145 }
@@ -120,9 +147,9 @@ Popup {
120 } 147 }
121 148
122 Item { 149 Item {
123
124 KubeFramework.ContactController { 150 KubeFramework.ContactController {
125 id: contactController 151 id: contactController
152 contact: popup.currentContact
126 } 153 }
127 154
128 height: parent.height 155 height: parent.height