Warning, /pim/kube/views/people/qml/MailListEditor.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * Copyright (C) 2018 Michael Bohlender, <bohlender@kolabsys.com>
0003 * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
0004 *
0005 * This program is free software; you can redistribute it and/or modify
0006 * it under the terms of the GNU General Public License as published by
0007 * the Free Software Foundation; either version 2 of the License, or
0008 * (at your option) any later version.
0009 *
0010 * This program is distributed in the hope that it will be useful,
0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0013 * GNU General Public License for more details.
0014 *
0015 * You should have received a copy of the GNU General Public License along
0016 * with this program; if not, write to the Free Software Foundation, Inc.,
0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0018 */
0019
0020
0021 import QtQuick 2.7
0022 import QtQuick.Layouts 1.1
0023
0024 import org.kube.framework 1.0 as Kube
0025
0026 Item {
0027 id: root
0028
0029 property variant controller
0030 implicitHeight: listView.height + lineEdit.height
0031 height: implicitHeight
0032
0033 Column {
0034 anchors.fill: parent
0035 spacing: Kube.Units.smallSpacing
0036
0037 ListView {
0038 id: listView
0039 anchors {
0040 left: parent.left
0041 right: parent.right
0042 }
0043 height: contentHeight
0044
0045 model: controller.model
0046
0047 delegate: Row {
0048 height: Kube.Units.gridUnit
0049 spacing: Kube.Units.smallSpacing
0050 Kube.Label {
0051 anchors.verticalCenter: parent.verticalCenter
0052 visible: model.isMain
0053 text: qsTr("(main)")
0054 }
0055 Kube.SelectableLabel {
0056 anchors.verticalCenter: parent.verticalCenter
0057 text: model.email
0058 }
0059 Kube.IconButton {
0060 anchors.verticalCenter: parent.verticalCenter
0061 height: Kube.Units.gridUnit
0062 width: height
0063 padding: 0
0064 iconName: Kube.Icons.listRemove
0065 onClicked: root.controller.remove(model.id)
0066 }
0067 }
0068 }
0069
0070 FocusScope {
0071 anchors {
0072 left: parent.left
0073 right: parent.right
0074 }
0075 height: Kube.Units.gridUnit
0076 focus: true
0077
0078 Kube.TextButton {
0079 anchors {
0080 verticalCenter: parent.verticalCenter
0081 left: parent.left
0082 }
0083 id: button
0084 text: "+ " + qsTr("Add email")
0085 textColor: Kube.Colors.highlightColor
0086 focus: true
0087 onClicked: {
0088 lineEdit.visible = true
0089 lineEdit.forceActiveFocus()
0090 }
0091 }
0092
0093 Kube.TextField {
0094 id: lineEdit
0095 anchors {
0096 verticalCenter: parent.verticalCenter
0097 left: parent.left
0098 right: parent.right
0099 }
0100 visible: false
0101
0102 placeholderText: "+ " + qsTr("Add email")
0103 onAccepted: {
0104 root.controller.add({"email": text, "isMain": false});
0105 clear()
0106 visible = false
0107 button.forceActiveFocus(Qt.TabFocusReason)
0108 }
0109 // onAborted: {
0110 // clear()
0111 // visible = false
0112 // button.forceActiveFocus(Qt.TabFocusReason)
0113 // }
0114 }
0115 }
0116 }
0117 }