Warning, /network/kio-gdrive/purpose/purpose_gdrive_config.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2020 Nicolas Fella <nicolas.fella@gmx.de>
0003
0004 SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006
0007 import QtQuick 2.2
0008 import QtQuick.Controls 2.10
0009 import QtQuick.Layouts 1.1
0010 import org.kde.kirigami 2.12 as Kirigami
0011 import org.kde.kquickcontrolsaddons 2.0 as KQCA
0012 import SSO.OnlineAccounts 0.1 as OA
0013
0014 ColumnLayout
0015 {
0016 id: root
0017
0018 property var folder: folderField.text
0019 property var accountName
0020 property var urls
0021 property var mimeType
0022
0023 Kirigami.Heading {
0024 text: i18nd("kio5_gdrive", "Select an account:")
0025 visible: list.count !== 0
0026 }
0027
0028 ScrollView {
0029 id: scroll
0030
0031 Layout.fillWidth: true
0032 Layout.fillHeight: true
0033
0034 Component.onCompleted: scroll.background.visible = true
0035
0036 ListView {
0037 id: list
0038
0039 clip: true
0040
0041 model: OA.AccountServiceModel {
0042 id: serviceModel
0043 serviceType: "google-drive"
0044 }
0045
0046 delegate: Kirigami.BasicListItem {
0047 text: model.displayName
0048 }
0049
0050 onCurrentIndexChanged: {
0051 if (currentIndex === -1) {
0052 root.accountName = undefined
0053 return
0054 }
0055
0056 root.accountName = serviceModel.get(list.currentIndex, "displayName")
0057 }
0058
0059 Kirigami.PlaceholderMessage {
0060 anchors.centerIn: parent
0061 width: parent.width - (Kirigami.Units.largeSpacing * 4)
0062 visible: list.count === 0
0063 text: i18nd("kio5_gdrive", "No account configured")
0064 }
0065 }
0066 }
0067
0068 Button {
0069 Layout.alignment: Qt.AlignRight
0070
0071 text: i18nd("kio5_gdrive", "Configure Accounts")
0072 icon.name: "applications-internet"
0073 onClicked: KQCA.KCMShell.openSystemSettings("kcm_kaccounts")
0074 }
0075
0076 Label {
0077 Layout.fillWidth: true
0078 text: i18nd("kio5_gdrive", "Upload to folder:")
0079 }
0080
0081 TextField {
0082 id: folderField
0083 Layout.fillWidth: true
0084 text: "/"
0085 onTextChanged: {
0086 // Setting folder to undefined disables the Run button
0087 root.folder = text !== "" ? text : undefined
0088 }
0089 }
0090 }