Purpose

nextcloudplugin_config.qml
1/*
2 SPDX-FileCopyrightText: 2017 Lim Yuen Hoe <yuenhoe86@gmail.com>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7import QtQuick 2.2
8import QtQuick.Controls 2.10
9import QtQuick.Layouts 1.1
10import org.kde.kirigami 2.12 as Kirigami
11import org.kde.kcmutils as KCMUtils
12import SSO.OnlineAccounts 0.1 as OA
13
14ColumnLayout
15{
16 id: root
17
18 property var folder: folderField.text
19 property var accountId
20 property var urls
21 property var mimeType
22
23 Kirigami.Heading {
24 text: i18nd("purpose6_nextcloud", "Select an account:")
25 visible: list.count !== 0
26 }
27
29 id: scroll
30
31 Layout.fillWidth: true
32 Layout.fillHeight: true
33
34 Component.onCompleted: scroll.background.visible = true
35
36 ListView {
37 id: list
38
39 clip: true
40
41 model: OA.AccountServiceModel {
42 id: serviceModel
43 serviceType: "dav-storage"
44 }
45
46 delegate: ItemDelegate {
47 width: ListView.view.width
48 text: model.displayName
49 }
50
51 onCurrentIndexChanged: {
52 if (currentIndex === -1) {
53 root.accountId = undefined
54 return
55 }
56
57 root.accountId = serviceModel.get(list.currentIndex, "accountId")
58 }
59
60 Kirigami.PlaceholderMessage {
61 anchors.centerIn: parent
62 width: parent.width - (Kirigami.Units.largeSpacing * 4)
63 visible: list.count === 0
64 text: i18nd("purpose6_nextcloud", "No account configured")
65 }
66 }
67 }
68
69 Button {
70 Layout.alignment: Qt.AlignRight
71
72 text: i18nd("purpose6_nextcloud", "Configure Accounts")
73 icon.name: "applications-internet"
74 onClicked: KCMUtils.KCMLauncher.openSystemSettings("kcm_kaccounts")
75 }
76
77 Label {
78 Layout.fillWidth: true
79 text: i18nd("purpose6_nextcloud", "Upload to folder:")
80 }
81
82 TextField {
83 id: folderField
84 Layout.fillWidth: true
85 text: "/"
86 onTextChanged: {
87 // Setting folder to undefined disables the Run button
88 root.folder = text !== "" ? text : undefined
89 }
90 }
91}
QString i18nd(const char *domain, const char *text, const TYPE &arg...)
AKONADI_CALENDAR_EXPORT QString displayName(Akonadi::ETMCalendar *calendar, const Akonadi::Collection &collection)
KIOCORE_EXPORT QStringList list(const QString &fileClass)
QString name(StandardShortcut id)
AlignRight
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:05 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.