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

Modernize code

parent 2adf3ec8
Pipeline #60354 passed with stage
in 11 minutes and 13 seconds
......@@ -23,12 +23,12 @@ K_PLUGIN_FACTORY(KCMAkonadiContactActionsFactory, registerPlugin<KCMAkonadiConta
KCMAkonadiContactActions::KCMAkonadiContactActions(QWidget *parent, const QVariantList &args)
: KCModule(parent, args)
{
KAboutData *about = new KAboutData(QStringLiteral("kcmakonadicontactactions"),
i18n("Contact Actions Settings"),
QString(),
QString(),
KAboutLicense::LGPL,
i18n("(c) 2009 Tobias Koenig"));
auto about = new KAboutData(QStringLiteral("kcmakonadicontactactions"),
i18n("Contact Actions Settings"),
QString(),
QString(),
KAboutLicense::LGPL,
i18n("(c) 2009 Tobias Koenig"));
about->addAuthor(i18n("Tobias Koenig"), QString(), QStringLiteral("tokoe@kde.org"));
......
......@@ -167,8 +167,8 @@ void SerializerPluginAddressee::compare(Akonadi::AbstractDifferencesReporter *re
reporter->setLeftPropertyValueTitle(i18n("Changed Contact"));
reporter->setRightPropertyValueTitle(i18n("Conflicting Contact"));
const KContacts::Addressee leftContact = leftItem.payload<KContacts::Addressee>();
const KContacts::Addressee rightContact = rightItem.payload<KContacts::Addressee>();
const auto leftContact = leftItem.payload<KContacts::Addressee>();
const auto rightContact = rightItem.payload<KContacts::Addressee>();
if (!compareString(leftContact.uid(), rightContact.uid())) {
reporter->addProperty(AbstractDifferencesReporter::ConflictMode, KContacts::Addressee::uidLabel(), leftContact.uid(), rightContact.uid());
......
......@@ -89,18 +89,18 @@ void SerializerPluginContactGroup::compare(Akonadi::AbstractDifferencesReporter
reporter->setLeftPropertyValueTitle(i18n("Changed Contact Group"));
reporter->setRightPropertyValueTitle(i18n("Conflicting Contact Group"));
const KContacts::ContactGroup leftContactGroup = leftItem.payload<KContacts::ContactGroup>();
const KContacts::ContactGroup rightContactGroup = rightItem.payload<KContacts::ContactGroup>();
const auto leftContactGroup = leftItem.payload<KContacts::ContactGroup>();
const auto rightContactGroup = rightItem.payload<KContacts::ContactGroup>();
if (!compareString(leftContactGroup.name(), rightContactGroup.name())) {
reporter->addProperty(AbstractDifferencesReporter::ConflictMode, i18n("Name"), leftContactGroup.name(), rightContactGroup.name());
}
// using job->exec() is ok here, not a hot path
auto *leftJob = new Akonadi::ContactGroupExpandJob(leftContactGroup);
auto leftJob = new Akonadi::ContactGroupExpandJob(leftContactGroup);
leftJob->exec();
auto *rightJob = new Akonadi::ContactGroupExpandJob(rightContactGroup);
auto rightJob = new Akonadi::ContactGroupExpandJob(rightContactGroup);
rightJob->exec();
compareVector(reporter, i18n("Member"), leftJob->contacts(), rightJob->contacts());
......
......@@ -67,7 +67,7 @@ void DialPhoneNumberAction::dialNumber(const KContacts::PhoneNumber &number)
command.replace(QLatin1String("%N"), number.number());
command.replace(QLatin1String("%n"), number.normalizedNumber());
auto *job = new KIO::CommandLauncherJob(command);
auto job = new KIO::CommandLauncherJob(command);
job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, nullptr));
job->start();
}
......@@ -42,7 +42,7 @@ static QDBusInterface *searchEkigaDBusInterface()
const QString service(QStringLiteral("org.ekiga.Ekiga"));
const QString path(QStringLiteral("/org/ekiga/Ekiga"));
QDBusInterface *interface = new QDBusInterface(service, path, QString(), QDBusConnection::sessionBus());
auto interface = new QDBusInterface(service, path, QString(), QDBusConnection::sessionBus());
if (!interface->isValid()) {
delete interface;
interface = new QDBusInterface(service, path, QString(), QDBusConnection::sessionBus());
......
......@@ -43,7 +43,7 @@ static QDBusInterface *searchSkypeDBusInterface()
const QString service(QStringLiteral("com.Skype.API"));
const QString path(QStringLiteral("/com/Skype"));
QDBusInterface *interface = new QDBusInterface(service, path, QString(), QDBusConnection::sessionBus());
auto interface = new QDBusInterface(service, path, QString(), QDBusConnection::sessionBus());
if (!interface->isValid()) {
delete interface;
interface = new QDBusInterface(service, path, QString(), QDBusConnection::sessionBus());
......
......@@ -51,9 +51,9 @@ void SendSmsAction::sendSms(const KContacts::PhoneNumber &phoneNumber)
std::unique_ptr<QDialer> dialer;
// we handle skype separated
if (ContactActionsSettings::self()->sendSmsAction() == ContactActionsSettings::UseSkypeSms) {
dialer.reset(new QSkypeDialer(QStringLiteral("AkonadiContacts")));
dialer = std::make_unique<QSkypeDialer>(QStringLiteral("AkonadiContacts"));
} else if (ContactActionsSettings::self()->sendSmsAction() == ContactActionsSettings::UseSflPhoneSms) {
dialer.reset(new QSflPhoneDialer(QStringLiteral("AkonadiContacts")));
dialer = std::make_unique<QSflPhoneDialer>(QStringLiteral("AkonadiContacts"));
}
if (dialer) {
if (dialer->sendSms(number, message)) {
......@@ -85,7 +85,7 @@ void SendSmsAction::sendSms(const KContacts::PhoneNumber &phoneNumber)
// Bug: 293232 In KDE3 We used %F to replace text
command.replace(QLatin1String("%F"), message);
auto *job = new KIO::CommandLauncherJob(command);
auto job = new KIO::CommandLauncherJob(command);
job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, nullptr));
job->start();
}
......@@ -44,7 +44,7 @@ void ShowAddressAction::showAddress(const KContacts::Address &address)
replaceArguments(commandTemplate, address);
if (!commandTemplate.isEmpty()) {
auto *job = new KIO::CommandLauncherJob(commandTemplate);
auto job = new KIO::CommandLauncherJob(commandTemplate);
job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, nullptr));
job->start();
}
......
......@@ -36,9 +36,9 @@ void SmsDialog::initUI()
{
setWindowTitle(i18nc("@title:window", "SMS text"));
auto *topLayout = new QVBoxLayout(this);
auto topLayout = new QVBoxLayout(this);
QLabel *label = new QLabel(i18n("Please insert SMS text for an SMS to the following number: %1", mNumber), this);
auto label = new QLabel(i18n("Please insert SMS text for an SMS to the following number: %1", mNumber), this);
topLayout->addWidget(label);
label->setWordWrap(true);
......@@ -53,7 +53,7 @@ void SmsDialog::initUI()
topLayout->addWidget(mLengthLabel);
mSmsTextEdit->setFocus();
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
......
......@@ -46,7 +46,7 @@ QByteArray ContactMetaDataAttribute::type() const
Attribute *ContactMetaDataAttribute::clone() const
{
auto *copy = new ContactMetaDataAttribute;
auto copy = new ContactMetaDataAttribute;
copy->setMetaData(d->mData);
return copy;
......
......@@ -37,7 +37,7 @@ void ContactMetaDataAttributeTest::clone()
Akonadi::ContactMetaDataAttribute attribute1;
attribute1.setMetaData(content1);
auto *attribute2 = static_cast<Akonadi::ContactMetaDataAttribute *>(attribute1.clone());
auto attribute2 = static_cast<Akonadi::ContactMetaDataAttribute *>(attribute1.clone());
const QVariantMap content2 = attribute2->metaData();
QVERIFY(content1 == content2);
......
......@@ -33,7 +33,7 @@ bool CollectionFilterModel::filterAcceptsRow(int row, const QModelIndex &parent)
bool accepted = true;
const QModelIndex index = sourceModel()->index(row, 0, parent);
const Akonadi::Collection collection = index.data(Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
const auto collection = index.data(Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
if (!collection.isValid()) {
return false;
}
......
......@@ -25,16 +25,16 @@ QAbstractItemModel *ContactCompletionModel::self()
return mSelf;
}
auto *monitor = new Monitor;
auto monitor = new Monitor;
monitor->setObjectName(QStringLiteral("ContactCompletionModelMonitor"));
monitor->fetchCollection(true);
monitor->itemFetchScope().fetchFullPayload();
monitor->setCollectionMonitored(Akonadi::Collection::root());
monitor->setMimeTypeMonitored(KContacts::Addressee::mimeType());
auto *model = new ContactCompletionModel(monitor);
auto model = new ContactCompletionModel(monitor);
auto *filter = new Akonadi::EntityMimeTypeFilterModel(model);
auto filter = new Akonadi::EntityMimeTypeFilterModel(model);
filter->setSourceModel(model);
filter->addMimeTypeExclusionFilter(Akonadi::Collection::mimeType());
filter->addMimeTypeExclusionFilter(Akonadi::Collection::virtualMimeType());
......@@ -67,7 +67,7 @@ QVariant ContactCompletionModel::entityData(const Item &item, int column, int ro
}
if (role == Qt::DisplayRole || role == Qt::EditRole) {
const KContacts::Addressee contact = item.payload<KContacts::Addressee>();
const auto contact = item.payload<KContacts::Addressee>();
switch (column) {
case NameColumn:
......
......@@ -46,7 +46,7 @@ public:
mEditorWidget = new ContactEditorWidget(displayMode == FullMode ? ContactEditorWidget::FullMode : ContactEditorWidget::VCardMode, mParent);
}
auto *layout = new QVBoxLayout(mParent);
auto layout = new QVBoxLayout(mParent);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
layout->addWidget(mEditorWidget);
......@@ -84,7 +84,7 @@ void Akonadi::AkonadiContactEditor::Private::itemFetchDone(KJob *job)
return;
}
auto *fetchJob = qobject_cast<Akonadi::ItemFetchJob *>(job);
auto fetchJob = qobject_cast<Akonadi::ItemFetchJob *>(job);
if (!fetchJob) {
return;
}
......@@ -100,12 +100,12 @@ void Akonadi::AkonadiContactEditor::Private::itemFetchDone(KJob *job)
// if in edit mode we have to fetch the parent collection to find out
// about the modify rights of the item
auto *collectionFetchJob = new Akonadi::CollectionFetchJob(mItem.parentCollection(), Akonadi::CollectionFetchJob::Base);
auto collectionFetchJob = new Akonadi::CollectionFetchJob(mItem.parentCollection(), Akonadi::CollectionFetchJob::Base);
mParent->connect(collectionFetchJob, &CollectionFetchJob::result, mParent, [this](KJob *job) {
parentCollectionFetchDone(job);
});
} else {
const KContacts::Addressee addr = mItem.payload<KContacts::Addressee>();
const auto addr = mItem.payload<KContacts::Addressee>();
mContactMetaData.load(mItem);
loadContact(addr, mContactMetaData);
mEditorWidget->setReadOnly(mReadOnly);
......@@ -120,7 +120,7 @@ void Akonadi::AkonadiContactEditor::Private::parentCollectionFetchDone(KJob *job
return;
}
auto *fetchJob = qobject_cast<Akonadi::CollectionFetchJob *>(job);
auto fetchJob = qobject_cast<Akonadi::CollectionFetchJob *>(job);
if (!fetchJob) {
return;
}
......@@ -130,7 +130,7 @@ void Akonadi::AkonadiContactEditor::Private::parentCollectionFetchDone(KJob *job
mReadOnly = !(parentCollection.rights() & Collection::CanChangeItem);
}
const KContacts::Addressee addr = mItem.payload<KContacts::Addressee>();
const auto addr = mItem.payload<KContacts::Addressee>();
mContactMetaData.load(mItem);
loadContact(addr, mContactMetaData);
mEditorWidget->setReadOnly(mReadOnly);
......@@ -162,7 +162,7 @@ void Akonadi::AkonadiContactEditor::Private::itemChanged(const Akonadi::Item &it
dlg->addButton(i18n("Ignore and Overwrite changes"), QMessageBox::RejectRole);
if (dlg->exec() == QMessageBox::AcceptRole) {
auto *job = new Akonadi::ItemFetchJob(mItem);
auto job = new Akonadi::ItemFetchJob(mItem);
job->fetchScope().fetchFullPayload();
job->fetchScope().fetchAttribute<ContactMetaDataAttribute>();
job->fetchScope().setAncestorRetrieval(Akonadi::ItemFetchScope::Parent);
......@@ -226,7 +226,7 @@ void Akonadi::AkonadiContactEditor::loadContact(const Akonadi::Item &item)
Q_ASSERT_X(false, "ContactEditor::loadContact", "You are calling loadContact in CreateMode!");
}
auto *job = new Akonadi::ItemFetchJob(item);
auto job = new Akonadi::ItemFetchJob(item);
job->fetchScope().fetchFullPayload();
job->fetchScope().fetchAttribute<ContactMetaDataAttribute>();
job->fetchScope().setAncestorRetrieval(Akonadi::ItemFetchScope::Parent);
......@@ -254,7 +254,7 @@ void Akonadi::AkonadiContactEditor::saveContactInAddressBook()
return;
}
KContacts::Addressee addr = d->mItem.payload<KContacts::Addressee>();
auto addr = d->mItem.payload<KContacts::Addressee>();
d->storeContact(addr, d->mContactMetaData);
......@@ -262,7 +262,7 @@ void Akonadi::AkonadiContactEditor::saveContactInAddressBook()
d->mItem.setPayload<KContacts::Addressee>(addr);
auto *job = new Akonadi::ItemModifyJob(d->mItem);
auto job = new Akonadi::ItemModifyJob(d->mItem);
connect(job, &ItemModifyJob::result, this, [this](KJob *job) {
d->storeDone(job);
});
......@@ -293,7 +293,7 @@ void Akonadi::AkonadiContactEditor::saveContactInAddressBook()
d->mContactMetaData.store(item);
auto *job = new Akonadi::ItemCreateJob(item, d->mDefaultCollection);
auto job = new Akonadi::ItemCreateJob(item, d->mDefaultCollection);
connect(job, &ItemCreateJob::result, this, [this](KJob *job) {
d->storeDone(job);
});
......
......@@ -38,11 +38,11 @@ public:
: q(parent)
, mMode(mode)
{
QWidget *mainWidget = new QWidget(q);
auto mainWidget = new QWidget(q);
q->setWindowTitle(mode == ContactEditorDialog::CreateMode ? i18n("New Contact") : i18n("Edit Contact"));
auto *mainLayout = new QVBoxLayout(q);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, q);
auto mainLayout = new QVBoxLayout(q);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, q);
q->connect(buttonBox, &QDialogButtonBox::accepted, q, [this]() {
slotOkClicked();
});
......@@ -53,7 +53,7 @@ public:
mainLayout->addWidget(mainWidget);
mainLayout->addWidget(buttonBox);
auto *layout = new QGridLayout(mainWidget);
auto layout = new QGridLayout(mainWidget);
layout->setContentsMargins(0, 0, 0, 0);
if (editorWidget) {
......@@ -67,7 +67,7 @@ public:
}
if (mode == ContactEditorDialog::CreateMode) {
QLabel *label = new QLabel(i18n("Add to:"), mainWidget);
auto label = new QLabel(i18n("Add to:"), mainWidget);
mAddressBookBox = new CollectionComboBox(mainWidget);
mAddressBookBox->setMimeTypeFilter(QStringList() << KContacts::Addressee::mimeType());
......
......@@ -53,7 +53,7 @@ void ContactGroupEditor::Private::itemFetchDone(KJob *job)
return;
}
auto *fetchJob = qobject_cast<ItemFetchJob *>(job);
auto fetchJob = qobject_cast<ItemFetchJob *>(job);
if (!fetchJob) {
return;
}
......@@ -69,12 +69,12 @@ void ContactGroupEditor::Private::itemFetchDone(KJob *job)
// if in edit mode we have to fetch the parent collection to find out
// about the modify rights of the item
auto *collectionFetchJob = new Akonadi::CollectionFetchJob(mItem.parentCollection(), Akonadi::CollectionFetchJob::Base);
auto collectionFetchJob = new Akonadi::CollectionFetchJob(mItem.parentCollection(), Akonadi::CollectionFetchJob::Base);
mParent->connect(collectionFetchJob, &CollectionFetchJob::result, mParent, [this](KJob *job) {
parentCollectionFetchDone(job);
});
} else {
const KContacts::ContactGroup group = mItem.payload<KContacts::ContactGroup>();
const auto group = mItem.payload<KContacts::ContactGroup>();
loadContactGroup(group);
setReadOnly(mReadOnly);
......@@ -91,7 +91,7 @@ void ContactGroupEditor::Private::parentCollectionFetchDone(KJob *job)
return;
}
auto *fetchJob = qobject_cast<Akonadi::CollectionFetchJob *>(job);
auto fetchJob = qobject_cast<Akonadi::CollectionFetchJob *>(job);
if (!fetchJob) {
return;
}
......@@ -101,7 +101,7 @@ void ContactGroupEditor::Private::parentCollectionFetchDone(KJob *job)
mReadOnly = !(parentCollection.rights() & Collection::CanChangeItem);
}
const KContacts::ContactGroup group = mItem.payload<KContacts::ContactGroup>();
const auto group = mItem.payload<KContacts::ContactGroup>();
loadContactGroup(group);
setReadOnly(mReadOnly);
......@@ -135,7 +135,7 @@ void ContactGroupEditor::Private::itemChanged(const Item &item, const QSet<QByte
dlg->addButton(i18n("Ignore and Overwrite changes"), QMessageBox::RejectRole);
if (dlg->exec() == QMessageBox::AcceptRole) {
auto *job = new ItemFetchJob(mItem);
auto job = new ItemFetchJob(mItem);
job->fetchScope().fetchFullPayload();
job->fetchScope().setAncestorRetrieval(Akonadi::ItemFetchScope::Parent);
......@@ -235,7 +235,7 @@ void ContactGroupEditor::loadContactGroup(const Akonadi::Item &item)
Q_ASSERT_X(false, "ContactGroupEditor::loadContactGroup", "You are calling loadContactGroup in CreateMode!");
}
auto *job = new ItemFetchJob(item);
auto job = new ItemFetchJob(item);
job->fetchScope().fetchFullPayload();
job->fetchScope().setAncestorRetrieval(Akonadi::ItemFetchScope::Parent);
......@@ -260,7 +260,7 @@ bool ContactGroupEditor::saveContactGroup()
return true;
}
KContacts::ContactGroup group = d->mItem.payload<KContacts::ContactGroup>();
auto group = d->mItem.payload<KContacts::ContactGroup>();
if (!d->storeContactGroup(group)) {
return false;
......@@ -268,7 +268,7 @@ bool ContactGroupEditor::saveContactGroup()
d->mItem.setPayload<KContacts::ContactGroup>(group);
auto *job = new ItemModifyJob(d->mItem);
auto job = new ItemModifyJob(d->mItem);
connect(job, &ItemModifyJob::result, this, [this](KJob *job) {
d->storeDone(job);
});
......@@ -300,7 +300,7 @@ bool ContactGroupEditor::saveContactGroup()
item.setPayload<KContacts::ContactGroup>(group);
item.setMimeType(KContacts::ContactGroup::mimeType());
auto *job = new ItemCreateJob(item, d->mDefaultCollection);
auto job = new ItemCreateJob(item, d->mDefaultCollection);
connect(job, &ItemCreateJob::result, this, [this](KJob *job) {
d->storeDone(job);
});
......
......@@ -54,10 +54,10 @@ ContactLineEdit::ContactLineEdit(bool isReference, ContactCompletionModel::Colum
{
setFrame(false);
auto *filter = new ContactsWithEmailFilterModel(this);
auto filter = new ContactsWithEmailFilterModel(this);
filter->setSourceModel(Akonadi::ContactCompletionModel::self());
auto *completer = new QCompleter(filter, this);
auto completer = new QCompleter(filter, this);
completer->setCompletionColumn(column);
completer->setCaseSensitivity(Qt::CaseInsensitive);
connect(completer, QOverload<const QModelIndex &>::of(&QCompleter::activated), this, QOverload<const QModelIndex &>::of(&ContactLineEdit::completed));
......@@ -127,13 +127,13 @@ QWidget *ContactGroupEditorDelegate::createEditor(QWidget *parent, const QStyleO
const bool isReference = index.data(ContactGroupModel::IsReferenceRole).toBool();
Q_UNUSED(option)
if (index.column() == 0) {
auto *edit = new ContactLineEdit(isReference, ContactCompletionModel::EmailColumn, parent);
auto edit = new ContactLineEdit(isReference, ContactCompletionModel::EmailColumn, parent);
connect(edit, QOverload<QWidget *>::of(&ContactLineEdit::completed), this, &ContactGroupEditorDelegate::completed);
return edit;
} else {
if (index.data(ContactGroupModel::IsReferenceRole).toBool()) {
auto *comboBox = new KComboBox(parent);
auto comboBox = new KComboBox(parent);
comboBox->setFrame(false);
comboBox->setAutoFillBackground(true);
return comboBox;
......@@ -149,14 +149,14 @@ void ContactGroupEditorDelegate::setEditorData(QWidget *editor, const QModelInde
{
if (index.data(ContactGroupModel::IsReferenceRole).toBool()) {
if (index.column() == 0) {
auto *lineEdit = qobject_cast<QLineEdit *>(editor);
auto lineEdit = qobject_cast<QLineEdit *>(editor);
if (!lineEdit) {
return;
}
lineEdit->setText(index.data(Qt::EditRole).toString());
} else {
auto *comboBox = qobject_cast<KComboBox *>(editor);
auto comboBox = qobject_cast<KComboBox *>(editor);
if (!comboBox) {
return;
}
......@@ -167,7 +167,7 @@ void ContactGroupEditorDelegate::setEditorData(QWidget *editor, const QModelInde
comboBox->setCurrentIndex(comboBox->findText(index.data(Qt::EditRole).toString()));
}
} else {
auto *lineEdit = qobject_cast<QLineEdit *>(editor);
auto lineEdit = qobject_cast<QLineEdit *>(editor);
if (!lineEdit) {
return;
}
......@@ -180,7 +180,7 @@ void ContactGroupEditorDelegate::setModelData(QWidget *editor, QAbstractItemMode
{
if (index.data(ContactGroupModel::IsReferenceRole).toBool()) {
if (index.column() == 0) {
auto *lineEdit = static_cast<ContactLineEdit *>(editor);
auto lineEdit = static_cast<ContactLineEdit *>(editor);
const bool isReference = lineEdit->isReference();
const Item item = lineEdit->completedItem();
......@@ -195,7 +195,7 @@ void ContactGroupEditorDelegate::setModelData(QWidget *editor, QAbstractItemMode
}
if (index.column() == 1) {
auto *comboBox = qobject_cast<KComboBox *>(editor);
auto comboBox = qobject_cast<KComboBox *>(editor);
if (!comboBox) {
return;
}
......@@ -203,7 +203,7 @@ void ContactGroupEditorDelegate::setModelData(QWidget *editor, QAbstractItemMode
model->setData(index, comboBox->currentText(), Qt::EditRole);
}
} else {
auto *lineEdit = static_cast<ContactLineEdit *>(editor);
auto lineEdit = static_cast<ContactLineEdit *>(editor);
const bool isReference = lineEdit->isReference();
const Item item = lineEdit->completedItem();
......
......@@ -74,9 +74,9 @@ ContactGroupEditorDialog::ContactGroupEditorDialog(Mode mode, QWidget *parent)
, d(new Private(this, mode))
{
setWindowTitle(mode == CreateMode ? i18n("New Contact Group") : i18n("Edit Contact Group"));
auto *mainLayout = new QVBoxLayout(this);
auto mainLayout = new QVBoxLayout(this);
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->setDefault(true);
d->okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
......@@ -88,15 +88,15 @@ ContactGroupEditorDialog::ContactGroupEditorDialog(Mode mode, QWidget *parent)
d->okButton->setAutoDefault(false);
buttonBox->button(QDialogButtonBox::Cancel)->setAutoDefault(false);
QWidget *mainWidget = new QWidget(this);
auto mainWidget = new QWidget(this);
auto *layout = new QGridLayout(mainWidget);
auto layout = new QGridLayout(mainWidget);
layout->setContentsMargins(0, 0, 0, 0);
d->mEditor = new Akonadi::ContactGroupEditor(mode == CreateMode ? Akonadi::ContactGroupEditor::CreateMode : Akonadi::ContactGroupEditor::EditMode, this);
if (mode == CreateMode) {
QLabel *label = new QLabel(i18n("Add to:"), mainWidget);
auto label = new QLabel(i18n("Add to:"), mainWidget);
d->mAddressBookBox = new CollectionComboBox(mainWidget);
d->mAddressBookBox->setMimeTypeFilter(QStringList() << KContacts::ContactGroup::mimeType());
......
......@@ -43,7 +43,7 @@ public:
} else {
item.setId(reference.uid().toLongLong());
}
auto *job = new ItemFetchJob(item, mParent);
auto job = new ItemFetchJob(item, mParent);
job->setProperty("row", row);
job->fetchScope().fetchFullPayload();
......@@ -62,7 +62,7 @@ public:
return;
}
auto *fetchJob = qobject_cast<ItemFetchJob *>(job);
auto fetchJob = qobject_cast<ItemFetchJob *>(job);
if (fetchJob->items().count() != 1) {
mMembers[row].loadingError = true;
......@@ -71,7 +71,7 @@ public:
}
const Item item = fetchJob->items().at(0);
const KContacts::Addressee contact = item.payload<KContacts::Addressee>();
const auto contact = item.payload<KContacts::Addressee>();
GroupMember &member = mMembers[row];
member.referencedContact = contact;
......
......@@ -90,7 +90,7 @@ public:
mExpandJob = nullptr;
if (!job->error()) {
auto *expandJob = qobject_cast<ContactGroupExpandJob *>(job);
auto expandJob = qobject_cast<ContactGroupExpandJob *>(job);
mCurrentContacts = expandJob->contacts();
}
......@@ -113,7 +113,7 @@ public:
mCurrentAddressBookName.clear();
if (!job->error()) {
auto *fetchJob = qobject_cast<CollectionFetchJob *>(job);
auto fetchJob = qobject_cast<CollectionFetchJob *>(job);
if (!fetchJob->collections().isEmpty()) {
const Collection collection = fetchJob->collections().at(0);
mCurrentAddressBookName = collection.displayName();
......@@ -141,7 +141,7 @@ ContactGroupViewer::ContactGroupViewer(QWidget *parent)
: QWidget(parent)
, d(new Private(this))
{
auto *layout = new QVBoxLayout(this);
auto layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
connect(d->mBrowser, &TextBrowser::anchorClicked, this, [this](const QUrl &url) {
......@@ -185,7 +185,7 @@ void ContactGroupViewer::itemChanged(const Item &item)
return;
}
const KContacts::ContactGroup group = item.payload<KContacts::ContactGroup>();