Commit 918d7afe authored by Laurent Montel's avatar Laurent Montel 😁

Modernize code

parent a15ff9bf
Pipeline #39512 passed with stage
in 24 minutes and 9 seconds
......@@ -65,7 +65,7 @@ AkonadiCollectionSearch::AkonadiCollectionSearch(const QString& mimeType, const
*/
void AkonadiCollectionSearch::collectionFetchResult(KJob* j)
{
CollectionFetchJob* 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)
{
ItemFetchJob* 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;
ItemDeleteJob* 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)
{
ItemDeleteJob* job = static_cast<ItemDeleteJob*>(j);
auto* job = static_cast<ItemDeleteJob*>(j);
if (j->error())
{
if (!mUid.isEmpty())
......
......@@ -98,7 +98,7 @@ QSize AlarmListDelegate::sizeHint(const QStyleOptionViewItem& option, const QMod
case AlarmListModel::ColourColumn:
{
int h = option.fontMetrics.lineSpacing();
return QSize(h * 3 / 4, h);
return {h * 3 / 4, h};
}
}
}
......
......@@ -190,7 +190,7 @@ void AlarmListView::showHideColumn(QMenu& menu, QAction* act)
void AlarmListView::setReplaceBlankName()
{
bool textHidden = header()->isSectionHidden(AlarmListModel::TextColumn);
AlarmListModel* 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);
QVBoxLayout* 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);
QHBoxLayout* 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
QGridLayout* 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();
QHBoxLayout* 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();
QHBoxLayout* 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
QHBoxLayout* 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"));
QVBoxLayout* topLayout = new QVBoxLayout(this);
auto* topLayout = new QVBoxLayout(this);
if (Preferences::useAlarmName())
{
QHBoxLayout* 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);
QGridLayout* 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);
QVBoxLayout* 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);
KDescendantsProxyModel* descendantsModel = new KDescendantsProxyModel(this);
auto* descendantsModel = new KDescendantsProxyModel(this);
descendantsModel->setSourceModel(model);
Akonadi::EntityMimeTypeFilterModel* 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);
QVBoxLayout* groupLayout = new QVBoxLayout(group);
auto* groupLayout = new QVBoxLayout(group);
// Sound checkbox and file selector
QHBoxLayout* 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>();
Akonadi::ChangeRecorder* 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"));
QVBoxLayout* 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
KAEvent* 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;
Event::Ptr kcalEvent(new Event);
KAEvent* event = new KAEvent(evnt);
auto* event = new KAEvent(evnt);
QString id = event->id();
if (id.isEmpty())
id = kcalEvent->uid();
......
......@@ -214,25 +214,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."));
QVBoxLayout* mainLayout = new QVBoxLayout(this);
auto* mainLayout = new QVBoxLayout(this);
mTabs = new QTabWidget(this);
mainLayout->addWidget(mTabs);
mTabScrollGroup = new StackedScrollGroup(this, mTabs);
StackedScrollWidget* mainScroll = new StackedScrollWidget(mTabScrollGroup);
auto* mainScroll = new StackedScrollWidget(mTabScrollGroup);
mTabs->addTab(mainScroll, i18nc("@title:tab", "Alarm"));
mMainPageIndex = 0;
PageFrame* 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);
QVBoxLayout* topLayout = new QVBoxLayout(mainPage);
auto* topLayout = new QVBoxLayout(mainPage);
// Recurrence tab
StackedScrollWidget* recurScroll = new StackedScrollWidget(mTabScrollGroup);
auto* recurScroll = new StackedScrollWidget(mTabScrollGroup);
mTabs->addTab(recurScroll, QString());
mRecurPageIndex = 1;
QFrame* recurTab = new QFrame;
QVBoxLayout* recurTabLayout = new QVBoxLayout();
auto* recurTabLayout = new QVBoxLayout();
recurTab->setLayout(recurTabLayout);
recurScroll->setWidget(recurTab); // recurTab becomes the child of recurScroll
mRecurrenceEdit = new RecurrenceEdit(mReadOnly);
......@@ -247,7 +247,7 @@ void EditAlarmDlg::init(const KAEvent* event)
{
// Alarm/template name
QFrame* frame = new QFrame;
QHBoxLayout* 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:"));
......@@ -267,7 +267,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);
QVBoxLayout* layout = new QVBoxLayout(actionBox);
auto* layout = new QVBoxLayout(actionBox);
type_init(actionBox, layout);
......@@ -276,7 +276,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);
QHBoxLayout* 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);
......@@ -291,7 +291,7 @@ void EditAlarmDlg::init(const KAEvent* event)
//?? mDeferGroup->addSpace(0);
}
QHBoxLayout* hlayout = new QHBoxLayout();
auto* hlayout = new QHBoxLayout();
hlayout->setContentsMargins(0, 0, 0, 0);
topLayout->addLayout(hlayout);
......@@ -300,7 +300,7 @@ void EditAlarmDlg::init(const KAEvent* event)
{
QGroupBox* templateTimeBox = new QGroupBox(i18nc("@title:group", "Time"), mainPage);
topLayout->addWidget(templateTimeBox);
QGridLayout* 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);
......@@ -314,7 +314,7 @@ void EditAlarmDlg::init(const KAEvent* event)
grid->addWidget(mTemplateDefaultTime, 0, 0, Qt::AlignLeft);
QWidget* box = new QWidget(templateTimeBox);
QHBoxLayout* 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());
......@@ -376,7 +376,7 @@ void EditAlarmDlg::init(const KAEvent* event)
mMoreOptions = new QFrame(mainPage);
mMoreOptions->setFrameStyle(QFrame::NoFrame);
topLayout->addWidget(mMoreOptions);
QVBoxLayout* moreLayout = new QVBoxLayout(mMoreOptions);
auto* moreLayout = new QVBoxLayout(mMoreOptions);
moreLayout->setContentsMargins(0, 0, 0, 0);
// Reminder
......@@ -1322,7 +1322,7 @@ void EditAlarmDlg::slotShowMainPage()
else
{
// Set scroll position to top, since it otherwise jumps randomly
StackedScrollWidget* 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
QHBoxLayout* 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
QStandardItemModel* 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));
QHBoxLayout* 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);
QHBoxLayout* fileBoxHLayout = new QHBoxLayout(mFileBox);
auto* fileBoxHLayout = new QHBoxLayout(mFileBox);
fileBoxHLayout->setContentsMargins(0, 0, 0, 0);
fileBoxHLayout->setSpacing(0);
mFileMessageEdit = new LineEdit(LineEdit::Url, mFileBox);
......@@ -864,7 +864,7 @@ void EditCommandAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
mCmdOutputBox = new QGroupBox(i18nc("@title:group", "Command Output"), parent);
frameLayout->addWidget(mCmdOutputBox);
QVBoxLayout* vlayout = new QVBoxLayout(mCmdOutputBox);
auto* vlayout = new QVBoxLayout(mCmdOutputBox);
mCmdOutputGroup = new ButtonGroup(mCmdOutputBox);
connect(mCmdOutputGroup, &ButtonGroup::buttonSet, this, &EditCommandAlarmDlg::contentsChanged);
......@@ -877,7 +877,7 @@ void EditCommandAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
// Log file name edit box
QWidget* box = new QWidget(mCmdOutputBox);
QHBoxLayout* 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
......@@ -889,7 +889,7 @@ void EditCommandAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
// Log file browse button.
// The file browser dialog is activated by the PickLogFileRadio class.
QPushButton* browseButton = new QPushButton(box);
auto* browseButton = new QPushButton(box);
boxHLayout->addWidget(browseButton);
browseButton->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
int size = browseButton->sizeHint().height();
......@@ -915,7 +915,7 @@ void EditCommandAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
// Top-adjust the controls
mCmdPadding = new QWidget(parent);
QHBoxLayout* hlayout = new QHBoxLayout(mCmdPadding);
auto* hlayout = new QHBoxLayout(mCmdPadding);
hlayout->setContentsMargins(0, 0, 0, 0);
hlayout->setSpacing(0);
frameLayout->addWidget(mCmdPadding);
......@@ -1096,7 +1096,7 @@ bool EditCommandAlarmDlg::type_validate(bool trial)
*/
void EditCommandAlarmDlg::type_executedTry(const QString& text, void* result)
{
ShellProcess* proc = (ShellProcess*)result;
auto* proc = (ShellProcess*)result;
if (proc && proc != (void*)-1
&& mCmdOutputGroup->checkedButton() != mCmdExecInTerm)
{
......@@ -1176,7 +1176,7 @@ void EditEmailAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
{
mTryButton->setWhatsThis(i18nc("@info:whatsthis", "Send the email to the specified addressees now"));
QGridLayout* grid = new QGridLayout();
auto* grid = new QGridLayout();
grid->setContentsMargins(0, 0, 0, 0);
grid->setColumnStretch(1, 1);
frameLayout->addLayout(grid);
......@@ -1631,7 +1631,7 @@ void EditAudioAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
// Top-adjust the controls
mPadding = new QWidget(parent);
QHBoxLayout* hlayout = new QHBoxLayout(mPadding);
auto* hlayout = new QHBoxLayout(mPadding);
hlayout->setContentsMargins(0, 0, 0, 0);
hlayout->setSpacing(0);
frameLayout->addWidget(mPadding);
......@@ -1828,7 +1828,7 @@ void EditAudioAlarmDlg::slotAudioPlaying(bool playing)
CommandEdit::CommandEdit(QWidget* parent)
: QWidget(parent)
{
QVBoxLayout* 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)
{
EventListModel* elm = qobject_cast<EventListModel*>(model);
auto* elm = qobject_cast<EventListModel*>(model);
Q_ASSERT(elm); // model must be derived from EventListModel
QTreeView::setModel(model);
......@@ -84,7 +84,7 @@ QModelIndex EventListView::selectedIndex() const
{
const QModelIndexList list = selectionModel()->selectedRows(); //clazy:exclude=inefficient-qlist
if (list.count() != 1)
return QModelIndex();
return {};
return list[0];
}
......@@ -97,7 +97,7 @@ KAEvent EventListView::selectedEvent() const
const QModelIndexList list = selectionModel()->selectedRows(); //clazy:exclude=inefficient-qlist
if (list.count() != 1)
return KAEvent();
const EventListModel* 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 EventListModel* 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())
{
QHelpEvent* 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)
{
EventListModel* 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:
{
EventListView* 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;
QMouseEvent* 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";
EventListModel* 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
QVBoxLayout* 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);
QGridLayout* 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)
{
QVBoxLayout* 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);
QHBoxLayout* hlayout = new QHBoxLayout();
auto* hlayout = new QHBoxLayout();
hlayout->setContentsMargins(0, 0, 0, 0);
topLayout->addLayout(hlayout);
QVBoxLayout* 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);
QHBoxLayout* 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);
QHBoxLayout* 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)
{
QHBoxLayout* 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);
QVBoxLayout* 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));
QDialogButtonBox* 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"))
{
MessageWindow* 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());
CommandOptions* options = new CommandOptions;
auto* options = new CommandOptions;
const QStringList nonexecArgs = options->setOptions(&parser, fixedArgs);
options->parse();
KAboutData::applicationData().processCommandLine(&parser);
......@@ -444,7 +444,7 @@ int KAlarmApp::activateInstance(const QStringList& args, const QString& workingD
case CommandOptions::CANCEL_EVENT:
{
// Display or delete the event with the specified event ID
QueuedAction action = static_cast<QueuedAction>(int((command == CommandOptions::TRIGGER_EVENT) ? QueuedAction::Trigger : QueuedAction::Cancel)