Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/nextcloud/nextcloudplugin_config.qml
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | Copyright 2017 Lim Yuen Hoe <yuenhoe86@gmail.com> | ||||
3 | | ||||
4 | This library is free software; you can redistribute it and/or | ||||
5 | modify it under the terms of the GNU Lesser General Public | ||||
6 | License as published by the Free Software Foundation; either | ||||
7 | version 2.1 of the License, or (at your option) any later version. | ||||
8 | | ||||
9 | This library is distributed in the hope that it will be useful, | ||||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
12 | Lesser General Public License for more details. | ||||
13 | | ||||
14 | You should have received a copy of the GNU Lesser General Public | ||||
15 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
16 | */ | ||||
17 | | ||||
18 | import QtQuick 2.2 | ||||
19 | import QtQuick.Controls 1.2 | ||||
20 | import QtQuick.Layouts 1.1 | ||||
21 | import org.kde.kquickcontrolsaddons 2.0 as KQCA | ||||
22 | import Ubuntu.OnlineAccounts 0.1 as OA | ||||
23 | | ||||
24 | ColumnLayout | ||||
25 | { | ||||
26 | id: root | ||||
27 | | ||||
28 | property alias folder: folderField.text | ||||
29 | property var accountId | ||||
30 | property var urls | ||||
31 | property var mimeType | ||||
32 | | ||||
33 | function accountChanged() | ||||
34 | { | ||||
35 | var valid = accountsCombo.enabled && accountsCombo.currentIndex>=0; | ||||
36 | if (valid) { root.accountId = serviceModel.get(accountsCombo.currentIndex, "accountId"); } | ||||
37 | refreshConfigReady(); | ||||
38 | } | ||||
39 | | ||||
40 | // without manually refreshing, auto-filled values don't seem to activate the "Run" button | ||||
41 | function refreshConfigReady() | ||||
42 | { | ||||
43 | var jobData = configuration.data; | ||||
44 | jobData['accountId'] = root.accountId; | ||||
45 | jobData['folder'] = root.folder; | ||||
46 | configuration.data = jobData; | ||||
47 | } | ||||
48 | | ||||
49 | Label { text: i18n("Account:") } | ||||
50 | RowLayout { | ||||
51 | Layout.fillWidth: true | ||||
52 | ComboBox { | ||||
53 | id: accountsCombo | ||||
54 | | ||||
55 | Layout.fillWidth: true | ||||
56 | textRole: "displayName" | ||||
57 | enabled: count>0 | ||||
58 | model: OA.AccountServiceModel { | ||||
59 | id: serviceModel | ||||
60 | serviceType: "nextcloud-upload" | ||||
61 | } | ||||
62 | onCurrentIndexChanged: root.accountChanged() | ||||
63 | Component.onCompleted: root.accountChanged() | ||||
64 | } | ||||
65 | Button { | ||||
66 | iconName: "settings-configure" | ||||
67 | onClicked: KQCA.KCMShell.open("kcm_kaccounts"); | ||||
68 | } | ||||
69 | } | ||||
70 | Label { text: i18n("Upload to folder:") } | ||||
71 | TextField { | ||||
72 | id: folderField | ||||
73 | Layout.fillWidth: true | ||||
74 | text: "/" | ||||
75 | } | ||||
76 | } |