Replace simulated IMAP delay with real connection test using AccountService::testConnection
This commit is contained in:
@@ -552,18 +552,27 @@ void AccountSetupDialog::submitImapAccount()
|
|||||||
m_sslCheckbox->isChecked() ? "Sí" : "No")
|
m_sslCheckbox->isChecked() ? "Sí" : "No")
|
||||||
);
|
);
|
||||||
|
|
||||||
// Simulate connection delay, then add/update account
|
// Disable UI during connection attempt
|
||||||
QTimer::singleShot(1500, this, [this, account]() mutable {
|
m_btnBack->setEnabled(false);
|
||||||
if (m_isEditing) {
|
m_btnNext->setEnabled(false);
|
||||||
account.setId(m_editingAccountId);
|
m_btnCancel->setEnabled(false);
|
||||||
m_accountService->updateAccount(account);
|
QString errorMsg;
|
||||||
} else {
|
bool success = m_accountService->testConnection(account.connectionSettings(), errorMsg);
|
||||||
m_accountService->addAccount(account);
|
if (success) {
|
||||||
}
|
if (m_isEditing) {
|
||||||
});
|
account.setId(m_editingAccountId);
|
||||||
|
m_accountService->updateAccount(account);
|
||||||
// Timeout for IMAP too
|
} else {
|
||||||
m_authTimeoutTimer->start(30000);
|
m_accountService->addAccount(account);
|
||||||
|
}
|
||||||
|
m_btnCancel->setEnabled(true);
|
||||||
|
} else {
|
||||||
|
QMessageBox::warning(this, tr("Connection failed"), tr("Could not connect to IMAP server: %1").arg(errorMsg));
|
||||||
|
// Re-enable UI
|
||||||
|
m_btnBack->setEnabled(true);
|
||||||
|
m_btnNext->setEnabled(true);
|
||||||
|
m_btnCancel->setEnabled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─────────────────── Account Result ───────────────────
|
// ─────────────────── Account Result ───────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user