Commit b9fd5723 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Coding style

parent 75215e6b
......@@ -23,9 +23,9 @@
#include <QFile>
#include <QDebug>
FakeServer::FakeServer(QObject *parent) :
QThread(parent),
m_tcpServer(nullptr)
FakeServer::FakeServer(QObject *parent)
: QThread(parent)
, m_tcpServer(nullptr)
{
moveToThread(this);
}
......@@ -38,16 +38,17 @@ QByteArray FakeServer::greeting()
QList<QByteArray> FakeServer::greetingAndEhlo(bool multiline)
{
return QList<QByteArray>() << greeting()
<< "C: EHLO 127.0.0.1"
<< QByteArray("S: 250") + (multiline ? '-' : ' ') + "Localhost ready to roll";
<< "C: EHLO 127.0.0.1"
<< QByteArray("S: 250") + (multiline ? '-' : ' ') + "Localhost ready to roll";
}
QList<QByteArray> FakeServer::bye()
{
return { "C: QUIT",
"S: 221 So long, and thanks for all the fish",
"X: "
};
return {
"C: QUIT",
"S: 221 So long, and thanks for all the fish",
"X: "
};
}
FakeServer::~FakeServer()
......@@ -179,7 +180,7 @@ void FakeServer::writeServerPart(int scenarioNumber)
QTcpSocket *clientSocket = m_clientSockets[scenarioNumber];
while (!scenario.isEmpty()
&& (scenario.first().startsWith("S: ") || scenario.first().startsWith("W: "))) {
&& (scenario.first().startsWith("S: ") || scenario.first().startsWith("W: "))) {
QByteArray rule = scenario.takeFirst();
if (rule.startsWith("S: ")) {
......
......@@ -38,10 +38,10 @@ private Q_SLOTS:
{
QStandardPaths::setTestModeEnabled(true);
}
void smtpJobTest_data()
{
QTest::addColumn<QList<QByteArray>>("scenario");
QTest::addColumn<QList<QByteArray> >("scenario");
QTest::addColumn<MailTransport::TransportBase::EnumAuthenticationType::type>("authType");
QTest::addColumn<QString>("from");
QTest::addColumn<QStringList>("to");
......@@ -74,7 +74,9 @@ private Q_SLOTS:
QTest::newRow("simple") << scenario << MailTransport::TransportBase::EnumAuthenticationType::LOGIN
<< QStringLiteral("Foo Bar <foo@bar.com>")
<< QStringList{}
<< QStringList{ QStringLiteral("bar@foo.com"), QStringLiteral("<bar@bar.foo>") }
<< QStringList{
QStringLiteral("bar@foo.com"), QStringLiteral("<bar@bar.foo>")
}
<< QByteArray("Hi Bob")
<< true;
}
......
......@@ -17,7 +17,6 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "lineeditpassword.h"
#include <KLocalizedString>
#include <QIcon>
......@@ -43,7 +42,6 @@ LineEditPassword::LineEditPassword(QWidget *parent)
LineEditPassword::~LineEditPassword()
{
}
void LineEditPassword::initialize()
......@@ -64,8 +62,7 @@ void LineEditPassword::toggleEchoMode()
if (mPasswordLineEdit->echoMode() == QLineEdit::Password) {
mPasswordLineEdit->setEchoMode(QLineEdit::Normal);
mToggleEchoModeAction->setIcon(QIcon::fromTheme(QStringLiteral("hint"), QIcon(QStringLiteral(":/icons/hint.svg"))));
}
else if (mPasswordLineEdit->echoMode() == QLineEdit::Normal) {
} else if (mPasswordLineEdit->echoMode() == QLineEdit::Normal) {
mPasswordLineEdit->setEchoMode(QLineEdit::Password);
mToggleEchoModeAction->setIcon(QIcon::fromTheme(QStringLiteral("visibility"), QIcon(QStringLiteral(":/icons/visibility.svg"))));
}
......
......@@ -22,8 +22,7 @@
class QLineEdit;
class QAction;
namespace MailTransport
{
namespace MailTransport {
class LineEditPassword : public QWidget
{
public:
......
......@@ -30,7 +30,6 @@
using namespace MailTransport;
SmtpConfigDialog::SmtpConfigDialog(Transport *transport, QWidget *parent)
: QDialog(parent)
{
......
......@@ -316,7 +316,7 @@ void SMTPConfigWidget::hostNameChanged(const QString &text)
d->resetAuthCapabilities();
if (d->encryptionGroup) {
for (int i = 0; i < d->encryptionGroup->buttons().count(); ++i) {
for (int i = 0; i < d->encryptionGroup->buttons().count(); ++i) {
d->encryptionGroup->buttons().at(i)->setEnabled(true);
}
}
......
......@@ -51,7 +51,7 @@ public:
}
int ref;
QHash<int, KSmtp::Session*> sessions;
QHash<int, KSmtp::Session *> sessions;
void removeSession(KSmtp::Session *session)
{
......@@ -59,11 +59,11 @@ public:
int key = sessions.key(session);
if (key > 0) {
QObject::connect(session, &KSmtp::Session::stateChanged,
[session](KSmtp::Session::State state) {
if (state == KSmtp::Session::Disconnected) {
session->deleteLater();
}
});
[session](KSmtp::Session::State state) {
if (state == KSmtp::Session::Disconnected) {
session->deleteLater();
}
});
session->quit();
sessions.remove(key);
}
......@@ -158,11 +158,11 @@ void SmtpJob::startSmtpJob()
this, &SmtpJob::sessionStateChanged, Qt::UniqueConnection);
connect(d->session, &KSmtp::Session::connectionError,
this, [this](const QString &err) {
setError(KJob::UserDefinedError);
setErrorText(err);
s_sessionPool->removeSession(d->session);
emitResult();
});
setError(KJob::UserDefinedError);
setErrorText(err);
s_sessionPool->removeSession(d->session);
emitResult();
});
if (d->session->state() == KSmtp::Session::Disconnected) {
d->session->open();
......@@ -267,7 +267,6 @@ void SmtpJob::startLoginJob()
default:
qCWarning(MAILTRANSPORT_SMTP_LOG) << "Unknown encryption mode" << transport()->encryption();
break;
}
connect(login, &KJob::result, this, &SmtpJob::slotResult);
......
......@@ -496,7 +496,6 @@ void TransportManagerPrivate::updatePluginList()
}
}
void TransportManager::updatePluginList()
{
d->updatePluginList();
......
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