Commit 3055a933 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use auto when it's possible

parent 7e396185
......@@ -35,9 +35,9 @@ AddArchiveMailDialog::AddArchiveMailDialog(ArchiveMailInfo *info, QWidget *paren
setModal(true);
setWindowIcon(QIcon::fromTheme(QStringLiteral("kmail")));
QVBoxLayout *topLayout = new QVBoxLayout(this);
auto *topLayout = new QVBoxLayout(this);
QGridLayout *mainLayout = new QGridLayout;
auto *mainLayout = new QGridLayout;
mainLayout->setContentsMargins({});
int row = 0;
......@@ -84,7 +84,7 @@ AddArchiveMailDialog::AddArchiveMailDialog(ArchiveMailInfo *info, QWidget *paren
dateLabel->setObjectName(QStringLiteral("date_label"));
mainLayout->addWidget(dateLabel, row, 0);
QHBoxLayout *hlayout = new QHBoxLayout;
auto *hlayout = new QHBoxLayout;
mDays = new QSpinBox(this);
mDays->setMinimum(1);
mDays->setMaximum(3600);
......
......@@ -34,7 +34,7 @@ ArchiveMailAgent::ArchiveMailAgent(const QString &id)
connect(mArchiveManager, &ArchiveMailManager::needUpdateConfigDialogBox, this, &ArchiveMailAgent::needUpdateConfigDialogBox);
Akonadi::Monitor *collectionMonitor = new Akonadi::Monitor(this);
auto *collectionMonitor = new Akonadi::Monitor(this);
collectionMonitor->setObjectName(QStringLiteral("ArchiveMailCollectionMonitor"));
collectionMonitor->fetchCollection(true);
collectionMonitor->ignoreSession(Akonadi::Session::defaultSession());
......
......@@ -43,7 +43,7 @@ void ArchiveMailManager::load()
const int numberOfCollection = collectionList.count();
for (int i = 0; i < numberOfCollection; ++i) {
KConfigGroup group = mConfig->group(collectionList.at(i));
ArchiveMailInfo *info = new ArchiveMailInfo(group);
auto *info = new ArchiveMailInfo(group);
if (ArchiveMailAgentUtil::needToArchive(info)) {
for (ArchiveMailInfo *oldInfo : qAsConst(mListArchiveInfo)) {
......@@ -180,7 +180,7 @@ QString ArchiveMailManager::printArchiveListInfo() const
void ArchiveMailManager::archiveFolder(const QString &path, Akonadi::Collection::Id collectionId)
{
ArchiveMailInfo *info = new ArchiveMailInfo;
auto *info = new ArchiveMailInfo;
info->setSaveCollectionId(collectionId);
info->setUrl(QUrl::fromLocalFile(path));
mListArchiveInfo.append(info);
......
......@@ -150,7 +150,7 @@ void ArchiveMailWidget::load()
const int numberOfCollection = collectionList.count();
for (int i = 0; i < numberOfCollection; ++i) {
KConfigGroup collectionGroup = config()->group(collectionList.at(i));
ArchiveMailInfo *info = new ArchiveMailInfo(collectionGroup);
auto *info = new ArchiveMailInfo(collectionGroup);
if (info->isValid()) {
createOrUpdateItem(info);
} else {
......@@ -207,7 +207,7 @@ bool ArchiveMailWidget::save() const
const int numberOfItem(mWidget.treeWidget->topLevelItemCount());
for (int i = 0; i < numberOfItem; ++i) {
ArchiveMailItem *mailItem = static_cast<ArchiveMailItem *>(mWidget.treeWidget->topLevelItem(i));
auto *mailItem = static_cast<ArchiveMailItem *>(mWidget.treeWidget->topLevelItem(i));
if (mailItem->info()) {
KConfigGroup group = config()->group(ArchiveMailAgentUtil::archivePattern.arg(mailItem->info()->saveCollectionId()));
mailItem->info()->writeConfig(group);
......@@ -242,7 +242,7 @@ void ArchiveMailWidget::slotModifyItem()
if (!item) {
return;
}
ArchiveMailItem *archiveItem = static_cast<ArchiveMailItem *>(item);
auto *archiveItem = static_cast<ArchiveMailItem *>(item);
QPointer<AddArchiveMailDialog> dialog = new AddArchiveMailDialog(archiveItem->info(), parentWidget());
if (dialog->exec()) {
ArchiveMailInfo *info = dialog->info();
......@@ -274,7 +274,7 @@ bool ArchiveMailWidget::verifyExistingArchive(ArchiveMailInfo *info) const
{
const int numberOfItem(mWidget.treeWidget->topLevelItemCount());
for (int i = 0; i < numberOfItem; ++i) {
ArchiveMailItem *mailItem = static_cast<ArchiveMailItem *>(mWidget.treeWidget->topLevelItem(i));
auto *mailItem = static_cast<ArchiveMailItem *>(mWidget.treeWidget->topLevelItem(i));
ArchiveMailInfo *archiveItemInfo = mailItem->info();
if (archiveItemInfo) {
if (info->saveCollectionId() == archiveItemInfo->saveCollectionId()) {
......@@ -293,11 +293,11 @@ void ArchiveMailWidget::slotOpenFolder()
if (!item) {
return;
}
ArchiveMailItem *archiveItem = static_cast<ArchiveMailItem *>(item);
auto *archiveItem = static_cast<ArchiveMailItem *>(item);
ArchiveMailInfo *archiveItemInfo = archiveItem->info();
if (archiveItemInfo) {
const QUrl url = archiveItemInfo->url();
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(url);
auto *job = new KIO::OpenUrlJob(url);
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, parentWidget()));
job->setRunExecutables(false);
job->start();
......@@ -308,7 +308,7 @@ void ArchiveMailWidget::slotOpenFolder()
void ArchiveMailWidget::slotItemChanged(QTreeWidgetItem *item, int col)
{
if (item) {
ArchiveMailItem *archiveItem = static_cast<ArchiveMailItem *>(item);
auto *archiveItem = static_cast<ArchiveMailItem *>(item);
if (archiveItem->info()) {
if (col == ArchiveMailWidget::Name) {
archiveItem->info()->setEnabled(archiveItem->checkState(ArchiveMailWidget::Name) == Qt::Checked);
......
......@@ -27,7 +27,7 @@ void ArchiveMailWidgetTest::shouldHaveDefaultValue()
new QHBoxLayout(&parent);
ArchiveMailWidget mailwidget({}, &parent, {QStringLiteral("akonadi_archivemail_agent")});
QTreeWidget *treeWidget = parent.findChild<QTreeWidget *>(QStringLiteral("treewidget"));
auto *treeWidget = parent.findChild<QTreeWidget *>(QStringLiteral("treewidget"));
QVERIFY(treeWidget);
QCOMPARE(treeWidget->topLevelItemCount(), 0);
......
......@@ -64,7 +64,7 @@ void ArchiveJob::execute()
return;
}
MailCommon::BackupJob *backupJob = new MailCommon::BackupJob();
auto *backupJob = new MailCommon::BackupJob();
backupJob->setRootFolder(Akonadi::EntityTreeModel::updatedCollection(mManager->kernel()->collectionModel(), collection));
backupJob->setSaveLocation(archivePath);
......
......@@ -30,10 +30,10 @@ void FollowupReminderNoAnswerDialogTest::initTestCase()
void FollowupReminderNoAnswerDialogTest::shouldHaveDefaultValues()
{
FollowUpReminderNoAnswerDialog dlg;
FollowUpReminderInfoWidget *infowidget = dlg.findChild<FollowUpReminderInfoWidget *>(QStringLiteral("FollowUpReminderInfoWidget"));
auto *infowidget = dlg.findChild<FollowUpReminderInfoWidget *>(QStringLiteral("FollowUpReminderInfoWidget"));
QVERIFY(infowidget);
QTreeWidget *treeWidget = infowidget->findChild<QTreeWidget *>(QStringLiteral("treewidget"));
auto *treeWidget = infowidget->findChild<QTreeWidget *>(QStringLiteral("treewidget"));
QVERIFY(treeWidget);
QCOMPARE(treeWidget->topLevelItemCount(), 0);
......@@ -42,12 +42,12 @@ void FollowupReminderNoAnswerDialogTest::shouldHaveDefaultValues()
void FollowupReminderNoAnswerDialogTest::shouldAddItemInTreeList()
{
FollowUpReminderNoAnswerDialog dlg;
FollowUpReminderInfoWidget *infowidget = dlg.findChild<FollowUpReminderInfoWidget *>(QStringLiteral("FollowUpReminderInfoWidget"));
QTreeWidget *treeWidget = infowidget->findChild<QTreeWidget *>(QStringLiteral("treewidget"));
auto *infowidget = dlg.findChild<FollowUpReminderInfoWidget *>(QStringLiteral("FollowUpReminderInfoWidget"));
auto *treeWidget = infowidget->findChild<QTreeWidget *>(QStringLiteral("treewidget"));
QList<FollowUpReminder::FollowUpReminderInfo *> lstInfo;
lstInfo.reserve(10);
for (int i = 0; i < 10; ++i) {
FollowUpReminder::FollowUpReminderInfo *info = new FollowUpReminder::FollowUpReminderInfo();
auto *info = new FollowUpReminder::FollowUpReminderInfo();
lstInfo.append(info);
}
dlg.setInfo(lstInfo);
......@@ -57,7 +57,7 @@ void FollowupReminderNoAnswerDialogTest::shouldAddItemInTreeList()
//Load valid infos
for (int i = 0; i < 10; ++i) {
FollowUpReminder::FollowUpReminderInfo *info = new FollowUpReminder::FollowUpReminderInfo();
auto *info = new FollowUpReminder::FollowUpReminderInfo();
info->setOriginalMessageItemId(42);
info->setMessageId(QStringLiteral("foo"));
info->setFollowUpReminderDate(QDate::currentDate());
......@@ -72,13 +72,13 @@ void FollowupReminderNoAnswerDialogTest::shouldAddItemInTreeList()
void FollowupReminderNoAnswerDialogTest::shouldItemHaveInfo()
{
FollowUpReminderNoAnswerDialog dlg;
FollowUpReminderInfoWidget *infowidget = dlg.findChild<FollowUpReminderInfoWidget *>(QStringLiteral("FollowUpReminderInfoWidget"));
QTreeWidget *treeWidget = infowidget->findChild<QTreeWidget *>(QStringLiteral("treewidget"));
auto *infowidget = dlg.findChild<FollowUpReminderInfoWidget *>(QStringLiteral("FollowUpReminderInfoWidget"));
auto *treeWidget = infowidget->findChild<QTreeWidget *>(QStringLiteral("treewidget"));
QList<FollowUpReminder::FollowUpReminderInfo *> lstInfo;
//Load valid infos
for (int i = 0; i < 10; ++i) {
FollowUpReminder::FollowUpReminderInfo *info = new FollowUpReminder::FollowUpReminderInfo();
auto *info = new FollowUpReminder::FollowUpReminderInfo();
info->setOriginalMessageItemId(42);
info->setMessageId(QStringLiteral("foo"));
info->setFollowUpReminderDate(QDate::currentDate());
......@@ -88,7 +88,7 @@ void FollowupReminderNoAnswerDialogTest::shouldItemHaveInfo()
dlg.setInfo(lstInfo);
for (int i = 0; i < treeWidget->topLevelItemCount(); ++i) {
FollowUpReminderInfoItem *item = static_cast<FollowUpReminderInfoItem *>(treeWidget->topLevelItem(i));
auto *item = static_cast<FollowUpReminderInfoItem *>(treeWidget->topLevelItem(i));
QVERIFY(item->info());
QVERIFY(item->info()->isValid());
}
......
......@@ -52,7 +52,7 @@ FollowUpReminderInfoWidget::FollowUpReminderInfoWidget(QWidget *parent)
, mChanged(false)
{
setObjectName(QStringLiteral("FollowUpReminderInfoWidget"));
QHBoxLayout *hbox = new QHBoxLayout(this);
auto *hbox = new QHBoxLayout(this);
hbox->setContentsMargins({});
mTreeWidget = new QTreeWidget(this);
mTreeWidget->setObjectName(QStringLiteral("treewidget"));
......@@ -102,7 +102,7 @@ void FollowUpReminderInfoWidget::load()
for (int i = 0; i < numberOfItem; ++i) {
KConfigGroup group = config->group(filterGroups.at(i));
FollowUpReminder::FollowUpReminderInfo *info = new FollowUpReminder::FollowUpReminderInfo(group);
auto *info = new FollowUpReminder::FollowUpReminderInfo(group);
if (info->isValid()) {
createOrUpdateItem(info);
} else {
......@@ -159,7 +159,7 @@ bool FollowUpReminderInfoWidget::save() const
const int numberOfItem(mTreeWidget->topLevelItemCount());
int i = 0;
for (; i < numberOfItem; ++i) {
FollowUpReminderInfoItem *mailItem = static_cast<FollowUpReminderInfoItem *>(mTreeWidget->topLevelItem(i));
auto *mailItem = static_cast<FollowUpReminderInfoItem *>(mTreeWidget->topLevelItem(i));
if (mailItem->info()) {
KConfigGroup group = config->group(FollowUpReminder::FollowUpReminderUtil::followUpReminderPattern().arg(i));
mailItem->info()->writeConfig(group, i);
......@@ -202,7 +202,7 @@ void FollowUpReminderInfoWidget::slotCustomContextMenuRequested(const QPoint &po
void FollowUpReminderInfoWidget::openShowMessage(Akonadi::Item::Id id)
{
FollowUpReminderShowMessageJob *job = new FollowUpReminderShowMessageJob(id);
auto *job = new FollowUpReminderShowMessageJob(id);
job->start();
}
......@@ -214,7 +214,7 @@ void FollowUpReminderInfoWidget::removeItem(const QList<QTreeWidgetItem *> &mail
if (KMessageBox::Yes == KMessageBox::warningYesNo(this,
i18np("Do you want to remove this selected item?", "Do you want to remove these %1 selected items?", mailItemLst.count()), i18n("Delete"))) {
for (QTreeWidgetItem *item : mailItemLst) {
FollowUpReminderInfoItem *mailItem = static_cast<FollowUpReminderInfoItem *>(item);
auto *mailItem = static_cast<FollowUpReminderInfoItem *>(item);
mListRemoveId << mailItem->info()->uniqueIdentifier();
delete mailItem;
}
......
......@@ -44,12 +44,12 @@ void FollowUpReminderManager::load(bool forceReloadConfig)
for (int i = 0; i < numberOfItems; ++i) {
KConfigGroup group = mConfig->group(itemList.at(i));
FollowUpReminderInfo *info = new FollowUpReminderInfo(group);
auto *info = new FollowUpReminderInfo(group);
if (info->isValid()) {
if (!info->answerWasReceived()) {
mFollowUpReminderInfoList.append(info);
if (!mInitialize) {
FollowUpReminderInfo *noAnswerInfo = new FollowUpReminderInfo(*info);
auto *noAnswerInfo = new FollowUpReminderInfo(*info);
noAnswerList.append(noAnswerInfo);
} else {
delete info;
......@@ -104,7 +104,7 @@ void FollowUpReminderManager::checkFollowUp(const Akonadi::Item &item, const Ako
break;
}
FollowUpReminderJob *job = new FollowUpReminderJob(this);
auto *job = new FollowUpReminderJob(this);
connect(job, &FollowUpReminderJob::finished, this, &FollowUpReminderManager::slotCheckFollowUpFinished);
job->setItem(item);
job->start();
......@@ -122,7 +122,7 @@ void FollowUpReminderManager::slotCheckFollowUpFinished(const QString &messageId
info->setAnswerWasReceived(true);
answerReceived(info->to());
if (info->todoId() != -1) {
FollowUpReminderFinishTaskJob *job = new FollowUpReminderFinishTaskJob(info->todoId(), this);
auto *job = new FollowUpReminderFinishTaskJob(info->todoId(), this);
connect(job, &FollowUpReminderFinishTaskJob::finishTaskDone, this, &FollowUpReminderManager::slotFinishTaskDone);
connect(job, &FollowUpReminderFinishTaskJob::finishTaskFailed, this, &FollowUpReminderManager::slotFinishTaskFailed);
job->start();
......
......@@ -34,7 +34,7 @@ FollowUpReminderNoAnswerDialog::FollowUpReminderNoAnswerDialog(QWidget *parent)
setWindowIcon(QIcon::fromTheme(QStringLiteral("kmail")));
setAttribute(Qt::WA_DeleteOnClose);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
auto *mainLayout = new QVBoxLayout(this);
QLabel *lab = new QLabel(i18n("You still wait an answer about this mail:"), this);
mainLayout->addWidget(lab);
......
......@@ -36,7 +36,7 @@ void FollowUpReminderFinishTaskJob::start()
void FollowUpReminderFinishTaskJob::closeTodo()
{
Akonadi::Item item(mTodoId);
Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(item, this);
auto *job = new Akonadi::ItemFetchJob(item, this);
connect(job, &Akonadi::ItemFetchJob::result, this, &FollowUpReminderFinishTaskJob::slotItemFetchJobDone);
}
......@@ -63,7 +63,7 @@ void FollowUpReminderFinishTaskJob::slotItemFetchJobDone(KJob *job)
Akonadi::Item updateItem = item;
updateItem.setPayload<KCalendarCore::Todo::Ptr>(todo);
Akonadi::ItemModifyJob *job = new Akonadi::ItemModifyJob(updateItem);
auto *job = new Akonadi::ItemModifyJob(updateItem);
connect(job, &Akonadi::ItemModifyJob::result, this, &FollowUpReminderFinishTaskJob::slotItemModifiedResult);
} else {
qCWarning(FOLLOWUPREMINDERAGENT_LOG) << " Found item different from 1: " << lst.count();
......
......@@ -30,7 +30,7 @@ void FollowUpReminderJob::start()
deleteLater();
return;
}
Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(mItem);
auto *job = new Akonadi::ItemFetchJob(mItem);
job->fetchScope().fetchPayloadPart(Akonadi::MessagePart::Envelope, true);
job->fetchScope().setAncestorRetrieval(Akonadi::ItemFetchScope::Parent);
......
......@@ -41,7 +41,7 @@ FilterLogDialog::FilterLogDialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(i18nc("@title:window", "Filter Log Viewer"));
QVBoxLayout *mainLayout = new QVBoxLayout(this);
auto *mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this);
mUser1Button = new QPushButton(this);
buttonBox->addButton(mUser1Button, QDialogButtonBox::ActionRole);
......@@ -56,7 +56,7 @@ FilterLogDialog::FilterLogDialog(QWidget *parent)
KGuiItem::assign(mUser2Button, KStandardGuiItem::saveAs());
QFrame *page = new QFrame(this);
QVBoxLayout *pageVBoxLayout = new QVBoxLayout;
auto *pageVBoxLayout = new QVBoxLayout;
page->setLayout(pageVBoxLayout);
pageVBoxLayout->setContentsMargins({});
mainLayout->addWidget(page);
......@@ -73,7 +73,7 @@ FilterLogDialog::FilterLogDialog(QWidget *parent)
mTextEdit->editor()->appendHtml(*it);
}
MailfilterPurposeMenuWidget *purposeMenu = new MailfilterPurposeMenuWidget(this, this);
auto *purposeMenu = new MailfilterPurposeMenuWidget(this, this);
QPushButton *mShareButton = new QPushButton(i18n("Share..."), this);
mShareButton->setMenu(purposeMenu->menu());
mShareButton->setIcon(QIcon::fromTheme(QStringLiteral("document-share")));
......@@ -91,7 +91,7 @@ FilterLogDialog::FilterLogDialog(QWidget *parent)
mLogDetailsBox = new QGroupBox(i18n("Logging Details"), page);
pageVBoxLayout->addWidget(mLogDetailsBox);
QVBoxLayout *layout = new QVBoxLayout;
auto *layout = new QVBoxLayout;
mLogDetailsBox->setLayout(layout);
mLogDetailsBox->setEnabled(mLogActiveBox->isChecked());
connect(mLogActiveBox, &QCheckBox::toggled, mLogDetailsBox, &QGroupBox::setEnabled);
......@@ -134,7 +134,7 @@ FilterLogDialog::FilterLogDialog(QWidget *parent)
// i18n( "" ) );
QWidget *hbox = new QWidget(page);
QHBoxLayout *hboxHBoxLayout = new QHBoxLayout;
auto *hboxHBoxLayout = new QHBoxLayout;
hbox->setLayout(hboxHBoxLayout);
hboxHBoxLayout->setContentsMargins({});
pageVBoxLayout->addWidget(hbox);
......@@ -360,7 +360,7 @@ void FilterLogTextEdit::addExtraMenuEntry(QMenu *menu, QPoint pos)
{
Q_UNUSED(pos);
if (!document()->isEmpty()) {
QAction *sep = new QAction(menu);
auto *sep = new QAction(menu);
sep->setSeparator(true);
menu->addAction(sep);
QAction *clearAllAction = KStandardAction::clear(this, &FilterLogTextEdit::clear, menu);
......
......@@ -360,7 +360,7 @@ void FilterManager::agentRemoved(const QString &identifier)
void FilterManager::filter(const Akonadi::Item &item, FilterManager::FilterSet set, const QString &resourceId)
{
Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(item, this);
auto *job = new Akonadi::ItemFetchJob(item, this);
job->setProperty("filterSet", static_cast<int>(set));
job->setProperty("resourceId", resourceId);
SearchRule::RequiredPart requestedPart = requiredPart(resourceId);
......@@ -380,7 +380,7 @@ void FilterManager::filter(const Akonadi::Item &item, FilterManager::FilterSet s
void FilterManager::filter(const Akonadi::Item &item, const QString &filterId, const QString &resourceId)
{
Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(item, this);
auto *job = new Akonadi::ItemFetchJob(item, this);
job->setProperty("filterId", filterId);
SearchRule::RequiredPart requestedPart = requiredPart(resourceId);
......@@ -446,7 +446,7 @@ bool FilterManager::processContextItem(ItemContext context)
const bool itemCanDelete = (col.rights() & Akonadi::Collection::CanDeleteItem);
if (context.deleteItem()) {
if (itemCanDelete) {
Akonadi::ItemDeleteJob *deleteJob = new Akonadi::ItemDeleteJob(context.item(), this);
auto *deleteJob = new Akonadi::ItemDeleteJob(context.item(), this);
connect(deleteJob, &Akonadi::ItemDeleteJob::result, this, [this](KJob *job) {
d->deleteJobResult(job);
});
......@@ -471,7 +471,7 @@ bool FilterManager::processContextItem(ItemContext context)
//remoteid still holds the old one. Without clearing it, we try to enforce that on the new location, which is
//anything but good (and the server replies with "NO Only resources can modify remote identifiers"
item.setRemoteId(QString());
Akonadi::ItemModifyJob *modifyJob = new Akonadi::ItemModifyJob(item, this);
auto *modifyJob = new Akonadi::ItemModifyJob(item, this);
modifyJob->disableRevisionCheck(); //no conflict handling for mails as no other process could change the mail body and we don't care about flag conflicts
//The below is a safety check to ignore modifying payloads if it was not requested,
//as in that case we might change the payload to an invalid one
......@@ -587,7 +587,7 @@ void FilterManager::applySpecificFilters(const Akonadi::Item::List &selectedMess
d->mTotalProgressCount = selectedMessages.size();
d->mCurrentProgressCount = 0;
Akonadi::ItemFetchJob *itemFetchJob = new Akonadi::ItemFetchJob(selectedMessages, this);
auto *itemFetchJob = new Akonadi::ItemFetchJob(selectedMessages, this);
if (requiredPart == SearchRule::CompleteMessage) {
itemFetchJob->fetchScope().fetchFullPayload(true);
} else if (requiredPart == SearchRule::Header) {
......@@ -615,7 +615,7 @@ void FilterManager::applyFilters(const Akonadi::Item::List &selectedMessages, Fi
d->mTotalProgressCount = selectedMessages.size();
d->mCurrentProgressCount = 0;
Akonadi::ItemFetchJob *itemFetchJob = new Akonadi::ItemFetchJob(selectedMessages, this);
auto *itemFetchJob = new Akonadi::ItemFetchJob(selectedMessages, this);
SearchRule::RequiredPart requiredParts = requiredPart(QString());
if (requiredParts == SearchRule::CompleteMessage) {
itemFetchJob->fetchScope().fetchFullPayload(true);
......
......@@ -66,7 +66,7 @@ MailFilterAgent::MailFilterAgent(const QString &id)
connect(m_filterManager, &FilterManager::percent, this, &MailFilterAgent::emitProgress);
connect(m_filterManager, &FilterManager::progressMessage, this, &MailFilterAgent::emitProgressMessage);
Akonadi::Monitor *collectionMonitor = new Akonadi::Monitor(this);
auto *collectionMonitor = new Akonadi::Monitor(this);
collectionMonitor->setObjectName(QStringLiteral("MailFilterCollectionMonitor"));
collectionMonitor->fetchCollection(true);
collectionMonitor->ignoreSession(Akonadi::Session::defaultSession());
......@@ -210,7 +210,7 @@ void MailFilterAgent::filterItem(const Akonadi::Item &item, const Akonadi::Colle
{
MailCommon::SearchRule::RequiredPart requiredPart = m_filterManager->requiredPart(collection.resource());
Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(item);
auto *job = new Akonadi::ItemFetchJob(item);
connect(job, &Akonadi::ItemFetchJob::itemsReceived,
this, &MailFilterAgent::itemsReceiviedForFiltering);
if (requiredPart == MailCommon::SearchRule::CompleteMessage) {
......
......@@ -29,10 +29,10 @@ void SendLaterConfigureDialogTest::initTestCase()
void SendLaterConfigureDialogTest::shouldHaveDefaultValue()
{
SendLaterConfigureDialog dlg;
SendLaterWidget *infowidget = dlg.findChild<SendLaterWidget *>(QStringLiteral("sendlaterwidget"));
auto *infowidget = dlg.findChild<SendLaterWidget *>(QStringLiteral("sendlaterwidget"));
QVERIFY(infowidget);
QTreeWidget *treeWidget = infowidget->findChild<QTreeWidget *>(QStringLiteral("treewidget"));
auto *treeWidget = infowidget->findChild<QTreeWidget *>(QStringLiteral("treewidget"));
QVERIFY(treeWidget);
QCOMPARE(treeWidget->topLevelItemCount(), 0);
......
......@@ -64,7 +64,7 @@ SendLaterAgent::SendLaterAgent(const QString &id)
}
// For extra safety, check list every hour, in case we didn't properly get
// notified about the network going up or down.
QTimer *reloadListTimer = new QTimer(this);
auto *reloadListTimer = new QTimer(this);
connect(reloadListTimer, &QTimer::timeout, this, &SendLaterAgent::reload);
reloadListTimer->start(1000 * 60 * 60); //1 hour
}
......@@ -134,7 +134,7 @@ void SendLaterAgent::configure(WId windowId)
const QVector<Akonadi::Item::Id> listMessage = dialog->messagesToRemove();
if (!listMessage.isEmpty()) {
//Will delete in specific job when done.
SendLaterRemoveMessageJob *sendlaterremovejob = new SendLaterRemoveMessageJob(listMessage, this);
auto *sendlaterremovejob = new SendLaterRemoveMessageJob(listMessage, this);
sendlaterremovejob->start();
}
}
......
......@@ -24,7 +24,7 @@ SendLaterConfigureDialog::SendLaterConfigureDialog(QWidget *parent)
{
setWindowTitle(i18nc("@title:window", "Configure"));
setWindowIcon(QIcon::fromTheme(QStringLiteral("kmail")));
QVBoxLayout *mainLayout = new QVBoxLayout(this);
auto *mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help, this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
......@@ -54,7 +54,7 @@ SendLaterConfigureDialog::SendLaterConfigureDialog(QWidget *parent)
aboutData.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"),
i18nc("EMAIL OF TRANSLATORS", "Your emails"));
KHelpMenu *helpMenu = new KHelpMenu(this, aboutData, true);
auto *helpMenu = new KHelpMenu(this, aboutData, true);
//Initialize menu
QMenu *menu = helpMenu->menu();
helpMenu->action(KHelpMenu::menuAboutApp)->setIcon(QIcon::fromTheme(QStringLiteral("kmail")));
......
......@@ -103,7 +103,7 @@ void SendLaterWidget::slotSendNow()
{
const QList<QTreeWidgetItem *> listItems = mWidget->treeWidget->selectedItems();
if (listItems.count() == 1) {
SendLaterItem *mailItem = static_cast<SendLaterItem *>(listItems.first());
auto *mailItem = static_cast<SendLaterItem *>(listItems.first());
Q_EMIT sendNow(mailItem->info()->itemId());
}
}
......@@ -182,7 +182,7 @@ void SendLaterWidget::save()
const int numberOfItem(mWidget->treeWidget->topLevelItemCount());
for (int i = 0; i < numberOfItem; ++i) {
SendLaterItem *mailItem = static_cast<SendLaterItem *>(mWidget->treeWidget->topLevelItem(i));
auto *mailItem = static_cast<SendLaterItem *>(mWidget->treeWidget->topLevelItem(i));
if (mailItem->info()) {
SendLaterUtil::writeSendLaterInfo(config, mailItem->info());
}
......@@ -210,7 +210,7 @@ void SendLaterWidget::slotRemoveItem()
for (QTreeWidgetItem *item : listItems) {
if (removeMessage) {
SendLaterItem *mailItem = static_cast<SendLaterItem *>(item);
auto *mailItem = static_cast<SendLaterItem *>(item);
if (mailItem->info()) {
Akonadi::Item::Id id = mailItem->info()->itemId();
if (id != -1) {
......@@ -233,7 +233,7 @@ void SendLaterWidget::slotModifyItem()
if (!item) {
return;
}
SendLaterItem *mailItem = static_cast<SendLaterItem *>(item);
auto *mailItem = static_cast<SendLaterItem *>(item);
QPointer<MessageComposer::SendLaterDialog> dialog = new MessageComposer::SendLaterDialog(mailItem->info(), this);
if (dialog->exec()) {
......
......@@ -41,7 +41,7 @@ void SendLaterJob::start()
if (mInfo) {
if (mInfo->itemId() > -1) {
const Akonadi::Item item = Akonadi::Item(mInfo->itemId());
Akonadi::ItemFetchJob *fetch = new Akonadi::ItemFetchJob(item, this);
auto *fetch = new Akonadi::ItemFetchJob(item, this);
mFetchScope.fetchAttribute<MailTransport::TransportAttribute>();
mFetchScope.fetchAttribute<MailTransport::SentBehaviourAttribute>();
mFetchScope.setAncestorRetrieval(Akonadi::ItemFetchScope::Parent);
......@@ -100,7 +100,7 @@ void SendLaterJob::slotJobFinished(KJob *job)
sendError(i18n("Cannot send message."), SendLaterManager::MailDispatchDoesntWork);
} else {
if (!mInfo->isRecurrence()) {
Akonadi::ItemDeleteJob *fetch = new Akonadi::ItemDeleteJob(mItem, this);
auto *fetch = new Akonadi::ItemDeleteJob(mItem, this);
connect(fetch, &Akonadi::ItemDeleteJob::result, this, &SendLaterJob::slotDeleteItem);
} else {
sendDone();
......
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