Commit b5890530 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

[IMAP] Disable the Gmail special cases when compiled without XOAUTH

When the IMAP resource is compiled without XOAUTH2 support, make sure
that the logic in the Settings dialog does not try to still apply the
Gmail-specific configuration.
parent bb6de383
...@@ -569,10 +569,12 @@ void SetupServer::slotTestChanged() ...@@ -569,10 +569,12 @@ void SetupServer::slotTestChanged()
m_serverTest = nullptr; m_serverTest = nullptr;
slotSafetyChanged(); slotSafetyChanged();
#ifdef WITH_GMAIL_XOAUTH2
// do not use imapConnectionPossible, as the data is not yet saved. // do not use imapConnectionPossible, as the data is not yet saved.
const bool isGmail = Utils::isGmail(m_ui->imapServer->text()); const bool isGmail = Utils::isGmail(m_ui->imapServer->text());
m_ui->testButton->setEnabled(!isGmail /* TODO && Global::connectionPossible() || m_ui->testButton->setEnabled(!isGmail /* TODO && Global::connectionPossible() ||
m_ui->imapServer->text() == "localhost"*/); m_ui->imapServer->text() == "localhost"*/);
#endif
} }
void SetupServer::slotEnableWidgets() void SetupServer::slotEnableWidgets()
...@@ -594,6 +596,7 @@ void SetupServer::slotComplete() ...@@ -594,6 +596,7 @@ void SetupServer::slotComplete()
void SetupServer::slotSafetyChanged() void SetupServer::slotSafetyChanged()
{ {
#ifdef WITH_GMAIL_XOAUTH2
if (m_serverTest == nullptr) { if (m_serverTest == nullptr) {
const bool isGmail = Utils::isGmail(m_ui->imapServer->text()); const bool isGmail = Utils::isGmail(m_ui->imapServer->text());
qCDebug(IMAPRESOURCE_LOG) << "serverTest null"; qCDebug(IMAPRESOURCE_LOG) << "serverTest null";
...@@ -604,7 +607,7 @@ void SetupServer::slotSafetyChanged() ...@@ -604,7 +607,7 @@ void SetupServer::slotSafetyChanged()
m_ui->authenticationCombo->setEnabled(!isGmail); m_ui->authenticationCombo->setEnabled(!isGmail);
return; return;
} }
#endif
QVector<int> protocols; QVector<int> protocols;
switch (m_ui->safeImapGroup->checkedId()) { switch (m_ui->safeImapGroup->checkedId()) {
...@@ -704,13 +707,16 @@ void SetupServer::populateDefaultAuthenticationOptions(QComboBox *combo) ...@@ -704,13 +707,16 @@ void SetupServer::populateDefaultAuthenticationOptions(QComboBox *combo)
addAuthenticationItem(combo, MailTransport::Transport::EnumAuthenticationType::NTLM); addAuthenticationItem(combo, MailTransport::Transport::EnumAuthenticationType::NTLM);
addAuthenticationItem(combo, MailTransport::Transport::EnumAuthenticationType::GSSAPI); addAuthenticationItem(combo, MailTransport::Transport::EnumAuthenticationType::GSSAPI);
addAuthenticationItem(combo, MailTransport::Transport::EnumAuthenticationType::ANONYMOUS); addAuthenticationItem(combo, MailTransport::Transport::EnumAuthenticationType::ANONYMOUS);
#ifdef WITH_GMAIL_XOAUTH2
if (Utils::isGmail(m_ui->imapServer->text())) { if (Utils::isGmail(m_ui->imapServer->text())) {
addAuthenticationItem(combo, MailTransport::Transport::EnumAuthenticationType::XOAUTH2); addAuthenticationItem(combo, MailTransport::Transport::EnumAuthenticationType::XOAUTH2);
} }
#endif
} }
void SetupServer::slotServerChanged() void SetupServer::slotServerChanged()
{ {
#ifdef WITH_GMAIL_XOAUTH2
const bool isGmail = Utils::isGmail(m_ui->imapServer->text()); const bool isGmail = Utils::isGmail(m_ui->imapServer->text());
const bool wasGmail = !m_ui->password->isEnabled(); const bool wasGmail = !m_ui->password->isEnabled();
...@@ -733,4 +739,5 @@ void SetupServer::slotServerChanged() ...@@ -733,4 +739,5 @@ void SetupServer::slotServerChanged()
setCurrentAuthMode(m_ui->authenticationCombo, MailTransport::Transport::EnumAuthenticationType::XOAUTH2); setCurrentAuthMode(m_ui->authenticationCombo, MailTransport::Transport::EnumAuthenticationType::XOAUTH2);
} }
m_ui->authenticationCombo->setEnabled(!isGmail); m_ui->authenticationCombo->setEnabled(!isGmail);
#endif
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment