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

Use auto vs auto * where it's possible

parent 7c6869c5
Pipeline #49700 skipped
......@@ -51,7 +51,7 @@ void FakeServer::dataAvailable()
{
QMutexLocker locker(&m_mutex);
auto *socket = qobject_cast<QTcpSocket *>(sender());
auto socket = qobject_cast<QTcpSocket *>(sender());
Q_ASSERT(socket != nullptr);
int scenarioNumber = m_clientSockets.indexOf(socket);
......
......@@ -22,7 +22,7 @@ SmtpConfigDialog::SmtpConfigDialog(Transport *transport, QWidget *parent)
{
Q_ASSERT(transport);
mTransport = transport;
auto *mainLayout = new QVBoxLayout(this);
auto mainLayout = new QVBoxLayout(this);
mConfigWidget = new SMTPConfigWidget(transport, this);
mConfigWidget->setObjectName(QStringLiteral("smtpconfigwidget"));
mainLayout->addWidget(mConfigWidget);
......
......@@ -15,11 +15,11 @@
AddTransportDialogNG_gui::AddTransportDialogNG_gui(QWidget *parent)
: QWidget(parent)
{
auto *layout = new QHBoxLayout(this);
auto layout = new QHBoxLayout(this);
QPushButton *button = new QPushButton(QStringLiteral("Add transport"));
layout->addWidget(button);
connect(button, &QPushButton::clicked, this, [this] {
auto *dlg = new MailTransport::AddTransportDialogNG(this);
auto dlg = new MailTransport::AddTransportDialogNG(this);
dlg->exec();
delete dlg;
});
......@@ -30,7 +30,7 @@ int main(int argc, char **argv)
QApplication app(argc, argv);
app.setApplicationName(QStringLiteral("addtransportnewng"));
QStandardPaths::setTestModeEnabled(true);
auto *t = new AddTransportDialogNG_gui();
auto t = new AddTransportDialogNG_gui();
t->show();
app.exec();
delete t;
......
......@@ -24,7 +24,7 @@ using namespace MailTransport;
TransportMgr::TransportMgr()
: mCurrentJob(nullptr)
{
auto *vbox = new QVBoxLayout(this);
auto vbox = new QVBoxLayout(this);
vbox->setContentsMargins(0, 0, 0, 0);
vbox->addWidget(new TransportManagementWidget(this));
......@@ -114,7 +114,7 @@ int main(int argc, char **argv)
QApplication app(argc, argv);
app.setApplicationName(QStringLiteral("transportmgr"));
auto *t = new TransportMgr();
auto t = new TransportMgr();
t->show();
app.exec();
delete t;
......
......@@ -253,7 +253,7 @@ void Transport::readPassword()
void Transport::readTransportPasswordFinished(QKeychain::Job *baseJob)
{
auto *job = qobject_cast<ReadPasswordJob *>(baseJob);
auto job = qobject_cast<ReadPasswordJob *>(baseJob);
Q_ASSERT(job);
if (job->error()) {
d->password.clear();
......
......@@ -73,7 +73,7 @@ void AttributeTest::testSerialization()
cc << QStringLiteral("cc2@me.org");
QStringList bcc(QStringLiteral("bcc1@me.org"));
bcc << QStringLiteral("bcc2@me.org");
auto *a = new AddressAttribute(from, to, cc, bcc);
auto a = new AddressAttribute(from, to, cc, bcc);
QByteArray data = a->serialized();
delete a;
a = new AddressAttribute;
......@@ -92,7 +92,7 @@ void AttributeTest::testSerialization()
qDebug() << "ms" << date.toString(QStringLiteral("z"));
int ms = date.toString(QStringLiteral("z")).toInt();
date = date.addMSecs(-ms);
auto *a = new DispatchModeAttribute(mode);
auto a = new DispatchModeAttribute(mode);
a->setSendAfter(date);
QByteArray data = a->serialized();
delete a;
......@@ -105,7 +105,7 @@ void AttributeTest::testSerialization()
{
QString msg(QStringLiteral("The #!@$ing thing failed!"));
auto *a = new ErrorAttribute(msg);
auto a = new ErrorAttribute(msg);
QByteArray data = a->serialized();
delete a;
a = new ErrorAttribute;
......@@ -115,7 +115,7 @@ void AttributeTest::testSerialization()
}
{
auto *a = new SentActionAttribute();
auto a = new SentActionAttribute();
const qlonglong id = 123456789012345ll;
a->addAction(SentActionAttribute::Action::MarkAsReplied, QVariant(id));
......@@ -225,7 +225,7 @@ void AttributeTest::testSerialization()
{
int id = 3219;
auto *a = new TransportAttribute(id);
auto a = new TransportAttribute(id);
QByteArray data = a->serialized();
delete a;
a = new TransportAttribute;
......
......@@ -52,7 +52,7 @@ void MessageQueueJobTest::initTestCase()
mda.setIsOnline(false);
// check that outbox is empty
auto *rjob = new SpecialMailCollectionsRequestJob(this);
auto rjob = new SpecialMailCollectionsRequestJob(this);
rjob->requestDefaultCollection(SpecialMailCollections::Outbox);
QSignalSpy spy(rjob, &KJob::result);
QVERIFY(spy.wait(10000));
......@@ -66,7 +66,7 @@ void MessageQueueJobTest::testValidMessages()
QVERIFY2(tid >= 0, "I need a default transport, but there is none.");
// send a valid message using the default transport
auto *qjob = new MessageQueueJob;
auto qjob = new MessageQueueJob;
qjob->transportAttribute().setTransportId(tid);
Message::Ptr msg = Message::Ptr(new Message);
msg->setContent("\nThis is message #1 from the MessageQueueJobTest unit test.\n");
......@@ -109,7 +109,7 @@ void MessageQueueJobTest::testValidMessages()
QVERIFY(item.flags().contains(Akonadi::MessageFlags::Queued));
// delete message, for further tests
auto *djob = new ItemDeleteJob(item);
auto djob = new ItemDeleteJob(item);
AKVERIFYEXEC(djob);
verifyOutboxContents(0);
......@@ -125,7 +125,7 @@ void MessageQueueJobTest::testInvalidMessages()
Message::Ptr msg;
// without message
auto *job = new MessageQueueJob;
auto job = new MessageQueueJob;
job->transportAttribute().setTransportId(TransportManager::self()->defaultTransportId());
job->addressAttribute().setTo(SPAM_ADDRESS);
QVERIFY(!job->exec());
......@@ -167,7 +167,7 @@ void MessageQueueJobTest::verifyOutboxContents(qlonglong count)
QVERIFY(SpecialMailCollections::self()->hasDefaultCollection(SpecialMailCollections::Outbox));
Collection outbox = SpecialMailCollections::self()->defaultCollection(SpecialMailCollections::Outbox);
QVERIFY(outbox.isValid());
auto *job = new CollectionStatisticsJob(outbox);
auto job = new CollectionStatisticsJob(outbox);
AKVERIFYEXEC(job);
QCOMPARE(job->statistics().count(), count);
}
......
......@@ -52,7 +52,7 @@ void DispatcherInterface::dispatchManually()
return;
}
auto *mjob = new FilterActionJob(outbox, new SendQueuedAction, sInstance);
auto mjob = new FilterActionJob(outbox, new SendQueuedAction, sInstance);
QObject::connect(mjob, &KJob::result, sInstance(), &DispatcherInterfacePrivate::massModifyResult);
}
......@@ -64,7 +64,7 @@ void DispatcherInterface::retryDispatching()
return;
}
auto *mjob = new FilterActionJob(outbox, new ClearErrorAction, sInstance);
auto mjob = new FilterActionJob(outbox, new ClearErrorAction, sInstance);
QObject::connect(mjob, &KJob::result, sInstance(), &DispatcherInterfacePrivate::massModifyResult);
}
......@@ -76,7 +76,7 @@ void DispatcherInterface::dispatchManualTransport(int transportId)
return;
}
auto *mjob = new FilterActionJob(outbox, new DispatchManualTransportAction(transportId), sInstance);
auto mjob = new FilterActionJob(outbox, new DispatchManualTransportAction(transportId), sInstance);
QObject::connect(mjob, &KJob::result, sInstance(), &DispatcherInterfacePrivate::massModifyResult);
}
......
......@@ -33,7 +33,7 @@ DispatchModeAttribute::~DispatchModeAttribute()
DispatchModeAttribute *DispatchModeAttribute::clone() const
{
auto *const cloned = new DispatchModeAttribute(d->mMode);
auto const cloned = new DispatchModeAttribute(d->mMode);
cloned->setSendAfter(d->mDueDate);
return cloned;
}
......
......@@ -109,7 +109,7 @@ void FilterActionJob::doStart()
{
if (d->collection.isValid()) {
qCDebug(MAILTRANSPORTAKONADI_LOG) << "Fetching collection" << d->collection.id();
auto *fjob = new ItemFetchJob(d->collection, this);
auto fjob = new ItemFetchJob(d->collection, this);
Q_ASSERT(d->functor);
d->fetchScope = d->functor->fetchScope();
fjob->setFetchScope(d->fetchScope);
......
......@@ -108,7 +108,7 @@ void MessageQueueJob::Private::outboxRequestResult(KJob *job)
return;
}
auto *requestJob = qobject_cast<SpecialMailCollectionsRequestJob *>(job);
auto requestJob = qobject_cast<SpecialMailCollectionsRequestJob *>(job);
if (!requestJob) {
return;
}
......@@ -132,7 +132,7 @@ void MessageQueueJob::Private::outboxRequestResult(KJob *job)
// Store the item in the outbox.
const Collection collection = requestJob->collection();
Q_ASSERT(collection.isValid());
auto *cjob = new ItemCreateJob(item, collection); // job autostarts
auto cjob = new ItemCreateJob(item, collection); // job autostarts
q->addSubjob(cjob);
}
......@@ -184,7 +184,7 @@ void MessageQueueJob::setMessage(const Message::Ptr &message)
void MessageQueueJob::start()
{
auto *rjob = new SpecialMailCollectionsRequestJob(this);
auto rjob = new SpecialMailCollectionsRequestJob(this);
rjob->requestDefaultCollection(SpecialMailCollections::Outbox);
connect(rjob, &SpecialMailCollectionsRequestJob::result, this, [this](KJob *job) {
d->outboxRequestResult(job);
......
......@@ -84,7 +84,7 @@ MailTransport::TransportJob *AkonadiMailTransportPlugin::createTransportJob(Mail
void AkonadiMailTransportPlugin::initializeTransport(MailTransport::Transport *t, const QString &identifier)
{
auto *cjob = new AgentInstanceCreateJob(identifier);
auto cjob = new AgentInstanceCreateJob(identifier);
if (!cjob->exec()) {
qCWarning(MAILTRANSPORT_AKONADI_LOG) << "Failed to create agent instance of type" << identifier;
return;
......
......@@ -30,7 +30,7 @@ void ResourceSendJob::doStart()
{
Message::Ptr msg = Message::Ptr(new Message);
msg->setContent(data());
auto *job = new MessageQueueJob;
auto job = new MessageQueueJob;
job->setMessage(msg);
job->transportAttribute().setTransportId(transport()->id());
// Default dispatch mode (send now).
......
......@@ -104,7 +104,7 @@ SentActionAttribute::Action::List SentActionAttribute::actions() const
SentActionAttribute *SentActionAttribute::clone() const
{
auto *attribute = new SentActionAttribute;
auto attribute = new SentActionAttribute;
attribute->d->mActions = d->mActions;
return attribute;
......
......@@ -22,7 +22,7 @@ Runner::Runner()
{
Control::start();
auto *rjob = new SpecialMailCollectionsRequestJob(this);
auto rjob = new SpecialMailCollectionsRequestJob(this);
rjob->requestDefaultCollection(SpecialMailCollections::Outbox);
connect(rjob, &SpecialMailCollectionsRequestJob::result, this, &Runner::checkFolders);
rjob->start();
......
......@@ -35,7 +35,7 @@ MessageQueuer::MessageQueuer()
if (!Akonadi::Control::start()) {
qFatal("Could not start Akonadi server.");
}
auto *vbox = new QVBoxLayout(this);
auto vbox = new QVBoxLayout(this);
vbox->setContentsMargins(0, 0, 0, 0);
mComboBox = new TransportComboBox(this);
......@@ -89,7 +89,7 @@ void MessageQueuer::sendOnDateClicked()
{
QPointer<QDialog> dialog = new QDialog(this);
auto layout = new QVBoxLayout(dialog);
auto *dt = new QDateTimeEdit(dialog);
auto dt = new QDateTimeEdit(dialog);
dt->setDateTime(QDateTime::currentDateTime());
dt->setDisplayFormat(QStringLiteral("hh:mm:ss"));
layout->addWidget(dt);
......@@ -116,7 +116,7 @@ MessageQueueJob *MessageQueuer::createQueueJob()
msg->setContent(QByteArray("\n") + mMailEdit->document()->toPlainText().toLatin1());
qDebug() << "msg:" << msg->encodedContent(true);
auto *job = new MessageQueueJob();
auto job = new MessageQueueJob();
job->setMessage(msg);
job->transportAttribute().setTransportId(mComboBox->currentTransportId());
// default dispatch mode
......@@ -138,7 +138,7 @@ int main(int argc, char **argv)
QApplication app(argc, argv);
app.setApplicationName(QStringLiteral("messagequeuer"));
auto *t = new MessageQueuer();
auto t = new MessageQueuer();
t->show();
app.exec();
delete t;
......
......@@ -22,7 +22,7 @@ Runner::Runner()
{
Control::start();
auto *rjob = new SpecialMailCollectionsRequestJob(this);
auto rjob = new SpecialMailCollectionsRequestJob(this);
rjob->requestDefaultCollection(SpecialMailCollections::Outbox);
connect(rjob, &SpecialMailCollectionsRequestJob::result, this, &Runner::checkFolders);
rjob->start();
......
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