import QtQuick import QtQuick.Layouts import qs.Common import qs.Widgets // Matrix login is homeserver URL + username + password (m.login.password) - // no SSO/QR flow in v1, see backend/matrix/auth.rs. Login itself (resolving // the homeserver, authenticating, then bootstrapping this device's E2EE // identity) can take a moment, so this only ever renders a status string // fed by matrixLoginStatus/matrixLoginResult events - see ChatView.qml's // handling of those, mirrored from the Sneedchat/Discord equivalents. ColumnLayout { id: root signal connectRequested(string homeserverUrl, string username, string password) property string statusText: "" property bool pending: false onStatusTextChanged: root.pending = false spacing: Theme.spacingXS DankTextField { id: homeserverField Layout.fillWidth: true placeholderText: "homeserver (e.g. https://matrix.org)" text: "https://matrix.org" } RowLayout { Layout.fillWidth: true spacing: Theme.spacingXS DankTextField { id: usernameField Layout.fillWidth: true placeholderText: "username" } DankTextField { id: passwordField Layout.preferredWidth: 160 placeholderText: "password" echoMode: TextInput.Password } } DankButton { text: root.pending ? "Connecting..." : "Connect" enabled: !root.pending onClicked: { if (!homeserverField.text || !usernameField.text || !passwordField.text) { root.statusText = "Homeserver, username and password are required."; return; } root.pending = true; root.statusText = ""; root.connectRequested(homeserverField.text, usernameField.text, passwordField.text); passwordField.text = ""; } } StyledText { Layout.fillWidth: true visible: root.statusText !== "" text: root.statusText wrapMode: Text.WordWrap color: Theme.surfaceVariantText } }