Contact the server's .well-known API before anything to get available login flows instead of blindly assuming it will be m.login.password, and to get the server's real URL instead of requiring users to remember that e.g. it's "chat.privacytools.io" and not just "privacytools.io" despite user IDs making it look like so. The server field will also now remember the last accepted URL.
52 lines
1.4 KiB
QML
52 lines
1.4 KiB
QML
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
import QtQuick 2.12
|
|
import QtQuick.Layouts 1.12
|
|
import "../../Base"
|
|
|
|
HSwipeView {
|
|
id: swipeView
|
|
clip: true
|
|
interactive: currentIndex !== 0 || signIn.serverUrl
|
|
onCurrentItemChanged: if (currentIndex === 0) serverBrowser.takeFocus()
|
|
Component.onCompleted: serverBrowser.takeFocus()
|
|
|
|
HPage {
|
|
id: serverPage
|
|
|
|
ServerBrowser {
|
|
id: serverBrowser
|
|
anchors.centerIn: parent
|
|
width: Math.min(implicitWidth, serverPage.availableWidth)
|
|
height: Math.min(implicitHeight, serverPage.availableHeight)
|
|
onAccepted: swipeView.currentIndex = 1
|
|
}
|
|
}
|
|
|
|
HPage {
|
|
id: tabPage
|
|
|
|
HTabbedBox {
|
|
anchors.centerIn: parent
|
|
width: Math.min(implicitWidth, tabPage.availableWidth)
|
|
height: Math.min(implicitHeight, tabPage.availableHeight)
|
|
|
|
header: HTabBar {
|
|
HTabButton { text: qsTr("Sign in") }
|
|
HTabButton { text: qsTr("Register") }
|
|
HTabButton { text: qsTr("Reset") }
|
|
}
|
|
|
|
SignIn {
|
|
id: signIn
|
|
serverUrl: serverBrowser.acceptedUrl
|
|
displayUrl: serverBrowser.acceptedUserUrl
|
|
onExitRequested: swipeView.currentIndex = 0
|
|
}
|
|
|
|
Register {}
|
|
Reset {}
|
|
}
|
|
}
|
|
}
|