diff options
Diffstat (limited to 'Login.qml')
| -rw-r--r-- | Login.qml | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/Login.qml b/Login.qml new file mode 100644 index 0000000..24354f6 --- /dev/null +++ b/Login.qml @@ -0,0 +1,101 @@ +import QtQuick 2.12 +import QtQuick.Window 2.12 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.0 +import org.yachat.app 1.0 + +Page +{ + header: CustToolbar + { + title: qsTr("Login") + } + + Login + { + id: login + } + + ColumnLayout + { + Row + { + Layout.fillWidth: true + + Text + { + text: qsTr("Username: ") + } + + TextField + { + id: username + placeholderText: qsTr("Enter username") + + Component.onCompleted: + { + username.forceActiveFocus() + } + } + } + + Row + { + Layout.fillWidth: true + + Text + { + text: qsTr("Password: ") + } + + TextField + { + id: password + placeholderText: qsTr("Enter password") + echoMode: TextInput.Password + } + } + + Button + { + text: qsTr("Login") + enabled: username.text && password.text + onClicked: + { + login.start(username.text, password.text) + } + + Connections + { + target: login + function onAuthSuccess(client) + { + Yc.addAccount(client) + Yc.storeAccount(client) + } + + function onClose() + { + stack.pop() + } + } + } + + Row + { + Text + { + id: error + + Connections + { + target: login + function onError(msg) + { + error.text = msg + } + } + } + } + } +} |
