Commit db9e7aa1 authored by Laurent Montel's avatar Laurent Montel 😁

Fix coding style. Port Q_FOREACH etc.

parent 69aec317
......@@ -18,7 +18,6 @@
02110-1301, USA.
*/
//krazy:excludeall=null since used by SASL (C library)
#include "session.h"
#include "response.h"
......@@ -37,6 +36,23 @@
#include <QTimer>
#include <QUrlQuery>
#if QT_VERSION < QT_VERSION_CHECK(5,7,0)
namespace QtPrivate
{
template <typename T> struct QAddConst {
typedef const T Type;
};
}
// this adds const to non-const objects (like std::as_const)
template <typename T>
Q_DECL_CONSTEXPR typename QtPrivate::QAddConst<T>::Type &qAsConst(T &t) Q_DECL_NOTHROW { return t; }
// prevent rvalue arguments:
template <typename T>
void qAsConst(const T &&) Q_DECL_EQ_DELETE;
#endif
using namespace KManageSieve;
Q_DECLARE_METATYPE(KManageSieve::AuthDetails)
......@@ -98,7 +114,7 @@ void Session::disconnectFromHost(bool sendLogout)
if (m_currentJob) {
killJob(m_currentJob, KJob::EmitResult);
}
Q_FOREACH (SieveJob *job, m_jobs) {
for (SieveJob *job : qAsConst(m_jobs)) {
killJob(job, KJob::EmitResult);
}
deleteLater();
......
......@@ -17,8 +17,6 @@
02110-1301, USA.
*/
//krazy:excludeall=null since used by SASL (C library)
#include "sessionthread_p.h"
#include "session.h"
#include "response.h"
......@@ -457,13 +455,14 @@ void SessionThread::sslResult(bool encrypted)
Q_ASSERT(QThread::currentThread() == thread());
const KSslCipher cipher = m_socket->sessionCipher();
if (!encrypted || m_socket->sslErrors().count() > 0 || m_socket->encryptionMode() != KTcpSocket::SslClientMode
const int numberOfSslError = m_socket->sslErrors().count();
if (!encrypted || numberOfSslError > 0 || m_socket->encryptionMode() != KTcpSocket::SslClientMode
|| cipher.isNull() || cipher.usedBits() == 0) {
qCDebug(KMANAGERSIEVE_LOG) << "Initial SSL handshake failed. cipher.isNull() is" << cipher.isNull()
<< ", cipher.usedBits() is" << cipher.usedBits()
<< ", the socket says:" << m_socket->errorString()
<< "and the list of SSL errors contains"
<< m_socket->sslErrors().count() << "items.";
<< numberOfSslError << "items.";
Q_EMIT sslError(KSslErrorUiData(m_socket));
} else {
......
......@@ -139,16 +139,15 @@ QStringList SelectFlagsListWidget::flags() const
SelectFlagsWidget::SelectFlagsWidget(QWidget *parent)
: QWidget(parent)
{
QHBoxLayout *lay = new QHBoxLayout;
QHBoxLayout *lay = new QHBoxLayout(this);
lay->setMargin(0);
mEdit = new QLineEdit;
mEdit = new QLineEdit(this);
mEdit->setReadOnly(true);
connect(mEdit, &QLineEdit::textChanged, this, &SelectFlagsWidget::valueChanged);
lay->addWidget(mEdit);
QPushButton *selectFlags = new QPushButton(i18n("..."));
QPushButton *selectFlags = new QPushButton(i18n("..."), this);
connect(selectFlags, &QPushButton::clicked, this, &SelectFlagsWidget::slotSelectFlags);
lay->addWidget(selectFlags);
setLayout(lay);
}
SelectFlagsWidget::~SelectFlagsWidget()
......
......@@ -22,8 +22,7 @@
#include <KLocalizedString>
namespace KSieveUi
{
using namespace KSieveUi;
SelectVacationComboBox::SelectVacationComboBox(QWidget *parent)
: KComboBox(parent)
{
......@@ -57,5 +56,3 @@ void SelectVacationComboBox::setCode(const QString &code, const QString &name, Q
}
}
}
......@@ -67,7 +67,8 @@ Lexer::Lexer(const char *scursor, const char *send, int options)
Lexer::~Lexer()
{
delete i; i = nullptr;
delete i;
i = nullptr;
}
bool Lexer::ignoreComments() const
......
......@@ -59,7 +59,8 @@ Parser::Parser(const char *scursor, const char *const send, int options)
Parser::~Parser()
{
delete i; i = nullptr;
delete i;
i = nullptr;
}
void Parser::setScriptBuilder(ScriptBuilder *builder)
......
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