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
|
/*
* 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
AccountServiceModel {
id: accounts
serviceType: "microblogging"
includeDisabled: true
}
ListView {
id: listView
width: parent.width
height: parent.height
anchors.fill: parent
focus: true
model: accounts
spacing: 3
delegate: Item {
width: parent.width
height: 60
AccountService {
id: accts
objectHandle: accountServiceHandle
onAuthenticated: { console.log("Access token is " + reply.AccessToken) }
onAuthenticationError: { console.log("Authentication failed, code " + error.code) }
onEnabledChanged: {
console.log ("ENABLED CHANGED");
}
}
Rectangle {
anchors.fill: parent
radius: 10
color: accts.enabled ? "lightsteelblue" : "#777"
Column {
anchors.fill: parent
anchors.margins: 5
Text {
font.bold: true
text: providerName
}
Text {
text: displayName
}
}
MouseArea {
anchors.fill: parent
onClicked: accts.authenticate(null)
}
}
}
}
}
|