QtAndroidTools/QtAndroidToolsDemo/tools/AndroidGoogleAccount.qml

89 lines
2.4 KiB
QML
Raw Normal View History

import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Dialogs 1.3
import QtAndroidTools 1.0
Page {
id: page
padding: 0
Connections {
target: QtAndroidGoogleAccount
2020-06-05 21:31:50 +02:00
function onSignedInAccountInfoChanged()
{
QtAndroidTools.insertImage("AccountPhoto", QtAndroidGoogleAccount.signedInAccountInfo.photo);
accountPhoto.source = "image://QtAndroidTools/AccountPhoto";
}
2020-06-05 21:31:50 +02:00
function onSignedIn(signInSuccessfully)
{
if(signInSuccessfully === true)
2019-10-01 23:13:20 +02:00
{
}
}
2020-06-05 21:31:50 +02:00
function onSignedOut()
{
QtAndroidTools.removeImage("AccountPhoto");
2019-09-30 22:10:35 +02:00
accountPhoto.source = "";
}
}
Column {
width: parent.width * 0.9
height: parent.height * 0.9
anchors.centerIn: parent
spacing: 5
Label {
font.pixelSize: 15
2020-06-05 21:31:50 +02:00
text: "<b>Id:</b> " + QtAndroidGoogleAccount.signedInAccountInfo.id
}
Label {
font.pixelSize: 15
2020-06-05 21:31:50 +02:00
text: "<b>DisplayName:</b> " + QtAndroidGoogleAccount.signedInAccountInfo.displayName
}
Label {
font.pixelSize: 15
2020-06-05 21:31:50 +02:00
text: "<b>Email:</b> " + QtAndroidGoogleAccount.signedInAccountInfo.email
}
Label {
font.pixelSize: 15
2020-06-05 21:31:50 +02:00
text: "<b>FamilyName:</b> " + QtAndroidGoogleAccount.signedInAccountInfo.familyName
}
Label {
font.pixelSize: 15
2020-06-05 21:31:50 +02:00
text: "<b>GivenName:</b> " + QtAndroidGoogleAccount.signedInAccountInfo.givenName
}
2019-09-30 22:10:35 +02:00
Label {
font.pixelSize: 15
2019-09-30 22:10:35 +02:00
text: "<b>Photo:</b> "
}
Image {
id: accountPhoto
2019-09-30 22:10:35 +02:00
width: 100
height: 100
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
2019-10-01 23:13:20 +02:00
text: "sigIn"
2020-01-07 04:40:17 +01:00
onClicked: QtAndroidGoogleAccount.signIn(QtAndroidGoogleDrive.SCOPE_DRIVE)
2019-09-30 22:10:35 +02:00
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
2019-10-01 23:13:20 +02:00
text: "sigIn select account"
2020-01-07 04:40:17 +01:00
onClicked: QtAndroidGoogleAccount.signInSelectAccount(QtAndroidGoogleDrive.SCOPE_DRIVE)
2019-09-30 22:10:35 +02:00
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: "signOut"
onClicked: QtAndroidGoogleAccount.signOut()
}
}
}