Add more behavior with the local test env.
This commit is contained in:
1 parent
acb58142d9
commit
df847becc8
10 files changed
+450
-114
No files matched your search
+30
-5
@@ -8,6 +8,7 @@ Page {
|
||||
|
||||
property string username: ""
|
||||
property bool quickConnect: false
|
||||
property bool quickConnectAvailable: false
|
||||
property string quickConnectCode: ""
|
||||
property bool busy: false
|
||||
property string error: ""
|
||||
@@ -39,13 +40,34 @@ Page {
|
||||
error = "";
|
||||
quickConnect = enabled;
|
||||
if (enabled) {
|
||||
quickConnectCode = page.session.startQuickConnect();
|
||||
quickConnectCode = "";
|
||||
passwordModeButton.forceActiveFocus();
|
||||
page.session.startQuickConnect(function (err, code) {
|
||||
if (err) {
|
||||
page.error = err;
|
||||
return;
|
||||
}
|
||||
page.quickConnectCode = code;
|
||||
}, function (err) {
|
||||
if (err) {
|
||||
page.error = err;
|
||||
return;
|
||||
}
|
||||
page.navigator.reset("Home");
|
||||
});
|
||||
} else {
|
||||
page.session.stopQuickConnect();
|
||||
page.initialFocus.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
|
||||
// Le bouton Quick Connect n'est proposé que si le serveur l'autorise.
|
||||
Component.onCompleted: {
|
||||
page.session.isQuickConnectEnabled(function (err, enabled) {
|
||||
page.quickConnectAvailable = enabled;
|
||||
});
|
||||
}
|
||||
|
||||
Component.onDestruction: if (page.session) page.session.cancel()
|
||||
|
||||
Column {
|
||||
@@ -90,12 +112,13 @@ Page {
|
||||
primary: true
|
||||
text: page.busy ? "Connexion…" : "Se connecter"
|
||||
KeyNavigation.up: passwordField
|
||||
KeyNavigation.right: quickConnectButton
|
||||
KeyNavigation.right: page.quickConnectAvailable ? quickConnectButton : null
|
||||
onClicked: page.signIn()
|
||||
}
|
||||
|
||||
FocusButton {
|
||||
id: quickConnectButton
|
||||
visible: page.quickConnectAvailable
|
||||
text: "Utiliser Quick Connect"
|
||||
KeyNavigation.up: passwordField
|
||||
KeyNavigation.left: signInButton
|
||||
@@ -119,7 +142,7 @@ Page {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: page.quickConnectCode
|
||||
text: page.quickConnectCode !== "" ? page.quickConnectCode : "…"
|
||||
color: Theme.accent
|
||||
font.pixelSize: Theme.fontCode
|
||||
font.bold: true
|
||||
@@ -127,8 +150,10 @@ Page {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "En attente d'autorisation…"
|
||||
color: Theme.textMuted
|
||||
width: parent.width
|
||||
text: page.error !== "" ? page.error : "En attente d'autorisation…"
|
||||
color: page.error !== "" ? Theme.error : Theme.textMuted
|
||||
wrapMode: Text.WordWrap
|
||||
font.pixelSize: Theme.fontSmall
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user