Commit 278448f7 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use auto vs auto * where it's possible

parent 9aec20bf
Pipeline #49674 failed with stage
in 13 minutes and 1 second
......@@ -65,7 +65,7 @@ AkonadiCollectionSearch::AkonadiCollectionSearch(const QString& mimeType, const
*/
void AkonadiCollectionSearch::collectionFetchResult(KJob* j)
{
auto* job = qobject_cast<CollectionFetchJob*>(j);
auto job = qobject_cast<CollectionFetchJob*>(j);
if (j->error())
qCCritical(KALARM_LOG) << "AkonadiCollectionSearch::collectionFetchResult: CollectionFetchJob" << job->fetchScope().resource()<< "error: " << j->errorString();
else
......@@ -115,7 +115,7 @@ void AkonadiCollectionSearch::collectionFetchResult(KJob* j)
*/
void AkonadiCollectionSearch::itemFetchResult(KJob* j)
{
auto* job = qobject_cast<ItemFetchJob*>(j);
auto job = qobject_cast<ItemFetchJob*>(j);
if (j->error())
{
if (!mUid.isEmpty())
......@@ -141,7 +141,7 @@ void AkonadiCollectionSearch::itemFetchResult(KJob* j)
}
else if (mGid.isEmpty())
continue;
auto* djob = new ItemDeleteJob(item, this);
auto djob = new ItemDeleteJob(item, this);
mItemDeleteJobs[djob] = mItemFetchJobs.value(job);
connect(djob, &ItemDeleteJob::result, this, &AkonadiCollectionSearch::itemDeleteResult);
}
......@@ -160,7 +160,7 @@ void AkonadiCollectionSearch::itemFetchResult(KJob* j)
*/
void AkonadiCollectionSearch::itemDeleteResult(KJob* j)
{
auto* job = static_cast<ItemDeleteJob*>(j);
auto job = static_cast<ItemDeleteJob*>(j);
if (j->error())
{
if (!mUid.isEmpty())
......
......@@ -191,7 +191,7 @@ void AlarmListView::showHideColumn(QMenu& menu, QAction* act)
void AlarmListView::setReplaceBlankName()
{
bool textHidden = header()->isSectionHidden(AlarmListModel::TextColumn);
auto* almodel = qobject_cast<AlarmListModel*>(model());
auto almodel = qobject_cast<AlarmListModel*>(model());
if (almodel)
almodel->setReplaceBlankName(textHidden);
}
......
......@@ -83,7 +83,7 @@ void AlarmTimeWidget::init(Mode mode, const QString& title)
mDeferring = mode & DEFER_TIME;
mButtonGroup = new ButtonGroup(this);
connect(mButtonGroup, &ButtonGroup::buttonSet, this, &AlarmTimeWidget::slotButtonSet);
auto* topLayout = new QVBoxLayout(topWidget);
auto topLayout = new QVBoxLayout(topWidget);
if (title.isEmpty())
topLayout->setContentsMargins(0, 0, 0, 0);
......@@ -105,7 +105,7 @@ void AlarmTimeWidget::init(Mode mode, const QString& title)
// Time edit box and Any time checkbox
QWidget* timeBox = new QWidget(topWidget);
auto* timeBoxHLayout = new QHBoxLayout(timeBox);
auto timeBoxHLayout = new QHBoxLayout(timeBox);
timeBoxHLayout->setContentsMargins(0, 0, 0, 0);
timeBoxHLayout->setSpacing(2 * style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
mTimeEdit = new TimeEdit(timeBox);
......@@ -151,7 +151,7 @@ void AlarmTimeWidget::init(Mode mode, const QString& title)
mAfterTimeRadio->setFocusWidget(mDelayTimeEdit);
// Set up the layout, either narrow or wide
auto* grid = new QGridLayout();
auto grid = new QGridLayout();
grid->setContentsMargins(0, 0, 0, 0);
topLayout->addLayout(grid);
if (mDeferring)
......@@ -161,7 +161,7 @@ void AlarmTimeWidget::init(Mode mode, const QString& title)
grid->addWidget(timeBox, 1, 1, Qt::AlignLeft);
grid->setColumnStretch(2, 1);
topLayout->addStretch();
auto* layout = new QHBoxLayout();
auto layout = new QHBoxLayout();
topLayout->addLayout(layout);
layout->addWidget(mAfterTimeRadio);
layout->addWidget(mDelayTimeEdit);
......@@ -186,13 +186,13 @@ void AlarmTimeWidget::init(Mode mode, const QString& title)
grid->setColumnStretch(2, 1);
topLayout->addStretch();
auto* layout = new QHBoxLayout();
auto layout = new QHBoxLayout();
topLayout->addLayout(layout);
layout->setSpacing(2 * style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
// Time zone selector
mTimeZoneBox = new QWidget(topWidget); // this is to control the QWhatsThis text display area
auto* hlayout = new QHBoxLayout(mTimeZoneBox);
auto hlayout = new QHBoxLayout(mTimeZoneBox);
hlayout->setContentsMargins(0, 0, 0, 0);
QLabel* label = new QLabel(i18nc("@label:listbox", "Time zone:"), mTimeZoneBox);
hlayout->addWidget(label);
......
......@@ -51,11 +51,11 @@ BirthdayDlg::BirthdayDlg(QWidget* parent)
setObjectName(QStringLiteral("BirthdayDlg")); // used by LikeBack
setWindowTitle(i18nc("@title:window", "Import Birthdays From KAddressBook"));
auto* topLayout = new QVBoxLayout(this);
auto topLayout = new QVBoxLayout(this);
if (Preferences::useAlarmName())
{
auto* hlayout = new QHBoxLayout();
auto hlayout = new QHBoxLayout();
hlayout->setContentsMargins(0, 0, 0, 0);
topLayout->addLayout(hlayout);
QLabel* label = new QLabel(i18nc("@label:textbox", "Alarm name:"), this);
......@@ -76,7 +76,7 @@ BirthdayDlg::BirthdayDlg(QWidget* parent)
QGroupBox* textGroup = new QGroupBox(i18nc("@title:group", "Alarm Text"), this);
topLayout->addWidget(textGroup);
auto* grid = new QGridLayout(textGroup);
auto grid = new QGridLayout(textGroup);
QLabel* label = new QLabel(i18nc("@label:textbox", "Prefix:"), textGroup);
label->setFixedSize(label->sizeHint());
grid->addWidget(label, 0, 0);
......@@ -103,7 +103,7 @@ BirthdayDlg::BirthdayDlg(QWidget* parent)
QGroupBox* group = new QGroupBox(i18nc("@title:group", "Select Birthdays"), this);
topLayout->addWidget(group);
auto* layout = new QVBoxLayout(group);
auto layout = new QVBoxLayout(group);
layout->setContentsMargins(0, 0, 0, 0);
// Start Akonadi server as we need it for the birthday model to access contacts information
......@@ -112,10 +112,10 @@ BirthdayDlg::BirthdayDlg(QWidget* parent)
BirthdayModel* model = BirthdayModel::instance();
connect(model, &BirthdayModel::dataChanged, this, &BirthdayDlg::resizeViewColumns);
auto* descendantsModel = new KDescendantsProxyModel(this);
auto descendantsModel = new KDescendantsProxyModel(this);
descendantsModel->setSourceModel(model);
auto* mimeTypeFilter = new Akonadi::EntityMimeTypeFilterModel(this);
auto mimeTypeFilter = new Akonadi::EntityMimeTypeFilterModel(this);
mimeTypeFilter->setSourceModel(descendantsModel);
mimeTypeFilter->addMimeTypeExclusionFilter(Akonadi::Collection::mimeType());
mimeTypeFilter->setHeaderGroup(Akonadi::EntityTreeModel::ItemListHeaders);
......@@ -146,10 +146,10 @@ BirthdayDlg::BirthdayDlg(QWidget* parent)
group = new QGroupBox(i18nc("@title:group", "Alarm Configuration"), this);
topLayout->addWidget(group);
auto* groupLayout = new QVBoxLayout(group);
auto groupLayout = new QVBoxLayout(group);
// Sound checkbox and file selector
auto* hlayout = new QHBoxLayout();
auto hlayout = new QHBoxLayout();
hlayout->setContentsMargins(0, 0, 0, 0);
groupLayout->addLayout(hlayout);
mSoundPicker = new SoundPicker(group);
......
......@@ -48,7 +48,7 @@ BirthdayModel* BirthdayModel::instance()
scope.fetchFullPayload(true);
scope.fetchAttribute<Akonadi::EntityDisplayAttribute>();
auto* recorder = new Akonadi::ChangeRecorder;
auto recorder = new Akonadi::ChangeRecorder;
recorder->setSession(session);
recorder->fetchCollection(true);
recorder->setItemFetchScope(scope);
......
......@@ -37,7 +37,7 @@ DeferAlarmDlg::DeferAlarmDlg(const DateTime& initialDT, bool anyTimeOption, bool
setWindowModality(Qt::WindowModal);
setWindowTitle(i18nc("@title:window", "Defer Alarm"));
auto* layout = new QVBoxLayout(this);
auto layout = new QVBoxLayout(this);
mTimeWidget = new AlarmTimeWidget((anyTimeOption ? AlarmTimeWidget::DEFER_ANY_TIME : AlarmTimeWidget::DEFER_TIME), this);
mTimeWidget->setDateTime(initialDT);
......
......@@ -231,7 +231,7 @@ void DisplayCalendar::updateKAEvents()
if (kcalevent->alarms().isEmpty())
continue; // ignore events without alarms
auto* event = new KAEvent(kcalevent);
auto event = new KAEvent(kcalevent);
if (!event->isValid())
{
qCWarning(KALARM_LOG) << "DisplayCalendar::updateKAEvents: Ignoring unusable event" << kcalevent->uid();
......@@ -259,7 +259,7 @@ bool DisplayCalendar::addEvent(KAEvent& evnt)
return false;
KCalendarCore::Event::Ptr kcalEvent(new KCalendarCore::Event);
auto* event = new KAEvent(evnt);
auto event = new KAEvent(evnt);
QString id = event->id();
if (id.isEmpty())
id = kcalEvent->uid();
......
......@@ -215,25 +215,25 @@ void EditAlarmDlg::init(const KAEvent& event)
if (mButtonBox->button(QDialogButtonBox::Ok))
mButtonBox->button(QDialogButtonBox::Ok)->setWhatsThis(i18nc("@info:whatsthis", "Schedule the alarm at the specified time."));
auto* mainLayout = new QVBoxLayout(this);
auto mainLayout = new QVBoxLayout(this);
mTabs = new QTabWidget(this);
mainLayout->addWidget(mTabs);
mTabScrollGroup = new StackedScrollGroup(this, mTabs);
auto* mainScroll = new StackedScrollWidget(mTabScrollGroup);
auto mainScroll = new StackedScrollWidget(mTabScrollGroup);
mTabs->addTab(mainScroll, i18nc("@title:tab", "Alarm"));
mMainPageIndex = 0;
auto* mainPage = new PageFrame(mainScroll);
auto mainPage = new PageFrame(mainScroll);
mainScroll->setWidget(mainPage); // mainPage becomes the child of mainScroll
connect(mainPage, &PageFrame::shown, this, &EditAlarmDlg::slotShowMainPage);
auto* topLayout = new QVBoxLayout(mainPage);
auto topLayout = new QVBoxLayout(mainPage);
// Recurrence tab
auto* recurScroll = new StackedScrollWidget(mTabScrollGroup);
auto recurScroll = new StackedScrollWidget(mTabScrollGroup);
mTabs->addTab(recurScroll, QString());
mRecurPageIndex = 1;
QFrame* recurTab = new QFrame;
auto* recurTabLayout = new QVBoxLayout();
auto recurTabLayout = new QVBoxLayout();
recurTab->setLayout(recurTabLayout);
recurScroll->setWidget(recurTab); // recurTab becomes the child of recurScroll
mRecurrenceEdit = new RecurrenceEdit(mReadOnly);
......@@ -248,7 +248,7 @@ void EditAlarmDlg::init(const KAEvent& event)
{
// Alarm/template name
QFrame* frame = new QFrame;
auto* box = new QHBoxLayout();
auto box = new QHBoxLayout();
frame->setLayout(box);
box->setContentsMargins(0, 0, 0, 0);
QLabel* label = new QLabel(mTemplate ? i18nc("@label:textbox", "Template name:") : i18nc("@label:textbox", "Alarm name:"));
......@@ -268,7 +268,7 @@ void EditAlarmDlg::init(const KAEvent& event)
// Controls specific to the alarm type
QGroupBox* actionBox = new QGroupBox(i18nc("@title:group", "Action"), mainPage);
topLayout->addWidget(actionBox, 1);
auto* layout = new QVBoxLayout(actionBox);
auto layout = new QVBoxLayout(actionBox);
type_init(actionBox, layout);
......@@ -277,7 +277,7 @@ void EditAlarmDlg::init(const KAEvent& event)
// Deferred date/time: visible only for a deferred recurring event.
mDeferGroup = new QGroupBox(i18nc("@title:group", "Deferred Alarm"), mainPage);
topLayout->addWidget(mDeferGroup);
auto* hlayout = new QHBoxLayout(mDeferGroup);
auto hlayout = new QHBoxLayout(mDeferGroup);
QLabel* label = new QLabel(i18nc("@label", "Deferred to:"), mDeferGroup);
label->setFixedSize(label->sizeHint());
hlayout->addWidget(label);
......@@ -292,7 +292,7 @@ void EditAlarmDlg::init(const KAEvent& event)
//?? mDeferGroup->addSpace(0);
}
auto* hlayout = new QHBoxLayout();
auto hlayout = new QHBoxLayout();
hlayout->setContentsMargins(0, 0, 0, 0);
topLayout->addLayout(hlayout);
......@@ -301,7 +301,7 @@ void EditAlarmDlg::init(const KAEvent& event)
{
QGroupBox* templateTimeBox = new QGroupBox(i18nc("@title:group", "Time"), mainPage);
topLayout->addWidget(templateTimeBox);
auto* grid = new QGridLayout(templateTimeBox);
auto grid = new QGridLayout(templateTimeBox);
mTemplateTimeGroup = new ButtonGroup(templateTimeBox);
connect(mTemplateTimeGroup, &ButtonGroup::buttonSet, this, &EditAlarmDlg::slotTemplateTimeType);
connect(mTemplateTimeGroup, &ButtonGroup::buttonSet, this, &EditAlarmDlg::contentsChanged);
......@@ -315,7 +315,7 @@ void EditAlarmDlg::init(const KAEvent& event)
grid->addWidget(mTemplateDefaultTime, 0, 0, Qt::AlignLeft);
QWidget* box = new QWidget(templateTimeBox);
auto* layout = new QHBoxLayout(box);
auto layout = new QHBoxLayout(box);
layout->setContentsMargins(0, 0, 0, 0);
mTemplateUseTime = new RadioButton(i18nc("@option:radio", "Time:"), box);
mTemplateUseTime->setFixedSize(mTemplateUseTime->sizeHint());
......@@ -377,7 +377,7 @@ void EditAlarmDlg::init(const KAEvent& event)
mMoreOptions = new QFrame(mainPage);
mMoreOptions->setFrameStyle(QFrame::NoFrame);
topLayout->addWidget(mMoreOptions);
auto* moreLayout = new QVBoxLayout(mMoreOptions);
auto moreLayout = new QVBoxLayout(mMoreOptions);
moreLayout->setContentsMargins(0, 0, 0, 0);
// Reminder
......@@ -1330,7 +1330,7 @@ void EditAlarmDlg::slotShowMainPage()
else
{
// Set scroll position to top, since it otherwise jumps randomly
auto* main = static_cast<StackedScrollWidget*>(mTabs->widget(0));
auto main = static_cast<StackedScrollWidget*>(mTabs->widget(0));
main->verticalScrollBar()->setValue(0);
}
if (mTimeWidget)
......
......@@ -130,7 +130,7 @@ void EditDisplayAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
// Display type combo box
QWidget* box = new QWidget(parent); // to group widgets for QWhatsThis text
auto* boxHLayout = new QHBoxLayout(box);
auto boxHLayout = new QHBoxLayout(box);
boxHLayout->setContentsMargins(0, 0, 0, 0);
QLabel* label = new QLabel(i18nc("@label:listbox", "Display type:"), box);
boxHLayout->addWidget(label);
......@@ -148,7 +148,7 @@ void EditDisplayAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
if (!ShellProcess::authorised())
{
// User not authorised to issue shell commands - disable Command Output option
auto* model = qobject_cast<QStandardItemModel*>(mTypeCombo->model());
auto model = qobject_cast<QStandardItemModel*>(mTypeCombo->model());
if (model)
{
QModelIndex index = model->index(2, mTypeCombo->modelColumn(), mTypeCombo->rootModelIndex());
......@@ -165,7 +165,7 @@ void EditDisplayAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
"<item><interface>%2</interface>: the alarm will display the contents of a text or image file.</item>"
"<item><interface>%3</interface>: the alarm will display the output from a command.</item></list></para>",
textItem, fileItem, commandItem));
auto* hlayout = new QHBoxLayout();
auto hlayout = new QHBoxLayout();
hlayout->setContentsMargins(0, 0, 0, 0);
frameLayout->addLayout(hlayout);
hlayout->addWidget(box);
......@@ -182,7 +182,7 @@ void EditDisplayAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
// File name edit box
mFileBox = new QWidget(parent);
frameLayout->addWidget(mFileBox);
auto* fileBoxHLayout = new QHBoxLayout(mFileBox);
auto fileBoxHLayout = new QHBoxLayout(mFileBox);
fileBoxHLayout->setContentsMargins(0, 0, 0, 0);
fileBoxHLayout->setSpacing(0);
mFileMessageEdit = new LineEdit(LineEdit::Url, mFileBox);
......@@ -866,7 +866,7 @@ void EditCommandAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
mCmdOutputBox = new QGroupBox(i18nc("@title:group", "Command Output"), parent);
frameLayout->addWidget(mCmdOutputBox);
auto* vlayout = new QVBoxLayout(mCmdOutputBox);
auto vlayout = new QVBoxLayout(mCmdOutputBox);
mCmdOutputGroup = new ButtonGroup(mCmdOutputBox);
connect(mCmdOutputGroup, &ButtonGroup::buttonSet, this, &EditCommandAlarmDlg::contentsChanged);
......@@ -879,7 +879,7 @@ void EditCommandAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
// Log file name edit box
QWidget* box = new QWidget(mCmdOutputBox);
auto* boxHLayout = new QHBoxLayout(box);
auto boxHLayout = new QHBoxLayout(box);
boxHLayout->setContentsMargins(0, 0, 0, 0);
boxHLayout->setSpacing(0);
(new QWidget(box))->setFixedWidth(mCmdExecInTerm->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth)); // indent the edit box
......@@ -891,7 +891,7 @@ void EditCommandAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
// Log file browse button.
// The file browser dialog is activated by the PickLogFileRadio class.
auto* browseButton = new QPushButton(box);
auto browseButton = new QPushButton(box);
boxHLayout->addWidget(browseButton);
browseButton->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
int size = browseButton->sizeHint().height();
......@@ -917,7 +917,7 @@ void EditCommandAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
// Top-adjust the controls
mCmdPadding = new QWidget(parent);
auto* hlayout = new QHBoxLayout(mCmdPadding);
auto hlayout = new QHBoxLayout(mCmdPadding);
hlayout->setContentsMargins(0, 0, 0, 0);
hlayout->setSpacing(0);
frameLayout->addWidget(mCmdPadding);
......@@ -1179,7 +1179,7 @@ void EditEmailAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
mTryButton->setWhatsThis(i18nc("@info:whatsthis", "Send the email to the specified addressees now"));
mTryButton->setToolTip(i18nc("@info:tooltip", "Send the email now"));
auto* grid = new QGridLayout();
auto grid = new QGridLayout();
grid->setContentsMargins(0, 0, 0, 0);
grid->setColumnStretch(1, 1);
frameLayout->addLayout(grid);
......@@ -1638,7 +1638,7 @@ void EditAudioAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
// Top-adjust the controls
mPadding = new QWidget(parent);
auto* hlayout = new QHBoxLayout(mPadding);
auto hlayout = new QHBoxLayout(mPadding);
hlayout->setContentsMargins(0, 0, 0, 0);
hlayout->setSpacing(0);
frameLayout->addWidget(mPadding);
......@@ -1835,7 +1835,7 @@ void EditAudioAlarmDlg::slotAudioPlaying(bool playing)
CommandEdit::CommandEdit(QWidget* parent)
: QWidget(parent)
{
auto* vlayout = new QVBoxLayout(this);
auto vlayout = new QVBoxLayout(this);
vlayout->setContentsMargins(0, 0, 0, 0);
mTypeScript = new CheckBox(EditCommandAlarmDlg::i18n_chk_EnterScript(), this);
mTypeScript->setFixedSize(mTypeScript->sizeHint());
......
......@@ -38,7 +38,7 @@ EventListView::EventListView(QWidget* parent)
void EventListView::setModel(QAbstractItemModel* model)
{
auto* elm = qobject_cast<EventListModel*>(model);
auto elm = qobject_cast<EventListModel*>(model);
Q_ASSERT(elm); // model must be derived from EventListModel
QTreeView::setModel(model);
......@@ -97,7 +97,7 @@ KAEvent EventListView::selectedEvent() const
const QModelIndexList list = selectionModel()->selectedRows(); //clazy:exclude=inefficient-qlist
if (list.count() != 1)
return KAEvent();
const auto* model = static_cast<const EventListModel*>(list[0].model());
const auto model = static_cast<const EventListModel*>(list[0].model());
return model->event(list[0]);
}
......@@ -111,7 +111,7 @@ QVector<KAEvent> EventListView::selectedEvents() const
int count = ixlist.count();
if (count)
{
const auto* model = static_cast<const EventListModel*>(ixlist[0].model());
const auto model = static_cast<const EventListModel*>(ixlist[0].model());
elist.reserve(count);
for (int i = 0; i < count; ++i)
elist += model->event(ixlist[i]);
......@@ -163,7 +163,7 @@ bool EventListView::viewportEvent(QEvent* e)
{
if (e->type() == QEvent::ToolTip && isActiveWindow())
{
auto* he = static_cast<QHelpEvent*>(e);
auto he = static_cast<QHelpEvent*>(e);
const QModelIndex index = indexAt(he->pos());
QVariant value = model()->data(index, Qt::ToolTipRole);
if (value.canConvert<QString>())
......@@ -172,7 +172,7 @@ bool EventListView::viewportEvent(QEvent* e)
int i = toolTip.indexOf(QLatin1Char('\n'));
if (i < 0)
{
auto* m = qobject_cast<EventListModel*>(model());
auto m = qobject_cast<EventListModel*>(model());
if (index.column() == ResourceDataModelBase::TextColumn
|| index.column() == ResourceDataModelBase::NameColumn
|| !m || m->event(index).commandError() == KAEvent::CMD_NO_ERROR)
......@@ -219,11 +219,11 @@ bool EventListDelegate::editorEvent(QEvent* e, QAbstractItemModel* model, const
break;
case QEvent::MouseButtonRelease:
{
auto* view = static_cast<EventListView*>(parent());
auto view = static_cast<EventListView*>(parent());
if (!view->editOnSingleClick()
|| !view->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, nullptr, view))
return false;
auto* me = static_cast<QMouseEvent*>(e);
auto me = static_cast<QMouseEvent*>(e);
if (me->button() != Qt::LeftButton || me->buttons()
|| me->modifiers() != Qt::NoModifier)
return false;
......@@ -235,7 +235,7 @@ bool EventListDelegate::editorEvent(QEvent* e, QAbstractItemModel* model, const
if (index.isValid())
{
qCDebug(KALARM_LOG) << "EventListDelegate::editorEvent";
auto* itemModel = qobject_cast<EventListModel*>(model);
auto itemModel = qobject_cast<EventListModel*>(model);
if (!itemModel)
qCCritical(KALARM_LOG) << "EventListDelegate::editorEvent: Invalid cast to EventListModel*";
else
......
......@@ -92,11 +92,11 @@ void Find::display()
QWidget* kalarmWidgets = mDialog->findExtension();
// Alarm types
auto* layout = new QVBoxLayout(kalarmWidgets);
auto layout = new QVBoxLayout(kalarmWidgets);
layout->setContentsMargins(0, 0, 0, 0);
QGroupBox* group = new QGroupBox(i18nc("@title:group", "Alarm Type"), kalarmWidgets);
layout->addWidget(group);
auto* grid = new QGridLayout(group);
auto grid = new QGridLayout(group);
grid->setColumnStretch(1, 1);
// Live & archived alarm selection
......
......@@ -25,7 +25,7 @@ FontColourChooser::FontColourChooser(QWidget* parent, const QStringList& fontLis
const QString& frameLabel, bool fg, bool defaultFont, int visibleListSize)
: QWidget(parent)
{
auto* topLayout = new QVBoxLayout(this);
auto topLayout = new QVBoxLayout(this);
QWidget* page = this;
if (!frameLabel.isNull())
{
......@@ -35,17 +35,17 @@ FontColourChooser::FontColourChooser(QWidget* parent, const QStringList& fontLis
}
else
topLayout->setContentsMargins(0, 0, 0, 0);
auto* hlayout = new QHBoxLayout();
auto hlayout = new QHBoxLayout();
hlayout->setContentsMargins(0, 0, 0, 0);
topLayout->addLayout(hlayout);
auto* colourLayout = new QVBoxLayout();
auto colourLayout = new QVBoxLayout();
colourLayout->setContentsMargins(0, 0, 0, 0);
hlayout->addLayout(colourLayout);
if (fg)
{
QWidget* box = new QWidget(page); // to group widgets for QWhatsThis text
colourLayout->addWidget(box);
auto* boxHLayout = new QHBoxLayout(box);
auto boxHLayout = new QHBoxLayout(box);
boxHLayout->setContentsMargins(0, 0, 0, 0);
QLabel* label = new QLabel(i18nc("@label:listbox", "Foreground color:"), box);
......@@ -60,7 +60,7 @@ FontColourChooser::FontColourChooser(QWidget* parent, const QStringList& fontLis
QWidget* box = new QWidget(page); // to group widgets for QWhatsThis text
colourLayout->addWidget(box);
auto* boxHLayout = new QHBoxLayout(box);
auto boxHLayout = new QHBoxLayout(box);
boxHLayout->setContentsMargins(0, 0, 0, 0);
QLabel* label = new QLabel(i18nc("@label:listbox", "Background color:"), box);
......@@ -75,7 +75,7 @@ FontColourChooser::FontColourChooser(QWidget* parent, const QStringList& fontLis
if (defaultFont)
{
auto* layout = new QHBoxLayout();
auto layout = new QHBoxLayout();
layout->setContentsMargins(0, 0, 0, 0);
topLayout->addLayout(layout);
mDefaultFont = new CheckBox(i18nc("@option:check", "Use default font"), page);
......
......@@ -77,7 +77,7 @@ FontColourDlg::FontColourDlg(const QColor& bgColour, const QColor& fgColour, con
{
setWindowTitle(caption);
auto* layout = new QVBoxLayout(this);
auto layout = new QVBoxLayout(this);
mChooser = new FontColourChooser(this, QStringList(), QString(), true, true);
mChooser->setBgColour(bgColour);
mChooser->setFgColour(fgColour);
......@@ -88,7 +88,7 @@ FontColourDlg::FontColourDlg(const QColor& bgColour, const QColor& fgColour, con
layout->addWidget(mChooser);
layout->addSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
auto* buttonBox = new QDialogButtonBox(this);
auto buttonBox = new QDialogButtonBox(this);
buttonBox->addButton(QDialogButtonBox::Ok);
buttonBox->addButton(QDialogButtonBox::Cancel);
layout->addWidget(buttonBox);
......
......@@ -298,7 +298,7 @@ bool KAlarmApp::restoreSession()
}
else if (type == QLatin1String("MessageWindow"))
{
auto* win = new MessageWindow;
auto win = new MessageWindow;
win->restore(i, false);
if (win->isValid())
{
......@@ -392,7 +392,7 @@ int KAlarmApp::activateInstance(const QStringList& args, const QString& workingD
QCommandLineParser parser;
KAboutData::applicationData().setupCommandLine(&parser);
parser.setApplicationDescription(QApplication::applicationDisplayName());
auto* options = new CommandOptions;
auto options = new CommandOptions;
const QStringList nonexecArgs = options->setOptions(&parser, fixedArgs);
options->parse();
KAboutData::applicationData().processCommandLine(&parser);
......@@ -530,7 +530,7 @@ int KAlarmApp::activateInstance(const QStringList& args, const QString& workingD
case EditAlarmDlg::DISPLAY:
{
// EditAlarmDlg::create() always returns EditDisplayAlarmDlg for type = DISPLAY
auto* dlg = qobject_cast<EditDisplayAlarmDlg*>(editDlg);
auto dlg = qobject_cast<EditDisplayAlarmDlg*>(editDlg);
if (options->fgColour().isValid())
dlg->setFgColour(options->fgColour());
if (options->bgColour().isValid())
......@@ -559,7 +559,7 @@ int KAlarmApp::activateInstance(const QStringList& args, const QString& workingD
case EditAlarmDlg::EMAIL:
{
// EditAlarmDlg::create() always returns EditEmailAlarmDlg for type = EMAIL
auto* dlg = qobject_cast<EditEmailAlarmDlg*>(editDlg);
auto dlg = qobject_cast<EditEmailAlarmDlg*>(editDlg);
if (options->fromID()
|| !options->addressees().isEmpty()
|| !options->subject().isEmpty()
......@@ -572,7 +572,7 @@ int KAlarmApp::activateInstance(const QStringList& args, const QString& workingD
case EditAlarmDlg::AUDIO:
{
// EditAlarmDlg::create() always returns EditAudioAlarmDlg for type = AUDIO
auto* dlg = qobject_cast<EditAudioAlarmDlg*>(editDlg);
auto dlg = qobject_cast<EditAudioAlarmDlg*>(editDlg);
if (!options->audioFile().isEmpty() || options->audioVolume() >= 0)
dlg->setAudio(options->audioFile(), options->audioVolume());
break;
......
......@@ -239,7 +239,7 @@ int KAMail::send(JobData& jobdata, QStringList& errmsgs)
return -1;
}
auto* mailjob = new MailTransport::MessageQueueJob(qApp);
auto mailjob = new MailTransport::MessageQueueJob(qApp);
mailjob->setMessage(message);
mailjob->transportAttribute().setTransportId(transport->id());
// MessageQueueJob email addresses must be pure, i.e. without display name. Note
......@@ -310,15 +310,15 @@ void KAMail::slotEmailSent(KJob* job)
*/
void initHeaders(KMime::Message& message, KAMail::JobData& data)
{
auto* date = new KMime::Headers::Date;
auto date = new KMime::Headers::Date;
date->setDateTime(KADateTime::currentDateTime(Preferences::timeSpec()).qDateTime());
message.setHeader(date);
auto* from = new KMime::Headers::From;
auto from = new KMime::Headers::From;
from->fromUnicodeString(data.from, autoDetectCharset(data.from));
message.setHeader(from);
auto* to = new KMime::Headers::To;
auto to = new KMime::Headers::To;
const KCalendarCore::Person::List toList = data.event.emailAddressees();