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

Modernize code

parent c5278fe4
Pipeline #48606 failed with stage
in 9 minutes and 47 seconds
......@@ -77,7 +77,7 @@ private Q_SLOTS:
fakeServer.startAndWait();
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::AppendJob(&session);
auto job = new KIMAP::AppendJob(&session);
job->setContent(content);
job->setFlags(flags);
job->setInternalDate(internaldate);
......
......@@ -64,7 +64,7 @@ private Q_SLOTS:
fakeServer.startAndWait();
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::CapabilitiesJob(&session);
auto job = new KIMAP::CapabilitiesJob(&session);
bool result = job->exec();
QEXPECT_FAIL("bad" , "Expected failure on BAD response", Continue);
QVERIFY(result);
......
......@@ -53,7 +53,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::CloseJob(&session);
auto job = new KIMAP::CloseJob(&session);
bool result = job->exec();
QEXPECT_FAIL("bad" , "Expected failure on BAD response", Continue);
QVERIFY(result);
......
......@@ -67,7 +67,7 @@ private Q_SLOTS:
fakeServer.startAndWait();
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::CreateJob(&session);
auto job = new KIMAP::CreateJob(&session);
job->setMailBox(mailbox);
bool result = job->exec();
QEXPECT_FAIL("bad" , "Expected failure on BAD response", Continue);
......
......@@ -74,7 +74,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::DeleteJob(&session);
auto job = new KIMAP::DeleteJob(&session);
job->setMailBox(mailbox);
bool result = job->exec();
QEXPECT_FAIL("bad" , "Expected failure on BAD response", Continue);
......
......@@ -57,7 +57,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::EnableJob(&session);
auto job = new KIMAP::EnableJob(&session);
job->setCapabilities(reqCapabilities);
QVERIFY(job->exec());
......
......@@ -76,7 +76,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::ExpungeJob(&session);
auto job = new KIMAP::ExpungeJob(&session);
bool result = job->exec();
QEXPECT_FAIL("bad" , "Expected failure on BAD response", Continue);
QEXPECT_FAIL("no" , "Expected failure on NO response", Continue);
......
......@@ -43,7 +43,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::ListJob(&session);
auto job = new KIMAP::ListJob(&session);
job->setIncludeUnsubscribed(true);
QVERIFY(job->exec());
......
......@@ -198,7 +198,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::FetchJob(&session);
auto job = new KIMAP::FetchJob(&session);
job->setUidBased(uidBased);
job->setSequenceSet(set);
job->setScope(scope);
......@@ -267,7 +267,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::FetchJob(&session);
auto job = new KIMAP::FetchJob(&session);
job->setUidBased(false);
job->setSequenceSet(KIMAP::ImapSet(1, 2));
job->setScope(scope);
......@@ -331,7 +331,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::FetchJob(&session);
auto job = new KIMAP::FetchJob(&session);
job->setUidBased(false);
job->setSequenceSet(KIMAP::ImapSet(2, 2));
job->setScope(scope);
......
......@@ -13,7 +13,7 @@
#include <QTest>
#include <QDebug>
typedef QMap<QByteArray, QByteArray> MAP;
using MAP = QMap<QByteArray, QByteArray>;
Q_DECLARE_METATYPE(MAP)
class GetMetadataJobTest: public QObject
......@@ -77,7 +77,7 @@ private Q_SLOTS:
KIMAP::Session session(QLatin1String("127.0.0.1"), 5989);
auto *getMetadataJob = new KIMAP::GetMetaDataJob(&session);
auto getMetadataJob = new KIMAP::GetMetaDataJob(&session);
getMetadataJob->setServerCapability(KIMAP::MetaDataJobBase::Metadata);
getMetadataJob->setMailBox(mailbox);
getMetadataJob->setDepth(KIMAP::GetMetaDataJob::AllLevels);
......@@ -130,7 +130,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
//C: A000001 GETMETADATA "Folder1" (/shared)
auto *getMetadataJob = new KIMAP::GetMetaDataJob(&session);
auto getMetadataJob = new KIMAP::GetMetaDataJob(&session);
getMetadataJob->setServerCapability(KIMAP::MetaDataJobBase::Metadata);
getMetadataJob->setMailBox(QStringLiteral("Folder1"));
getMetadataJob->addRequestedEntry("/shared");
......@@ -264,7 +264,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *getMetadataJob = new KIMAP::GetMetaDataJob(&session);
auto getMetadataJob = new KIMAP::GetMetaDataJob(&session);
getMetadataJob->setServerCapability(KIMAP::MetaDataJobBase::Annotatemore);
getMetadataJob->setMailBox(mailbox);
getMetadataJob->addRequestedEntry(entry);
......@@ -300,7 +300,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
//C: A000001 GETANNOTATION "Folder1"
auto *getMetadataJob = new KIMAP::GetMetaDataJob(&session);
auto getMetadataJob = new KIMAP::GetMetaDataJob(&session);
getMetadataJob->setServerCapability(KIMAP::MetaDataJobBase::Annotatemore);
getMetadataJob->setMailBox(QStringLiteral("Folder1"));
QVERIFY(getMetadataJob->exec());
......@@ -336,7 +336,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
//C: A000001 GETANNOTATION "Folder1" ("/comment" "/motd") "value.shared"
auto *getMetadataJob = new KIMAP::GetMetaDataJob( &session);
auto getMetadataJob = new KIMAP::GetMetaDataJob( &session);
getMetadataJob->setServerCapability(KIMAP::MetaDataJobBase::Annotatemore);
getMetadataJob->setMailBox(QStringLiteral("Folder1"));
getMetadataJob->addRequestedEntry("/shared/comment");
......
......@@ -10,7 +10,7 @@
#include <QTest>
typedef QMap<QByteArray, QByteArray> ArrayMap;
using ArrayMap = QMap<QByteArray, QByteArray>;
Q_DECLARE_METATYPE(ArrayMap)
class IdJobTest: public QObject {
......@@ -42,7 +42,7 @@ void testId()
fakeServer.startAndWait();
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::IdJob(&session);
auto job = new KIMAP::IdJob(&session);
const auto keys = values.keys();
for (const QByteArray &key : keys) {
job->setField(key, values.value(key));
......
......@@ -185,11 +185,11 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *select = new KIMAP::SelectJob(&session);
auto select = new KIMAP::SelectJob(&session);
select->setMailBox(expectedMailBox);
QVERIFY(select->exec());
auto *idle = new KIMAP::IdleJob(&session);
auto idle = new KIMAP::IdleJob(&session);
QSignalSpy statsSpy(idle, &KIMAP::IdleJob::mailBoxStats);
QSignalSpy flagsSpy(idle, &KIMAP::IdleJob::mailBoxMessageFlagsChanged);
......@@ -263,11 +263,11 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
const int originalTimeout = session.timeout();
auto *select = new KIMAP::SelectJob(&session);
auto select = new KIMAP::SelectJob(&session);
select->setMailBox(QStringLiteral("INBOX"));
QVERIFY(select->exec());
auto *idle = new KIMAP::IdleJob(&session);
auto idle = new KIMAP::IdleJob(&session);
idle->exec();
QCOMPARE(session.timeout(), originalTimeout);
......
......@@ -51,7 +51,7 @@ void FakeServer::dataAvailable()
{
QMutexLocker locker(&m_mutex);
auto *socket = qobject_cast<QTcpSocket *>(sender());
auto socket = qobject_cast<QTcpSocket *>(sender());
QVERIFY(socket);
int scenarioNumber = m_clientSockets.indexOf(socket);
......
......@@ -86,7 +86,7 @@ SslServer::SslServer(QSsl::SslProtocol protocol, bool waitForStartTls)
void SslServer::incomingConnection(qintptr handle)
{
auto *socket = new QSslSocket();
auto socket = new QSslSocket();
socket->setSocketDescriptor(handle);
socket->setProtocol(mProtocol);
......@@ -120,7 +120,7 @@ void SslServer::sslErrors(const QList<QSslError> &errors)
for (const QSslError &error : errors) {
qWarning() << "Received ssl error: " << error.errorString();
}
auto *socket = qobject_cast<QSslSocket *>(QObject::sender());
auto socket = qobject_cast<QSslSocket *>(QObject::sender());
if (socket) {
socket->disconnectFromHost();
}
......@@ -128,7 +128,7 @@ void SslServer::sslErrors(const QList<QSslError> &errors)
void SslServer::error(QAbstractSocket::SocketError error)
{
auto *socket = qobject_cast<QSslSocket *>(QObject::sender());
auto socket = qobject_cast<QSslSocket *>(QObject::sender());
if (socket) {
qWarning() << socket->errorString();
}
......
......@@ -191,7 +191,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::ListJob(&session);
auto job = new KIMAP::ListJob(&session);
job->setIncludeUnsubscribed(unsubscribed);
QSignalSpy spy(job,
......
......@@ -32,9 +32,9 @@ private Q_SLOTS:
);
fakeServer.startAndWait();
KIMAP::Session *session = new KIMAP::Session(QStringLiteral("127.0.0.1"), 5989);
auto session = new KIMAP::Session(QStringLiteral("127.0.0.1"), 5989);
auto *logout = new KIMAP::LogoutJob(session);
auto logout = new KIMAP::LogoutJob(session);
QVERIFY(logout->exec());
fakeServer.quit();
......@@ -52,9 +52,9 @@ private Q_SLOTS:
);
fakeServer.startAndWait();
KIMAP::Session *session = new KIMAP::Session(QStringLiteral("127.0.0.1"), 5989);
auto session = new KIMAP::Session(QStringLiteral("127.0.0.1"), 5989);
auto *logout = new KIMAP::LogoutJob(session);
auto logout = new KIMAP::LogoutJob(session);
QVERIFY(logout->exec());
fakeServer.quit();
......
......@@ -146,7 +146,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::GetQuotaRootJob(&session);
auto job = new KIMAP::GetQuotaRootJob(&session);
job->setMailBox(mailbox);
bool result = job->exec();
QEXPECT_FAIL("bad" , "Expected failure on BAD response", Continue);
......
......@@ -58,7 +58,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::RenameJob(&session);
auto job = new KIMAP::RenameJob(&session);
job->setSourceMailBox(mailbox);
job->setDestinationMailBox(newname);
bool result = job->exec();
......
......@@ -14,7 +14,7 @@
#include <QTest>
typedef QPair< KIMAP::SearchJob::SearchCriteria, QByteArray > SearchCriteriaValuePair;
using SearchCriteriaValuePair = QPair<KIMAP::SearchJob::SearchCriteria, QByteArray>;
Q_DECLARE_METATYPE(QList<SearchCriteriaValuePair>)
Q_DECLARE_METATYPE(KIMAP::SearchJob::SearchLogic)
......@@ -90,7 +90,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::SearchJob(&session);
auto job = new KIMAP::SearchJob(&session);
job->setUidBased(uidbased);
job->setSearchLogic(searchLogic);
for (const SearchCriteriaValuePair &pair : qAsConst(searchCriteria)) {
......@@ -180,7 +180,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::SearchJob(&session);
auto job = new KIMAP::SearchJob(&session);
job->setUidBased(uidbased);
job->setTerm(searchTerm);
......
......@@ -103,8 +103,8 @@ private Q_SLOTS:
<< "S: * OK [UIDNEXT 567] Predicted next UID"
<< "S: * OK [HIGHESTMODSEQ 90060115205545359]"
<< "S: * OK [UNSEEN 7] There are some unseen messages in the mailbox"
<< "S: * FLAGS (\\Answered \\Flagged \\Draft \\Deleted \\Seen)"
<< "S: * OK [PERMANENTFLAGS (\\Answered \\Flagged \\Draft \\Deleted \\Seen \\*)] Permanent flags"
<< R"(S: * FLAGS (\Answered \Flagged \Draft \Deleted \Seen))"
<< R"(S: * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen \*)] Permanent flags)"
<< "S: * VANISHED (EARLIER) 41,43:116,118,120:211,214:540"
<< "S: * 49 FETCH (UID 117 FLAGS (\\Seen \\Answered) MODSEQ (90060115194045001))"
<< "S: * 50 FETCH (UID 119 FLAGS (\\Draft $MDNSent) MODSEQ (90060115194045308))"
......@@ -150,7 +150,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::SelectJob(&session);
auto job = new KIMAP::SelectJob(&session);
job->setCondstoreEnabled(condstoreEnabled);
job->setMailBox(QStringLiteral("INBOX"));
if (lastUidvalidity > -1 && lastModseq > 0) {
......@@ -212,7 +212,7 @@ private Q_SLOTS:
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::SelectJob(&session);
auto job = new KIMAP::SelectJob(&session);
job->setMailBox(QStringLiteral("INBOX"));
QVERIFY(job->exec());
......
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