feat(GODT-2767): pass user and username to setup wizard.

This commit is contained in:
Xavier Michelon
2023-08-10 09:31:57 +02:00
parent 9ef7d133c0
commit ad31e6a9c5
3 changed files with 18 additions and 15 deletions

View File

@ -167,7 +167,7 @@ ApplicationWindow {
Backend.quit();
}
onShowSetupGuide: function (user, address) {
setupWizard.startClientConfig();
setupWizard.startClientConfig(user, address);
}
onShowSetupWizard: {
setupWizard.start();

View File

@ -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()
}
}

View File

@ -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