Commit e15cd5ec authored by Ahmad Samir's avatar Ahmad Samir
Browse files

Put back KIO in the package search

One of the plugins links against KIOWidgets, which means that CMake will
fail configuration if KIO is not found.
parent 7811b81e
Pipeline #33391 passed with stage
in 8 minutes and 45 seconds
......@@ -3,7 +3,7 @@ set(PIM_VERSION "5.15.2")
project(MailTransport VERSION ${PIM_VERSION})
# ECM setup
set(KF5_MIN_VERSION "5.71.0")
set(KF5_MIN_VERSION "5.73.0")
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
......@@ -39,6 +39,7 @@ find_package(KF5ConfigWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Wallet ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Service ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Mime ${KMIME_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Akonadi ${AKONADI_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5AkonadiMime ${AKONADIMIME_LIB_VERSION} CONFIG REQUIRED)
......@@ -47,7 +48,7 @@ find_package(KPimGAPI ${KGAPI_LIB_VERSION} CONFIG REQUIRED)
option(KDEPIM_RUN_AKONADI_TEST "Enable autotest based on Akonadi." TRUE)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054800)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054A00)
add_definitions(-DQT_NO_FOREACH)
add_definitions(-DQT_NO_KEYWORDS)
......
......@@ -59,7 +59,6 @@ target_link_libraries(KF5MailTransport
KF5::Wallet
PRIVATE
KF5::I18n
KF5::KIOCore
KF5::ConfigGui
KF5::WidgetsAddons
KF5::CoreAddons
......
/*
Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2006-2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
......
......@@ -34,9 +34,9 @@ QList<QByteArray> FakeServer::greetingAndEhlo(bool multiline)
QList<QByteArray> FakeServer::bye()
{
return {
"C: QUIT",
"S: 221 So long, and thanks for all the fish",
"X: "
"C: QUIT",
"S: 221 So long, and thanks for all the fish",
"X: "
};
}
......
......@@ -2,7 +2,7 @@
SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
Based on MailTransport code by:
SPDX-FileCopyrightText: 2006 - 2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2006-2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2007 KovoKs <kovoks@kovoks.nl>
Based on KMail code by:
......
......@@ -2,7 +2,7 @@
SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
Based on MailTransport code by:
SPDX-FileCopyrightText: 2006 - 2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2006-2007 Volker Krause <vkrause@kde.org>
Based on KMail code by:
SPDX-FileCopyrightText: 2001-2002 Michael Haeckel <haeckel@kde.org>
......
......@@ -74,6 +74,8 @@ public:
{
}
void doLogin();
SmtpJob *q;
KSmtp::Session *session = nullptr;
KSmtp::SessionUiProxy::Ptr uiProxy;
......@@ -188,22 +190,22 @@ void SmtpJob::startPasswordRetrieval(bool forceRefresh)
GOOGLE_API_KEY, transport()->userName(), { KGAPI2::Account::mailScopeUrl() });
connect(promise, &KGAPI2::AccountPromise::finished,
this, [forceRefresh, this](KGAPI2::AccountPromise *promise) {
if (promise->account()) {
if (forceRefresh) {
promise = KGAPI2::AccountManager::instance()->refreshTokens(
GOOGLE_API_KEY, GOOGLE_API_SECRET, transport()->userName());
} else {
onTokenRequestFinished(promise);
return;
}
} else {
promise = KGAPI2::AccountManager::instance()->getAccount(
GOOGLE_API_KEY, GOOGLE_API_SECRET, transport()->userName(),
{ KGAPI2::Account::mailScopeUrl() });
}
connect(promise, &KGAPI2::AccountPromise::finished,
this, &SmtpJob::onTokenRequestFinished);
});
if (promise->account()) {
if (forceRefresh) {
promise = KGAPI2::AccountManager::instance()->refreshTokens(
GOOGLE_API_KEY, GOOGLE_API_SECRET, transport()->userName());
} else {
onTokenRequestFinished(promise);
return;
}
} else {
promise = KGAPI2::AccountManager::instance()->getAccount(
GOOGLE_API_KEY, GOOGLE_API_SECRET, transport()->userName(),
{ KGAPI2::Account::mailScopeUrl() });
}
connect(promise, &KGAPI2::AccountPromise::finished,
this, &SmtpJob::onTokenRequestFinished);
});
} else {
startLoginJob();
}
......@@ -226,7 +228,6 @@ void SmtpJob::onTokenRequestFinished(KGAPI2::AccountPromise *promise)
startLoginJob();
}
void SmtpJob::startLoginJob()
{
if (!transport()->requiresAuthentication()) {
......@@ -234,16 +235,16 @@ void SmtpJob::startLoginJob()
return;
}
auto login = new KSmtp::LoginJob(d->session);
auto user = transport()->userName();
auto passwd = transport()->password();
if ((user.isEmpty() || passwd.isEmpty())
&& transport()->authenticationType() != Transport::EnumAuthenticationType::GSSAPI) {
QPointer<KPasswordDialog> dlg
= new KPasswordDialog(
nullptr,
KPasswordDialog::ShowUsernameLine
|KPasswordDialog::ShowKeepPassword);
nullptr,
KPasswordDialog::ShowUsernameLine
|KPasswordDialog::ShowKeepPassword);
dlg->setAttribute(Qt::WA_DeleteOnClose, true);
dlg->setPrompt(i18n("You need to supply a username and a password "
"to use this SMTP server."));
dlg->setKeepPassword(transport()->storePassword());
......@@ -251,31 +252,41 @@ void SmtpJob::startLoginJob()
dlg->setUsername(user);
dlg->setPassword(passwd);
bool gotIt = false;
if (dlg->exec()) {
connect(this, &KJob::result, dlg, &QDialog::reject);
connect(dlg, &QDialog::finished, this, [this, dlg](const int result) {
if (result == QDialog::Rejected) {
setError(KilledJobError);
emitResult();
return;
}
transport()->setUserName(dlg->username());
transport()->setPassword(dlg->password());
transport()->setStorePassword(dlg->keepPassword());
transport()->save();
gotIt = true;
}
delete dlg;
if (!gotIt) {
setError(KilledJobError);
emitResult();
return;
}
d->doLogin();
});
dlg->open();
return;
}
if (transport()->authenticationType() == Transport::EnumAuthenticationType::XOAUTH2) {
d->doLogin();
}
void SmtpJobPrivate::doLogin()
{
QString passwd = q->transport()->password();
if (q->transport()->authenticationType() == Transport::EnumAuthenticationType::XOAUTH2) {
passwd = passwd.left(passwd.indexOf(QLatin1Char('\001')));
} else {
passwd = transport()->password();
}
login->setUserName(transport()->userName());
auto login = new KSmtp::LoginJob(session);
login->setUserName(q->transport()->userName());
login->setPassword(passwd);
switch (transport()->authenticationType()) {
switch (q->transport()->authenticationType()) {
case TransportBase::EnumAuthenticationType::PLAIN:
login->setPreferedAuthMode(KSmtp::LoginJob::Plain);
break;
......@@ -298,11 +309,11 @@ void SmtpJob::startLoginJob()
login->setPreferedAuthMode(KSmtp::LoginJob::GSSAPI);
break;
default:
qCWarning(MAILTRANSPORT_SMTP_LOG) << "Unknown authentication mode" << transport()->authenticationTypeString();
qCWarning(MAILTRANSPORT_SMTP_LOG) << "Unknown authentication mode" << q->transport()->authenticationTypeString();
break;
}
switch (transport()->encryption()) {
switch (q->transport()->encryption()) {
case Transport::EnumEncryption::None:
login->setEncryptionMode(KSmtp::LoginJob::Unencrypted);
break;
......@@ -313,12 +324,12 @@ void SmtpJob::startLoginJob()
login->setEncryptionMode(KSmtp::LoginJob::SSLorTLS);
break;
default:
qCWarning(MAILTRANSPORT_SMTP_LOG) << "Unknown encryption mode" << transport()->encryption();
qCWarning(MAILTRANSPORT_SMTP_LOG) << "Unknown encryption mode" << q->transport()->encryption();
break;
}
connect(login, &KJob::result, this, &SmtpJob::slotResult);
addSubjob(login);
q->connect(login, &KJob::result, q, &SmtpJob::slotResult);
q->addSubjob(login);
login->start();
qCDebug(MAILTRANSPORT_SMTP_LOG) << "Login started";
}
......@@ -363,7 +374,7 @@ void SmtpJob::slotResult(KJob *job)
return;
}
if (qobject_cast<KSmtp::LoginJob*>(job)) {
if (qobject_cast<KSmtp::LoginJob *>(job)) {
if (job->error() == KSmtp::LoginJob::TokenExpired) {
startPasswordRetrieval(/*force refresh */ true);
return;
......
......@@ -14,8 +14,7 @@ class SMTPMailTransportPlugin : public MailTransport::TransportAbstractPlugin
{
Q_OBJECT
public:
explicit SMTPMailTransportPlugin(QObject *parent = nullptr, const QList<QVariant> & =
{
explicit SMTPMailTransportPlugin(QObject *parent = nullptr, const QList<QVariant> & = {
});
~SMTPMailTransportPlugin() override;
......
......@@ -71,7 +71,7 @@ void PrecommandJob::start()
void PreCommandJobPrivate::slotStarted()
{
Q_EMIT q->infoMessage(q, i18n("Executing precommand"),
i18n("Executing precommand '%1'.", precommand));
i18n("Executing precommand '%1'.", precommand));
}
void PreCommandJobPrivate::slotError(QProcess::ProcessError error)
......
/*
Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2006-2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2007 KovoKs <info@kovoks.nl>
SPDX-FileCopyrightText: 2008 Thomas McGuire <thomas.mcguire@gmx.net>
......@@ -17,6 +17,7 @@
#include <QHash>
#include <QHostInfo>
#include <QProgressBar>
#include <QRegularExpression>
#include <QTimer>
#include <QSet>
......@@ -67,7 +68,8 @@ public:
bool handleNntpConversation(MailTransport::Socket *socket, int type, int *stage, const QString &response, bool *shouldStartTLS);
QVector<int> parseAuthenticationList(const QStringList &authentications);
inline bool isGmail(const QString &server) const {
inline bool isGmail(const QString &server) const
{
return server.endsWith(QLatin1String("gmail.com")) || server.endsWith(QLatin1String("googlemail.com"));
}
......@@ -242,10 +244,9 @@ bool ServerTestPrivate::handlePopConversation(MailTransport::Socket *socket, int
// Initial Greeting
if (stage == 0) {
//Regexp taken from POP3 ioslave
QString responseWithoutCRLF = response;
responseWithoutCRLF.chop(2);
QRegExp re(QStringLiteral("<[A-Za-z0-9\\.\\-_]+@[A-Za-z0-9\\.\\-_]+>$"),
Qt::CaseInsensitive);
const QString responseWithoutCRLF = response.chopped(2);
const QRegularExpression re(QStringLiteral("<[A-Za-z0-9\\.\\-_]+@[A-Za-z0-9\\.\\-_]+>$"),
QRegularExpression::CaseInsensitiveOption);
if (responseWithoutCRLF.indexOf(re) != -1) {
authenticationResults[type] << Transport::EnumAuthenticationType::APOP;
}
......
/*
Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2006-2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
......
/*
Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2006-2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
......
/*
Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2006-2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
......
/*
Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2006-2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
......
/*
Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2006-2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
......
/*
Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2006-2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
......@@ -623,7 +623,9 @@ void TransportManager::loadPasswordsAsync()
d->wallet = Wallet::openWallet(Wallet::NetworkWallet(), window,
Wallet::Asynchronous);
if (d->wallet) {
connect(d->wallet, &KWallet::Wallet::walletOpened, this, [this](bool status) { d->slotWalletOpened(status);});
connect(d->wallet, &KWallet::Wallet::walletOpened, this, [this](bool status) {
d->slotWalletOpened(status);
});
d->walletAsyncOpen = true;
} else {
d->walletOpenFailed = true;
......
/*
Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2006-2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
......@@ -13,7 +13,6 @@
#include <QList>
#include <QObject>
namespace KWallet {
class Wallet;
}
......
/*
Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2006-2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
......
/*
Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2006-2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
......
......@@ -2,7 +2,7 @@
SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
Based on MailTransport code by:
SPDX-FileCopyrightText: 2006 - 2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2006-2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2007 KovoKs <kovoks@kovoks.nl>
Based on KMail code by:
......
Supports Markdown
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