Add Default and RememberAccount? pages

This commit is contained in:
miruka
2019-04-27 21:07:20 -04:00
parent 0db5a3233d
commit 8a714fb7a0
8 changed files with 103 additions and 23 deletions

View File

@@ -0,0 +1,22 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4
import "../base" as Base
Base.HRowLayout {
Base.HLabel {
text: "Select or add a room to start."
wrapMode: Text.Wrap
padding: 3
leftPadding: 10
rightPadding: 10
Layout.margins: 10
Layout.alignment: Qt.AlignCenter
Layout.maximumWidth: parent.width - Layout.margins * 2
background: Rectangle {
color: Qt.hsla(1, 1, 1, 0.3)
}
}
}

View File

@@ -0,0 +1,44 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4
import "../base" as Base
Item {
property string loginWith: "username"
property var client: null
Base.HInterfaceBox {
id: rememberBox
title: "Sign in"
anchors.centerIn: parent
enterButtonTarget: "yes"
buttonModel: [
{ name: "yes", text: qsTr("Yes") },
{ name: "no", text: qsTr("No") },
]
buttonCallbacks: {
"yes": function(button) {
Backend.clientManager.remember(client)
pageStack.showPage("Default")
},
"no": function(button) { pageStack.showPage("Default") },
}
Base.HLabel {
text: qsTr(
"Do you want to remember this account?\n\n" +
"If yes, the " + loginWith + " and an access token will be " +
"stored to automatically sign in on this device."
)
wrapMode: Text.Wrap
Layout.margins: rememberBox.margins
Layout.maximumWidth: rememberBox.width - Layout.margins * 2
}
Item { Layout.fillHeight: true }
}
}

View File

@@ -25,11 +25,16 @@ Item {
"register": function(button) {},
"login": function(button) {
button.loadingUntilFutureDone(
Backend.clientManager.new(
"matrix.org", identifierField.text, passwordField.text
)
var future = Backend.clientManager.new(
"matrix.org", identifierField.text, passwordField.text
)
button.loadingUntilFutureDone(future)
future.onGotResult.connect(function(client) {
pageStack.showPage(
"RememberAccount",
{"loginWith": loginWith, "client": client}
)
})
},
"forgot": function(button) {}
@@ -60,6 +65,7 @@ Item {
loginWith === "phone" ? "Phone" :
"Username"
)
text: "test_mary"
onAccepted: signInBox.clickEnterButtonTarget()
Layout.fillWidth: true
@@ -67,6 +73,7 @@ Item {
}
Base.HTextField {
text: "1234"
id: passwordField
placeholderText: qsTr("Password")
echoMode: TextField.Password