Commit 688c93e5 authored by Laurent Montel's avatar Laurent Montel 😁

Modernize code

parent 850ff668
Pipeline #39339 passed with stage
in 12 minutes and 39 seconds
......@@ -197,10 +197,10 @@ void CalendarBaseTest::testDelete()
QTestEventLoop::instance().enterLoop(5);
QVERIFY(!QTestEventLoop::instance().timeout());
ItemFetchJob *job1 = new ItemFetchJob(event, this);
ItemFetchJob *job2 = new ItemFetchJob(todo, this);
ItemFetchJob *job3 = new ItemFetchJob(journal, this);
ItemFetchJob *job4 = new ItemFetchJob(incidence, this);
auto *job1 = new ItemFetchJob(event, this);
auto *job2 = new ItemFetchJob(todo, this);
auto *job3 = new ItemFetchJob(journal, this);
auto *job4 = new ItemFetchJob(incidence, this);
QVERIFY(!job1->exec());
QVERIFY(!job2->exec());
QVERIFY(!job3->exec());
......
......@@ -46,7 +46,7 @@ void ETMCalendarTest::createIncidence(const QString &uid)
incidence->setDtStart(QDateTime::currentDateTimeUtc());
incidence->setSummary(QStringLiteral("summary"));
item.setPayload<KCalendarCore::Incidence::Ptr>(incidence);
ItemCreateJob *job = new ItemCreateJob(item, mCollection, this);
auto *job = new ItemCreateJob(item, mCollection, this);
AKVERIFYEXEC(job);
}
......@@ -62,7 +62,7 @@ void ETMCalendarTest::createTodo(const QString &uid, const QString &parentUid)
todo->setSummary(QStringLiteral("summary"));
item.setPayload<KCalendarCore::Incidence::Ptr>(todo);
ItemCreateJob *job = new ItemCreateJob(item, mCollection, this);
auto *job = new ItemCreateJob(item, mCollection, this);
mIncidencesToAdd++;
mIncidencesToChange++;
AKVERIFYEXEC(job);
......@@ -148,7 +148,7 @@ void ETMCalendarTest::testCollectionChanged_data()
void ETMCalendarTest::testCollectionChanged()
{
QFETCH(Akonadi::Collection, noRightsCollection);
CollectionModifyJob *job = new CollectionModifyJob(mCollection, this);
auto *job = new CollectionModifyJob(mCollection, this);
QSignalSpy spy(mCalendar, &ETMCalendar::collectionChanged);
mIncidencesToChange = 6;
AKVERIFYEXEC(job);
......@@ -174,7 +174,7 @@ void ETMCalendarTest::testIncidencesModified()
Incidence::Ptr clone = Incidence::Ptr(CalendarUtils::incidence(item)->clone());
clone->setSummary(tr("foo33"));
item.setPayload(clone);
ItemModifyJob *job = new ItemModifyJob(item);
auto *job = new ItemModifyJob(item);
mIncidencesToChange = 1;
AKVERIFYEXEC(job);
QTestEventLoop::instance().enterLoop(10);
......@@ -190,7 +190,7 @@ void ETMCalendarTest::testIncidencesDeleted()
const Item item = mCalendar->item(tr("a"));
QVERIFY(item.isValid());
QVERIFY(item.hasPayload());
ItemDeleteJob *job = new ItemDeleteJob(item);
auto *job = new ItemDeleteJob(item);
AKVERIFYEXEC(job);
mIncidencesToDelete = 1;
QTestEventLoop::instance().enterLoop(10);
......@@ -353,7 +353,7 @@ void ETMCalendarTest::testSubTodos()
ta->setRelatedTo(tr("tb"));
mIncidencesToChange++;
ItemModifyJob *job = new ItemModifyJob(ta_item);
auto *job = new ItemModifyJob(ta_item);
AKVERIFYEXEC(job);
waitForIt();
......@@ -400,7 +400,7 @@ void ETMCalendarTest::testSubTodos()
// Delete everything, so we don't have duplicate ids when the next test row runs
Akonadi::Item::List itemsToDelete = mCalendar->items();
mIncidencesToDelete = itemsToDelete.count();
ItemDeleteJob *deleteJob = new ItemDeleteJob(itemsToDelete);
auto *deleteJob = new ItemDeleteJob(itemsToDelete);
AKVERIFYEXEC(deleteJob);
waitForIt();
}
......@@ -424,7 +424,7 @@ void ETMCalendarTest::testNotifyObserverBug()
mIncidencesToChange = 1;
incidence->setSummary(QStringLiteral("new-summary"));
item.setPayload(incidence);
ItemModifyJob *job = new ItemModifyJob(item);
auto *job = new ItemModifyJob(item);
AKVERIFYEXEC(job);
// The test will now happen inside ETMCalendarTest::calendarIncidenceChanged()
......@@ -446,7 +446,7 @@ void ETMCalendarTest::testUidChange()
QVERIFY(item.isValid());
item.setPayload(clone);
mIncidencesToChange = 1;
ItemModifyJob *job = new ItemModifyJob(item);
auto *job = new ItemModifyJob(item);
AKVERIFYEXEC(job);
waitForIt();
......@@ -501,7 +501,7 @@ void ETMCalendarTest::testShareETM()
createTodo(QStringLiteral("uid-123"), QString());
waitForIt();
ETMCalendar *calendar2 = new ETMCalendar(mCalendar, this);
auto *calendar2 = new ETMCalendar(mCalendar, this);
calendar2->registerObserver(this);
// Uncheck our calendar
......@@ -535,7 +535,7 @@ void ETMCalendarTest::testFilterInvitations()
incidence->addAttendee(me);
item.setPayload<KCalendarCore::Incidence::Ptr>(incidence);
ItemCreateJob *job = new ItemCreateJob(item, mCollection, this);
auto *job = new ItemCreateJob(item, mCollection, this);
AKVERIFYEXEC(job);
waitForIt();
// incidence do not pop up in model
......@@ -565,7 +565,7 @@ void ETMCalendarTest::testFilterInvitationsChanged()
item.setPayload<KCalendarCore::Incidence::Ptr>(incidence);
mIncidencesToDelete = 1;
ItemModifyJob *modifyJob = new ItemModifyJob(item, this);
auto *modifyJob = new ItemModifyJob(item, this);
AKVERIFYEXEC(modifyJob);
waitForIt();
QCOMPARE(mCalendar->model()->rowCount(), anz);
......
......@@ -28,7 +28,7 @@ class FetchJobCalendarTest : public QObject
incidence->setSummary(QStringLiteral("summary"));
incidence->setDtStart(QDateTime::currentDateTimeUtc());
item.setPayload<KCalendarCore::Incidence::Ptr>(incidence);
ItemCreateJob *job = new ItemCreateJob(item, mCollection, this);
auto *job = new ItemCreateJob(item, mCollection, this);
AKVERIFYEXEC(job);
}
......
......@@ -16,13 +16,13 @@ using namespace Akonadi;
bool Helper::confirmExists(const Akonadi::Item &item)
{
ItemFetchJob *job = new ItemFetchJob(item);
auto *job = new ItemFetchJob(item);
return job->exec() != 0;
}
bool Helper::confirmDoesntExist(const Akonadi::Item &item)
{
ItemFetchJob *job = new ItemFetchJob(item);
auto *job = new ItemFetchJob(item);
return job->exec() == 0;
}
......
......@@ -24,7 +24,7 @@ Q_DECLARE_METATYPE(QList<Akonadi::IncidenceChanger::ChangeType>)
static bool checkSummary(const Akonadi::Item &item, const QString &expected)
{
ItemFetchJob *job = new ItemFetchJob(item);
auto *job = new ItemFetchJob(item);
job->fetchScope().fetchFullPayload();
bool ok = false;
[&]() {
......@@ -63,7 +63,7 @@ static Akonadi::Item item()
static Akonadi::Item createItem(const Akonadi::Collection &collection)
{
Item i = item();
ItemCreateJob *createJob = new ItemCreateJob(i, collection);
auto *createJob = new ItemCreateJob(i, collection);
[&]() {
QVERIFY(createJob->exec());
QVERIFY(createJob->item().isValid());
......
......@@ -48,7 +48,7 @@ static Akonadi::Item item()
static Akonadi::Item createItem(const Akonadi::Collection &collection)
{
Item i = item();
ItemCreateJob *createJob = new ItemCreateJob(i, collection);
auto *createJob = new ItemCreateJob(i, collection);
createJob->exec();
return createJob->item();
......@@ -212,7 +212,7 @@ private Q_SLOTS:
Item item;
QVERIFY(mItemIdByChangeId.contains(changeId));
item.setId(mItemIdByChangeId.value(changeId));
ItemFetchJob *fetchJob = new ItemFetchJob(item, this);
auto *fetchJob = new ItemFetchJob(item, this);
fetchJob->fetchScope().fetchFullPayload();
AKVERIFYEXEC(fetchJob);
QVERIFY(!fetchJob->items().isEmpty());
......@@ -239,7 +239,7 @@ private Q_SLOTS:
QTest::newRow("Delete empty list") << Item::List() << true << true;
QTest::newRow("Delete invalid item") << (Item::List() << Item()) << true << true;
ItemFetchJob *fetchJob = new ItemFetchJob(mCollection);
auto *fetchJob = new ItemFetchJob(mCollection);
fetchJob->fetchScope().fetchFullPayload();
AKVERIFYEXEC(fetchJob);
Item::List items = fetchJob->items();
......@@ -284,7 +284,7 @@ private Q_SLOTS:
if (expectedResultCode == IncidenceChanger::ResultCodeSuccess) {
// Check that the incidence was really deleted
for (const Akonadi::Item &item : qAsConst(items)) {
ItemFetchJob *fetchJob = new ItemFetchJob(item, this);
auto *fetchJob = new ItemFetchJob(item, this);
fetchJob->fetchScope().fetchFullPayload();
QVERIFY(!fetchJob->exec());
QVERIFY(fetchJob->items().isEmpty());
......@@ -312,7 +312,7 @@ private Q_SLOTS:
incidence->setUid(QStringLiteral("test123uid"));
incidence->setSummary(QStringLiteral("summary"));
item.setPayload<KCalendarCore::Incidence::Ptr>(incidence);
ItemCreateJob *job = new ItemCreateJob(item, mCollection, this);
auto *job = new ItemCreateJob(item, mCollection, this);
AKVERIFYEXEC(job);
item = job->item();
incidence->setSummary(QStringLiteral("New Summary"));
......@@ -347,7 +347,7 @@ private Q_SLOTS:
mIncidencesToModify = 1;
mExpectedResultByChangeId.insert(changeId, expectedResultCode);
waitForSignals();
ItemFetchJob *fetchJob = new ItemFetchJob(item, this);
auto *fetchJob = new ItemFetchJob(item, this);
fetchJob->fetchScope().fetchFullPayload();
AKVERIFYEXEC(fetchJob);
QVERIFY(fetchJob->items().count() == 1);
......@@ -374,7 +374,7 @@ private Q_SLOTS:
incidence->setOrganizer(Person(QStringLiteral("orga"), QStringLiteral("orga@dev.nul")));
incidence->setDirtyFields(QSet<IncidenceBase::Field>());
item.setPayload<KCalendarCore::Incidence::Ptr>(incidence);
ItemCreateJob *job = new ItemCreateJob(item, mCollection, this);
auto *job = new ItemCreateJob(item, mCollection, this);
AKVERIFYEXEC(job);
item = job->item();
Alarm::Ptr alarm = Alarm::Ptr(new Alarm(incidence.data()));
......@@ -390,7 +390,7 @@ private Q_SLOTS:
mIncidencesToModify = 1;
mExpectedResultByChangeId.insert(changeId, IncidenceChanger::ResultCodeSuccess);
waitForSignals();
ItemFetchJob *fetchJob = new ItemFetchJob(item, this);
auto *fetchJob = new ItemFetchJob(item, this);
fetchJob->fetchScope().fetchFullPayload();
AKVERIFYEXEC(fetchJob);
QVERIFY(fetchJob->items().count() == 1);
......@@ -529,7 +529,7 @@ private Q_SLOTS:
QFETCH(bool, expectReset);
item.setId(-1);
ItemCreateJob *job = new ItemCreateJob(item, mCollection, this);
auto *job = new ItemCreateJob(item, mCollection, this);
AKVERIFYEXEC(job);
item = job->item();
item.setPayload<KCalendarCore::Incidence::Ptr>(event);
......@@ -543,7 +543,7 @@ private Q_SLOTS:
mIncidencesToModify = 1;
mExpectedResultByChangeId.insert(changeId, IncidenceChanger::ResultCodeSuccess);
waitForSignals();
ItemFetchJob *fetchJob = new ItemFetchJob(item, this);
auto *fetchJob = new ItemFetchJob(item, this);
fetchJob->fetchScope().fetchFullPayload();
AKVERIFYEXEC(fetchJob);
QVERIFY(fetchJob->items().count() == 1);
......@@ -589,7 +589,7 @@ private Q_SLOTS:
incidence->setUid(QStringLiteral("test123uid"));
incidence->setSummary(QStringLiteral("summary"));
item.setPayload<KCalendarCore::Incidence::Ptr>(incidence);
ItemCreateJob *job = new ItemCreateJob(item, mCollection, this);
auto *job = new ItemCreateJob(item, mCollection, this);
AKVERIFYEXEC(job);
item = job->item();
......@@ -622,7 +622,7 @@ private Q_SLOTS:
mIncidencesToModify = 1;
mExpectedResultByChangeId.insert(changeId, IncidenceChanger::ResultCodeSuccess);
waitForSignals();
ItemFetchJob *fetchJob = new ItemFetchJob(item, this);
auto *fetchJob = new ItemFetchJob(item, this);
fetchJob->fetchScope().fetchFullPayload();
AKVERIFYEXEC(fetchJob);
QVERIFY(fetchJob->items().count() == 1);
......@@ -636,7 +636,7 @@ private Q_SLOTS:
// Wait for the last one
mExpectedResultByChangeId.insert(changeId, IncidenceChanger::ResultCodeSuccess);
waitForChange(changeId);
ItemFetchJob *fetchJob = new ItemFetchJob(item, this);
auto *fetchJob = new ItemFetchJob(item, this);
fetchJob->fetchScope().fetchFullPayload();
AKVERIFYEXEC(fetchJob);
QVERIFY(fetchJob->items().count() == 1);
......
......@@ -605,7 +605,7 @@ void ITIPHandlerTest::cleanup()
{
const Akonadi::Item::List items = calendarItems();
for (const Akonadi::Item &item : items) {
ItemDeleteJob *job = new ItemDeleteJob(item);
auto *job = new ItemDeleteJob(item);
AKVERIFYEXEC(job);
}
......
......@@ -59,13 +59,13 @@ void UnitTestBase::createIncidence(const QString &uid)
void UnitTestBase::createIncidence(const Item &item)
{
QVERIFY(mCollection.isValid());
ItemCreateJob *job = new ItemCreateJob(item, mCollection, this);
auto *job = new ItemCreateJob(item, mCollection, this);
QVERIFY(job->exec());
}
void UnitTestBase::verifyExists(const QString &uid, bool exists)
{
FetchJobCalendar *calendar = new FetchJobCalendar();
auto *calendar = new FetchJobCalendar();
connect(calendar, &FetchJobCalendar::loadFinished, this, &UnitTestBase::onLoadFinished);
waitForIt();
calendar->deleteLater();
......
......@@ -92,7 +92,7 @@ QByteArray BlockAlarmsAttribute::type() const
BlockAlarmsAttribute *BlockAlarmsAttribute::clone() const
{
BlockAlarmsAttribute *copy = new BlockAlarmsAttribute();
auto *copy = new BlockAlarmsAttribute();
copy->d->audio = d->audio;
copy->d->display = d->display;
copy->d->email = d->email;
......
......@@ -113,7 +113,7 @@ void CalendarBasePrivate::internalInsert(const Akonadi::Item &item)
incidence->setReadOnly(!(collection.rights() & Akonadi::Collection::CanChangeItem));
} else if (!mCollectionJobs.key(item.storageCollectionId())) {
collection = Akonadi::Collection(item.storageCollectionId());
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(collection, Akonadi::CollectionFetchJob::Base, this);
auto *job = new Akonadi::CollectionFetchJob(collection, Akonadi::CollectionFetchJob::Base, this);
QObject::connect(job, &KJob::result, this, &CalendarBasePrivate::collectionFetchResult);
mCollectionJobs.insert(job, collection.id());
}
......@@ -154,7 +154,7 @@ void CalendarBasePrivate::collectionFetchResult(KJob *job)
return;
}
Akonadi::CollectionFetchJob *fetchJob = qobject_cast<Akonadi::CollectionFetchJob *>(job);
auto *fetchJob = qobject_cast<Akonadi::CollectionFetchJob *>(job);
const Akonadi::Collection collection = fetchJob->collections().at(0);
if (collection.id() != colid) {
......
......@@ -46,7 +46,7 @@ CalendarModel::CalendarModel(Akonadi::Monitor *monitor)
CalendarModel::Ptr CalendarModel::create(Monitor *monitor)
{
CalendarModel *model = new CalendarModel(monitor);
auto *model = new CalendarModel(monitor);
CalendarModel::Ptr modelPtr = CalendarModel::Ptr(model);
model->setWeakPointer(modelPtr.toWeakRef());
return modelPtr;
......
......@@ -43,7 +43,7 @@ void ETMCalendarPrivate::init()
{
if (!mETM) {
Akonadi::Session *session = new Akonadi::Session("ETMCalendar", q);
Akonadi::Monitor *monitor = new Akonadi::Monitor(q);
auto *monitor = new Akonadi::Monitor(q);
monitor->setObjectName(QStringLiteral("ETMCalendarMonitor"));
connect(monitor, QOverload<const Akonadi::Collection &, const QSet<QByteArray> &>::of(&Monitor::collectionChanged), this, [this](const Akonadi::Collection &cols, const QSet<QByteArray> &set)
{
......@@ -122,7 +122,7 @@ void ETMCalendarPrivate::onCollectionChanged(const Akonadi::Collection &collecti
void ETMCalendarPrivate::setupFilteredETM()
{
// We're only interested in the CollectionTitle column
KColumnFilterProxyModel *columnFilterProxy = new KColumnFilterProxyModel(this);
auto *columnFilterProxy = new KColumnFilterProxyModel(this);
columnFilterProxy->setSourceModel(mETM.data());
columnFilterProxy->setVisibleColumn(CalendarModel::CollectionTitle);
columnFilterProxy->setObjectName(QStringLiteral("Remove columns"));
......@@ -136,7 +136,7 @@ void ETMCalendarPrivate::setupFilteredETM()
mCollectionProxyModel->setSourceModel(columnFilterProxy);
// Keep track of selected items.
QItemSelectionModel *selectionModel = new QItemSelectionModel(mCollectionProxyModel);
auto *selectionModel = new QItemSelectionModel(mCollectionProxyModel);
selectionModel->setObjectName(QStringLiteral("Calendar Selection Model"));
// Make item selection work by means of checkboxes.
......@@ -447,7 +447,7 @@ ETMCalendar::ETMCalendar(ETMCalendar *other, QObject *parent)
{
Q_D(ETMCalendar);
CalendarModel *model = qobject_cast<Akonadi::CalendarModel *>(other->entityTreeModel());
auto *model = qobject_cast<Akonadi::CalendarModel *>(other->entityTreeModel());
if (model) {
d->mETM = model->weakPointer().toStrongRef();
}
......@@ -590,7 +590,7 @@ void ETMCalendar::setCollectionFilteringEnabled(bool enable)
d->mCalFilterProxyModel->setSourceModel(d->mSelectionProxy);
delete qobject_cast<KDescendantsProxyModel *>(oldModel);
} else {
KDescendantsProxyModel *flatner = new KDescendantsProxyModel(this);
auto *flatner = new KDescendantsProxyModel(this);
flatner->setSourceModel(d->mETM.data());
d->mCalFilterProxyModel->setSourceModel(flatner);
}
......
......@@ -18,7 +18,7 @@ FetchJobCalendarPrivate::FetchJobCalendarPrivate(FetchJobCalendar *qq)
: CalendarBasePrivate(qq)
, q(qq)
{
IncidenceFetchJob *job = new IncidenceFetchJob();
auto *job = new IncidenceFetchJob();
connect(job, &KJob::result,
this, &FetchJobCalendarPrivate::slotSearchJobFinished);
connect(this, &CalendarBasePrivate::fetchFinished,
......@@ -31,7 +31,7 @@ FetchJobCalendarPrivate::~FetchJobCalendarPrivate()
void FetchJobCalendarPrivate::slotSearchJobFinished(KJob *job)
{
IncidenceFetchJob *searchJob = static_cast<Akonadi::IncidenceFetchJob *>(job);
auto *searchJob = static_cast<Akonadi::IncidenceFetchJob *>(job);
m_success = true;
m_errorMessage = QString();
if (searchJob->error()) {
......@@ -75,7 +75,7 @@ FetchJobCalendar::~FetchJobCalendar()
bool FetchJobCalendar::isLoaded() const
{
FetchJobCalendarPrivate *d = static_cast<FetchJobCalendarPrivate *>(d_ptr.data());
auto *d = static_cast<FetchJobCalendarPrivate *>(d_ptr.data());
return d->m_isLoaded;
}
......
......@@ -103,7 +103,7 @@ void FbCheckerJob::dataReceived(KIO::Job *, const QByteArray &data)
void FbCheckerJob::onGetJobFinished(KJob *job)
{
KIO::TransferJob *transferJob = static_cast<KIO::TransferJob *>(job);
auto *transferJob = static_cast<KIO::TransferJob *>(job);
if (mData.contains("BEGIN:VCALENDAR")) {
qCDebug(AKONADICALENDAR_LOG) << "found freebusy";
mValidUrl = transferJob->url();
......@@ -201,7 +201,7 @@ void FreeBusyManagerPrivate::fetchFreeBusyUrl(const QString &email)
return;
}
// Try with the url configured by preferred email in kcontactmanager
Akonadi::ContactSearchJob *job = new Akonadi::ContactSearchJob();
auto *job = new Akonadi::ContactSearchJob();
job->setQuery(Akonadi::ContactSearchJob::Email, email);
job->setProperty("contactEmail", QVariant::fromValue(email));
connect(job, &Akonadi::ContactSearchJob::result, this, &FreeBusyManagerPrivate::contactSearchJobFinished);
......@@ -219,7 +219,7 @@ void FreeBusyManagerPrivate::contactSearchJobFinished(KJob *_job)
return;
}
Akonadi::ContactSearchJob *job = qobject_cast<Akonadi::ContactSearchJob *>(_job);
auto *job = qobject_cast<Akonadi::ContactSearchJob *>(_job);
KConfig cfg(configFile());
KConfigGroup group = cfg.group(email);
QString url = group.readEntry(QStringLiteral("url"));
......@@ -327,7 +327,7 @@ void FreeBusyManagerPrivate::fbCheckerJobFinished(KJob *job)
{
const QString email = job->property("email").toString();
if (!job->error()) {
FbCheckerJob *checkerJob = static_cast<FbCheckerJob *>(job);
auto *checkerJob = static_cast<FbCheckerJob *>(job);
QUrl dirURL = checkerJob->validUrl();
// write the URL to the cache
KConfig cfg(configFile());
......@@ -379,7 +379,7 @@ void FreeBusyManagerPrivate::processFreeBusyDownloadResult(KJob *_job)
{
Q_Q(FreeBusyManager);
FreeBusyDownloadJob *job = qobject_cast<FreeBusyDownloadJob *>(_job);
auto *job = qobject_cast<FreeBusyDownloadJob *>(_job);
Q_ASSERT(job);
if (job->error()) {
qCritical() << "Error downloading freebusy" << _job->errorString();
......@@ -423,7 +423,7 @@ void FreeBusyManagerPrivate::processFreeBusyDownloadResult(KJob *_job)
void FreeBusyManagerPrivate::processFreeBusyUploadResult(KJob *_job)
{
KIO::FileCopyJob *job = static_cast<KIO::FileCopyJob *>(_job);
auto *job = static_cast<KIO::FileCopyJob *>(_job);
if (job->error()) {
KMessageBox::sorry(
nullptr,
......@@ -481,7 +481,7 @@ void FreeBusyManagerPrivate::finishProcessRetrieveQueue(const QString &email, co
mFreeBusyUrlEmailMap.insert(freeBusyUrlForEmail, email);
FreeBusyDownloadJob *job = new FreeBusyDownloadJob(freeBusyUrlForEmail, mParentWidgetForRetrieval);
auto *job = new FreeBusyDownloadJob(freeBusyUrlForEmail, mParentWidgetForRetrieval);
q->connect(job, &FreeBusyDownloadJob::result, this, [this](KJob *job) {
processFreeBusyDownloadResult(job);
});
......@@ -583,7 +583,7 @@ void FreeBusyManagerPrivate::onHandlesFreeBusy(const QString &email, bool handle
return;
}
QDBusInterface *iface = dynamic_cast<QDBusInterface *>(sender());
auto *iface = dynamic_cast<QDBusInterface *>(sender());
if (!iface) {
return;
}
......@@ -649,7 +649,7 @@ void FreeBusyManagerPrivate::onFreeBusyRetrieved(const QString &email, const QSt
return;
}
QDBusInterface *iface = dynamic_cast<QDBusInterface *>(sender());
auto *iface = dynamic_cast<QDBusInterface *>(sender());
if (!iface) {
return;
}
......@@ -885,7 +885,7 @@ void FreeBusyManager::mailFreeBusy(int daysToPublish, QWidget *parentWidget)
QPointer<PublishDialog> publishdlg = new PublishDialog();
if (publishdlg->exec() == QDialog::Accepted) {
// Send the mail
MailScheduler *scheduler = new MailScheduler(/*factory=*/ nullptr, this);
auto *scheduler = new MailScheduler(/*factory=*/ nullptr, this);
connect(scheduler, &Scheduler::transactionFinished,
d, &FreeBusyManagerPrivate::processMailSchedulerResult);
d->mParentWidgetForMailling = parentWidget;
......
......@@ -72,7 +72,7 @@ void ICalImporter::Private::setErrorMessage(const QString &message)
void ICalImporter::Private::resourceCreated(KJob *job)
{
Akonadi::AgentInstanceCreateJob *createjob
auto *createjob
= qobject_cast<Akonadi::AgentInstanceCreateJob *>(job);
Q_ASSERT(createjob);
......@@ -148,7 +148,7 @@ bool ICalImporter::importIntoNewResource(const QString &filename)
Akonadi::AgentType type
= Akonadi::AgentManager::self()->type(QStringLiteral("akonadi_ical_resource"));
Akonadi::AgentInstanceCreateJob *job = new Akonadi::AgentInstanceCreateJob(type, this);
auto *job = new Akonadi::AgentInstanceCreateJob(type, this);
job->setProperty("path", filename);
connect(job, &KJob::result, d, &Private::resourceCreated);
job->start();
......
......@@ -195,7 +195,7 @@ void IncidenceChanger::Private::performNextModification(Akonadi::Item::Id id)
void IncidenceChanger::Private::handleTransactionJobResult(KJob *job)
{
TransactionSequence *transaction = qobject_cast<TransactionSequence *>(job);
auto *transaction = qobject_cast<TransactionSequence *>(job);
Q_ASSERT(transaction);
Q_ASSERT(mAtomicOperationByTransaction.contains(transaction));
......@@ -228,7 +228,7 @@ void IncidenceChanger::Private::handleCreateJobResult(KJob *job)
{
Change::Ptr change = mChangeForJob.take(job);
const ItemCreateJob *j = qobject_cast<const ItemCreateJob *>(job);
const auto *j = qobject_cast<const ItemCreateJob *>(job);
Q_ASSERT(j);
Akonadi::Item item = j->item();
......@@ -299,7 +299,7 @@ void IncidenceChanger::Private::handleDeleteJobResult(KJob *job)
{
Change::Ptr change = mChangeForJob.take(job);
const ItemDeleteJob *j = qobject_cast<const ItemDeleteJob *>(job);
const auto *j = qobject_cast<const ItemDeleteJob *>(job);
const Item::List items = j->deletedItems();
QSharedPointer<DeletionChange> deletionChange = change.staticCast<DeletionChange>();
......@@ -369,7 +369,7 @@ void IncidenceChanger::Private::handleModifyJobResult(KJob *job)
{
Change::Ptr change = mChangeForJob.take(job);
const ItemModifyJob *j = qobject_cast<const ItemModifyJob *>(job);
const auto *j = qobject_cast<const ItemModifyJob *>(job);
const Item item = j->item();
Q_ASSERT(mDirtyFieldsByJob.contains(job));
Q_ASSERT(item.hasPayload<KCalendarCore::Incidence::Ptr>());
......@@ -462,7 +462,7 @@ void IncidenceChanger::Private::handleInvitationsBeforeChange(const Change::Ptr
bool sendOk = true;
Q_ASSERT(!change->originalItems.isEmpty());
ITIPHandlerHelper *handler = new ITIPHandlerHelper(mFactory, change->parentWidget);
auto *handler = new ITIPHandlerHelper(mFactory, change->parentWidget);
handler->setParent(this);
if (m_invitationPolicy == InvitationPolicySend) {
......@@ -560,7 +560,7 @@ void IncidenceChanger::Private::handleInvitationsBeforeChange(const Change::Ptr
void IncidenceChanger::Private::handleInvitationsAfterChange(const Change::Ptr &change)
{
if (change->useGroupwareCommunication) {
ITIPHandlerHelper *handler = new ITIPHandlerHelper(mFactory, change->parentWidget);
auto *handler = new ITIPHandlerHelper(mFactory, change->parentWidget);
connect(handler, &ITIPHandlerHelper::finished,
change.data(), &Change::emitUserDialogClosedAfterChange);
handler->setParent(this);
......@@ -834,7 +834,7 @@ void IncidenceChanger::Private::deleteIncidences2(int changeId, ITIPHandlerHelpe
Q_UNUSED(status);
Change::Ptr change = mChangeById[changeId];
const uint atomicOperationId = change->atomicOperationId;
ItemDeleteJob *deleteJob = new ItemDeleteJob(change->originalItems, parentJob(change));
auto *deleteJob = new ItemDeleteJob(change->originalItems, parentJob(change));
mChangeForJob.insert(deleteJob, change);
if (mBatchOperationInProgress) {
......@@ -880,7 +880,7 @@ int IncidenceChanger::modifyIncidence(const Item &changedItem, const KCalendarCo
const uint atomicOperationId = d->mBatchOperationInProgress ? d->mLatestAtomicOperationId : 0;
const int changeId = ++d->mLatestChangeId;
ModificationChange *modificationChange = new ModificationChange(this, changeId,
auto *modificationChange = new ModificationChange(this, changeId,
atomicOperationId, parent);
Change::Ptr change(modificationChange);
......@@ -1021,7 +1021,7 @@ void IncidenceChanger::Private::performModification2(int changeId, ITIPHandlerHe
// Let's wait for it to end.
queueModification(change);
} else {
ItemModifyJob *modifyJob = new ItemModifyJob(newItem, parentJob(change));
auto *modifyJob = new ItemModifyJob(newItem, parentJob(change));
mChangeForJob.insert(modifyJob, change);
mDirtyFieldsByJob.insert(modifyJob, incidence->dirtyFields());
......@@ -1048,7 +1048,7 @@ void IncidenceChanger::startAtomicOperation(const QString &operationDescription)
++d->mLatestAtomicOperationId;
d->mBatchOperationInProgress = true;
AtomicOperation *atomicOperation = new AtomicOperation(d, d->mLatestAtomicOperationId);