Warning, /frameworks/purpose/src/plugins/nextcloud/nextcloudplugin_config.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2017 Lim Yuen Hoe <yuenhoe86@gmail.com>
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.kcmutils as KCMUtils
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 accountId
0020     property var urls
0021     property var mimeType
0022 
0023     Kirigami.Heading {
0024         text: i18nd("purpose6_nextcloud", "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: "dav-storage"
0044             }
0045 
0046             delegate: ItemDelegate {
0047                 width: ListView.view.width
0048                 text: model.displayName
0049             }
0050 
0051             onCurrentIndexChanged: {
0052                 if (currentIndex === -1) {
0053                     root.accountId = undefined
0054                     return
0055                 }
0056 
0057                 root.accountId = serviceModel.get(list.currentIndex, "accountId")
0058             }
0059 
0060             Kirigami.PlaceholderMessage {
0061                 anchors.centerIn: parent
0062                 width: parent.width - (Kirigami.Units.largeSpacing * 4)
0063                 visible: list.count === 0
0064                 text: i18nd("purpose6_nextcloud", "No account configured")
0065             }
0066         }
0067     }
0068 
0069     Button {
0070         Layout.alignment: Qt.AlignRight
0071 
0072         text: i18nd("purpose6_nextcloud", "Configure Accounts")
0073         icon.name: "applications-internet"
0074         onClicked: KCMUtils.KCMLauncher.openSystemSettings("kcm_kaccounts")
0075     }
0076 
0077     Label {
0078         Layout.fillWidth: true
0079         text: i18nd("purpose6_nextcloud", "Upload to folder:")
0080     }
0081 
0082     TextField {
0083         id: folderField
0084         Layout.fillWidth: true
0085         text: "/"
0086         onTextChanged: {
0087             // Setting folder to undefined disables the Run button
0088             root.folder = text !== "" ? text : undefined
0089         }
0090     }
0091 }