From ad31e6a9c534c37375b1df6e50c37c30af5236dd Mon Sep 17 00:00:00 2001 From: Xavier Michelon Date: Thu, 10 Aug 2023 09:31:57 +0200 Subject: [PATCH] feat(GODT-2767): pass user and username to setup wizard. --- .../bridge-gui/bridge-gui/qml/MainWindow.qml | 2 +- .../SetupWizard/ClientConfigParameters.qml | 8 +++---- .../qml/SetupWizard/SetupWizard.qml | 23 +++++++++++-------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/MainWindow.qml b/internal/frontend/bridge-gui/bridge-gui/qml/MainWindow.qml index 3e725f4d..7fb46a0e 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/MainWindow.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/MainWindow.qml @@ -167,7 +167,7 @@ ApplicationWindow { Backend.quit(); } onShowSetupGuide: function (user, address) { - setupWizard.startClientConfig(); + setupWizard.startClientConfig(user, address); } onShowSetupWizard: { setupWizard.start(); diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/ClientConfigParameters.qml b/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/ClientConfigParameters.qml index 426581fa..bcda3273 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/ClientConfigParameters.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/ClientConfigParameters.qml @@ -64,8 +64,6 @@ Rectangle { RowLayout { id: configuration - property string currentAddress: wizard.user ? wizard.user.address : "" - Layout.fillHeight: true Layout.fillWidth: true Layout.topMargin: 32 @@ -78,7 +76,7 @@ Rectangle { port: Backend.imapPort.toString() security: Backend.useSSLForIMAP ? "SSL" : "STARTTLS" title: qsTr("IMAP") - username: configuration.currentAddress + username: wizard.address } Configuration { Layout.fillWidth: true @@ -88,7 +86,7 @@ Rectangle { port: Backend.smtpPort.toString() security: Backend.useSSLForSMTP ? "SSL" : "STARTTLS" title: qsTr("SMTP") - username: configuration.currentAddress + username: wizard.address } } @@ -107,7 +105,7 @@ Rectangle { Layout.topMargin: 32 colorScheme: root.colorScheme text: qsTr("Done") - onClicked: root.wizard.closeWizard() + onClicked: wizard.closeWizard() } } diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/SetupWizard.qml b/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/SetupWizard.qml index e7d176c8..7d9bf352 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/SetupWizard.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/SetupWizard.qml @@ -27,12 +27,11 @@ Item { Generic } - property string address property int client property string clientVersion property ColorScheme colorScheme - property string userID - property bool wasSignedOut + property var user + property string address function clientIconSource() { switch (client) { @@ -84,19 +83,19 @@ Item { rightContent.currentIndex = 0; } - function startClientConfig() { + function startClientConfig(user, address) { + root.user = user + root.address = address root.visible = true; rootStackLayout.currentIndex = 0; leftContent.showClientSelector(); rightContent.currentIndex = 2; } - function startLogin(wasSignedOut = false) { + function startLogin() { root.visible = true; rootStackLayout.currentIndex = 0; - root.userID = ""; root.address = ""; - root.wasSignedOut = wasSignedOut; leftContent.showLogin(); rightContent.currentIndex = 1; login.reset(true); @@ -116,8 +115,14 @@ Item { } Connections { - function onLoginFinished() { - startClientConfig(); + function onLoginFinished(userIndex, wasSignedOut) { + if (wasSignedOut) { + closeWizard(); + return; + } + let user = Backend.users.get(userIndex) + let address = user ? user.addresses[0] : "" + startClientConfig(user, address); } target: Backend