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

Modernize code

parent 4c5b7c7f
Pipeline #60353 failed with stage
in 25 minutes and 24 seconds
......@@ -98,7 +98,7 @@ void MailDispatcherAgent::dispatch()
Q_EMIT status(AgentBase::Idle, i18n("Finished sending messages."));
if (!mErrorOccurred && mShowSentNotification) {
KNotification *notify = new KNotification(QStringLiteral("emailsent"));
auto notify = new KNotification(QStringLiteral("emailsent"));
notify->setIconName(QStringLiteral("kmail"));
notify->setComponentName(QStringLiteral("akonadi_maildispatcher_agent"));
notify->setTitle(i18nc("Notification title when email was sent", "E-Mail Successfully Sent"));
......@@ -253,7 +253,7 @@ void MailDispatcherAgent::sendResult(KJob *job)
// do anything.
qCDebug(MAILDISPATCHER_LOG) << "Sending failed. error:" << job->errorString();
KNotification *notify = new KNotification(QStringLiteral("sendingfailed"));
auto notify = new KNotification(QStringLiteral("sendingfailed"));
notify->setComponentName(QStringLiteral("akonadi_maildispatcher_agent"));
notify->setIconName(QStringLiteral("kmail"));
notify->setTitle(i18nc("Notification title when email sending failed", "E-Mail Sending Failed"));
......@@ -265,7 +265,7 @@ void MailDispatcherAgent::sendResult(KJob *job)
qCDebug(MAILDISPATCHER_LOG) << "Sending succeeded.";
// handle possible sent actions
const auto *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) {
......
......@@ -13,7 +13,7 @@
MailDispatcherConfig::MailDispatcherConfig(const KSharedConfigPtr &config, QWidget *parent, const QVariantList &cfg)
: Akonadi::AgentConfigurationBase(config, parent, cfg)
{
QWidget *w = new QWidget(parent);
auto w = new QWidget(parent);
mWidget = new KNotifyConfigWidget(parent);
mWidget->setApplication(QStringLiteral("akonadi_maildispatcher_agent"));
......
......@@ -81,21 +81,21 @@ void OutboxQueue::addIfComplete(const Item &item)
return;
}
const auto *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 auto *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 auto *sentBehaviourAttribute = item.attribute<SentBehaviourAttribute>();
const auto sentBehaviourAttribute = item.attribute<SentBehaviourAttribute>();
Q_ASSERT(sentBehaviourAttribute);
if (sentBehaviourAttribute->sentBehaviour() == SentBehaviourAttribute::MoveToCollection && !sentBehaviourAttribute->moveToCollection().isValid()) {
qCWarning(MAILDISPATCHER_LOG) << "Item " << item.id() << "has invalid sent-mail collection.";
......
......@@ -123,7 +123,7 @@ void SendJob::doTraditionalTransport()
// Message.
Q_ASSERT(mItem.hasPayload<Message::Ptr>());
const Message::Ptr message = mItem.payload<Message::Ptr>();
const auto message = mItem.payload<Message::Ptr>();
bool needAssemble = false;
if (message->removeHeader("Bcc")) {
needAssemble = true;
......
......@@ -32,13 +32,13 @@ MigrationAgent::MigrationAgent(const QString &id)
void MigrationAgent::configure(WId windowId)
{
QDialog *dlg = new QDialog();
auto dlg = new QDialog();
auto topLayout = new QVBoxLayout(dlg);
auto widget = new MigrationStatusWidget(mScheduler, dlg);
topLayout->addWidget(widget);
dlg->setAttribute(Qt::WA_DeleteOnClose);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, dlg);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, dlg);
connect(buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, dlg, &QDialog::reject);
topLayout->addWidget(buttonBox);
......
......@@ -18,31 +18,31 @@ void LogModel::message(MigratorBase::MessageType type, const QString &msg)
{
switch (type) {
case MigratorBase::Success: {
QStandardItem *item = new QStandardItem(QIcon::fromTheme(QStringLiteral("dialog-ok-apply")), msg);
auto item = new QStandardItem(QIcon::fromTheme(QStringLiteral("dialog-ok-apply")), msg);
item->setEditable(false);
appendRow(item);
break;
}
case MigratorBase::Skip: {
QStandardItem *item = new QStandardItem(QIcon::fromTheme(QStringLiteral("dialog-ok")), msg);
auto item = new QStandardItem(QIcon::fromTheme(QStringLiteral("dialog-ok")), msg);
item->setEditable(false);
appendRow(item);
break;
}
case MigratorBase::Info: {
QStandardItem *item = new QStandardItem(QIcon::fromTheme(QStringLiteral("dialog-information")), msg);
auto item = new QStandardItem(QIcon::fromTheme(QStringLiteral("dialog-information")), msg);
item->setEditable(false);
appendRow(item);
break;
}
case MigratorBase::Warning: {
QStandardItem *item = new QStandardItem(QIcon::fromTheme(QStringLiteral("dialog-warning")), msg);
auto item = new QStandardItem(QIcon::fromTheme(QStringLiteral("dialog-warning")), msg);
item->setEditable(false);
appendRow(item);
break;
}
case MigratorBase::Error: {
QStandardItem *item = new QStandardItem(QIcon::fromTheme(QStringLiteral("dialog-error")), msg);
auto item = new QStandardItem(QIcon::fromTheme(QStringLiteral("dialog-error")), msg);
item->setEditable(false);
appendRow(item);
break;
......
......@@ -22,7 +22,7 @@ MigrationStatusWidget::MigrationStatusWidget(MigrationScheduler &scheduler, QWid
, mScheduler(scheduler)
{
auto vboxLayout = new QVBoxLayout(this);
QToolBar *toolbar = new QToolBar(QStringLiteral("MigrationControlToolbar"), this);
auto toolbar = new QToolBar(QStringLiteral("MigrationControlToolbar"), this);
QAction *start = toolbar->addAction(QStringLiteral("Start"));
start->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-start")));
......@@ -74,12 +74,12 @@ void MigrationStatusWidget::abortSelected()
void MigrationStatusWidget::onItemActivated(const QModelIndex &index)
{
QDialog *dlg = new QDialog(this);
auto dlg = new QDialog(this);
auto topLayout = new QVBoxLayout(dlg);
dlg->setLayout(topLayout);
QWidget *widget = new QWidget(dlg);
auto widget = new QWidget(dlg);
topLayout->addWidget(widget);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, dlg);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, dlg);
connect(buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, dlg, &QDialog::reject);
topLayout->addWidget(buttonBox);
......@@ -94,7 +94,7 @@ void MigrationStatusWidget::onItemActivated(const QModelIndex &index)
}
{
auto hboxLayout = new QHBoxLayout;
QLabel *label =
auto 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);
......
......@@ -296,7 +296,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 auto *attr = it.key().attribute<Akonadi::EntityDisplayAttribute>();
const auto attr = it.key().attribute<Akonadi::EntityDisplayAttribute>();
QString displayName;
if (attr && !attr->displayName().isEmpty()) {
displayName = attr->displayName();
......
......@@ -35,7 +35,7 @@ QVariant NewMailNotifierCollectionProxyModel::data(const QModelIndex &index, int
{
if (role == Qt::CheckStateRole) {
if (index.isValid()) {
const Akonadi::Collection collection = data(index, Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
const auto collection = data(index, Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
// Make top-level collections uncheckable
if (collection.parentCollection() == Akonadi::Collection::root()) {
return {};
......@@ -43,7 +43,7 @@ QVariant NewMailNotifierCollectionProxyModel::data(const QModelIndex &index, int
if (mNotificationCollection.contains(collection)) {
return mNotificationCollection.value(collection) ? Qt::Checked : Qt::Unchecked;
} else {
const auto *attr = collection.attribute<Akonadi::NewMailNotifierAttribute>();
const auto attr = collection.attribute<Akonadi::NewMailNotifierAttribute>();
if (!attr || !attr->ignoreNewMail()) {
return Qt::Checked;
}
......@@ -58,7 +58,7 @@ bool NewMailNotifierCollectionProxyModel::setData(const QModelIndex &index, cons
{
if (role == Qt::CheckStateRole) {
if (index.isValid()) {
const Akonadi::Collection collection = data(index, Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
const auto collection = data(index, Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
mNotificationCollection[collection] = (value == Qt::Checked);
Q_EMIT dataChanged(index, index);
return true;
......@@ -88,7 +88,7 @@ NewMailNotifierSelectCollectionWidget::NewMailNotifierSelectCollectionWidget(QWi
Akonadi::AttributeFactory::registerAttribute<Akonadi::NewMailNotifierAttribute>();
auto vbox = new QVBoxLayout(this);
QLabel *label = new QLabel(i18n("Select which folders to monitor for new message notifications:"));
auto label = new QLabel(i18n("Select which folders to monitor for new message notifications:"));
vbox->addWidget(label);
// Create a new change recorder.
......@@ -137,7 +137,7 @@ NewMailNotifierSelectCollectionWidget::NewMailNotifierSelectCollectionWidget(QWi
auto hbox = new QHBoxLayout;
vbox->addLayout(hbox);
QPushButton *button = new QPushButton(i18n("&Select All"), this);
auto button = new QPushButton(i18n("&Select All"), this);
connect(button, &QPushButton::clicked, this, &NewMailNotifierSelectCollectionWidget::slotSelectAllCollections);
hbox->addWidget(button);
......@@ -189,7 +189,7 @@ void NewMailNotifierSelectCollectionWidget::updateCollectionsRecursive()
while (i.hasNext()) {
i.next();
Akonadi::Collection collection = i.key();
auto *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()) {
......
......@@ -43,10 +43,10 @@ NewMailNotifierSettingsWidget::NewMailNotifierSettingsWidget(const KSharedConfig
auto tab = new QTabWidget(parent);
parent->layout()->addWidget(tab);
QWidget *settings = new QWidget;
auto settings = new QWidget;
auto vbox = new QVBoxLayout(settings);
QGroupBox *grp = new QGroupBox(i18n("Choose which fields to show:"), parent);
auto grp = new QGroupBox(i18n("Choose which fields to show:"), parent);
vbox->addWidget(grp);
auto groupboxLayout = new QVBoxLayout;
grp->setLayout(groupboxLayout);
......@@ -82,14 +82,14 @@ NewMailNotifierSettingsWidget::NewMailNotifierSettingsWidget(const KSharedConfig
vbox->addStretch();
tab->addTab(settings, i18n("Display"));
QWidget *textSpeakWidget = new QWidget;
auto textSpeakWidget = new QWidget;
vbox = new QVBoxLayout;
textSpeakWidget->setLayout(vbox);
mTextToSpeak = new QCheckBox(i18n("Enabled"), parent);
mTextToSpeak->setObjectName(QStringLiteral("mTextToSpeak"));
vbox->addWidget(mTextToSpeak);
QLabel *howIsItWork = new QLabel(i18n("<a href=\"whatsthis\">How does this work?</a>"), parent);
auto howIsItWork = new QLabel(i18n("<a href=\"whatsthis\">How does this work?</a>"), parent);
howIsItWork->setObjectName(QStringLiteral("howIsItWork"));
howIsItWork->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
howIsItWork->setContextMenuPolicy(Qt::NoContextMenu);
......@@ -98,7 +98,7 @@ NewMailNotifierSettingsWidget::NewMailNotifierSettingsWidget(const KSharedConfig
auto textToSpeakLayout = new QHBoxLayout;
textToSpeakLayout->setContentsMargins(0, 0, 0, 0);
QLabel *lab = new QLabel(i18n("Message:"), parent);
auto lab = new QLabel(i18n("Message:"), parent);
lab->setObjectName(QStringLiteral("labmessage"));
textToSpeakLayout->addWidget(lab);
mTextToSpeakSetting = new QLineEdit;
......
......@@ -60,7 +60,7 @@ void SpecialNotifierJob::slotItemFetchJobDone(KJob *job)
return;
}
const KMime::Message::Ptr mb = mItem.payload<KMime::Message::Ptr>();
const auto mb = mItem.payload<KMime::Message::Ptr>();
mFrom = mb->from()->asUnicodeString();
mSubject = mb->subject()->asUnicodeString();
if (NewMailNotifierAgentSettings::showPhoto()) {
......@@ -138,7 +138,7 @@ void SpecialNotifierJob::emitNotification(const QPixmap &pixmap)
}
if (NewMailNotifierAgentSettings::showButtonToDisplayMail()) {
KNotification *notification =
auto notification =
new KNotification(QStringLiteral("new-email"),
NewMailNotifierAgentSettings::keepPersistentNotification() ? KNotification::Persistent | KNotification::SkipGrouping
: KNotification::CloseOnTimeout);
......@@ -195,7 +195,7 @@ void SpecialNotifierJob::slotMarkAsRead()
{
Akonadi::MessageStatus messageStatus;
messageStatus.setRead(true);
Akonadi::MarkAsCommand *markAsReadAllJob = new Akonadi::MarkAsCommand(messageStatus, Akonadi::Item::List() << mItem);
auto markAsReadAllJob = new Akonadi::MarkAsCommand(messageStatus, Akonadi::Item::List() << mItem);
connect(markAsReadAllJob, &Akonadi::MarkAsCommand::result, this, &SpecialNotifierJob::slotMarkAsResult);
markAsReadAllJob->execute();
}
......
......@@ -22,12 +22,12 @@ KCMLdap::KCMLdap(QWidget *parent, const QVariantList &)
: KCModule(parent)
{
setButtons(KCModule::Apply);
KAboutData *about = new KAboutData(QStringLiteral("kcmldap"),
i18n("kcmldap"),
QString(),
i18n("LDAP Server Settings"),
KAboutLicense::LGPL,
i18n("(c) 2009 - 2010 Tobias Koenig"));
auto about = new KAboutData(QStringLiteral("kcmldap"),
i18n("kcmldap"),
QString(),
i18n("LDAP Server Settings"),
KAboutLicense::LGPL,
i18n("(c) 2009 - 2010 Tobias Koenig"));
about->addAuthor(i18n("Tobias Koenig"), QString(), QStringLiteral("tokoe@kde.org"));
setAboutData(about);
auto layout = new QVBoxLayout(this);
......
......@@ -117,7 +117,7 @@ void AkonadiSlave::stat(const QUrl &url)
}
// Stats for an item
else if (Item::fromUrl(url).isValid()) {
ItemFetchJob *job = new ItemFetchJob(Item::fromUrl(url));
auto job = new ItemFetchJob(Item::fromUrl(url));
if (!job->exec()) {
error(KIO::ERR_INTERNAL, job->errorString());
......@@ -148,7 +148,7 @@ void AkonadiSlave::del(const QUrl &url, bool isFile)
}
finished();
} else { // It's a file
ItemDeleteJob *job = new ItemDeleteJob(Item::fromUrl(url));
auto job = new ItemDeleteJob(Item::fromUrl(url));
if (!job->exec()) {
error(KIO::ERR_INTERNAL, job->errorString());
return;
......@@ -221,7 +221,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 auto *attr = collection.attribute<EntityDisplayAttribute>()) {
if (const auto attr = collection.attribute<EntityDisplayAttribute>()) {
if (!attr->iconName().isEmpty()) {
entry.fastInsert(KIO::UDSEntry::UDS_ICON_NAME, attr->iconName());
}
......
......@@ -367,7 +367,7 @@ int POP3Protocol::loginAPOP(const char *challenge, KIO::AuthInfo &ai)
bool POP3Protocol::saslInteract(void *in, AuthInfo &ai)
{
qCDebug(POP3_LOG);
auto *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
......
......@@ -93,7 +93,7 @@ GidMigrationJob::~GidMigrationJob()
void GidMigrationJob::doStart()
{
CollectionFetchJob *fetchJob = new CollectionFetchJob(Collection::root(), CollectionFetchJob::Recursive, this);
auto fetchJob = new CollectionFetchJob(Collection::root(), CollectionFetchJob::Recursive, this);
fetchJob->fetchScope().setContentMimeTypes(mMimeTypeFilter);
connect(fetchJob, &CollectionFetchJob::collectionsReceived, this, &GidMigrationJob::collectionsReceived);
connect(fetchJob, &CollectionFetchJob::result, this, &GidMigrationJob::collectionsFetched);
......
......@@ -41,7 +41,7 @@ bool GidMigrator::shouldAutostart() const
void GidMigrator::startWork()
{
GidMigrationJob *job = new GidMigrationJob(QStringList() << mMimeType, this);
auto job = new GidMigrationJob(QStringList() << mMimeType, this);
connect(job, &GidMigrationJob::result, this, &GidMigrator::migrationFinished);
}
......
......@@ -66,7 +66,7 @@ std::unique_ptr<QSettings> settingsForResource(const Akonadi::AgentInstance &ins
const auto configFile = Akonadi::ServerManager::self()->addNamespace(instance.identifier()) + QStringLiteral("rc");
const auto configPath = QStandardPaths::locate(QStandardPaths::ConfigLocation, configFile);
return std::unique_ptr<QSettings>{new QSettings{configPath, QSettings::IniFormat}};
return std::make_unique<QSettings>(configPath, QSettings::IniFormat);
}
QString getAccountNameFromResourceSettings(const Akonadi::AgentInstance &instance)
......
......@@ -26,7 +26,7 @@ BirthdaysConfigAgentWidget::BirthdaysConfigAgentWidget(const KSharedConfigPtr &c
Settings::instance(config);
QWidget *mainWidget = new QWidget(parent);
auto mainWidget = new QWidget(parent);
ui.setupUi(mainWidget);
parent->layout()->addWidget(mainWidget);
......
......@@ -67,7 +67,7 @@ void BirthdaysResource::retrieveCollections()
c.setContentMimeTypes(QStringList() << QStringLiteral("application/x-vnd.akonadi.calendar.event"));
c.setRights(Collection::ReadOnly);
auto *attribute = c.attribute<EntityDisplayAttribute>(Collection::AddIfMissing);
auto attribute = c.attribute<EntityDisplayAttribute>(Collection::AddIfMissing);
attribute->setIconName(QStringLiteral("view-calendar-birthday"));
Collection::List list;
......@@ -87,7 +87,7 @@ bool BirthdaysResource::retrieveItem(const Akonadi::Item &item, const QSet<QByte
{
Q_UNUSED(parts)
qint64 contactId = item.remoteId().mid(1).toLongLong();
ItemFetchJob *job = new ItemFetchJob(Item(contactId), this);
auto job = new ItemFetchJob(Item(contactId), this);
job->fetchScope().fetchFullPayload();
connect(job, &ItemFetchJob::result, this, &BirthdaysResource::contactRetrieved);
return true;
......@@ -124,7 +124,7 @@ void BirthdaysResource::contactChanged(const Akonadi::Item &item)
return;
}
KContacts::Addressee contact = item.payload<KContacts::Addressee>();
auto contact = item.payload<KContacts::Addressee>();
if (Settings::self()->filterOnCategories()) {
bool hasCategory = false;
......@@ -183,7 +183,7 @@ void BirthdaysResource::contactRemoved(const Akonadi::Item &item)
void BirthdaysResource::doFullSearch()
{
CollectionFetchJob *job = new CollectionFetchJob(Collection::root(), CollectionFetchJob::Recursive, this);
auto job = new CollectionFetchJob(Collection::root(), CollectionFetchJob::Recursive, this);
connect(job, &CollectionFetchJob::collectionsReceived, this, &BirthdaysResource::listContacts);
}
......@@ -213,7 +213,7 @@ KCalendarCore::Event::Ptr BirthdaysResource::createBirthday(const Akonadi::Item
if (!contactItem.hasPayload<KContacts::Addressee>()) {
return KCalendarCore::Event::Ptr();
}
KContacts::Addressee contact = contactItem.payload<KContacts::Addressee>();
auto contact = contactItem.payload<KContacts::Addressee>();
const QString name = contact.realName().isEmpty() ? contact.nickName() : contact.realName();
if (name.isEmpty()) {
......@@ -245,7 +245,7 @@ KCalendarCore::Event::Ptr BirthdaysResource::createAnniversary(const Akonadi::It
if (!contactItem.hasPayload<KContacts::Addressee>()) {
return KCalendarCore::Event::Ptr();
}
KContacts::Addressee contact = contactItem.payload<KContacts::Addressee>();
auto contact = contactItem.payload<KContacts::Addressee>();
const QString name = contact.realName().isEmpty() ? contact.nickName() : contact.realName();
if (name.isEmpty()) {
......@@ -330,7 +330,7 @@ KCalendarCore::Event::Ptr BirthdaysResource::createEvent(QDate date)
void BirthdaysResource::checkForUnknownCategories(const QString &categoryToCheck, Event::Ptr &event)
{
Akonadi::TagCreateJob *tagCreateJob = new Akonadi::TagCreateJob(Akonadi::Tag(categoryToCheck), this);
auto tagCreateJob = new Akonadi::TagCreateJob(Akonadi::Tag(categoryToCheck), this);
tagCreateJob->setMergeIfExisting(true);
event->setCategories(categoryToCheck);
}
......
......@@ -212,7 +212,7 @@ void ContactsResource::itemAdded(const Akonadi::Item &item, const Akonadi::Colle
Item newItem(item);
if (item.hasPayload<KContacts::Addressee>()) {
const KContacts::Addressee contact = item.payload<KContacts::Addressee>();
const auto contact = item.payload<KContacts::Addressee>();
const QString fileName = directoryPath + QLatin1Char('/') + contact.uid() + QStringLiteral(".vcf");
......@@ -230,7 +230,7 @@ void ContactsResource::itemAdded(const Akonadi::Item &item, const Akonadi::Colle
newItem.setRemoteId(contact.uid() + QStringLiteral(".vcf"));
} else if (item.hasPayload<KContacts::ContactGroup>()) {
const KContacts::ContactGroup group = item.payload<KContacts::ContactGroup>();
const auto group = item.payload<KContacts::ContactGroup>();
const QString fileName = directoryPath + QLatin1Char('/') + group.id() + QStringLiteral(".ctg");
......@@ -264,7 +264,7 @@ void ContactsResource::itemChanged(const Akonadi::Item &item, const QSet<QByteAr
const QString fileName = directoryForCollection(item.parentCollection()) + QLatin1Char('/') + item.remoteId();
if (item.hasPayload<KContacts::Addressee>()) {
const KContacts::Addressee contact = item.payload<KContacts::Addressee>();
const auto contact = item.payload<KContacts::Addressee>();
KContacts::VCardConverter converter;
const QByteArray content = converter.createVCard(contact);
......@@ -279,7 +279,7 @@ void ContactsResource::itemChanged(const Akonadi::Item &item, const QSet<QByteAr
newItem.setRemoteId(item.remoteId());
} else if (item.hasPayload<KContacts::ContactGroup>()) {
const KContacts::ContactGroup group = item.payload<KContacts::ContactGroup>();
const auto group = item.payload<KContacts::ContactGroup>();
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly)) {
......
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