GODT-2042: fix setup guide not always showing on first login.

This commit is contained in:
Xavier Michelon
2022-12-02 11:17:28 +01:00
parent e87db5b2ab
commit 4003e0a2ab
20 changed files with 1039 additions and 1033 deletions

View File

@ -126,12 +126,8 @@ void QMLBackend::connectGrpcEvents()
connect(client, &GRPCClient::login2PasswordRequested, this, &QMLBackend::login2PasswordRequested);
connect(client, &GRPCClient::login2PasswordError, this, &QMLBackend::login2PasswordError);
connect(client, &GRPCClient::login2PasswordErrorAbort, this, &QMLBackend::login2PasswordErrorAbort);
connect(client, &GRPCClient::loginFinished, this, [&](QString const &userID) {
this->retrieveUserList();
qint32 const index = users_->rowOfUserID(userID); emit loginFinished(index); });
connect(client, &GRPCClient::loginAlreadyLoggedIn, this, [&](QString const &userID) {
this->retrieveUserList();
qint32 const index = users_->rowOfUserID(userID); emit loginAlreadyLoggedIn(index); });
connect(client, &GRPCClient::loginFinished, this, &QMLBackend::onLoginFinished);
connect(client, &GRPCClient::loginAlreadyLoggedIn, this, &QMLBackend::onLoginAlreadyLoggedIn);
// update events
connect(client, &GRPCClient::updateManualError, this, &QMLBackend::updateManualError);
@ -429,6 +425,28 @@ void QMLBackend::setMailServerSettings(int imapPort, int smtpPort, bool useSSLFo
}
//****************************************************************************************************************************************************
/// \param[in] userID the userID.
/// \param[in] wasSignedOut Was the user signed-out.
//****************************************************************************************************************************************************
void QMLBackend::onLoginFinished(QString const &userID, bool wasSignedOut)
{
this->retrieveUserList();
qint32 const index = users_->rowOfUserID(userID);
emit loginFinished(index, wasSignedOut);
}
//****************************************************************************************************************************************************
/// \param[in] userID the userID.
//****************************************************************************************************************************************************
void QMLBackend::onLoginAlreadyLoggedIn(QString const &userID)
{
this->retrieveUserList();
qint32 const index = users_->rowOfUserID(userID);
emit loginAlreadyLoggedIn(index);
}
//****************************************************************************************************************************************************
/// \param[in] useSSLForIMAP The value for the 'Use SSL for IMAP' property
/// \param[in] useSSLForSMTP The value for the 'Use SSL for SMTP' property

View File

@ -179,6 +179,8 @@ public slots: // slot for signals received from QML -> To be forwarded to Bridge
public slots: // slot for signals received from gRPC that need transformation instead of simple forwarding
void onMailServerSettingsChanged(int imapPort, int smtpPort, bool useSSLForIMAP, bool useSSLForSMTP); ///< Slot for the ConnectionModeChanged gRPC event.
void onGenericError(bridgepp::ErrorInfo const& info); ///< Slot for generic errors received from the gRPC service.
void onLoginFinished(QString const &userID, bool wasSignedOut); ///< Slot for LoginFinished gRPC event.
void onLoginAlreadyLoggedIn(QString const &userID); ///< Slot for the LoginAlreadyLoggedIn gRPC event.
signals: // Signals received from the Go backend, to be forwarded to QML
void toggleAutostartFinished();
@ -195,7 +197,7 @@ signals: // Signals received from the Go backend, to be forwarded to QML
void login2PasswordRequested();
void login2PasswordError(QString const& errorMsg);
void login2PasswordErrorAbort(QString const& errorMsg);
void loginFinished(int index);
void loginFinished(int index, bool wasSignedOut);
void loginAlreadyLoggedIn(int index);
void updateManualReady(QString const& version);
void updateManualRestartNeeded();

View File

@ -100,7 +100,6 @@ void UserList::reset(QList<SPUser> const &users)
//****************************************************************************************************************************************************
void UserList::appendUser(SPUser const &user)
{
user->setSetupGuideSeen(false);
int const size = users_.size();
this->beginInsertRows(QModelIndex(), size, size);
users_.append(user);

View File

@ -86,7 +86,11 @@ ApplicationWindow {
root.showAndRise()
}
function onLoginFinished(index) {
function onLoginFinished(index, wasSignedOut) {
var user = Backend.users.get(index)
if (user && !wasSignedOut) {
root.showSetup(user, user.addresses[0])
}
console.debug("Login finished", index)
}
}