Dekko
Loading...
Searching...
No Matches
RecipientDelegate.qml
1/* Copyright (C) 2016 - 2017 Dan Chapman <dpniel@ubuntu.com>
2
3 This file is part of Dekko email client for Ubuntu devices
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of
8 the License or (at your option) version 3
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18import QtQuick 2.4
19import Lomiri.Components 1.3
20import Lomiri.Components.Popups 1.3
21import Dekko.Lomiri.Components 1.0
22
23// Should be used on a list model of type MailAddress. i.e QQmlObjectListModel<MailAddress>
24LomiriShape {
25 id: delegate
26
27 property bool composeMode: false
28 property int type: -1
29
30 aspect: LomiriShape.Flat
31 color: Qt.rgba(0, 0, 0, 0.05)
32 radius: "small"
33 height: units.gu(3)
34 width: inner_avatar.width + label.width + units.gu(1.5)
35
36 Avatar {
37 id: inner_avatar
38 width: height
39 anchors {
40 left: parent.left
41 top: parent.top
42 bottom: parent.bottom
43 margins: units.dp(1)
44 }
45 name: model.qtObject.name
46 initials: model.qtObject.initials
47 email: model.qtObject.address
48 fontSize: "x-small"
49 validContact: true
50 }
51
52 Label {
53 id: label
54 anchors {
55 left: inner_avatar.right
56 leftMargin: units.gu(0.5)
57 verticalCenter: parent.verticalCenter
58 }
59 text: model.qtObject.name
60 }
61
62 MouseArea {
63 anchors.fill: parent
64 onClicked: {
65 PopupUtils.open(Qt.resolvedUrl("../popovers/RecipientPopover.qml"), delegate, {address: model.qtObject, composeMode: composeMode, index: model.index, type: type})
66 }
67 }
68}
69