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

Modernize code

parent 1e46c8ae
Pipeline #60364 passed with stage
in 5 minutes and 52 seconds
......@@ -26,7 +26,7 @@ SmtpConfigDialog::SmtpConfigDialog(Transport *transport, QWidget *parent)
mConfigWidget = new SMTPConfigWidget(transport, this);
mConfigWidget->setObjectName(QStringLiteral("smtpconfigwidget"));
mainLayout->addWidget(mConfigWidget);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
buttonBox->setObjectName(QStringLiteral("buttons"));
mOkButton = buttonBox->button(QDialogButtonBox::Ok);
mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return);
......
......@@ -116,7 +116,7 @@ void SmtpJob::doStart()
startSmtpJob();
} else {
d->currentState = SmtpJobPrivate::Precommand;
PrecommandJob *job = new PrecommandJob(transport()->precommand(), this);
auto job = new PrecommandJob(transport()->precommand(), this);
addSubjob(job);
job->start();
}
......
......@@ -16,7 +16,7 @@ AddTransportDialogNG_gui::AddTransportDialogNG_gui(QWidget *parent)
: QWidget(parent)
{
auto layout = new QHBoxLayout(this);
QPushButton *button = new QPushButton(QStringLiteral("Add transport"));
auto button = new QPushButton(QStringLiteral("Add transport"));
layout->addWidget(button);
connect(button, &QPushButton::clicked, this, [this] {
auto dlg = new MailTransport::AddTransportDialogNG(this);
......
......@@ -31,7 +31,7 @@ TransportMgr::TransportMgr()
mComboBox = new TransportComboBox(this);
mComboBox->setEditable(true);
vbox->addWidget(mComboBox);
QPushButton *b = new QPushButton(QStringLiteral("&Edit"), this);
auto b = new QPushButton(QStringLiteral("&Edit"), this);
vbox->addWidget(b);
connect(b, &QPushButton::clicked, this, &TransportMgr::editBtnClicked);
b = new QPushButton(QStringLiteral("&Remove all transports"), this);
......
......@@ -39,7 +39,7 @@ public:
*/
~Transport() override;
typedef QList<Transport *> List;
using List = QList<Transport *>;
/**
Returns true if this transport is valid, ie. has all necessary data set.
......
......@@ -122,7 +122,7 @@ TransportManager::TransportManager()
QDBusConnection::sessionBus().registerObject(DBUS_OBJECT_PATH, this, QDBusConnection::ExportScriptableSlots | QDBusConnection::ExportScriptableSignals);
QDBusServiceWatcher *watcher = new QDBusServiceWatcher(DBUS_SERVICE_NAME, QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForUnregistration, this);
auto watcher = new QDBusServiceWatcher(DBUS_SERVICE_NAME, QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForUnregistration, this);
connect(watcher, &QDBusServiceWatcher::serviceUnregistered, this, [this]() {
d->dbusServiceUnregistered();
});
......@@ -189,7 +189,7 @@ TransportType::List TransportManager::types() const
Transport *TransportManager::createTransport() const
{
int id = d->createId();
Transport *t = new Transport(QString::number(id));
auto t = new Transport(QString::number(id));
t->setId(id);
return t;
}
......
......@@ -37,7 +37,7 @@ public:
/**
Describes a list of transport types.
*/
typedef QVector<TransportType> List;
using List = QVector<TransportType>;
/**
Constructs a new TransportType.
......
......@@ -88,11 +88,11 @@ AddTransportDialogNG::AddTransportDialogNG(QWidget *parent)
// Setup UI.
{
auto mainLayout = new QVBoxLayout(this);
QWidget *widget = new QWidget(this);
auto widget = new QWidget(this);
d->ui.setupUi(widget);
mainLayout->addWidget(widget);
setWindowTitle(i18nc("@title:window", "Create Outgoing Account"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
d->okButton = buttonBox->button(QDialogButtonBox::Ok);
d->okButton->setText(i18nc("create and configure a mail transport", "Create and Configure"));
d->okButton->setEnabled(false);
......
......@@ -140,7 +140,7 @@ void AttributeTest::testSerialization()
{
SentBehaviourAttribute::SentBehaviour beh = SentBehaviourAttribute::MoveToCollection;
Collection::Id id = 123456789012345ll;
SentBehaviourAttribute *a = new SentBehaviourAttribute(beh, Collection(id));
auto a = new SentBehaviourAttribute(beh, Collection(id));
bool sendSilently = true;
a->setSendSilently(sendSilently);
QByteArray data = a->serialized();
......@@ -157,7 +157,7 @@ void AttributeTest::testSerialization()
{
SentBehaviourAttribute::SentBehaviour beh = SentBehaviourAttribute::MoveToCollection;
Collection::Id id = 123456789012345ll;
SentBehaviourAttribute *a = new SentBehaviourAttribute(beh, Collection(id));
auto a = new SentBehaviourAttribute(beh, Collection(id));
bool sendSilently = true;
a->setSendSilently(sendSilently);
QByteArray data = a->serialized();
......@@ -179,7 +179,7 @@ void AttributeTest::testSerialization()
{
SentBehaviourAttribute::SentBehaviour beh = SentBehaviourAttribute::Delete;
Collection::Id id = 123456789012345ll;
SentBehaviourAttribute *a = new SentBehaviourAttribute(beh, Collection(id));
auto a = new SentBehaviourAttribute(beh, Collection(id));
bool sendSilently = true;
a->setSendSilently(sendSilently);
QByteArray data = a->serialized();
......@@ -203,7 +203,7 @@ void AttributeTest::testSerialization()
{
SentBehaviourAttribute::SentBehaviour beh = SentBehaviourAttribute::MoveToDefaultSentCollection;
Collection::Id id = 123456789012345ll;
SentBehaviourAttribute *a = new SentBehaviourAttribute(beh, Collection(id));
auto a = new SentBehaviourAttribute(beh, Collection(id));
bool sendSilently = true;
a->setSendSilently(sendSilently);
QByteArray data = a->serialized();
......
......@@ -78,7 +78,7 @@ void MessageQueueJobTest::testValidMessages()
// fetch the message and verify it
QTest::qWait(1000);
verifyOutboxContents(1);
ItemFetchJob *fjob = new ItemFetchJob(SpecialMailCollections::self()->defaultCollection(SpecialMailCollections::Outbox));
auto fjob = new ItemFetchJob(SpecialMailCollections::self()->defaultCollection(SpecialMailCollections::Outbox));
fjob->fetchScope().fetchFullPayload();
fjob->fetchScope().fetchAllAttributes();
AKVERIFYEXEC(fjob);
......@@ -86,24 +86,24 @@ void MessageQueueJobTest::testValidMessages()
Item item = fjob->items().constFirst();
QVERIFY(!item.remoteId().isEmpty()); // stored by the resource
QVERIFY(item.hasPayload<Message::Ptr>());
auto *addrA = item.attribute<AddressAttribute>();
auto addrA = item.attribute<AddressAttribute>();
QVERIFY(addrA);
QVERIFY(addrA->from().isEmpty());
QCOMPARE(addrA->to().count(), 1);
QCOMPARE(addrA->to(), SPAM_ADDRESS);
QCOMPARE(addrA->cc().count(), 0);
QCOMPARE(addrA->bcc().count(), 0);
auto *dA = item.attribute<DispatchModeAttribute>();
auto dA = item.attribute<DispatchModeAttribute>();
QVERIFY(dA);
QCOMPARE(dA->dispatchMode(), DispatchModeAttribute::Automatic); // default mode
auto *sA = item.attribute<SentBehaviourAttribute>();
auto sA = item.attribute<SentBehaviourAttribute>();
QVERIFY(sA);
// default sent collection
QCOMPARE(sA->sentBehaviour(), SentBehaviourAttribute::MoveToDefaultSentCollection);
auto *tA = item.attribute<TransportAttribute>();
auto tA = item.attribute<TransportAttribute>();
QVERIFY(tA);
QCOMPARE(tA->transportId(), tid);
auto *eA = item.attribute<ErrorAttribute>();
auto eA = item.attribute<ErrorAttribute>();
QVERIFY(!eA); // no error
QCOMPARE(item.flags().count(), 1);
QVERIFY(item.flags().contains(Akonadi::MessageFlags::Queued));
......
......@@ -46,7 +46,7 @@ void FilterActionJob::Private::fetchResult(KJob *job)
return;
}
auto *fjob = dynamic_cast<ItemFetchJob *>(job);
auto fjob = dynamic_cast<ItemFetchJob *>(job);
Q_ASSERT(fjob);
Q_ASSERT(items.isEmpty());
items = fjob->items();
......
......@@ -46,7 +46,7 @@ public:
/**
* Describes a list of sent actions.
*/
typedef QVector<Action> List;
using List = QVector<Action>;
/**
* Creates a new invalid action.
......
......@@ -59,7 +59,7 @@ MessageQueuer::MessageQueuer()
mMailEdit->setAcceptRichText(false);
mMailEdit->setLineWrapMode(QTextEdit::NoWrap);
vbox->addWidget(mMailEdit);
QPushButton *b = new QPushButton(QStringLiteral("&Send Now"), this);
auto b = new QPushButton(QStringLiteral("&Send Now"), this);
vbox->addWidget(b);
connect(b, &QPushButton::clicked, this, &MessageQueuer::sendNowClicked);
b = new QPushButton(QStringLiteral("Send &Queued"), this);
......
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