File: create-account.qml

package info (click to toggle)
accounts-qml-module 0.7%2Bgit20231028.05e79eb-6
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 580 kB
  • sloc: cpp: 3,817; makefile: 35; sh: 5
file content (74 lines) | stat: -rw-r--r-- 2,329 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
 * Copyright 2013 Canonical Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; version 2.1.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import QtQuick 2.0
import SSO.OnlineAccounts 0.1

Rectangle {
    width: 400
    height: 300

    ListView {
        id: listView
        anchors.fill: parent
        focus: true
        model: ProviderModel {}
        spacing: 3
        delegate: Item {
            width: parent.width
            height: 60
            Account { 
                id: account
                objectHandle: Manager.createAccount(model.providerId)
            }
            AccountService {
                id: globalAccountSettings
                objectHandle: account.accountServiceHandle
                credentials: Credentials {
                    id: creds
                    userName: "my name"
                    secret: "password you'll never guess"
                    caption: account.provider.id
                    acl: ["*"]
                }
            }
            Rectangle {
                anchors.fill: parent
                radius: 10
                color: "lightsteelblue"
                Text {
                    font.bold: true
                    text: model.displayName
                }
                MouseArea {
                    anchors.fill: parent
                    /* Uncomment this to test the account creation.
                     WARNING: this will create a real account on your system,
                     with dummy data!
                     */
                    // onClicked: writeAccount()
                }
            }

            function writeAccount()
            {
                account.updateDisplayName("Delete me");
                account.updateEnabled(false);
                creds.sync();
            }
        }
    }
}