Warning, /pim/kube/components/accounts/qml/AccountWizardPage.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 QtQuick.Controls 2
0023 import org.kube.framework 1.0 as Kube
0024
0025
0026 FocusScope {
0027 id: root
0028 property string accountType
0029 signal done()
0030
0031 property bool isFirstView: root.StackView.index == 0
0032 property bool requireSetup: false
0033
0034 function save() {
0035 if (loader.item.valid) {
0036 loader.item.save()
0037 Kube.Fabric.postMessage(Kube.Messages.synchronize, {"accountId": loader.item.accountIdentifier});
0038 root.done()
0039 } else {
0040 console.warn("Invalid settings.");
0041 }
0042 }
0043
0044 //accountType -> uiPath
0045 Kube.AccountFactory {
0046 id: accountFactory
0047 accountType: root.accountType
0048 }
0049
0050 Kube.IconButton {
0051 id: backButton
0052 iconName: Kube.Icons.goBack
0053 tooltip: "go back"
0054 visible: !root.isFirstView
0055 onClicked: {
0056 stack.pop()
0057 }
0058 }
0059
0060 Keys.onReturnPressed: save()
0061
0062 //Item to avoid anchors conflict with stack
0063 Item {
0064 anchors{
0065 top: backButton.bottom
0066 left: parent.left
0067 right: parent.right
0068 bottom: parent.bottom
0069 }
0070
0071 Kube.Heading {
0072 id: heading
0073 text: loader.item.heading
0074 color: Kube.Colors.highlightColor
0075 }
0076
0077 Kube.Label {
0078 id: subHeadline
0079
0080 anchors {
0081 left: heading.left
0082 top: heading.bottom
0083 }
0084
0085 width: parent.width
0086 text: loader.item.subheadline
0087 color: Kube.Colors.disabledTextColor
0088 wrapMode: Text.Wrap
0089 }
0090
0091 Item {
0092 id: accountEdit
0093 anchors {
0094 top:subHeadline.bottom
0095 left: parent.left
0096 right: parent.right
0097 topMargin: Kube.Units.largeSpacing * 2
0098 }
0099
0100 Loader {
0101 id: loader
0102 anchors.fill: parent
0103 focus: true
0104 source: accountFactory.uiPath
0105 }
0106 }
0107
0108 Item {
0109 id: spacer
0110 Layout.fillHeight: true
0111 anchors {
0112 top:accountEdit.bottom
0113 bottom: footer.top
0114 left: parent.left
0115 right: parent.right
0116 }
0117 }
0118
0119 //This is where we should place the account wizard ui
0120 Item {
0121 id: footer
0122
0123 anchors {
0124 bottom: parent.bottom
0125 left: parent.left
0126 right: parent.right
0127 topMargin: Kube.Units.largeSpacing * 2
0128 }
0129
0130 Kube.Button {
0131 anchors {
0132 left: parent.left
0133 bottom: parent.bottom
0134 }
0135 visible: !root.requireSetup
0136
0137 text: qsTr("Discard")
0138 onClicked: {
0139 root.done()
0140 }
0141 }
0142
0143 Kube.PositiveButton {
0144 anchors {
0145 right: parent.right
0146 bottom: parent.bottom
0147 }
0148 objectName: "saveButton"
0149
0150 text: qsTr("Save")
0151 onClicked: save()
0152 }
0153 }
0154 }
0155 }