Changeset View
Changeset View
Standalone View
Standalone View
src/kmanagesieve/session.cpp
Show First 20 Lines • Show All 114 Lines • ▼ Show 20 Line(s) | 114 | if (!allowUnencrypted() && !QSslSocket::supportsSsl()) { | |||
---|---|---|---|---|---|
115 | setErrorMessage(KIO::buildErrorString(KIO::ERR_SLAVE_DEFINED, i18n("Cannot use TLS since the underlying Qt library does not support it."))); | 115 | setErrorMessage(KIO::buildErrorString(KIO::ERR_SLAVE_DEFINED, i18n("Cannot use TLS since the underlying Qt library does not support it."))); | ||
116 | disconnectFromHost(); | 116 | disconnectFromHost(); | ||
117 | return; | 117 | return; | ||
118 | } | 118 | } | ||
119 | if (!allowUnencrypted() && QSslSocket::supportsSsl() && !m_supportsStartTls | 119 | if (!allowUnencrypted() && QSslSocket::supportsSsl() && !m_supportsStartTls | ||
120 | && KMessageBox::warningContinueCancel(nullptr, | 120 | && KMessageBox::warningContinueCancel(nullptr, | ||
121 | i18n("TLS encryption was requested, but your Sieve server does not advertise TLS in its capabilities.\n" | 121 | i18n("TLS encryption was requested, but your Sieve server does not advertise TLS in its capabilities.\n" | ||
122 | "You can choose to try to initiate TLS negotiations nonetheless, or cancel the operation."), | 122 | "You can choose to try to initiate TLS negotiations nonetheless, or cancel the operation."), | ||
123 | i18n("Server Does Not Advertise TLS"), KGuiItem(i18n("&Start TLS nonetheless")), KStandardGuiItem::cancel(), | 123 | i18n("Sieve Server Does Not Advertise TLS"), KGuiItem(i18n("&Start TLS nonetheless")), KStandardGuiItem::cancel(), | ||
124 | QStringLiteral("ask_starttls_%1").arg(m_url.host())) != KMessageBox::Continue) { | 124 | QStringLiteral("ask_starttls_%1").arg(m_url.host())) != KMessageBox::Continue) { | ||
125 | setErrorMessage(KIO::buildErrorString(KIO::ERR_USER_CANCELED, i18n("TLS encryption requested, but not supported by server."))); | 125 | setErrorMessage(KIO::buildErrorString(KIO::ERR_USER_CANCELED, i18n("TLS encryption requested, but not supported by server."))); | ||
126 | disconnectFromHost(); | 126 | disconnectFromHost(); | ||
127 | return; | 127 | return; | ||
128 | } | 128 | } | ||
129 | 129 | | |||
130 | if (m_supportsStartTls && QSslSocket::supportsSsl()) { | 130 | if (m_supportsStartTls && QSslSocket::supportsSsl()) { | ||
131 | m_state = StartTls; | 131 | m_state = StartTls; | ||
▲ Show 20 Lines • Show All 197 Lines • ▼ Show 20 Line(s) | |||||
329 | } | 329 | } | ||
330 | 330 | | |||
331 | void Session::setErrorMessage(const QString &msg) | 331 | void Session::setErrorMessage(const QString &msg) | ||
332 | { | 332 | { | ||
333 | if (m_currentJob) { | 333 | if (m_currentJob) { | ||
334 | m_currentJob->setErrorMessage(msg); | 334 | m_currentJob->setErrorMessage(msg); | ||
335 | } else { | 335 | } else { | ||
336 | qCWarning(KMANAGERSIEVE_LOG) << objectName() << "No job for reporting this error message!" << msg << " m_url " << m_url.host(); | 336 | qCWarning(KMANAGERSIEVE_LOG) << objectName() << "No job for reporting this error message!" << msg << " m_url " << m_url.host(); | ||
337 | KMessageBox::error(nullptr, i18n("Server:%1\n%2", m_url.host(),msg)); | 337 | KMessageBox::error(nullptr, i18n("The Sieve server on %1 has reported an error:\n%2", m_url.host(),msg), i18n("Sieve Manager")); | ||
338 | } | 338 | } | ||
339 | } | 339 | } | ||
340 | 340 | | |||
341 | bool Session::allowUnencrypted() const | 341 | bool Session::allowUnencrypted() const | ||
342 | { | 342 | { | ||
343 | return QUrlQuery(m_url).queryItemValue(QStringLiteral("x-allow-unencrypted")) == QLatin1String("true"); | 343 | return QUrlQuery(m_url).queryItemValue(QStringLiteral("x-allow-unencrypted")) == QLatin1String("true"); | ||
344 | } | 344 | } |