Commit c89c6679 authored by Laurent Montel's avatar Laurent Montel 😁

Modernize code

parent cc8bce36
Pipeline #39341 passed with stage
in 13 minutes and 17 seconds
......@@ -204,7 +204,7 @@ public:
, mHolidayMask(nullptr)
, mWorkingHoursYTop(0)
, mWorkingHoursYBottom(0)
, mHasSelection(0)
, mHasSelection(false)
, mSelectedId(-1)
, mMarcusBains(nullptr)
, mActionType(Agenda::NOP)
......
......@@ -1166,7 +1166,7 @@ bool AgendaItem::event(QEvent *event)
if (!mEventView->preferences()->enableToolTips()) {
return true;
} else if (mValid) {
QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event);
auto *helpEvent = static_cast<QHelpEvent *>(event);
QToolTip::showText(
helpEvent->globalPos(),
KCalUtils::IncidenceFormatter::toolTipStr(
......
......@@ -749,19 +749,19 @@ void AgendaView::init(QDate start, QDate end)
}
// The widget itself
AgendaScrollArea *allDayScrollArea = new AgendaScrollArea(true, this, d->mIsInteractive,
auto *allDayScrollArea = new AgendaScrollArea(true, this, d->mIsInteractive,
d->mAllDayFrame);
allDayFrameLayout->addWidget(allDayScrollArea);
d->mAllDayAgenda = allDayScrollArea->agenda();
/* Create the main agenda widget and the related widgets */
QWidget *agendaFrame = new QWidget(d->mSplitterAgenda);
QHBoxLayout *agendaLayout = new QHBoxLayout(agendaFrame);
auto *agendaLayout = new QHBoxLayout(agendaFrame);
agendaLayout->setContentsMargins(0, 0, 0, 0);
agendaLayout->setSpacing(SPACING);
// Create agenda
AgendaScrollArea *scrollArea = new AgendaScrollArea(false, this, d->mIsInteractive,
auto *scrollArea = new AgendaScrollArea(false, this, d->mIsInteractive,
agendaFrame);
d->mAgenda = scrollArea->agenda();
......@@ -774,7 +774,7 @@ void AgendaView::init(QDate start, QDate end)
// This timeLabelsZoneLayout is for adding some spacing
// to align timelabels, to agenda's grid
QVBoxLayout *timeLabelsZoneLayout = new QVBoxLayout();
auto *timeLabelsZoneLayout = new QVBoxLayout();
agendaLayout->addLayout(timeLabelsZoneLayout);
agendaLayout->addWidget(scrollArea);
......@@ -1052,7 +1052,7 @@ void AgendaView::zoomView(const int delta, const QPoint &pos, const Qt::Orientat
{
// TODO find out why this is necessary. seems to be some kind of performance hack
static QDate zoomDate;
static QTimer *t = new QTimer(this);
static auto *t = new QTimer(this);
//Zoom to the selected incidence, on the other way
// zoom to the date on screen after the first mousewheel move.
......@@ -1130,7 +1130,7 @@ void AgendaView::placeDecorations(DecorationList &decoList, const QDate &date, Q
decoHBox->setMinimumWidth(1);
for (CalendarDecoration::Element *it : elements) {
DecorationLabel *label = new DecorationLabel(it, decoHBox);
auto *label = new DecorationLabel(it, decoHBox);
label->setAlignment(Qt::AlignBottom);
label->setMinimumWidth(1);
layout->addWidget(label);
......@@ -1165,7 +1165,7 @@ void AgendaView::createDayLabels(bool force)
d->mLayoutTopDayLabels->setSpacing(1);
// this spacer moves the day labels over to line up with the day columns
QSpacerItem *spacer
auto *spacer
= new QSpacerItem((!d->mIsSideBySide ? d->mTimeLabelsZone->width() : 0)
+SPACING
+d->mAllDayAgenda->scrollArea()->frameWidth(),
......@@ -1224,7 +1224,7 @@ void AgendaView::createDayLabels(bool force)
date.day());
QString shortstr = QString::number(date.day());
AlternateLabel *dayLabel
auto *dayLabel
= new AlternateLabel(shortstr, longstr, veryLongStr, topDayLabelBox);
topDayLabelBoxLayout->addWidget(dayLabel);
dayLabel->useShortText(); // will be recalculated in updateDayLabelSizes() anyway
......@@ -1253,7 +1253,7 @@ void AgendaView::createDayLabels(bool force)
#endif
}
QSpacerItem *rightSpacer = new QSpacerItem(d->mAllDayAgenda->scrollArea()->frameWidth(),
auto *rightSpacer = new QSpacerItem(d->mAllDayAgenda->scrollArea()->frameWidth(),
1, QSizePolicy::Fixed);
d->mLayoutTopDayLabels->addSpacerItem(rightSpacer);
......@@ -1420,7 +1420,7 @@ void AgendaView::createTimeBarHeaders()
const auto lst = d->mTimeLabelsZone->timeLabels();
for (QScrollArea *area : lst) {
TimeLabels *timeLabel = static_cast<TimeLabels *>(area->widget());
auto *timeLabel = static_cast<TimeLabels *>(area->widget());
QLabel *label
= new QLabel(timeLabel->header().replace(QLatin1Char('/'), QStringLiteral("/ ")),
d->mTimeBarHeaderFrame);
......
......@@ -415,7 +415,7 @@ QString TimeLabels::headerToolTip() const
bool TimeLabels::event(QEvent *event)
{
if (event->type() == QEvent::ToolTip) {
QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event);
auto *helpEvent = static_cast<QHelpEvent *>(event);
const int cell = yposToCell(helpEvent->pos().y());
QString toolTip;
......
......@@ -66,8 +66,8 @@ void TimeLabelsZone::init()
void TimeLabelsZone::addTimeLabels(const QTimeZone &zone)
{
QScrollArea *area = new QScrollArea(this);
TimeLabels *labels = new TimeLabels(zone, 24, this);
auto *area = new QScrollArea(this);
auto *labels = new TimeLabels(zone, 24, this);
mTimeLabelsList.prepend(area);
area->setWidgetResizable(true);
area->setWidget(labels);
......@@ -94,7 +94,7 @@ void TimeLabelsZone::setupTimeLabel(QScrollArea *area)
area->verticalScrollBar()->setValue(mAgenda->verticalScrollBar()->value());
}
TimeLabels *timeLabels = static_cast<TimeLabels *>(area->widget());
auto *timeLabels = static_cast<TimeLabels *>(area->widget());
timeLabels->setAgenda(mAgenda);
// timelabel's scroll is just a slave, this shouldn't be here
......@@ -116,7 +116,7 @@ int TimeLabelsZone::preferedTimeLabelsWidth() const
void TimeLabelsZone::updateAll()
{
for (QScrollArea *area : qAsConst(mTimeLabelsList)) {
TimeLabels *timeLabel = static_cast<TimeLabels *>(area->widget());
auto *timeLabel = static_cast<TimeLabels *>(area->widget());
timeLabel->updateConfig();
}
}
......@@ -141,7 +141,7 @@ void TimeLabelsZone::updateTimeLabelsPosition()
if (mAgenda) {
const auto lst = timeLabels();
for (QScrollArea *area : lst) {
TimeLabels *label = static_cast<TimeLabels *>(area->widget());
auto *label = static_cast<TimeLabels *>(area->widget());
const int adjustment = mAgenda->contentsY();
// y() is the offset to our parent (QScrollArea)
// and gets negative as we scroll
......
......@@ -51,7 +51,7 @@ TimeScaleConfigDialog::TimeScaleConfigDialog(const PrefsPtr &preferences, QWidge
, d(new Private(this, preferences))
{
setWindowTitle(i18nc("@title:window", "Timezone"));
QVBoxLayout *mainLayout = new QVBoxLayout(this);
auto *mainLayout = new QVBoxLayout(this);
setModal(true);
QWidget *mainwidget = new QWidget(this);
......@@ -106,7 +106,7 @@ TimeScaleConfigDialog::TimeScaleConfigDialog(const PrefsPtr &preferences, QWidge
this, &TimeScaleConfigDialog::slotUpdateButton);
for (const TimeZoneNamePair &item : qAsConst(selList)) {
QListWidgetItem *widgetItem = new QListWidgetItem(item.first);
auto *widgetItem = new QListWidgetItem(item.first);
widgetItem->setData(TimeZoneNameRole, item.second);
listWidget->addItem(widgetItem);
}
......
......@@ -98,7 +98,7 @@ void EventView::setHolidayRegions(const QStringList &regions)
qDeleteAll(d->mHolidayRegions);
d->mHolidayRegions.clear();
for (const QString &regionStr : regions) {
KHolidays::HolidayRegion *region = new KHolidays::HolidayRegion(regionStr);
auto *region = new KHolidays::HolidayRegion(regionStr);
if (region->isValid()) {
d->mHolidayRegions.append(region);
} else {
......@@ -529,7 +529,7 @@ void EventView::restoreConfig(const KConfigGroup &configGroup)
} else if (useCustom) {
if (!d->collectionSelectionModel) {
// Sort the calendar model on calendar name
QSortFilterProxyModel *sortProxy = new QSortFilterProxyModel(this);
auto *sortProxy = new QSortFilterProxyModel(this);
sortProxy->setDynamicSortFilter(true);
sortProxy->setSortCaseSensitivity(Qt::CaseInsensitive);
......@@ -538,7 +538,7 @@ void EventView::restoreConfig(const KConfigGroup &configGroup)
}
// Only show the first column.
KRearrangeColumnsProxyModel *columnFilterProxy = new KRearrangeColumnsProxyModel(this);
auto *columnFilterProxy = new KRearrangeColumnsProxyModel(this);
columnFilterProxy->setSourceColumns(
QVector<int>() << Akonadi::ETMCalendar::CollectionTitle);
columnFilterProxy->setSourceModel(sortProxy);
......
......@@ -38,10 +38,10 @@ void EventViews::setResourceColor(const Akonadi::Collection &coll, const QColor
// Save the color in akonadi (so the resource can even save it server-side)
Akonadi::Collection collection = coll;
Akonadi::CollectionColorAttribute *colorAttr
auto *colorAttr
= collection.attribute<Akonadi::CollectionColorAttribute>(Akonadi::Collection::AddIfMissing);
colorAttr->setColor(color);
Akonadi::CollectionModifyJob *job = new Akonadi::CollectionModifyJob(collection, nullptr);
auto *job = new Akonadi::CollectionModifyJob(collection, nullptr);
QObject::connect(job, &Akonadi::CollectionModifyJob::result, [=]() {
if (job->error()) {
qCWarning(CALENDARVIEW_LOG) << "Failed to set CollectionColorAttribute:" << job->errorString();
......@@ -65,7 +65,7 @@ QColor EventViews::resourceColor(const Akonadi::Collection &coll, const PrefsPtr
}
// Color stored in akonadi
if (coll.hasAttribute<Akonadi::CollectionColorAttribute>()) {
const Akonadi::CollectionColorAttribute *colorAttr
const auto *colorAttr
= coll.attribute<Akonadi::CollectionColorAttribute>();
if (colorAttr && colorAttr->color().isValid()) {
return colorAttr->color();
......
......@@ -64,9 +64,9 @@ void JournalDateView::addJournal(const Akonadi::Item &j)
QWidget *container = new QWidget(this);
layout()->addWidget(container);
QHBoxLayout *layout = new QHBoxLayout(container);
auto *layout = new QHBoxLayout(container);
layout->addStretch(1);
JournalFrame *entry = new JournalFrame(j, mCalendar, this);
auto *entry = new JournalFrame(j, mCalendar, this);
layout->addWidget(entry, 3 /*stretch*/);
layout->addStretch(1);
......@@ -140,14 +140,14 @@ JournalFrame::JournalFrame(const Akonadi::Item &j, const Akonadi::ETMCalendar::P
mWriteInProgress = false;
mChanger = nullptr;
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
auto *verticalLayout = new QVBoxLayout(this);
mBrowser = new QTextBrowser(this);
mBrowser->viewport()->installEventFilter(this);
mBrowser->setFrameStyle(QFrame::NoFrame);
verticalLayout->addWidget(mBrowser);
QHBoxLayout *buttonsLayout = new QHBoxLayout();
auto *buttonsLayout = new QHBoxLayout();
verticalLayout->addLayout(buttonsLayout);
buttonsLayout->addStretch();
......
......@@ -23,11 +23,11 @@ using namespace EventViews;
JournalView::JournalView(QWidget *parent) : EventView(parent)
{
QVBoxLayout *topLayout = new QVBoxLayout(this);
auto *topLayout = new QVBoxLayout(this);
topLayout->setContentsMargins(0, 0, 0, 0);
mSA = new QScrollArea(this);
mCurrentWidget = new QWidget(mSA->viewport());
QVBoxLayout *mVBoxVBoxLayout = new QVBoxLayout(mCurrentWidget);
auto *mVBoxVBoxLayout = new QVBoxLayout(mCurrentWidget);
mVBoxVBoxLayout->setContentsMargins(0, 0, 0, 0);
mSA->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
mSA->setWidgetResizable(true);
......
......@@ -79,7 +79,7 @@ public:
bool ListViewItem::operator<(const QTreeWidgetItem &other) const
{
const ListViewItem *otheritem = static_cast<const ListViewItem *>(&other);
const auto *otheritem = static_cast<const ListViewItem *>(&other);
switch (treeWidget()->sortColumn()) {
case StartDateTime_Column:
......@@ -334,7 +334,7 @@ Akonadi::Item::List ListView::selectedIncidences() const
QTreeWidgetItem *item = d->mTreeWidget->selectedItems().isEmpty() ? nullptr
: d->mTreeWidget->selectedItems().first();
if (item) {
ListViewItem *i = static_cast<ListViewItem *>(item);
auto *i = static_cast<ListViewItem *>(item);
eventList.append(i->mIncidence);
}
return eventList;
......@@ -437,7 +437,7 @@ void ListView::Private::addIncidence(const Akonadi::ETMCalendar::Ptr &calendar,
tinc->setReadOnly(true);
}
}
ListViewItem *item = new ListViewItem(aitem, mTreeWidget);
auto *item = new ListViewItem(aitem, mTreeWidget);
// set tooltips
for (int col = 0; col < Dummy_EOF_Column; ++col) {
......@@ -511,7 +511,7 @@ ListViewItem *ListView::Private::getItemForIncidence(const Akonadi::Item &aitem)
{
int index = 0;
while (QTreeWidgetItem *it = mTreeWidget->topLevelItem(index)) {
ListViewItem *item = static_cast<ListViewItem *>(it);
auto *item = static_cast<ListViewItem *>(it);
if (item->mIncidence.id() == aitem.id()) {
return item;
}
......
......@@ -80,7 +80,7 @@ void MonthItem::updateMonthGraphicsItems()
}
// A new item needs to be created
MonthGraphicsItem *newItem = new MonthGraphicsItem(this);
auto *newItem = new MonthGraphicsItem(this);
mMonthGraphicsItemList << newItem;
newItem->setStartDate(start);
newItem->setDaySpan(span);
......@@ -239,7 +239,7 @@ bool MonthItem::greaterThan(const MonthItem *e1, const MonthItem *e2)
bool MonthItem::greaterThanFallback(const MonthItem *other) const
{
const HolidayMonthItem *h = qobject_cast<const HolidayMonthItem *>(other);
const auto *h = qobject_cast<const HolidayMonthItem *>(other);
// If "other" is a holiday, display it first.
return !h;
......@@ -322,7 +322,7 @@ IncidenceMonthItem::~IncidenceMonthItem()
bool IncidenceMonthItem::greaterThanFallback(const MonthItem *other) const
{
const IncidenceMonthItem *o = qobject_cast<const IncidenceMonthItem *>(other);
const auto *o = qobject_cast<const IncidenceMonthItem *>(other);
if (!o) {
return MonthItem::greaterThanFallback(other);
}
......@@ -707,7 +707,7 @@ HolidayMonthItem::~HolidayMonthItem()
bool HolidayMonthItem::greaterThanFallback(const MonthItem *other) const
{
const HolidayMonthItem *o = qobject_cast<const HolidayMonthItem *>(other);
const auto *o = qobject_cast<const HolidayMonthItem *>(other);
if (o) {
return MonthItem::greaterThanFallback(other);
}
......
......@@ -496,7 +496,7 @@ void MonthScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *mouseEvent)
MonthGraphicsItem *iItem = dynamic_cast<MonthGraphicsItem *>(itemAt(pos, {}));
if (iItem) {
if (iItem->monthItem()) {
IncidenceMonthItem *tmp = qobject_cast<IncidenceMonthItem *>(iItem->monthItem());
auto *tmp = qobject_cast<IncidenceMonthItem *>(iItem->monthItem());
if (tmp) {
selectItem(iItem->monthItem());
mMonthView->defaultAction(tmp->akonadiItem());
......@@ -584,7 +584,7 @@ void MonthScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
selectItem(mClickedItem);
if (mouseEvent->button() == Qt::RightButton) {
IncidenceMonthItem *tmp = qobject_cast<IncidenceMonthItem *>(mClickedItem);
auto *tmp = qobject_cast<IncidenceMonthItem *>(mClickedItem);
if (tmp) {
Q_EMIT showIncidencePopupSignal(tmp->akonadiItem(), tmp->realStartDate());
}
......@@ -725,7 +725,7 @@ void MonthScene::selectItem(MonthItem *item)
Another solution would be to have two Q_SIGNALS: incidenceSelected() and incidenceClicked()
*/
IncidenceMonthItem *tmp = qobject_cast<IncidenceMonthItem *>(item);
auto *tmp = qobject_cast<IncidenceMonthItem *>(item);
if (!tmp) {
mSelectedItem = nullptr;
......@@ -747,7 +747,7 @@ void MonthScene::selectItem(MonthItem *item)
void MonthScene::removeIncidence(const QString &uid)
{
for (MonthItem *manager : qAsConst(mManagerList)) {
IncidenceMonthItem *imi = qobject_cast<IncidenceMonthItem *>(manager);
auto *imi = qobject_cast<IncidenceMonthItem *>(manager);
if (!imi) {
continue;
}
......
......@@ -143,12 +143,12 @@ MonthView::MonthView(NavButtonsVisibility visibility, QWidget *parent)
: EventView(parent)
, d(new MonthViewPrivate(this))
{
QHBoxLayout *topLayout = new QHBoxLayout(this);
auto *topLayout = new QHBoxLayout(this);
topLayout->addWidget(d->view);
topLayout->setContentsMargins(0, 0, 0, 0);
if (visibility == Visible) {
QVBoxLayout *rightLayout = new QVBoxLayout();
auto *rightLayout = new QVBoxLayout();
rightLayout->setSpacing(0);
rightLayout->setContentsMargins(0, 0, 0, 0);
......@@ -172,7 +172,7 @@ MonthView::MonthView(NavButtonsVisibility visibility, QWidget *parent)
connect(d->fullView, &QAbstractButton::clicked,
this, &MonthView::changeFullView);
QToolButton *minusMonth = new QToolButton(this);
auto *minusMonth = new QToolButton(this);
minusMonth->setIcon(QIcon::fromTheme(QStringLiteral("arrow-up-double")));
minusMonth->setAutoRaise(true);
minusMonth->setToolTip(i18nc("@info:tooltip", "Go back one month"));
......@@ -182,7 +182,7 @@ MonthView::MonthView(NavButtonsVisibility visibility, QWidget *parent)
connect(minusMonth, &QAbstractButton::clicked,
this, &MonthView::moveBackMonth);
QToolButton *minusWeek = new QToolButton(this);
auto *minusWeek = new QToolButton(this);
minusWeek->setIcon(QIcon::fromTheme(QStringLiteral("arrow-up")));
minusWeek->setAutoRaise(true);
minusWeek->setToolTip(i18nc("@info:tooltip", "Go back one week"));
......@@ -192,7 +192,7 @@ MonthView::MonthView(NavButtonsVisibility visibility, QWidget *parent)
connect(minusWeek, &QAbstractButton::clicked,
this, &MonthView::moveBackWeek);
QToolButton *plusWeek = new QToolButton(this);
auto *plusWeek = new QToolButton(this);
plusWeek->setIcon(QIcon::fromTheme(QStringLiteral("arrow-down")));
plusWeek->setAutoRaise(true);
plusWeek->setToolTip(i18nc("@info:tooltip", "Go forward one week"));
......@@ -202,7 +202,7 @@ MonthView::MonthView(NavButtonsVisibility visibility, QWidget *parent)
connect(plusWeek, &QAbstractButton::clicked,
this, &MonthView::moveFwdWeek);
QToolButton *plusMonth = new QToolButton(this);
auto *plusMonth = new QToolButton(this);
plusMonth->setIcon(QIcon::fromTheme(QStringLiteral("arrow-down-double")));
plusMonth->setAutoRaise(true);
plusMonth->setToolTip(i18nc("@info:tooltip", "Go forward one month"));
......@@ -267,7 +267,7 @@ KCalendarCore::DateList MonthView::selectedIncidenceDates() const
{
KCalendarCore::DateList list;
if (d->scene->selectedItem()) {
IncidenceMonthItem *tmp = qobject_cast<IncidenceMonthItem *>(d->scene->selectedItem());
auto *tmp = qobject_cast<IncidenceMonthItem *>(d->scene->selectedItem());
if (tmp) {
QDate selectedItemDate = tmp->realStartDate();
if (selectedItemDate.isValid()) {
......@@ -453,7 +453,7 @@ Akonadi::Item::List MonthView::selectedIncidences() const
{
Akonadi::Item::List selected;
if (d->scene->selectedItem()) {
IncidenceMonthItem *tmp = qobject_cast<IncidenceMonthItem *>(d->scene->selectedItem());
auto *tmp = qobject_cast<IncidenceMonthItem *>(d->scene->selectedItem());
if (tmp) {
Akonadi::Item incidenceSelected = tmp->akonadiItem();
if (incidenceSelected.isValid()) {
......@@ -474,7 +474,7 @@ void MonthView::reloadIncidences()
MonthItem *itemToReselect = nullptr;
if (IncidenceMonthItem *tmp = qobject_cast<IncidenceMonthItem *>(d->scene->selectedItem())) {
if (auto *tmp = qobject_cast<IncidenceMonthItem *>(d->scene->selectedItem())) {
d->selectedItemId = tmp->akonadiItem().id();
d->selectedItemDate = tmp->realStartDate();
if (!d->selectedItemDate.isValid()) {
......
......@@ -141,7 +141,7 @@ MultiAgendaView::MultiAgendaView(QWidget *parent)
: EventView(parent)
, d(new Private(this))
{
QHBoxLayout *topLevelLayout = new QHBoxLayout(this);
auto *topLevelLayout = new QHBoxLayout(this);
topLevelLayout->setSpacing(0);
topLevelLayout->setContentsMargins(0, 0, 0, 0);
......@@ -149,7 +149,7 @@ MultiAgendaView::MultiAgendaView(QWidget *parent)
int topLabelHeight = 2 * fm.height() + fm.lineSpacing();
QWidget *topSideBox = new QWidget(this);
QVBoxLayout *topSideBoxVBoxLayout = new QVBoxLayout(topSideBox);
auto *topSideBoxVBoxLayout = new QVBoxLayout(topSideBox);
topSideBoxVBoxLayout->setContentsMargins(0, 0, 0, 0);
QWidget *topSideSpacer = new QWidget(topSideBox);
......@@ -164,7 +164,7 @@ MultiAgendaView::MultiAgendaView(QWidget *parent)
d->mLabel->setWordWrap(true);
QWidget *sideBox = new QWidget(d->mLeftSplitter);
QVBoxLayout *sideBoxVBoxLayout = new QVBoxLayout(sideBox);
auto *sideBoxVBoxLayout = new QVBoxLayout(sideBox);
sideBoxVBoxLayout->setContentsMargins(0, 0, 0, 0);
// compensate for the frame the agenda views but not the timelabels have
......@@ -195,7 +195,7 @@ MultiAgendaView::MultiAgendaView(QWidget *parent)
d->mScrollArea->setFrameShape(QFrame::NoFrame);
topLevelLayout->addWidget(d->mScrollArea, 100);
d->mTopBox = new QWidget(d->mScrollArea->viewport());
QHBoxLayout *mTopBoxHBoxLayout = new QHBoxLayout(d->mTopBox);
auto *mTopBoxHBoxLayout = new QHBoxLayout(d->mTopBox);
mTopBoxHBoxLayout->setContentsMargins(0, 0, 0, 0);
d->mScrollArea->setWidget(d->mTopBox);
......@@ -468,7 +468,7 @@ AgendaView *MultiAgendaView::Private::createView(const QString &title)
{
QWidget *box = new QWidget(mTopBox);
mTopBox->layout()->addWidget(box);
QVBoxLayout *layout = new QVBoxLayout(box);
auto *layout = new QVBoxLayout(box);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(new ElidedLabel(title));
AgendaView *av = new AgendaView(q->preferences(),
......@@ -574,7 +574,7 @@ void MultiAgendaView::resizeSplitters()
return;
}
QSplitter *lastMovedSplitter = qobject_cast<QSplitter *>(sender());
auto *lastMovedSplitter = qobject_cast<QSplitter *>(sender());
if (!lastMovedSplitter) {
lastMovedSplitter = d->mLeftSplitter;
}
......@@ -688,22 +688,22 @@ void MultiAgendaView::doRestoreConfig(const KConfigGroup &configGroup)
d->mCollectionSelectionModels.resize(d->mCustomNumberOfColumns);
for (int i = 0; i < d->mCustomNumberOfColumns; ++i) {
// Sort the calanders by name
QSortFilterProxyModel *sortProxy = new QSortFilterProxyModel(this);
auto *sortProxy = new QSortFilterProxyModel(this);
sortProxy->setDynamicSortFilter(true);
sortProxy->setSourceModel(calendar()->entityTreeModel());
// Only show the first column
KRearrangeColumnsProxyModel *columnFilterProxy = new KRearrangeColumnsProxyModel(this);
auto *columnFilterProxy = new KRearrangeColumnsProxyModel(this);
columnFilterProxy->setSourceColumns(
QVector<int>() << Akonadi::ETMCalendar::CollectionTitle);
columnFilterProxy->setSourceModel(sortProxy);
// Keep track of selection.
QItemSelectionModel *qsm = new QItemSelectionModel(columnFilterProxy);
auto *qsm = new QItemSelectionModel(columnFilterProxy);
// Make the model checkable.
KCheckableProxyModel *checkableProxy = new KCheckableProxyModel(this);
auto *checkableProxy = new KCheckableProxyModel(this);
checkableProxy->setSourceModel(columnFilterProxy);
checkableProxy->setSelectionModel(qsm);
const QString groupName
......
......@@ -275,7 +275,7 @@ void Prefs::Private::setBool(KCoreConfigSkeleton::ItemBool *baseConfigItem, bool
{
KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem);
if (appItem) {
KCoreConfigSkeleton::ItemBool *item
auto *item
= dynamic_cast<KCoreConfigSkeleton::ItemBool *>(appItem);
if (item) {
item->setValue(value);
......@@ -292,7 +292,7 @@ bool Prefs::Private::getBool(const KCoreConfigSkeleton::ItemBool *baseConfigItem
{
KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem);
if (appItem) {
KCoreConfigSkeleton::ItemBool *item
auto *item
= dynamic_cast<KCoreConfigSkeleton::ItemBool *>(appItem);
if (item) {
return item->value();
......@@ -307,7 +307,7 @@ void Prefs::Private::setInt(KCoreConfigSkeleton::ItemInt *baseConfigItem, int va
{
KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem);
if (appItem) {
KCoreConfigSkeleton::ItemInt *item = dynamic_cast<KCoreConfigSkeleton::ItemInt *>(appItem);
auto *item = dynamic_cast<KCoreConfigSkeleton::ItemInt *>(appItem);
if (item) {
item->setValue(value);
} else {
......@@ -323,7 +323,7 @@ int Prefs::Private::getInt(const KCoreConfigSkeleton::ItemInt *baseConfigItem) c
{
KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem);
if (appItem) {
KCoreConfigSkeleton::ItemInt *item = dynamic_cast<KCoreConfigSkeleton::ItemInt *>(appItem);
auto *item = dynamic_cast<KCoreConfigSkeleton::ItemInt *>(appItem);
if (item) {
return item->value();
}
......@@ -338,7 +338,7 @@ void Prefs::Private::setString(KCoreConfigSkeleton::ItemString *baseConfigItem,
{
KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem);
if (appItem) {
KCoreConfigSkeleton::ItemString *item
auto *item
= dynamic_cast<KCoreConfigSkeleton::ItemString *>(appItem);
if (item) {
......@@ -356,7 +356,7 @@ QString Prefs::Private::getString(const KCoreConfigSkeleton::ItemString *baseCon
{
KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem);
if (appItem) {
KCoreConfigSkeleton::ItemString *item
auto *item
= dynamic_cast<KCoreConfigSkeleton::ItemString *>(appItem);
if (item) {
......@@ -373,7 +373,7 @@ void Prefs::Private::setDateTime(KCoreConfigSkeleton::ItemDateTime *baseConfigIt
{
KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem);
if (appItem) {
KCoreConfigSkeleton::ItemDateTime *item
auto *item
= dynamic_cast<KCoreConfigSkeleton::ItemDateTime *>(appItem);
if (item) {
......@@ -392,7 +392,7 @@ QDateTime Prefs::Private::getDateTime(
{
KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem);
if (appItem) {
KCoreConfigSkeleton::ItemDateTime *item
auto *item
= dynamic_cast<KCoreConfigSkeleton::ItemDateTime *>(appItem);
if (item) {
......@@ -409,7 +409,7 @@ void Prefs::Private::setStringList(KCoreConfigSkeleton::ItemStringList *baseConf
{
KConfigSkeletonItem *appItem = appConfigItem(baseConfigItem);
if (appItem) {
KCoreConfigSkeleton::ItemStringList *item
auto *item
= dynamic_cast<KCoreConfigSkeleton::ItemStringList *>(appItem);
if (item) {
......@@ -428,7 +428,7 @@ QStringList Prefs::Private::getStringList(