Commit 07d7b342 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code (using auto)

parent 345349a9
Pipeline #39366 failed with stage
in 35 minutes and 57 seconds
......@@ -275,7 +275,7 @@ void MailDispatcherAgent::sendResult(KJob *job)
qCDebug(MAILDISPATCHER_LOG) << "Sending succeeded.";
// handle possible sent actions
const MailTransport::SentActionAttribute *attribute = sentItem.attribute<MailTransport::SentActionAttribute>();
const auto *attribute = sentItem.attribute<MailTransport::SentActionAttribute>();
if (attribute) {
const MailTransport::SentActionAttribute::Action::List lstAct = attribute->actions();
for (const MailTransport::SentActionAttribute::Action &action : lstAct) {
......
......@@ -38,7 +38,7 @@ void OutboxQueue::initQueue()
mQueue.clear();
qCDebug(MAILDISPATCHER_LOG) << "Fetching items in collection" << mOutbox.id();
ItemFetchJob *job = new ItemFetchJob(mOutbox);
auto *job = new ItemFetchJob(mOutbox);
job->fetchScope().fetchAllAttributes();
job->fetchScope().fetchFullPayload(false);
connect(job, &ItemFetchJob::result, this, &OutboxQueue::collectionFetched);
......@@ -81,21 +81,21 @@ void OutboxQueue::addIfComplete(const Item &item)
return;
}
const DispatchModeAttribute *dispatchModeAttribute = item.attribute<DispatchModeAttribute>();
const auto *dispatchModeAttribute = item.attribute<DispatchModeAttribute>();
Q_ASSERT(dispatchModeAttribute);
if (dispatchModeAttribute->dispatchMode() == DispatchModeAttribute::Manual) {
qCDebug(MAILDISPATCHER_LOG) << "Item " << item.id() << "is queued to be sent manually.";
return;
}
const TransportAttribute *transportAttribute = item.attribute<TransportAttribute>();
const auto *transportAttribute = item.attribute<TransportAttribute>();
Q_ASSERT(transportAttribute);
if (transportAttribute->transport() == nullptr) {
qCWarning(MAILDISPATCHER_LOG) << "Item " << item.id() << "has invalid transport.";
return;
}
const SentBehaviourAttribute *sentBehaviourAttribute = item.attribute<SentBehaviourAttribute>();
const auto *sentBehaviourAttribute = item.attribute<SentBehaviourAttribute>();
Q_ASSERT(sentBehaviourAttribute);
if (sentBehaviourAttribute->sentBehaviour() == SentBehaviourAttribute::MoveToCollection
&& !sentBehaviourAttribute->moveToCollection().isValid()) {
......@@ -227,7 +227,7 @@ void OutboxQueue::localFoldersChanged()
mMonitor->setCollectionMonitored(mOutbox, false);
mOutbox = Collection(-1);
SpecialMailCollectionsRequestJob *job = new SpecialMailCollectionsRequestJob(this);
auto *job = new SpecialMailCollectionsRequestJob(this);
job->requestDefaultCollection(SpecialMailCollections::Outbox);
connect(job, &SpecialMailCollectionsRequestJob::result, this, &OutboxQueue::localFoldersRequestResult);
......@@ -237,7 +237,7 @@ void OutboxQueue::localFoldersChanged()
// make sure we have a place to dump the sent mails as well
if (!SpecialMailCollections::self()->hasDefaultCollection(SpecialMailCollections::SentMail)) {
SpecialMailCollectionsRequestJob *job = new SpecialMailCollectionsRequestJob(this);
auto *job = new SpecialMailCollectionsRequestJob(this);
job->requestDefaultCollection(SpecialMailCollections::SentMail);
qCDebug(MAILDISPATCHER_LOG) << "Requesting sent-mail folder";
......@@ -372,7 +372,7 @@ void OutboxQueue::fetchOne()
Q_ASSERT(!mIgnore.contains(item.id()));
mIgnore.insert(item.id());
ItemFetchJob *job = new ItemFetchJob(item);
auto *job = new ItemFetchJob(item);
job->fetchScope().fetchAllAttributes();
job->fetchScope().fetchFullPayload();
connect(job, &ItemFetchJob::result, this, &OutboxQueue::itemFetched);
......
......@@ -213,7 +213,7 @@ void SendJob::resourceResult(qlonglong itemId, int result, const QString &messag
delete mInterface; // So that abort() knows the transport job is over.
mInterface = nullptr;
const TransportResourceBase::TransportResult transportResult
const auto transportResult
= static_cast<TransportResourceBase::TransportResult>(result);
const bool success = (transportResult == TransportResourceBase::TransportSucceeded);
......@@ -377,7 +377,7 @@ void SendJob::doEmitResult(KJob *job)
} else {
qCDebug(MAILDISPATCHER_LOG) << "Success storing result.";
// It is still possible that the transport failed.
StoreResultJob *srJob = static_cast<StoreResultJob *>(job);
auto *srJob = static_cast<StoreResultJob *>(job);
if (!srJob->success()) {
setError(UserDefinedError);
setErrorText(srJob->message());
......
......@@ -24,7 +24,7 @@ void SentActionHandler::runAction(const SentActionAttribute::Action &action)
if (action.type() == SentActionAttribute::Action::MarkAsReplied
|| action.type() == SentActionAttribute::Action::MarkAsForwarded) {
const Akonadi::Item item(action.value().toLongLong());
Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(item);
auto *job = new Akonadi::ItemFetchJob(item);
connect(job, &Akonadi::ItemFetchJob::result, this, &SentActionHandler::itemFetchResult);
job->setProperty("type", static_cast<int>(action.type()));
}
......@@ -37,7 +37,7 @@ void SentActionHandler::itemFetchResult(KJob *job)
return;
}
Akonadi::ItemFetchJob *fetchJob = qobject_cast<Akonadi::ItemFetchJob *>(job);
auto *fetchJob = qobject_cast<Akonadi::ItemFetchJob *>(job);
if (fetchJob->items().isEmpty()) {
return;
}
......@@ -51,6 +51,6 @@ void SentActionHandler::itemFetchResult(KJob *job)
item.setFlag(Akonadi::MessageFlags::Forwarded);
}
Akonadi::ItemModifyJob *modifyJob = new Akonadi::ItemModifyJob(item);
auto *modifyJob = new Akonadi::ItemModifyJob(item);
modifyJob->setIgnorePayload(true);
}
......@@ -33,7 +33,7 @@ StoreResultJob::~StoreResultJob()
void StoreResultJob::doStart()
{
// Fetch item in case it was modified elsewhere.
ItemFetchJob *job = new ItemFetchJob(mItem, this);
auto *job = new ItemFetchJob(mItem, this);
connect(job, &ItemFetchJob::result, this, &StoreResultJob::fetchDone);
}
......@@ -74,7 +74,7 @@ void StoreResultJob::fetchDone(KJob *job)
item.removeAttribute<ErrorAttribute>();
} else {
item.setFlag(Akonadi::MessageFlags::HasError);
ErrorAttribute *errorAttribute = new ErrorAttribute(mMessage);
auto *errorAttribute = new ErrorAttribute(mMessage);
item.addAttribute(errorAttribute);
// If dispatch failed, set the DispatchModeAttribute to Manual.
......@@ -87,7 +87,7 @@ void StoreResultJob::fetchDone(KJob *job)
}
}
ItemModifyJob *modifyJob = new ItemModifyJob(item, this);
auto *modifyJob = new ItemModifyJob(item, this);
QObject::connect(modifyJob, &ItemModifyJob::result, this, &StoreResultJob::modifyDone);
}
......
......@@ -32,9 +32,9 @@ MigrationAgent::MigrationAgent(const QString &id)
void MigrationAgent::configure(WId windowId)
{
QDialog *dlg = new QDialog();
QVBoxLayout *topLayout = new QVBoxLayout(dlg);
auto *topLayout = new QVBoxLayout(dlg);
MigrationStatusWidget *widget = new MigrationStatusWidget(mScheduler, dlg);
auto *widget = new MigrationStatusWidget(mScheduler, dlg);
topLayout->addWidget(widget);
dlg->setAttribute(Qt::WA_DeleteOnClose);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, dlg);
......
......@@ -21,7 +21,7 @@ MigrationStatusWidget::MigrationStatusWidget(MigrationScheduler &scheduler, QWid
: QWidget(parent)
, mScheduler(scheduler)
{
QVBoxLayout *vboxLayout = new QVBoxLayout(this);
auto *vboxLayout = new QVBoxLayout(this);
QToolBar *toolbar = new QToolBar(QStringLiteral("MigrationControlToolbar"), this);
QAction *start = toolbar->addAction(QStringLiteral("Start"));
......@@ -37,7 +37,7 @@ MigrationStatusWidget::MigrationStatusWidget(MigrationScheduler &scheduler, QWid
connect(abort, &QAction::triggered, this, &MigrationStatusWidget::abortSelected);
vboxLayout->addWidget(toolbar);
QTreeView *treeView = new QTreeView(this);
auto *treeView = new QTreeView(this);
treeView->setModel(&mScheduler.model());
mSelectionModel = treeView->selectionModel();
Q_ASSERT(mSelectionModel);
......@@ -75,7 +75,7 @@ void MigrationStatusWidget::abortSelected()
void MigrationStatusWidget::onItemActivated(const QModelIndex &index)
{
QDialog *dlg = new QDialog(this);
QVBoxLayout *topLayout = new QVBoxLayout(dlg);
auto *topLayout = new QVBoxLayout(dlg);
dlg->setLayout(topLayout);
QWidget *widget = new QWidget(dlg);
topLayout->addWidget(widget);
......@@ -84,16 +84,16 @@ void MigrationStatusWidget::onItemActivated(const QModelIndex &index)
connect(buttonBox, &QDialogButtonBox::rejected, dlg, &QDialog::reject);
topLayout->addWidget(buttonBox);
QVBoxLayout *vboxLayout = new QVBoxLayout;
auto *vboxLayout = new QVBoxLayout;
{
QListView *listView = new QListView(widget);
auto *listView = new QListView(widget);
listView->setModel(&mScheduler.logModel(index.data(MigratorModel::IdentifierRole).toString()));
listView->setAutoScroll(true);
listView->scrollToBottom();
vboxLayout->addWidget(listView);
}
{
QHBoxLayout *hboxLayout = new QHBoxLayout;
auto *hboxLayout = new QHBoxLayout;
QLabel *label = new QLabel(QStringLiteral("<a href=\"%1\">%2</a>").arg(index.data(MigratorModel::LogfileRole).toString()).arg(ki18n("Logfile").toString()), widget);
label->setOpenExternalLinks(true);
hboxLayout->addWidget(label);
......
......@@ -290,7 +290,7 @@ void NewMailNotifierAgent::slotShowNotifications()
QHash< Akonadi::Collection, QList<Akonadi::Item::Id> >::const_iterator end(mNewMails.constEnd());
for (QHash< Akonadi::Collection, QList<Akonadi::Item::Id> >::const_iterator it = mNewMails.constBegin(); it != end; ++it) {
const Akonadi::EntityDisplayAttribute *attr = it.key().attribute<Akonadi::EntityDisplayAttribute>();
const auto *attr = it.key().attribute<Akonadi::EntityDisplayAttribute>();
QString displayName;
if (attr && !attr->displayName().isEmpty()) {
displayName = attr->displayName();
......@@ -333,7 +333,7 @@ void NewMailNotifierAgent::slotShowNotifications()
}
}
if (hasUniqMessage) {
SpecialNotifierJob *job = new SpecialNotifierJob(mListEmails, currentPath, item, this);
auto *job = new SpecialNotifierJob(mListEmails, currentPath, item, this);
job->setDefaultIconName(mDefaultIconName);
connect(job, &SpecialNotifierJob::displayNotification, this, &NewMailNotifierAgent::slotDisplayNotification);
connect(job, &SpecialNotifierJob::say, this, &NewMailNotifierAgent::slotSay);
......
......@@ -44,7 +44,7 @@ QVariant NewMailNotifierCollectionProxyModel::data(const QModelIndex &index, int
if (mNotificationCollection.contains(collection)) {
return mNotificationCollection.value(collection) ? Qt::Checked : Qt::Unchecked;
} else {
const Akonadi::NewMailNotifierAttribute *attr = collection.attribute<Akonadi::NewMailNotifierAttribute>();
const auto *attr = collection.attribute<Akonadi::NewMailNotifierAttribute>();
if (!attr || !attr->ignoreNewMail()) {
return Qt::Checked;
}
......@@ -88,7 +88,7 @@ NewMailNotifierSelectCollectionWidget::NewMailNotifierSelectCollectionWidget(QWi
: QWidget(parent)
{
Akonadi::AttributeFactory::registerAttribute<Akonadi::NewMailNotifierAttribute>();
QVBoxLayout *vbox = new QVBoxLayout(this);
auto *vbox = new QVBoxLayout(this);
QLabel *label = new QLabel(i18n("Select which folders to monitor for new message notifications:"));
vbox->addWidget(label);
......@@ -104,7 +104,7 @@ NewMailNotifierSelectCollectionWidget::NewMailNotifierSelectCollectionWidget(QWi
mModel->setItemPopulationStrategy(Akonadi::EntityTreeModel::NoItemPopulation);
connect(mModel, &Akonadi::EntityTreeModel::collectionTreeFetched, this, &NewMailNotifierSelectCollectionWidget::slotCollectionTreeFetched);
Akonadi::CollectionFilterProxyModel *mimeTypeProxy = new Akonadi::CollectionFilterProxyModel(this);
auto *mimeTypeProxy = new Akonadi::CollectionFilterProxyModel(this);
mimeTypeProxy->setExcludeVirtualCollections(true);
mimeTypeProxy->setDynamicSortFilter(true);
mimeTypeProxy->addMimeTypeFilters(QStringList() << KMime::Message::mimeType());
......@@ -122,7 +122,7 @@ NewMailNotifierSelectCollectionWidget::NewMailNotifierSelectCollectionWidget(QWi
mCollectionFilter->setSortCaseSensitivity(Qt::CaseSensitive);
mCollectionFilter->setSortLocaleAware(true);
KLineEdit *searchLine = new KLineEdit(this);
auto *searchLine = new KLineEdit(this);
searchLine->setPlaceholderText(i18n("Search..."));
searchLine->setClearButtonEnabled(true);
connect(searchLine, &QLineEdit::textChanged,
......@@ -137,7 +137,7 @@ NewMailNotifierSelectCollectionWidget::NewMailNotifierSelectCollectionWidget(QWi
mFolderView->setModel(mCollectionFilter);
QHBoxLayout *hbox = new QHBoxLayout;
auto *hbox = new QHBoxLayout;
vbox->addLayout(hbox);
QPushButton *button = new QPushButton(i18n("&Select All"), this);
......@@ -192,7 +192,7 @@ void NewMailNotifierSelectCollectionWidget::updateCollectionsRecursive()
while (i.hasNext()) {
i.next();
Akonadi::Collection collection = i.key();
Akonadi::NewMailNotifierAttribute *attr = collection.attribute<Akonadi::NewMailNotifierAttribute>();
auto *attr = collection.attribute<Akonadi::NewMailNotifierAttribute>();
Akonadi::CollectionModifyJob *modifyJob = nullptr;
const bool selected = i.value();
if (selected && attr && attr->ignoreNewMail()) {
......@@ -214,7 +214,7 @@ void NewMailNotifierSelectCollectionWidget::updateCollectionsRecursive()
void NewMailNotifierSelectCollectionWidget::slotModifyJobDone(KJob *job)
{
Akonadi::CollectionModifyJob *modifyJob = qobject_cast<Akonadi::CollectionModifyJob *>(job);
auto *modifyJob = qobject_cast<Akonadi::CollectionModifyJob *>(job);
if (modifyJob && job->error()) {
if (job->property("AttributeAdded").toBool()) {
qCWarning(NEWMAILNOTIFIER_LOG) << "Failed to append NewMailNotifierAttribute to collection"
......
......@@ -40,15 +40,15 @@ NewMailNotifierSettingsWidget::NewMailNotifierSettingsWidget(const KSharedConfig
{
NewMailNotifierAgentSettings::instance(config);
setObjectName(QStringLiteral("NewMailNotifierSettingsWidget"));
QTabWidget *tab = new QTabWidget(parent);
auto *tab = new QTabWidget(parent);
parent->layout()->addWidget(tab);
QWidget *settings = new QWidget;
QVBoxLayout *vbox = new QVBoxLayout(settings);
auto *vbox = new QVBoxLayout(settings);
QGroupBox *grp = new QGroupBox(i18n("Choose which fields to show:"), parent);
vbox->addWidget(grp);
QVBoxLayout *groupboxLayout = new QVBoxLayout;
auto *groupboxLayout = new QVBoxLayout;
grp->setLayout(groupboxLayout);
mShowPhoto = new QCheckBox(i18n("Show Photo"), parent);
......@@ -96,7 +96,7 @@ NewMailNotifierSettingsWidget::NewMailNotifierSettingsWidget(const KSharedConfig
vbox->addWidget(howIsItWork);
connect(howIsItWork, &QLabel::linkActivated, this, &NewMailNotifierSettingsWidget::slotHelpLinkClicked);
QHBoxLayout *textToSpeakLayout = new QHBoxLayout;
auto *textToSpeakLayout = new QHBoxLayout;
textToSpeakLayout->setContentsMargins(0, 0, 0, 0);
QLabel *lab = new QLabel(i18n("Message:"), parent);
lab->setObjectName(QStringLiteral("labmessage"));
......
......@@ -29,7 +29,7 @@ SpecialNotifierJob::SpecialNotifierJob(const QStringList &listEmails, const QStr
, mItemId(id)
{
Akonadi::Item item(mItemId);
Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(item, this);
auto *job = new Akonadi::ItemFetchJob(item, this);
job->fetchScope().fetchPayloadPart(Akonadi::MessagePart::Envelope, true);
connect(job, &Akonadi::ItemFetchJob::result, this, &SpecialNotifierJob::slotItemFetchJobDone);
......@@ -64,7 +64,7 @@ void SpecialNotifierJob::slotItemFetchJobDone(KJob *job)
mFrom = mb->from()->asUnicodeString();
mSubject = mb->subject()->asUnicodeString();
if (NewMailNotifierAgentSettings::showPhoto()) {
Akonadi::ContactSearchJob *job = new Akonadi::ContactSearchJob(this);
auto *job = new Akonadi::ContactSearchJob(this);
job->setLimit(1);
job->setQuery(Akonadi::ContactSearchJob::Email, KEmailAddress::firstEmailAddress(mFrom).toLower(), Akonadi::ContactSearchJob::ExactMatch);
connect(job, &Akonadi::ItemFetchJob::result, this, &SpecialNotifierJob::slotSearchJobFinished);
......@@ -178,7 +178,7 @@ void SpecialNotifierJob::slotActivateNotificationAction(unsigned int index)
void SpecialNotifierJob::slotDeleteMessage()
{
Akonadi::ItemDeleteJob *job = new Akonadi::ItemDeleteJob(mItem);
auto *job = new Akonadi::ItemDeleteJob(mItem);
connect(job, &Akonadi::ItemDeleteJob::result, this, &SpecialNotifierJob::deleteItemDone);
}
......@@ -220,7 +220,7 @@ void SpecialNotifierJob::slotMarkAsResult(Akonadi::MarkAsCommand::Result result)
void SpecialNotifierJob::slotOpenMail()
{
NewMailNotifierShowMessageJob *job = new NewMailNotifierShowMessageJob(mItem.id());
auto *job = new NewMailNotifierShowMessageJob(mItem.id());
job->start();
deleteLater();
}
......@@ -12,7 +12,7 @@ int main(int argc, char **argv)
{
QApplication app(argc, argv);
NewMailNotifierSelectCollectionWidget *w = new NewMailNotifierSelectCollectionWidget;
auto *w = new NewMailNotifierSelectCollectionWidget;
w->show();
app.exec();
delete w;
......
......@@ -30,7 +30,7 @@ KCMLdap::KCMLdap(QWidget *parent, const QVariantList &)
i18n("(c) 2009 - 2010 Tobias Koenig"));
about->addAuthor(i18n("Tobias Koenig"), QString(), QStringLiteral("tokoe@kde.org"));
setAboutData(about);
QVBoxLayout *layout = new QVBoxLayout(this);
auto *layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
mLdapConfigureWidget = new KLDAP::LdapConfigureWidget(this);
......
......@@ -62,7 +62,7 @@ AkonadiSlave::~AkonadiSlave()
void AkonadiSlave::get(const QUrl &url)
{
const Item item = Item::fromUrl(url);
ItemFetchJob *job = new ItemFetchJob(item);
auto *job = new ItemFetchJob(item);
job->fetchScope().fetchFullPayload();
if (!job->exec()) {
......@@ -91,7 +91,7 @@ void AkonadiSlave::stat(const QUrl &url)
if (collection != Collection::root()) {
// Check that the collection exists.
CollectionFetchJob *job = new CollectionFetchJob(collection, CollectionFetchJob::Base);
auto *job = new CollectionFetchJob(collection, CollectionFetchJob::Base);
if (!job->exec()) {
error(KIO::ERR_INTERNAL, job->errorString());
return;
......@@ -134,7 +134,7 @@ void AkonadiSlave::del(const QUrl &url, bool isFile)
if (!isFile) { // It's a directory
Collection collection = Collection::fromUrl(url);
CollectionDeleteJob *job = new CollectionDeleteJob(collection);
auto *job = new CollectionDeleteJob(collection);
if (!job->exec()) {
error(KIO::ERR_INTERNAL, job->errorString());
return;
......@@ -165,7 +165,7 @@ void AkonadiSlave::listDir(const QUrl &url)
error(KIO::ERR_DOES_NOT_EXIST, i18n("No such collection."));
return;
}
CollectionFetchJob *job = new CollectionFetchJob(collection, CollectionFetchJob::FirstLevel);
auto *job = new CollectionFetchJob(collection, CollectionFetchJob::FirstLevel);
if (!job->exec()) {
error(KIO::ERR_CANNOT_ENTER_DIRECTORY, job->errorString());
return;
......@@ -178,7 +178,7 @@ void AkonadiSlave::listDir(const QUrl &url)
// Fetching items
if (collection != Collection::root()) {
ItemFetchJob *fjob = new ItemFetchJob(collection);
auto *fjob = new ItemFetchJob(collection);
if (!fjob->exec()) {
error(KIO::ERR_INTERNAL, job->errorString());
return;
......@@ -214,7 +214,7 @@ KIO::UDSEntry AkonadiSlave::entryForCollection(const Akonadi::Collection &collec
entry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
entry.fastInsert(KIO::UDSEntry::UDS_URL, collection.url().url());
entry.fastInsert(KIO::UDSEntry::UDS_ACCESS, S_IRUSR | S_IRGRP | S_IROTH);
if (const EntityDisplayAttribute *attr = collection.attribute<EntityDisplayAttribute>()) {
if (const auto *attr = collection.attribute<EntityDisplayAttribute>()) {
if (!attr->iconName().isEmpty()) {
entry.fastInsert(KIO::UDSEntry::UDS_ICON_NAME, attr->iconName());
}
......
......@@ -359,7 +359,7 @@ int POP3Protocol::loginAPOP(const char *challenge, KIO::AuthInfo &ai)
bool POP3Protocol::saslInteract(void *in, AuthInfo &ai)
{
qCDebug(POP3_LOG);
sasl_interact_t *interact = (sasl_interact_t *)in;
auto *interact = (sasl_interact_t *)in;
//some mechanisms do not require username && pass, so don't need a popup
//window for getting this info
......@@ -610,7 +610,7 @@ bool POP3Protocol::pop3_open()
// use QSslSocket internally
QNetworkProxy proxy;
proxy.setType(QNetworkProxy::NoProxy);
if (QSslSocket *sock = qobject_cast<QSslSocket *>(socket())) {
if (auto *sock = qobject_cast<QSslSocket *>(socket())) {
sock->setProxy(proxy);
} else {
qCWarning(POP3_LOG) << "no socket, cannot set no proxy";
......
......@@ -64,7 +64,7 @@ void EntityTreeCreateJob::collectionCreateJobDone(KJob *job)
{
Q_ASSERT(m_pendingJobs > 0);
--m_pendingJobs;
CollectionCreateJob *collectionCreateJob = qobject_cast<CollectionCreateJob *>(job);
auto *collectionCreateJob = qobject_cast<CollectionCreateJob *>(job);
Collection createdCollection = collectionCreateJob->collection();
if (job->error()) {
......
......@@ -26,7 +26,7 @@ UpdateJob::~UpdateJob()
void UpdateJob::doStart()
{
ItemFetchJob *fetchJob = new ItemFetchJob(mCollection, this);
auto *fetchJob = new ItemFetchJob(mCollection, this);
fetchJob->fetchScope().setCacheOnly(true);
fetchJob->fetchScope().setIgnoreRetrievalErrors(true);
fetchJob->fetchScope().setFetchModificationTime(false);
......@@ -51,7 +51,7 @@ void UpdateJob::slotResult(KJob *job)
//This slot is automatically called for all subjobs by KCompositeJob
//FIXME the fetch job emits result before itemsReceived, because itemsReceived is triggered using the result signal (which is wrong IMO). See ItemFetchJob::timeout
//If result was emitted at the end we could avoid having to call processNext in itemsReceived and locking it.
ItemFetchJob *const fetchJob = qobject_cast<ItemFetchJob *>(job);
auto *const fetchJob = qobject_cast<ItemFetchJob *>(job);
const bool fetchReturnedNoItems = fetchJob && fetchJob->items().isEmpty();
Job::slotResult(job);
if (fetchReturnedNoItems) {
......@@ -73,7 +73,7 @@ bool UpdateJob::processNext()
}
const Akonadi::Item &item = mItemQueue.dequeue();
//Only the single item modifyjob updates the gid
ItemModifyJob *modJob = new ItemModifyJob(item, this);
auto *modJob = new ItemModifyJob(item, this);
modJob->setUpdateGid(true);
modJob->setIgnorePayload(true);
mModJobRunning = true;
......@@ -118,7 +118,7 @@ void GidMigrationJob::processCollection()
return;
}
const Collection col = mCollections.takeLast();
UpdateJob *updateJob = new UpdateJob(col, this);
auto *updateJob = new UpdateJob(col, this);
connect(updateJob, &UpdateJob::result, this, &GidMigrationJob::itemsUpdated);
}
......
......@@ -62,7 +62,7 @@ int main(int argc, char **argv)
return 5;
}
GidMigrator *migrator = new GidMigrator(mimeType);
auto *migrator = new GidMigrator(mimeType);
if (infoDialog && migrator) {
infoDialog->migratorAdded();
QObject::connect(migrator, &MigratorBase::message,
......
......@@ -31,13 +31,13 @@ InfoDialog::InfoDialog(bool closeWhenDone)
: mCloseWhenDone(closeWhenDone)
{
setAttribute(Qt::WA_DeleteOnClose);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
auto *mainLayout = new QVBoxLayout(this);
mList = new QListWidget(this);
mList->setMinimumWidth(640);
mainLayout->addWidget(mList);
QHBoxLayout *statusLayout = new QHBoxLayout;
auto *statusLayout = new QHBoxLayout;
mainLayout->addLayout(statusLayout);
mStatusLabel = new QLabel(this);
......@@ -86,7 +86,7 @@ void InfoDialog::message(KMigratorBase::MessageType type, const QString &msg)
{
bool autoScroll = mAutoScrollList;
QListWidgetItem *item = new QListWidgetItem(msg, mList);
auto *item = new QListWidgetItem(msg, mList);
switch (type) {
case KMigratorBase::Success:
item->setIcon(QIcon::fromTheme(QStringLiteral("dialog-ok-apply")));
......
......@@ -112,7 +112,7 @@ void KMigratorBase::setMigrationState(const QString &identifier, MigrationState
KJob *KMigratorBase::createAgentInstance(const QString &typeId, QObject *receiver, const char *slot)
{
Q_EMIT message(Info, i18n("Creating instance of type %1", typeId));
AgentInstanceCreateJob *job = new AgentInstanceCreateJob(typeId, this);
auto *job = new AgentInstanceCreateJob(typeId, this);
connect(job, SIGNAL(result(KJob*)), receiver, slot);
job->start();
return job;
......
......@@ -39,7 +39,7 @@ BirthdaysResource::BirthdaysResource(const QString &id)
Settings::self(), QDBusConnection::ExportAdaptors);
setName(i18n("Birthdays & Anniversaries"));
Monitor *monitor = new Monitor(this);
auto *monitor = new Monitor(this);
monitor->setMimeTypeMonitored(Addressee::mimeType());
monitor->itemFetchScope().fetchFullPayload();
connect(monitor, &Monitor::itemAdded, this, &BirthdaysResource::contactChanged);
......@@ -68,7 +68,7 @@ void BirthdaysResource::retrieveCollections()
c.setContentMimeTypes(QStringList() << QStringLiteral("application/x-vnd.akonadi.calendar.event"));
c.setRights(Collection::ReadOnly);
EntityDisplayAttribute *attribute = c.attribute<EntityDisplayAttribute>(Collection::AddIfMissing);
auto *attribute = c.attribute<EntityDisplayAttribute>(Collection::AddIfMissing);
attribute->setIconName(QStringLiteral("view-calendar-birthday"));
Collection::List list;
......@@ -96,7 +96,7 @@ bool BirthdaysResource::retrieveItem(const Akonadi::Item &item, const QSet< QByt
void BirthdaysResource::contactRetrieved(KJob *job)
{
ItemFetchJob *fj = static_cast<ItemFetchJob *>(job);
auto *fj = static_cast<ItemFetchJob *>(job);
if (job->error()) {
Q_EMIT error(job->errorText());
cancelTask();
......@@ -196,7 +196,7 @@ void BirthdaysResource::listContacts(const Akonadi::Collection::List &cols)
if (!contactFilter.isWantedCollection(col)) {
continue;
}
ItemFetchJob *job = new ItemFetchJob(col, this);
auto *job = new ItemFetchJob(col, this);
job->fetchScope().fetchFullPayload();
connect(job, &ItemFetchJob::itemsReceived, this, &BirthdaysResource::createEvents);