diff --git a/src/LoginPage.qml b/src/LoginPage.qml index 57658ff..4f0d1ae 100644 --- a/src/LoginPage.qml +++ b/src/LoginPage.qml @@ -8,6 +8,7 @@ Page { id: page function saveSettings() { + settings.autoLogIn = autoLogIn.checked; settings.connectOptions = connectOptions.text; settings.databaseName = databaseName.text; settings.hostName = hostName.text; @@ -15,6 +16,12 @@ Page { settings.usePort = usePort.checked; } + function tryAutoLogIn() { + if (autoLogIn.checked) { + loginAction.trigger(); + } + } + title: qsTr("Login") ColumnLayout { @@ -133,6 +140,22 @@ Page { onAccepted: loginAction.trigger() } + + CheckBox { + id: autoLogIn + + Layout.alignment: Qt.AlignRight + Layout.columnSpan: 2 + Mnemonic.label: qsTr("Log in auto&matically") + checked: settings.autoLogIn + text: Mnemonic.richTextLabel + + Shortcut { + sequence: autoLogIn.Mnemonic.sequence + + onActivated: autoLogIn.click() + } + } } } @@ -145,6 +168,7 @@ Page { Settings { id: settings + property bool autoLogIn: false property string connectOptions: "" property string databaseName: "" property string hostName: "" diff --git a/src/Main.qml b/src/Main.qml index e3ea3e5..697932c 100644 --- a/src/Main.qml +++ b/src/Main.qml @@ -9,6 +9,10 @@ ApplicationWindow { visible: true width: 640 + Component.onCompleted: function () { + (pageStack.currentItem as LoginPage)?.tryAutoLogIn(); + } + StackView { id: pageStack