Warning, /pim/kube/framework/qml/EditAccount.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net>
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.Layouts 1.1
0022 import org.kube.framework 1.0 as Kube
0023 
0024 
0025 Item {
0026     id: root
0027     property string accountId
0028     property bool canRemove: true
0029 
0030     Kube.AccountFactory {
0031         id: accountFactory
0032         accountId: root.accountId
0033     }
0034 
0035     Item {
0036 
0037         anchors {
0038             fill: parent
0039             margins: Kube.Units.largeSpacing * 2
0040         }
0041 
0042         Kube.Heading {
0043             id: heading
0044             text: loader.item ? loader.item.heading : ""
0045             color: Kube.Colors.highlightColor
0046         }
0047 
0048         Kube.Label {
0049             id: subHeadline
0050 
0051             anchors {
0052                 left: heading.left
0053                 top: heading.bottom
0054             }
0055 
0056             width: parent.width
0057             text: loader.item ? loader.item.subheadline : ""
0058             color: Kube.Colors.disabledTextColor
0059             wrapMode: Text.Wrap
0060         }
0061 
0062         Column {
0063             anchors {
0064                 top: subHeadline.bottom
0065                 left: parent.left
0066                 right: parent.right
0067                 bottom: footer.top
0068                 topMargin: Kube.Units.largeSpacing * 2
0069             }
0070             spacing: Kube.Units.largeSpacing
0071             Loader {
0072                 id: loader
0073                 anchors {
0074                     left: parent.left
0075                     right: parent.right
0076                 }
0077                 height: item ? item.implicitHeight : 0
0078                 source: accountFactory.uiPath
0079                 Binding {
0080                     target: loader.item
0081                     property: "accountId"
0082                     value: root.accountId
0083                     when: loader.status == Loader.Ready
0084                 }
0085             }
0086             Kube.Button {
0087                 visible: accountFactory.requiresKeyring
0088                 anchors.right: parent.right
0089                 text: qsTr("Change Password")
0090                 onClicked: {
0091                     Kube.Fabric.postMessage(Kube.Messages.componentDone, {})
0092                     Kube.Fabric.postMessage(Kube.Messages.requestLogin, {accountId: loader.item.accountId})
0093                 }
0094             }
0095         }
0096 
0097         //This is where we should place the account wizard ui
0098         GridLayout {
0099             id: footer
0100             anchors {
0101                 bottom: parent.bottom
0102                 left: parent.left
0103                 right: parent.right
0104                 topMargin: Kube.Units.largeSpacing * 2
0105             }
0106             height: childrenRect.height
0107 
0108             columns: 2
0109             columnSpacing: Kube.Units.largeSpacing
0110             rowSpacing: Kube.Units.largeSpacing
0111 
0112             Item {
0113                 Layout.fillHeight: true
0114             }
0115 
0116             Kube.Label {
0117                 text: ""
0118             }
0119 
0120             Item {
0121                 Layout.fillWidth: true
0122 
0123                 Kube.Button {
0124                     text: qsTr("Remove Account")
0125                     visible: root.canRemove
0126 
0127                     onClicked: {
0128                         loader.item.remove()
0129                     }
0130                 }
0131 
0132                 Kube.Button {
0133                     anchors.right: parent.right
0134                     text: qsTr("Save")
0135                     onClicked: {
0136                         if(loader.item.valid) {
0137                             loader.item.save()
0138                             Kube.Fabric.postMessage(Kube.Messages.synchronize, {"accountId": loader.item.accountId});
0139                             Kube.Fabric.postMessage(Kube.Messages.componentDone, {})
0140                         } else {
0141                             console.warn("Invalid settings.");
0142                         }
0143                     }
0144                 }
0145             }
0146         }
0147     }
0148 }