Dekko
Loading...
Searching...
No Matches
RecipientPopover.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 QtQuick.Controls.Suru 2.2
20import Lomiri.Components 1.3
21import Lomiri.Components.Popups 1.3
22import Dekko.Mail 1.0
23import Dekko.Mail.API 1.0
24import Dekko.Components 1.0
25import Dekko.Lomiri.Components 1.0
27Popover {
28 id: info
29 property var address
30
31 property bool composeMode: false
32 property int type: -1
33 property int index: -1
34
35 Column {
36 anchors {
37 left: parent.left
38 top: parent.top
39 right: parent.right
40 }
41
42 ListItem {
43 height: layout.height
44 color: Suru.secondaryBackgroundColor
45 ListItemLayout {
46 id: layout
47 title.text: address ? address.name : model.email
48 title.elide: Text.ElideRight
49 title.wrapMode: Text.NoWrap
50 subtitle.text: {
51 if (address.name) {
52 if (address.name !== address.address)
53 return address.address
54 else
55 return ""
56 }/* else if (model.isInContacts) {
57 return model.contactInfo.organization
58 } else {
59 return ""
60 }*/
61 }
62// summary.text: address.name && model.isInContacts ? model.contactInfo.organization : ""
63 subtitle.elide: Text.ElideRight
64 subtitle.wrapMode: Text.NoWrap
65
66 Avatar {
67 id: avatar
68 name: address.name
69 initials: address.initials
70 email: address.address
71 validContact: true
72 fontSize: "large"
73 SlotsLayout.position: SlotsLayout.Leading
74 }
75 }
76 }
77
78 ContextGroup {
79 contextActions: [
80 ContextAction {
81 description: qsTr("Copy to clipboard")
82 actionIcon: Icons.CopyIcon
83 onTriggered: {
84 Log.logInfo("RecipientPopover::copyToClipBoard", "Copying \"%1\" to clipboard".arg(address.completeAddress))
85 Clipboard.push(["text/plain", address.completeAddress])
86 PopupUtils.close(info)
87 }
88 },
90 visible: !composeMode
91 description: qsTr("Send message")
92 actionIcon: Icons.SendIcon
93 onTriggered: {
94 // Just dispatch a mailto: uri to be opened.
95 ViewActions.openUris([address.toRfc6068Mailto()])
96 PopupUtils.close(info)
97 }
98 },
100 visible: composeMode
101 description: qsTr("Remove")
102 actionIcon: Icons.DeleteIcon
103 onTriggered: {
104 ComposerActions.removeRecipient(type, index)
105 PopupUtils.close(info)
106 }
107 }
108 ]
109 }
110 }
111}