Debian Codegraph @

online-accounts-plugins/lib/module/qml6/ServiceSwitches.qml

raw
1 /*
2 * Copyright (C) 2013-2015 Canonical Ltd.
3 *
4 * Contact: Alberto Mardegan <[email protected]>
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 3, as published
8 * by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranties of
12 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
13 * PURPOSE. See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 import QtQuick 2.9
20 import Lomiri.Components
21 import Lomiri.Components.ListItems as ListItem
22 import SSO.OnlineAccounts 0.1
23
24 Column {
25 id: root
26
27 property var account
28
29 anchors.left: parent.left
30 anchors.right: parent.right
31
32 ListItem.Standard {
33 text: i18n.dtr("lomiri-online-accounts", "Access to this account:")
34 }
35
36 AccountServiceModel {
37 id: accountServices
38 includeDisabled: true
39 account: root.account.objectHandle
40 }
41
42 AccountService {
43 id: globalAccountService
44 objectHandle: root.account.accountServiceHandle
45 }
46
47 Credentials {
48 id: credentials
49 credentialsId: globalAccountService.authData.credentialsId
50 }
51
52 Repeater {
53 model: accountServices
54 delegate: ServiceItem {
55 accountServiceHandle: model.accountServiceHandle
56 onApplicationAdded: {
57 var newAcl = ApplicationManager.addApplicationToAcl(credentials.acl,
58 applicationId)
59 if (newAcl != credentials.acl) {
60 credentials.acl = newAcl
61 credentials.sync()
62 }
63 }
64
65 onApplicationRemoved: {
66 var newAcl =
67 ApplicationManager.removeApplicationFromAcl(credentials.acl,
68 applicationId)
69 if (newAcl != credentials.acl) {
70 credentials.acl = newAcl
71 credentials.sync()
72 }
73 }
74 }
75 }
76 }