Warning, /pim/kube/views/people/qml/PersonComposer.qml is written in an unsupported language. File is not indexed.

0001  /*
0002   Copyright (C) 2017 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 import QtQuick 2.7
0021 import QtQuick.Controls 2
0022 import QtQuick.Layouts 1.1
0023 import QtQuick.Dialogs 1.0 as Dialogs
0024 
0025 
0026 import org.kube.framework 1.0 as Kube
0027 
0028 
0029 Flickable {
0030     id: root
0031 
0032     property var contactController
0033 
0034     anchors {
0035         fill: parent
0036         leftMargin: Kube.Units.largeSpacing
0037     }
0038 
0039     ScrollBar.vertical: Kube.ScrollBar { }
0040     contentHeight: contentColumn.height
0041 
0042     clip: true
0043 
0044     Kube.ScrollHelper {
0045         flickable: root
0046         anchors.fill: parent
0047     }
0048 
0049     ColumnLayout {
0050         id: contentColumn
0051 
0052         anchors {
0053             left: parent.left
0054             right: parent.right
0055         }
0056 
0057         spacing: Kube.Units.largeSpacing
0058 
0059         Item {
0060             width: parent.width
0061             height: Kube.Units.smallSpacing
0062         }
0063 
0064 
0065         Item {
0066 
0067             height: Kube.Units.gridUnit * 8
0068             width: root.width - Kube.Units.largeSpacing
0069 
0070             Rectangle {
0071                 id: avatar
0072 
0073                 height: parent.height
0074                 width: height
0075                 Kube.KubeImage {
0076                     anchors.fill: parent
0077                     visible: contactController.imageData != ""
0078                     imageData: contactController.imageData
0079                 }
0080                 Kube.Icon {
0081                     anchors.fill: parent
0082                     visible: contactController.imageData == ""
0083                     iconName: Kube.Icons.user
0084                 }
0085                 color: Kube.Colors.buttonColor
0086 
0087                 Kube.AbstractButton {
0088                     anchors.fill: parent
0089 
0090                     color: "#00000000"
0091 
0092                     onClicked: {
0093                         fileDialog.open()
0094                     }
0095 
0096                     Dialogs.FileDialog {
0097                         id: fileDialog
0098                         title: qsTr("Choose an Avatar")
0099                         folder: shortcuts.home
0100                         selectFolder: false
0101                         selectExisting: true
0102                         selectMultiple: false
0103                         onAccepted: {
0104                             //TODO
0105                         }
0106                     }
0107                 }
0108             }
0109 
0110             Row {
0111                 id: nameRow
0112                 anchors {
0113                     left: avatar.right
0114                     leftMargin: Kube.Units.largeSpacing
0115                 }
0116 
0117                 spacing: Kube.Units.smallSpacing
0118 
0119                 Kube.TextField {
0120                     width: Kube.Units.gridUnit * 15
0121                     placeholderText: qsTr("First name")
0122                     backgroundColor: "white"
0123                     text: contactController.firstName
0124                     onTextChanged: contactController.firstName = text
0125                 }
0126 
0127                 Kube.TextField {
0128                     width: Kube.Units.gridUnit * 15
0129                     placeholderText: qsTr("Last name")
0130                     backgroundColor: "white"
0131                     text: contactController.lastName
0132                     onTextChanged: contactController.lastName = text
0133                 }
0134             }
0135 
0136             Kube.TextField {
0137                 id: jobTitle
0138 
0139                 anchors {
0140                     top: nameRow.bottom
0141                     left: avatar.right
0142                     topMargin: Kube.Units.smallSpacing
0143                     leftMargin: Kube.Units.largeSpacing
0144                 }
0145 
0146                 width: Kube.Units.gridUnit * 20
0147                 text: contactController.jobTitle
0148                 onTextChanged: contactController.jobTitle = text
0149                 placeholderText: qsTr("Job Title")
0150                 backgroundColor: "white"
0151             }
0152 
0153             Kube.TextField {
0154                 id: company
0155 
0156                 anchors {
0157                     bottom: avatar.bottom
0158                     left: avatar.right
0159                     leftMargin: Kube.Units.largeSpacing
0160                 }
0161                 width: Kube.Units.gridUnit * 20
0162 
0163                 placeholderText: qsTr("Company")
0164                 text: contactController.company
0165                 onTextChanged: contactController.company = text
0166                 backgroundColor: "white"
0167             }
0168         }
0169 
0170         Column {
0171             Layout.preferredWidth: Kube.Units.gridUnit * 20
0172             spacing: Kube.Units.smallSpacing
0173 
0174             Kube.Label {
0175                 text: qsTr("Email")
0176             }
0177             MailListEditor {
0178                 width: parent.width
0179                 controller: contactController.mails
0180             }
0181         }
0182 
0183         // Column {
0184         //     width: root.width - Kube.Units.largeSpacing
0185         //     spacing: Kube.Units.smallSpacing
0186 
0187         //     Kube.Label {
0188         //         text: qsTr("Phone")
0189         //     }
0190 
0191         //     PhoneListEditor {
0192         //         controller: contactController.phones
0193         //     }
0194         // }
0195 
0196         // Column {
0197         //     id: address
0198 
0199         //     width: root.width - Kube.Units.largeSpacing
0200         //     spacing: Kube.Units.smallSpacing
0201 
0202         //     Kube.Label {
0203         //         text: "Address"
0204         //     }
0205 
0206         //     Kube.TextField {
0207         //         width: Kube.Units.gridUnit * 20
0208         //         text: contactController.street
0209         //         onTextChanged: contactController.stree = text
0210         //         placeholderText: qsTr("Street")
0211         //         backgroundColor: "white"
0212         //     }
0213         //     Kube.TextField {
0214         //         width: Kube.Units.gridUnit * 20
0215         //         text: contactController.city
0216         //         onTextChanged: contactController.city = text
0217         //         placeholderText: qsTr("City")
0218         //         backgroundColor: "white"
0219         //     }
0220         //     Kube.TextField {
0221         //         width: Kube.Units.gridUnit * 20
0222         //         text: contactController.country
0223         //         onTextChanged: contactController.country = text
0224         //         placeholderText: qsTr("Country")
0225         //         backgroundColor: "white"
0226         //     }
0227         // }
0228 
0229         Column{
0230             Layout.preferredWidth: Kube.Units.gridUnit * 20
0231             spacing: Kube.Units.smallSpacing
0232 
0233             Kube.Label {
0234                 text: "Addressbook"
0235             }
0236             Kube.EntityComboBox {
0237                 type: "addressbook"
0238                 initialSelectionObject: contactController.addressbook
0239                 onSelected: {
0240                     contactController.addressbook = entity
0241                 }
0242             }
0243         }
0244 
0245         Item {
0246             width: parent.width
0247             height: Kube.Units.largeSpacing
0248         }
0249     }
0250 }