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(); Backend.quit();
} }
onShowSetupGuide: function (user, address) { onShowSetupGuide: function (user, address) {
setupWizard.startClientConfig(); setupWizard.startClientConfig(user, address);
} }
onShowSetupWizard: { onShowSetupWizard: {
setupWizard.start(); setupWizard.start();

View File

@ -64,8 +64,6 @@ Rectangle {
RowLayout { RowLayout {
id: configuration id: configuration
property string currentAddress: wizard.user ? wizard.user.address : ""
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 32 Layout.topMargin: 32
@ -78,7 +76,7 @@ Rectangle {
port: Backend.imapPort.toString() port: Backend.imapPort.toString()
security: Backend.useSSLForIMAP ? "SSL" : "STARTTLS" security: Backend.useSSLForIMAP ? "SSL" : "STARTTLS"
title: qsTr("IMAP") title: qsTr("IMAP")
username: configuration.currentAddress username: wizard.address
} }
Configuration { Configuration {
Layout.fillWidth: true Layout.fillWidth: true
@ -88,7 +86,7 @@ Rectangle {
port: Backend.smtpPort.toString() port: Backend.smtpPort.toString()
security: Backend.useSSLForSMTP ? "SSL" : "STARTTLS" security: Backend.useSSLForSMTP ? "SSL" : "STARTTLS"
title: qsTr("SMTP") title: qsTr("SMTP")
username: configuration.currentAddress username: wizard.address
} }
} }
@ -107,7 +105,7 @@ Rectangle {
Layout.topMargin: 32 Layout.topMargin: 32
colorScheme: root.colorScheme colorScheme: root.colorScheme
text: qsTr("Done") text: qsTr("Done")
onClicked: root.wizard.closeWizard() onClicked: wizard.closeWizard()
} }
} }

View File

@ -27,12 +27,11 @@ Item {
Generic Generic
} }
property string address
property int client property int client
property string clientVersion property string clientVersion
property ColorScheme colorScheme property ColorScheme colorScheme
property string userID property var user
property bool wasSignedOut property string address
function clientIconSource() { function clientIconSource() {
switch (client) { switch (client) {
@ -84,19 +83,19 @@ Item {
rightContent.currentIndex = 0; rightContent.currentIndex = 0;
} }
function startClientConfig() { function startClientConfig(user, address) {
root.user = user
root.address = address
root.visible = true; root.visible = true;
rootStackLayout.currentIndex = 0; rootStackLayout.currentIndex = 0;
leftContent.showClientSelector(); leftContent.showClientSelector();
rightContent.currentIndex = 2; rightContent.currentIndex = 2;
} }
function startLogin(wasSignedOut = false) { function startLogin() {
root.visible = true; root.visible = true;
rootStackLayout.currentIndex = 0; rootStackLayout.currentIndex = 0;
root.userID = "";
root.address = ""; root.address = "";
root.wasSignedOut = wasSignedOut;
leftContent.showLogin(); leftContent.showLogin();
rightContent.currentIndex = 1; rightContent.currentIndex = 1;
login.reset(true); login.reset(true);
@ -116,8 +115,14 @@ Item {
} }
Connections { Connections {
function onLoginFinished() { function onLoginFinished(userIndex, wasSignedOut) {
startClientConfig(); if (wasSignedOut) {
closeWizard();
return;
}
let user = Backend.users.get(userIndex)
let address = user ? user.addresses[0] : ""
startClientConfig(user, address);
} }
target: Backend target: Backend