diff --git a/framework/qml/Icons.qml b/framework/qml/Icons.qml index 4dfae3d7..79a52046 100644 --- a/framework/qml/Icons.qml +++ b/framework/qml/Icons.qml @@ -1,78 +1,79 @@ /* Copyright (C) 2017 Michael Bohlender, Copyright (C) 2017 Christian Mollekopf, This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ pragma Singleton import QtQuick 2.7 Item { property string error: "error" property string info_inverted: "kdocumentinfo-inverted" property string error_inverted: "error-inverted" property string busy: "view-refresh" property string busy_inverted: "view-refresh-inverted" property string noNetworkConnection_inverted: "network-disconnect-inverted" property string connected: "dialog-ok" property string connected_inverted: "dialog-ok-inverted" property string success: "dialog-ok" property string success_inverted: "dialog-ok-inverted" property string markAsRead: "kuberead" property string markAsUnread: "kubeunread" property string markImportant: "kubeimportant" property string undo: "edit-undo-inverted" property string moveToTrash: "kubetrash" property string edit: "document-edit" property string edit_inverted: "document-edit-inverted" property string replyToSender: "mail-reply-sender" property string forward: "mail-forward" property string outbox: "mail-folder-outbox" property string outbox_inverted: "mail-folder-outbox-inverted" property string copy: "edit-copy" property string menu_inverted: "application-menu-inverted" property string group: "group" property string user: "im-user" property string user_inverted: "im-user-inverted" property string search_inverted: "edit-find-inverted" property string mail_inverted: "mail-message-inverted" property string goBack: "go-previous" property string goBack_inverted: "go-previous-inverted" property string goDown: "go-down" property string goDown_inverted: "go-down-inverted" property string goUp: "go-up" property string checkbox: "checkbox" property string password_show: "password-show-on" property string password_hide: "password-show-off" property string secure: "document-encrypt" property string insecure: "document-decrypt" property string signed: "document-sign" property string key_import_inverted: "view-certificate-import-inverted" property string addNew: "list-add" + property string listRemove: "list-remove" property string remove: "kube-list-remove-inverted" property string folder: "folder" property string save_inverted: "document-save-inverted" property string bold: "format-text-bold-symbolic" property string italic: "format-text-italic-symbolic" property string underline: "format-text-underline-symbolic" } diff --git a/views/people/qml/MailListEditor.qml b/views/people/qml/MailListEditor.qml new file mode 100644 index 00000000..e9dc76e7 --- /dev/null +++ b/views/people/qml/MailListEditor.qml @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2018 Michael Bohlender, + * Copyright (C) 2017 Christian Mollekopf, + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +import QtQuick 2.7 +import QtQuick.Layouts 1.1 + +import org.kube.framework 1.0 as Kube + +Column { + id: root + + property variant controller + + spacing: Kube.Units.smallSpacing + + ListView { + id: emails + + width: personComposerRoot.width - Kube.Units.largeSpacing + height: contentHeight + + model: controller.model + + delegate: Row { + height: textField.height + Kube.Units.smallSpacing + spacing: Kube.Units.smallSpacing + Kube.Label { text: qsTr("(main)") } + Kube.TextField {id: textField; width: Kube.Units.gridUnit * 15; text: model.email; backgroundColor: "white" } + Kube.IconButton { + id: removeButton + iconName: Kube.Icons.listRemove + onClicked: root.controller.remove(model.id) + } + } + } + + Kube.Button { + id: button + text: qsTr("Add") + focus: true + onClicked: { + root.controller.add({email: ""}); + } + } +} diff --git a/views/people/qml/PersonComposer.qml b/views/people/qml/PersonComposer.qml index 1d4dfa87..2e0436ed 100644 --- a/views/people/qml/PersonComposer.qml +++ b/views/people/qml/PersonComposer.qml @@ -1,256 +1,223 @@ /* Copyright (C) 2017 Michael Bohlender, Copyright (C) 2017 Christian Mollekopf, This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.7 import QtQuick.Controls 2.0 as Controls2 import QtQuick.Layouts 1.1 import QtQuick.Dialogs 1.0 as Dialogs import org.kube.framework 1.0 as Kube Flickable { id: personComposerFlickable anchors { fill: parent leftMargin: Kube.Units.largeSpacing } Controls2.ScrollBar.vertical: Kube.ScrollBar { } contentHeight: contentColumn.height clip: true Kube.ScrollHelper { flickable: personComposerFlickable anchors.fill: parent } ColumnLayout { id: contentColumn anchors { left: parent.left right: parent.right } spacing: Kube.Units.largeSpacing Item { width: parent.width height: Kube.Units.smallSpacing } Item { height: Kube.Units.gridUnit * 8 width: personComposerRoot.width - Kube.Units.largeSpacing Rectangle { id: avatar height: parent.height width: height Kube.KubeImage { anchors.fill: parent visible: contactController.imageData != "" imageData: contactController.imageData } Kube.Icon { anchors.fill: parent visible: contactController.imageData == "" iconName: Kube.Icons.user } color: Kube.Colors.buttonColor Kube.AbstractButton { anchors.fill: parent color: "#00000000" onClicked: { fileDialogComponent.createObject(parent) } Component { id: fileDialogComponent Dialogs.FileDialog { id: fileDialog visible: true title: "Choose an Avatar" selectFolder: false onAccepted: { //TODO } } } } } Row { id: nameRow anchors { left: avatar.right leftMargin: Kube.Units.largeSpacing } spacing: Kube.Units.smallSpacing Kube.TextField { width: Kube.Units.gridUnit * 15 placeholderText: qsTr("First Name") backgroundColor: "white" } Kube.TextField { width: Kube.Units.gridUnit * 15 placeholderText: qsTr("Last Name") backgroundColor: "white" } } Kube.TextField { id: jobTitle anchors { top: nameRow.bottom left: avatar.right topMargin: Kube.Units.smallSpacing leftMargin: Kube.Units.largeSpacing } width: Kube.Units.gridUnit * 20 text: contactController.jobTitle placeholderText: qsTr("Job Title") backgroundColor: "white" } Kube.TextField { id: company anchors { bottom: avatar.bottom left: avatar.right leftMargin: Kube.Units.largeSpacing } width: Kube.Units.gridUnit * 20 placeholderText: qsTr("Company") text: contactController.company backgroundColor: "white" } } Column { width: personComposerRoot.width - Kube.Units.largeSpacing spacing: Kube.Units.smallSpacing Kube.Label { text: qsTr("Email") } - Flow { - id: emails - - width: personComposerRoot.width - Kube.Units.largeSpacing - - Repeater { - model: contactController.emails - - delegate: Row { - spacing: Kube.Units.smallSpacing - Kube.Label { text: qsTr("(main)") } - Kube.TextField { width: Kube.Units.gridUnit * 15; text: modelDatas; color: Kube.Colors.highlightColor; backgroundColor: "white" } - Item { width: Kube.Units.smallSpacing; height: 1 } - } - } - } - Kube.Button { - text: qsTr("Add") + MailListEditor { + controller: contactController.mails } } Column { width: personComposerRoot.width - Kube.Units.largeSpacing spacing: Kube.Units.smallSpacing Kube.Label { text: qsTr("Phone") } - Flow { - id: phone - - width: personComposerRoot.width - Kube.Units.largeSpacing - spacing: Kube.Units.smallSpacing - - Repeater { - model: contactController.phoneNumbers - - Row { - spacing: Kube.Units.smallSpacing - Kube.Label { text: qsTr("(main)") } - Kube.TextField { width: Kube.Units.gridUnit * 15; text: modelData; backgroundColor: "white"} - Item { width: Kube.Units.smallSpacing; height: 1 } - } - } - } - Kube.Button { - text: qsTr("Add") + PhoneListEditor { + controller: contactController.phones } } Column{ id: address width: personComposerRoot.width - Kube.Units.largeSpacing spacing: Kube.Units.smallSpacing Kube.Label { text: "Address" } Kube.TextField { width: Kube.Units.gridUnit * 20 text: contactController.street placeholderText: qsTr("Street") backgroundColor: "white" } Kube.TextField { width: Kube.Units.gridUnit * 20 text: contactController.city placeholderText: qsTr("City") backgroundColor: "white" } Kube.TextField { width: Kube.Units.gridUnit * 20 text: contactController.country placeholderText: qsTr("Country") backgroundColor: "white" } } Item { width: parent.width height: Kube.Units.largeSpacing } } } diff --git a/views/people/qml/PhoneListEditor.qml b/views/people/qml/PhoneListEditor.qml new file mode 100644 index 00000000..6486e088 --- /dev/null +++ b/views/people/qml/PhoneListEditor.qml @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2018 Michael Bohlender, + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +import QtQuick 2.7 +import QtQuick.Layouts 1.1 + +import org.kube.framework 1.0 as Kube + +Column { + id: root + + property variant controller + + spacing: Kube.Units.smallSpacing + + ListView { + id: emails + + width: personComposerRoot.width - Kube.Units.largeSpacing + height: contentHeight + + model: controller.model + + delegate: Row { + height: textField.height + Kube.Units.smallSpacing + spacing: Kube.Units.smallSpacing + Kube.Label { text: qsTr("(main)") } + Kube.TextField {id: textField; width: Kube.Units.gridUnit * 15; text: model.number; backgroundColor: "white" } + Kube.IconButton { + id: removeButton + iconName: Kube.Icons.listRemove + onClicked: root.controller.remove(model.id) + } + } + } + + Kube.Button { + id: button + text: qsTr("Add") + focus: true + onClicked: { + root.controller.add({number: ""}); + } + } +}