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

KDE's Doxygen guidelines are available online.