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: ...@@ -204,7 +204,7 @@ public:
, mHolidayMask(nullptr) , mHolidayMask(nullptr)
, mWorkingHoursYTop(0) , mWorkingHoursYTop(0)
, mWorkingHoursYBottom(0) , mWorkingHoursYBottom(0)
, mHasSelection(0) , mHasSelection(false)
, mSelectedId(-1) , mSelectedId(-1)
, mMarcusBains(nullptr) , mMarcusBains(nullptr)
, mActionType(Agenda::NOP) , mActionType(Agenda::NOP)
......
...@@ -1166,7 +1166,7 @@ bool AgendaItem::event(QEvent *event) ...@@ -1166,7 +1166,7 @@ bool AgendaItem::event(QEvent *event)
if (!mEventView->preferences()->enableToolTips()) { if (!mEventView->preferences()->enableToolTips()) {
return true; return true;
} else if (mValid) { } else if (mValid) {
QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event); auto *helpEvent = static_cast<QHelpEvent *>(event);
QToolTip::showText( QToolTip::showText(
helpEvent->globalPos(), helpEvent->globalPos(),
KCalUtils::IncidenceFormatter::toolTipStr( KCalUtils::IncidenceFormatter::toolTipStr(
......
...@@ -749,19 +749,19 @@ void AgendaView::init(QDate start, QDate end) ...@@ -749,19 +749,19 @@ void AgendaView::init(QDate start, QDate end)
} }
// The widget itself // The widget itself
AgendaScrollArea *allDayScrollArea = new AgendaScrollArea(true, this, d->mIsInteractive, auto *allDayScrollArea = new AgendaScrollArea(true, this, d->mIsInteractive,
d->mAllDayFrame); d->mAllDayFrame);
allDayFrameLayout->addWidget(allDayScrollArea); allDayFrameLayout->addWidget(allDayScrollArea);
d->mAllDayAgenda = allDayScrollArea->agenda(); d->mAllDayAgenda = allDayScrollArea->agenda();
/* Create the main agenda widget and the related widgets */ /* Create the main agenda widget and the related widgets */
QWidget *agendaFrame = new QWidget(d->mSplitterAgenda); QWidget *agendaFrame = new QWidget(d->mSplitterAgenda);
QHBoxLayout *agendaLayout = new QHBoxLayout(agendaFrame); auto *agendaLayout = new QHBoxLayout(agendaFrame);
agendaLayout->setContentsMargins(0, 0, 0, 0); agendaLayout->setContentsMargins(0, 0, 0, 0);
agendaLayout->setSpacing(SPACING); agendaLayout->setSpacing(SPACING);
// Create agenda // Create agenda
AgendaScrollArea *scrollArea = new AgendaScrollArea(false, this, d->mIsInteractive, auto *scrollArea = new AgendaScrollArea(false, this, d->mIsInteractive,
agendaFrame); agendaFrame);
d->mAgenda = scrollArea->agenda(); d->mAgenda = scrollArea->agenda();
...@@ -774,7 +774,7 @@ void AgendaView::init(QDate start, QDate end) ...@@ -774,7 +774,7 @@ void AgendaView::init(QDate start, QDate end)
// This timeLabelsZoneLayout is for adding some spacing // This timeLabelsZoneLayout is for adding some spacing
// to align timelabels, to agenda's grid // to align timelabels, to agenda's grid
QVBoxLayout *timeLabelsZoneLayout = new QVBoxLayout(); auto *timeLabelsZoneLayout = new QVBoxLayout();
agendaLayout->addLayout(timeLabelsZoneLayout); agendaLayout->addLayout(timeLabelsZoneLayout);
agendaLayout->addWidget(scrollArea); agendaLayout->addWidget(scrollArea);
...@@ -1052,7 +1052,7 @@ void AgendaView::zoomView(const int delta, const QPoint &pos, const Qt::Orientat ...@@ -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 // TODO find out why this is necessary. seems to be some kind of performance hack
static QDate zoomDate; 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 selected incidence, on the other way
// zoom to the date on screen after the first mousewheel move. // zoom to the date on screen after the first mousewheel move.
...@@ -1130,7 +1130,7 @@ void AgendaView::placeDecorations(DecorationList &decoList, const QDate &date, Q ...@@ -1130,7 +1130,7 @@ void AgendaView::placeDecorations(DecorationList &decoList, const QDate &date, Q
decoHBox->setMinimumWidth(1); decoHBox->setMinimumWidth(1);
for (CalendarDecoration::Element *it : elements) { for (CalendarDecoration::Element *it : elements) {
DecorationLabel *label = new DecorationLabel(it, decoHBox); auto *label = new DecorationLabel(it, decoHBox);
label->setAlignment(Qt::AlignBottom); label->setAlignment(Qt::AlignBottom);
label->setMinimumWidth(1); label->setMinimumWidth(1);
layout->addWidget(label); layout->addWidget(label);
...@@ -1165,7 +1165,7 @@ void AgendaView::createDayLabels(bool force) ...@@ -1165,7 +1165,7 @@ void AgendaView::createDayLabels(bool force)
d->mLayoutTopDayLabels->setSpacing(1); d->mLayoutTopDayLabels->setSpacing(1);
// this spacer moves the day labels over to line up with the day columns // 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) = new QSpacerItem((!d->mIsSideBySide ? d->mTimeLabelsZone->width() : 0)
+SPACING +SPACING
+d->mAllDayAgenda->scrollArea()->frameWidth(), +d->mAllDayAgenda->scrollArea()->frameWidth(),
...@@ -1224,7 +1224,7 @@ void AgendaView::createDayLabels(bool force) ...@@ -1224,7 +1224,7 @@ void AgendaView::createDayLabels(bool force)
date.day()); date.day());
QString shortstr = QString::number(date.day()); QString shortstr = QString::number(date.day());
AlternateLabel *dayLabel auto *dayLabel
= new AlternateLabel(shortstr, longstr, veryLongStr, topDayLabelBox); = new AlternateLabel(shortstr, longstr, veryLongStr, topDayLabelBox);
topDayLabelBoxLayout->addWidget(dayLabel); topDayLabelBoxLayout->addWidget(dayLabel);
dayLabel->useShortText(); // will be recalculated in updateDayLabelSizes() anyway dayLabel->useShortText(); // will be recalculated in updateDayLabelSizes() anyway
...@@ -1253,7 +1253,7 @@ void AgendaView::createDayLabels(bool force) ...@@ -1253,7 +1253,7 @@ void AgendaView::createDayLabels(bool force)
#endif #endif
} }
QSpacerItem *rightSpacer = new QSpacerItem(d->mAllDayAgenda->scrollArea()->frameWidth(), auto *rightSpacer = new QSpacerItem(d->mAllDayAgenda->scrollArea()->frameWidth(),
1, QSizePolicy::Fixed); 1, QSizePolicy::Fixed);
d->mLayoutTopDayLabels->addSpacerItem(rightSpacer); d->mLayoutTopDayLabels->addSpacerItem(rightSpacer);
...@@ -1420,7 +1420,7 @@ void AgendaView::createTimeBarHeaders() ...@@ -1420,7 +1420,7 @@ void AgendaView::createTimeBarHeaders()
const auto lst = d->mTimeLabelsZone->timeLabels(); const auto lst = d->mTimeLabelsZone->timeLabels();
for (QScrollArea *area : lst) { for (QScrollArea *area : lst) {
TimeLabels *timeLabel = static_cast<TimeLabels *>(area->widget()); auto *timeLabel = static_cast<TimeLabels *>(area->widget());
QLabel *label QLabel *label
= new QLabel(timeLabel->header().replace(QLatin1Char('/'), QStringLiteral("/ ")), = new QLabel(timeLabel->header().replace(QLatin1Char('/'), QStringLiteral("/ ")),
d->mTimeBarHeaderFrame); d->mTimeBarHeaderFrame);
......
...@@ -415,7 +415,7 @@ QString TimeLabels::headerToolTip() const ...@@ -415,7 +415,7 @@ QString TimeLabels::headerToolTip() const
bool TimeLabels::event(QEvent *event) bool TimeLabels::event(QEvent *event)
{ {
if (event->type() == QEvent::ToolTip) { if (event->type() == QEvent::ToolTip) {
QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event); auto *helpEvent = static_cast<QHelpEvent *>(event);
const int cell = yposToCell(helpEvent->pos().y()); const int cell = yposToCell(helpEvent->pos().y());
QString toolTip; QString toolTip;
......
...@@ -66,8 +66,8 @@ void TimeLabelsZone::init() ...@@ -66,8 +66,8 @@ void TimeLabelsZone::init()
void TimeLabelsZone::addTimeLabels(const QTimeZone &zone) void TimeLabelsZone::addTimeLabels(const QTimeZone &zone)
{ {
QScrollArea *area = new QScrollArea(this); auto *area = new QScrollArea(this);
TimeLabels *labels = new TimeLabels(zone, 24, this); auto *labels = new TimeLabels(zone, 24, this);
mTimeLabelsList.prepend(area); mTimeLabelsList.prepend(area);
area->setWidgetResizable(true); area->setWidgetResizable(true);
area->setWidget(labels); area->setWidget(labels);
...@@ -94,7 +94,7 @@ void TimeLabelsZone::setupTimeLabel(QScrollArea *area) ...@@ -94,7 +94,7 @@ void TimeLabelsZone::setupTimeLabel(QScrollArea *area)
area->verticalScrollBar()->setValue(mAgenda->verticalScrollBar()->value()); area->verticalScrollBar()->setValue(mAgenda->verticalScrollBar()->value());
} }
TimeLabels *timeLabels = static_cast<TimeLabels *>(area->widget()); auto *timeLabels = static_cast<TimeLabels *>(area->widget());
timeLabels->setAgenda(mAgenda); timeLabels->setAgenda(mAgenda);
// timelabel's scroll is just a slave, this shouldn't be here // timelabel's scroll is just a slave, this shouldn't be here
...@@ -116,7 +116,7 @@ int TimeLabelsZone::preferedTimeLabelsWidth() const ...@@ -116,7 +116,7 @@ int TimeLabelsZone::preferedTimeLabelsWidth() const
void TimeLabelsZone::updateAll() void TimeLabelsZone::updateAll()
{ {
for (QScrollArea *area : qAsConst(mTimeLabelsList)) { for (QScrollArea *area : qAsConst(mTimeLabelsList)) {
TimeLabels *timeLabel = static_cast<TimeLabels *>(area->widget()); auto *timeLabel = static_cast<TimeLabels *>(area->widget());
timeLabel->updateConfig(); timeLabel->updateConfig();
} }
} }
...@@ -141,7 +141,7 @@ void TimeLabelsZone::updateTimeLabelsPosition() ...@@ -141,7 +141,7 @@ void TimeLabelsZone::updateTimeLabelsPosition()
if (mAgenda) { if (mAgenda) {
const auto lst = timeLabels(); const auto lst = timeLabels();
for (QScrollArea *area : lst) { for (QScrollArea *area : lst) {
TimeLabels *label = static_cast<TimeLabels *>(area->widget()); auto *label = static_cast<TimeLabels *>(area->widget());
const int adjustment = mAgenda->contentsY(); const int adjustment = mAgenda->contentsY();
// y() is the offset to our parent (QScrollArea) // y() is the offset to our parent (QScrollArea)
// and gets negative as we scroll // and gets negative as we scroll
......
...@@ -51,7 +51,7 @@ TimeScaleConfigDialog::TimeScaleConfigDialog(const PrefsPtr &preferences, QWidge ...@@ -51,7 +51,7 @@ TimeScaleConfigDialog::TimeScaleConfigDialog(const PrefsPtr &preferences, QWidge
, d(new Private(this, preferences)) , d(new Private(this, preferences))
{ {
setWindowTitle(i18nc("@title:window", "Timezone")); setWindowTitle(i18nc("@title:window", "Timezone"));
QVBoxLayout *mainLayout = new QVBoxLayout(this); auto *mainLayout = new QVBoxLayout(this);
setModal(true); setModal(true);
QWidget *mainwidget = new QWidget(this); QWidget *mainwidget = new QWidget(this);
...@@ -106,7 +106,7 @@ TimeScaleConfigDialog::TimeScaleConfigDialog(const PrefsPtr &preferences, QWidge ...@@ -106,7 +106,7 @@ TimeScaleConfigDialog::TimeScaleConfigDialog(const PrefsPtr &preferences, QWidge
this, &TimeScaleConfigDialog::slotUpdateButton); this, &TimeScaleConfigDialog::slotUpdateButton);
for (const TimeZoneNamePair &item : qAsConst(selList)) { for (const TimeZoneNamePair &item : qAsConst(selList)) {
QListWidgetItem *widgetItem = new QListWidgetItem(item.first); auto *widgetItem = new QListWidgetItem(item.first);
widgetItem->setData(TimeZoneNameRole, item.second); widgetItem->setData(TimeZoneNameRole, item.second);
listWidget->addItem(widgetItem); listWidget->addItem(widgetItem);
} }
......
...@@ -98,7 +98,7 @@ void EventView::setHolidayRegions(const QStringList &regions) ...@@ -98,7 +98,7 @@ void EventView::setHolidayRegions(const QStringList &regions)
qDeleteAll(d->mHolidayRegions); qDeleteAll(d->mHolidayRegions);
d->mHolidayRegions.clear(); d->mHolidayRegions.clear();
for (const QString &regionStr : regions) { for (const QString &regionStr : regions) {
KHolidays::HolidayRegion *region = new KHolidays::HolidayRegion(regionStr); auto *region = new KHolidays::HolidayRegion(regionStr);
if (region->isValid()) { if (region->isValid()) {
d->mHolidayRegions.append(region); d->mHolidayRegions.append(region);
} else { } else {
...@@ -529,7 +529,7 @@ void EventView::restoreConfig(const KConfigGroup &configGroup) ...@@ -529,7 +529,7 @@ void EventView::restoreConfig(const KConfigGroup &configGroup)
} else if (useCustom) { } else if (useCustom) {
if (!d->collectionSelectionModel) { if (!d->collectionSelectionModel) {
// Sort the calendar model on calendar name // Sort the calendar model on calendar name
QSortFilterProxyModel *sortProxy = new QSortFilterProxyModel(this); auto *sortProxy = new QSortFilterProxyModel(this);
sortProxy->setDynamicSortFilter(true); sortProxy->setDynamicSortFilter(true);
sortProxy->setSortCaseSensitivity(Qt::CaseInsensitive); sortProxy->setSortCaseSensitivity(Qt::CaseInsensitive);
...@@ -538,7 +538,7 @@ void EventView::restoreConfig(const KConfigGroup &configGroup) ...@@ -538,7 +538,7 @@ void EventView::restoreConfig(const KConfigGroup &configGroup)
} }
// Only show the first column. // Only show the first column.
KRearrangeColumnsProxyModel *columnFilterProxy = new KRearrangeColumnsProxyModel(this); auto *columnFilterProxy = new KRearrangeColumnsProxyModel(this);
columnFilterProxy->setSourceColumns( columnFilterProxy->setSourceColumns(
QVector<int>() << Akonadi::ETMCalendar::CollectionTitle); QVector<int>() << Akonadi::ETMCalendar::CollectionTitle);
columnFilterProxy->setSourceModel(sortProxy); columnFilterProxy->setSourceModel(sortProxy);
......
...@@ -38,10 +38,10 @@ void EventViews::setResourceColor(const Akonadi::Collection &coll, const QColor ...@@ -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) // Save the color in akonadi (so the resource can even save it server-side)
Akonadi::Collection collection = coll; Akonadi::Collection collection = coll;
Akonadi::CollectionColorAttribute *colorAttr auto *colorAttr
= collection.attribute<Akonadi::CollectionColorAttribute>(Akonadi::Collection::AddIfMissing); = collection.attribute<Akonadi::CollectionColorAttribute>(Akonadi::Collection::AddIfMissing);
colorAttr->setColor(color); colorAttr->setColor(color);
Akonadi::CollectionModifyJob *job = new Akonadi::CollectionModifyJob(collection, nullptr); auto *job = new Akonadi::CollectionModifyJob(collection, nullptr);
QObject::connect(job, &Akonadi::CollectionModifyJob::result, [=]() { QObject::connect(job, &Akonadi::CollectionModifyJob::result, [=]() {
if (job->error()) { if (job->error()) {
qCWarning(CALENDARVIEW_LOG) << "Failed to set CollectionColorAttribute:" << job->errorString(); qCWarning(CALENDARVIEW_LOG) << "Failed to set CollectionColorAttribute:" << job->errorString();
...@@ -65,7 +65,7 @@ QColor EventViews::resourceColor(const Akonadi::Collection &coll, const PrefsPtr ...@@ -65,7 +65,7 @@ QColor EventViews::resourceColor(const Akonadi::Collection &coll, const PrefsPtr
} }
// Color stored in akonadi // Color stored in akonadi
if (coll.hasAttribute<Akonadi::CollectionColorAttribute>()) { if (coll.hasAttribute<Akonadi::CollectionColorAttribute>()) {
const Akonadi::CollectionColorAttribute *colorAttr const auto *colorAttr
= coll.attribute<Akonadi::CollectionColorAttribute>(); = coll.attribute<Akonadi::CollectionColorAttribute>();
if (colorAttr && colorAttr->color().isValid()) { if (colorAttr && colorAttr->color().isValid()) {
return colorAttr->color(); return colorAttr->color();
......
...@@ -64,9 +64,9 @@ void JournalDateView::addJournal(const Akonadi::Item &j) ...@@ -64,9 +64,9 @@ void JournalDateView::addJournal(const Akonadi::Item &j)
QWidget *container = new QWidget(this); QWidget *container = new QWidget(this);
layout()->addWidget(container); layout()->addWidget(container);
QHBoxLayout *layout = new QHBoxLayout(container); auto *layout = new QHBoxLayout(container);
layout->addStretch(1); layout->addStretch(1);
JournalFrame *entry = new JournalFrame(j, mCalendar, this); auto *entry = new JournalFrame(j, mCalendar, this);
layout->addWidget(entry, 3 /*stretch*/); layout->addWidget(entry, 3 /*stretch*/);
layout->addStretch(1); layout->addStretch(1);
...@@ -140,14 +140,14 @@ JournalFrame::JournalFrame(const Akonadi::Item &j, const Akonadi::ETMCalendar::P ...@@ -140,14 +140,14 @@ JournalFrame::JournalFrame(const Akonadi::Item &j, const Akonadi::ETMCalendar::P
mWriteInProgress = false; mWriteInProgress = false;
mChanger = nullptr; mChanger = nullptr;
QVBoxLayout *verticalLayout = new QVBoxLayout(this); auto *verticalLayout = new QVBoxLayout(this);
mBrowser = new QTextBrowser(this); mBrowser = new QTextBrowser(this);
mBrowser->viewport()->installEventFilter(this); mBrowser->viewport()->installEventFilter(this);
mBrowser->setFrameStyle(QFrame::NoFrame); mBrowser->setFrameStyle(QFrame::NoFrame);
verticalLayout->addWidget(mBrowser); verticalLayout->addWidget(mBrowser);
QHBoxLayout *buttonsLayout = new QHBoxLayout(); auto *buttonsLayout = new QHBoxLayout();
verticalLayout->addLayout(buttonsLayout); verticalLayout->addLayout(buttonsLayout);
buttonsLayout->addStretch(); buttonsLayout->addStretch();
......
...@@ -23,11 +23,11 @@ using namespace EventViews; ...@@ -23,11 +23,11 @@ using namespace EventViews;
JournalView::JournalView(QWidget *parent) : EventView(parent) JournalView::JournalView(QWidget *parent) : EventView(parent)
{ {
QVBoxLayout *topLayout = new QVBoxLayout(this); auto *topLayout = new QVBoxLayout(this);
topLayout->setContentsMargins(0, 0, 0, 0); topLayout->setContentsMargins(0, 0, 0, 0);
mSA = new QScrollArea(this); mSA = new QScrollArea(this);
mCurrentWidget = new QWidget(mSA->viewport()); mCurrentWidget = new QWidget(mSA->viewport());
QVBoxLayout *mVBoxVBoxLayout = new QVBoxLayout(mCurrentWidget); auto *mVBoxVBoxLayout = new QVBoxLayout(mCurrentWidget);
mVBoxVBoxLayout->setContentsMargins(0, 0, 0, 0); mVBoxVBoxLayout->setContentsMargins(0, 0, 0, 0);
mSA->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); mSA->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
mSA->setWidgetResizable(true); mSA->setWidgetResizable(true);
......
...@@ -79,7 +79,7 @@ public: ...@@ -79,7 +79,7 @@ public:
bool ListViewItem::operator<(const QTreeWidgetItem &other) const 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()) { switch (treeWidget()->sortColumn()) {
case StartDateTime_Column: case StartDateTime_Column:
...@@ -334,7 +334,7 @@ Akonadi::Item::List ListView::selectedIncidences() const ...@@ -334,7 +334,7 @@ Akonadi::Item::List ListView::selectedIncidences() const
QTreeWidgetItem *item = d->mTreeWidget->selectedItems().isEmpty() ? nullptr QTreeWidgetItem *item = d->mTreeWidget->selectedItems().isEmpty() ? nullptr
: d->mTreeWidget->selectedItems().first(); : d->mTreeWidget->selectedItems().first();
if (item) { if (item) {
ListViewItem *i = static_cast<ListViewItem *>(item); auto *i = static_cast<ListViewItem *>(item);
eventList.append(i->mIncidence); eventList.append(i->mIncidence);
} }
return eventList; return eventList;
...@@ -437,7 +437,7 @@ void ListView::Private::addIncidence(const Akonadi::ETMCalendar::Ptr &calendar, ...@@ -437,7 +437,7 @@ void ListView::Private::addIncidence(const Akonadi::ETMCalendar::Ptr &calendar,
tinc->setReadOnly(true); tinc->setReadOnly(true);
} }
} }
ListViewItem *item = new ListViewItem(aitem, mTreeWidget); auto *item = new ListViewItem(aitem, mTreeWidget);
// set tooltips // set tooltips
for (int col = 0; col < Dummy_EOF_Column; ++col) { for (int col = 0; col < Dummy_EOF_Column; ++col) {
...@@ -511,7 +511,7 @@ ListViewItem *ListView::Private::getItemForIncidence(const Akonadi::Item &aitem) ...@@ -511,7 +511,7 @@ ListViewItem *ListView::Private::getItemForIncidence(const Akonadi::Item &aitem)
{ {
int index = 0; int index = 0;
while (QTreeWidgetItem *it = mTreeWidget->topLevelItem(index)) { while (QTreeWidgetItem *it = mTreeWidget->topLevelItem(index)) {
ListViewItem *item = static_cast<ListViewItem *>(it); auto *item = static_cast<ListViewItem *>(it);
if (item->mIncidence.id() == aitem.id()) { if (item->mIncidence.id() == aitem.id()) {
return item; return item;
} }
......
...@@ -80,7 +80,7 @@ void MonthItem::updateMonthGraphicsItems() ...@@ -80,7 +80,7 @@ void MonthItem::updateMonthGraphicsItems()
} }
// A new item needs to be created // A new item needs to be created
MonthGraphicsItem *newItem = new MonthGraphicsItem(this); auto *newItem = new MonthGraphicsItem(this);
mMonthGraphicsItemList << newItem; mMonthGraphicsItemList << newItem;
newItem->setStartDate(start); newItem->setStartDate(start);
newItem->setDaySpan(span); newItem->setDaySpan(span);
...@@ -239,7 +239,7 @@ bool MonthItem::greaterThan(const MonthItem *e1, const MonthItem *e2) ...@@ -239,7 +239,7 @@ bool MonthItem::greaterThan(const MonthItem *e1, const MonthItem *e2)
bool MonthItem::greaterThanFallback(const MonthItem *other) const 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. // If "other" is a holiday, display it first.
return !h; return !h;
...@@ -322,7 +322,7 @@ IncidenceMonthItem::~IncidenceMonthItem() ...@@ -322,7 +322,7 @@ IncidenceMonthItem::~IncidenceMonthItem()
bool IncidenceMonthItem::greaterThanFallback(const MonthItem *other) const 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) { if (!o) {
return MonthItem::greaterThanFallback(other); return MonthItem::greaterThanFallback(other);
} }
...@@ -707,7 +707,7 @@ HolidayMonthItem::~HolidayMonthItem() ...@@ -707,7 +707,7 @@ HolidayMonthItem::~HolidayMonthItem()
bool HolidayMonthItem::greaterThanFallback(const MonthItem *other) const 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) { if (o) {
return MonthItem::greaterThanFallback(other); return MonthItem::greaterThanFallback(other);
} }
......
...@@ -496,7 +496,7 @@ void MonthScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *mouseEvent) ...@@ -496,7 +496,7 @@ void MonthScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *mouseEvent)
MonthGraphicsItem *iItem = dynamic_cast<MonthGraphicsItem *>(itemAt(pos, {})); MonthGraphicsItem *iItem = dynamic_cast<MonthGraphicsItem *>(itemAt(pos, {}));
if (iItem) { if (iItem) {
if (iItem->monthItem()) { if (iItem->monthItem()) {
IncidenceMonthItem *tmp = qobject_cast<IncidenceMonthItem *>(iItem->monthItem()); auto *tmp = qobject_cast<IncidenceMonthItem *>(iItem->monthItem());
if (tmp) { if (tmp) {
selectItem(iItem->monthItem()); selectItem(iItem->monthItem());
mMonthView->defaultAction(tmp->akonadiItem()); mMonthView->defaultAction(tmp->akonadiItem());
...@@ -584,7 +584,7 @@ void MonthScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) ...@@ -584,7 +584,7 @@ void MonthScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
selectItem(mClickedItem); selectItem(mClickedItem);
if (mouseEvent->button() == Qt::RightButton) { if (mouseEvent->button() == Qt::RightButton) {
IncidenceMonthItem *tmp = qobject_cast<IncidenceMonthItem *>(mClickedItem); auto *tmp = qobject_cast<IncidenceMonthItem *>(mClickedItem);
if (tmp) { if (tmp) {
Q_EMIT showIncidencePopupSignal(tmp->akonadiItem(), tmp->realStartDate()); Q_EMIT showIncidencePopupSignal(tmp->akonadiItem(), tmp->realStartDate());
} }
...@@ -725,7 +725,7 @@ void MonthScene::selectItem(MonthItem *item) ...@@ -725,7 +725,7 @@ void MonthScene::selectItem(MonthItem *item)
Another solution would be to have two Q_SIGNALS: incidenceSelected() and incidenceClicked() 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) { if (!tmp) {
mSelectedItem = nullptr; mSelectedItem = nullptr;
...@@ -747,7 +747,7 @@ void MonthScene::selectItem(MonthItem *item) ...@@ -747,7 +747,7 @@ void MonthScene::selectItem(MonthItem *item)
void MonthScene::removeIncidence(const QString &uid) void MonthScene::removeIncidence(const QString &uid)
{ {
for (MonthItem *manager : qAsConst(mManagerList)) { for (MonthItem *manager : qAsConst(mManagerList)) {
IncidenceMonthItem *imi = qobject_cast<IncidenceMonthItem *>(manager); auto *imi = qobject_cast<IncidenceMonthItem *>(manager);
if (!imi) { if (!imi) {
continue; continue;
} }
......
...@@ -143,12 +143,12 @@ MonthView::MonthView(NavButtonsVisibility visibility, QWidget *parent) ...@@ -143,12 +143,12 @@ MonthView::MonthView(NavButtonsVisibility visibility, QWidget *parent)
: EventView(parent) : EventView(parent)
, d(new MonthViewPrivate(this)) , d(new MonthViewPrivate(this))
{ {
QHBoxLayout *topLayout = new QHBoxLayout(this); auto *topLayout = new QHBoxLayout(this);
topLayout->addWidget(d->view); topLayout->addWidget(d->view);
topLayout->setContentsMargins(0, 0, 0, 0); topLayout->setContentsMargins(0, 0, 0, 0);
if (visibility == Visible) { if (visibility == Visible) {
QVBoxLayout *rightLayout = new QVBoxLayout(); auto *rightLayout = new QVBoxLayout();
rightLayout->setSpacing(0); rightLayout->setSpacing(0);
rightLayout->setContentsMargins(0, 0, 0, 0); rightLayout->setContentsMargins(0, 0, 0, 0);
...@@ -172,7 +172,7 @@ MonthView::MonthView(NavButtonsVisibility visibility, QWidget *parent) ...@@ -172,7 +172,7 @@ MonthView::MonthView(NavButtonsVisibility visibility, QWidget *parent)
connect(d->fullView, &QAbstractButton::clicked, connect(d->fullView, &QAbstractButton::clicked,
this, &MonthView::changeFullView); this, &MonthView::changeFullView);
QToolButton *minusMonth = new QToolButton(this); auto *minusMonth = new QToolButton(this);
minusMonth->setIcon(QIcon::fromTheme(QStringLiteral("arrow-up-double")));