diff --git a/src/agenda/agenda.cpp b/src/agenda/agenda.cpp --- a/src/agenda/agenda.cpp +++ b/src/agenda/agenda.cpp @@ -91,7 +91,7 @@ int col = 0; const KCalCore::DateList dateList = mAgenda->dateList(); - foreach (const QDate &date, dateList) { + for (const QDate &date : dateList) { if (date == currentDate) { return QApplication::isRightToLeft() ? mAgenda->columns() - 1 - col : col; } @@ -1471,7 +1471,7 @@ #endif QList cells; - foreach (CalendarSupport::CellItem *item, d->mItems) { + for (CalendarSupport::CellItem *item : d->mItems) { if (item) { cells.append(item); } @@ -1984,7 +1984,7 @@ // qCDebug(CALENDARVIEW_LOG) << "Ignoring"; return; } - foreach (const AgendaItem::QPtr &agendaItem, agendaItems) { + for (const AgendaItem::QPtr &agendaItem : agendaItems) { if (agendaItem) { if (incidence->instanceIdentifier() != agendaItem->incidence()->instanceIdentifier()) { continue; @@ -2097,22 +2097,22 @@ void Agenda::resizeAllContents() { double subCellWidth; - foreach (const AgendaItem::QPtr &item, d->mItems) { + for (const AgendaItem::QPtr &item : d->mItems) { if (item) { subCellWidth = calcSubCellWidth(item); placeAgendaItem(item, subCellWidth); } } /* if (d->mAllDayMode) { - foreach (const AgendaItem::QPtr &item, d->mItems) { + for (const AgendaItem::QPtr &item : d->mItems) { if (item) { subCellWidth = calcSubCellWidth(item); placeAgendaItem(item, subCellWidth); } } } else { - foreach (const AgendaItem::QPtr &item, d->mItems) { + for (const AgendaItem::QPtr &item : d->mItems) { if (item) { subCellWidth = calcSubCellWidth(item); placeAgendaItem(item, subCellWidth); @@ -2233,7 +2233,7 @@ const KCalCore::Incidence::Ptr selectedItem = d->mSelectedItem->incidence(); - foreach (AgendaItem::QPtr item, d->mItems) { + for (AgendaItem::QPtr item : d->mItems) { if (item) { const KCalCore::Incidence::Ptr itemInc = item->incidence(); if (itemInc && selectedItem && itemInc->uid() == selectedItem->uid()) { diff --git a/src/agenda/agendaview.cpp b/src/agenda/agendaview.cpp --- a/src/agenda/agendaview.cpp +++ b/src/agenda/agendaview.cpp @@ -853,7 +853,7 @@ AgendaView::~AgendaView() { - foreach (const ViewCalendar::Ptr &cal, d->mViewCalendar->mSubCalendars) { + for (const ViewCalendar::Ptr &cal : d->mViewCalendar->mSubCalendars) { if (cal->getCalendar()) { cal->getCalendar()->unregisterObserver(d); } @@ -1137,7 +1137,7 @@ void AgendaView::placeDecorations(DecorationList &decoList, const QDate &date, QWidget *labelBox, bool forWeek) { - foreach (CalendarDecoration::Decoration *deco, decoList) { + for (CalendarDecoration::Decoration *deco : decoList) { CalendarDecoration::Element::List elements; elements = forWeek ? deco->weekElements(date) : deco->dayElements(date); if (!elements.isEmpty()) { @@ -1149,7 +1149,7 @@ decoHBox->setFrameShape(QFrame::StyledPanel); decoHBox->setMinimumWidth(1); - foreach (CalendarDecoration::Element *it, elements) { + for (CalendarDecoration::Element *it : elements) { DecorationLabel *label = new DecorationLabel(it); label->setAlignment(Qt::AlignBottom); label->setMinimumWidth(1); @@ -1224,7 +1224,7 @@ loadDecorations(botStrDecos, botDecos), false); #endif - Q_FOREACH (const QDate &date, d->mSelectedDates) { + for (const QDate &date : d->mSelectedDates) { auto topDayLabelBox = new QFrame(d->mTopDayLabels); auto topDayLabelBoxLayout = new QVBoxLayout(topDayLabelBox); topDayLabelBoxLayout->setMargin(0); @@ -1307,7 +1307,7 @@ } // Then, set that maximum text type to all the labels - foreach (AlternateLabel *label, d->mDateDayLabels) { + for (AlternateLabel *label : d->mDateDayLabels) { label->setFixedType(overallType); } } @@ -1436,7 +1436,7 @@ QFont labelFont = d->mTimeLabelsZone->preferences()->agendaTimeLabelsFont(); labelFont.setPointSize(labelFont.pointSize() - SHRINKDOWN); - foreach (QScrollArea *area, d->mTimeLabelsZone->timeLabels()) { + for (QScrollArea *area : d->mTimeLabelsZone->timeLabels()) { TimeLabels *timeLabel = static_cast(area->widget()); QLabel *label = new QLabel(timeLabel->header().replace(QLatin1Char('/'), QStringLiteral("/ ")), @@ -1467,7 +1467,7 @@ int width = d->mTimeLabelsZone->preferedTimeLabelsWidth(); for (QLabel *l : qAsConst(d->mTimeBarHeaders)) { - foreach (const QString &word, l->text().split(QLatin1Char(' '))) { + for (const QString &word : l->text().split(QLatin1Char(' '))) { width = qMax(width, fm.boundingRect(word).width()); } } @@ -1722,7 +1722,7 @@ KCalCore::CalFilter *filter = calendar()->filter(); bool wehaveall = true; if (filter) { - Q_FOREACH (const Akonadi::Item &aitem, incidences) { + for (const Akonadi::Item &aitem : incidences) { if (!(wehaveall = filter->filterIncidence(CalendarSupport::incidence(aitem)))) { break; } @@ -1737,7 +1737,7 @@ QDateTime end = CalendarSupport::incidence(incidences.first())->dateTime( KCalCore::Incidence::RoleEnd).toLocalTime(); Akonadi::Item first = incidences.first(); - Q_FOREACH (const Akonadi::Item &aitem, incidences) { + for (const Akonadi::Item &aitem : incidences) { if (CalendarSupport::incidence(aitem)->dtStart().toLocalTime() < start) { first = aitem; } @@ -1798,7 +1798,7 @@ bool somethingReselected = false; const KCalCore::Incidence::List incidences = d->mViewCalendar->incidences(); - foreach (const KCalCore::Incidence::Ptr &incidence, incidences) { + for (const KCalCore::Incidence::Ptr &incidence : incidences) { Q_ASSERT(incidence); const bool wasSelected = (incidence->uid() == selectedAgendaId) || (incidence->uid() == selectedAllDayAgendaId); @@ -2032,7 +2032,7 @@ const QDate day = d->mSelectedDates[gpos.x()]; QDateTime newTime(day, {}, Qt::LocalTime); - Q_FOREACH (const KCalCore::Incidence::Ptr &incidence, incidences) { + for (const KCalCore::Incidence::Ptr &incidence : incidences) { const Akonadi::Item existingItem = calendar()->item(incidence); const bool existsInSameCollection = existingItem.isValid() @@ -2226,7 +2226,7 @@ // Deleted incidence is an main incidence // Delete all exceptions as well KCalCore::Incidence::List exceptions = calendar2(incidence->uid())->instances(incidence); - foreach (const KCalCore::Incidence::Ptr &exception, exceptions) { + for (const KCalCore::Incidence::Ptr &exception : exceptions) { if (exception->allDay()) { d->mAllDayAgenda->removeIncidence(exception); } else { diff --git a/src/agenda/timelabels.cpp b/src/agenda/timelabels.cpp --- a/src/agenda/timelabels.cpp +++ b/src/agenda/timelabels.cpp @@ -407,7 +407,7 @@ } auto abbreviations = QStringLiteral(" "); - foreach (const auto &transition, mTimezone.transitions(now, now.addYears(1))) { + for (const auto &transition : mTimezone.transitions(now, now.addYears(1))) { abbreviations += transition.abbreviation; abbreviations += QLatin1String(", "); } diff --git a/src/agenda/timelabelszone.cpp b/src/agenda/timelabelszone.cpp --- a/src/agenda/timelabelszone.cpp +++ b/src/agenda/timelabelszone.cpp @@ -68,7 +68,7 @@ addTimeLabels(mPrefs->timeZone()); - foreach (const QString &zoneStr, mPrefs->timeScaleTimezones()) { + for (const QString &zoneStr : mPrefs->timeScaleTimezones()) { if (!seenTimeZones.contains(zoneStr)) { auto zone = QTimeZone(zoneStr.toUtf8()); if (zone.isValid()) { @@ -154,7 +154,7 @@ void TimeLabelsZone::updateTimeLabelsPosition() { if (mAgenda) { - foreach (QScrollArea *area, timeLabels()) { + for (QScrollArea *area : timeLabels()) { TimeLabels *label = static_cast(area->widget()); const int adjustment = mAgenda->contentsY(); // y() is the offset to our parent (QScrollArea) diff --git a/src/agenda/viewcalendar.cpp b/src/agenda/viewcalendar.cpp --- a/src/agenda/viewcalendar.cpp +++ b/src/agenda/viewcalendar.cpp @@ -45,7 +45,7 @@ KCalCore::Incidence::List MultiViewCalendar::incidences() const { KCalCore::Incidence::List list; - foreach (const ViewCalendar::Ptr &cal, mSubCalendars) { + for (const ViewCalendar::Ptr &cal : mSubCalendars) { if (cal->getCalendar()) { list += cal->getCalendar()->incidences(); } diff --git a/src/eventview.cpp b/src/eventview.cpp --- a/src/eventview.cpp +++ b/src/eventview.cpp @@ -114,7 +114,7 @@ Q_D(EventView); qDeleteAll(d->mHolidayRegions); d->mHolidayRegions.clear(); - foreach (const QString ®ionStr, regions) { + for (const QString ®ionStr : regions) { KHolidays::HolidayRegion *region = new KHolidays::HolidayRegion(regionStr); if (region->isValid()) { d->mHolidayRegions.append(region); diff --git a/src/month/monthitem.cpp b/src/month/monthitem.cpp --- a/src/month/monthitem.cpp +++ b/src/month/monthitem.cpp @@ -178,14 +178,14 @@ void MonthItem::updateGeometry() { - foreach (MonthGraphicsItem *item, mMonthGraphicsItemList) { + for (MonthGraphicsItem *item : mMonthGraphicsItemList) { item->updateGeometry(); } } void MonthItem::setZValue(qreal z) { - foreach (MonthGraphicsItem *item, mMonthGraphicsItemList) { + for (MonthGraphicsItem *item : mMonthGraphicsItemList) { item->setZValue(z); } } diff --git a/src/month/monthscene.cpp b/src/month/monthscene.cpp --- a/src/month/monthscene.cpp +++ b/src/month/monthscene.cpp @@ -462,7 +462,7 @@ setStartHeight(newHeight); - foreach (MonthItem *manager, mManagerList) { + for (MonthItem *manager : mManagerList) { manager->updateGeometry(); } @@ -773,7 +773,7 @@ continue; } if (incidence->uid() == uid) { - foreach (MonthGraphicsItem *gitem, imi->monthGraphicsItems()) { + for (MonthGraphicsItem *gitem : imi->monthGraphicsItems()) { removeItem(gitem); } } diff --git a/src/month/monthview.cpp b/src/month/monthview.cpp --- a/src/month/monthview.cpp +++ b/src/month/monthview.cpp @@ -570,7 +570,7 @@ MonthItem::greaterThan); // build each month's cell event list - foreach (MonthItem *manager, d->scene->mManagerList) { + for (MonthItem *manager : d->scene->mManagerList) { for (QDate date = manager->startDate(); date <= manager->endDate(); date = date.addDays(1)) { MonthCell *cell = d->scene->mMonthCellMap.value(date); @@ -580,12 +580,12 @@ } } - foreach (MonthItem *manager, d->scene->mManagerList) { + for (MonthItem *manager : d->scene->mManagerList) { manager->updateMonthGraphicsItems(); manager->updatePosition(); } - foreach (MonthItem *manager, d->scene->mManagerList) { + for (MonthItem *manager : d->scene->mManagerList) { manager->updateGeometry(); } diff --git a/src/multiagenda/multiagendaview.cpp b/src/multiagenda/multiagendaview.cpp --- a/src/multiagenda/multiagendaview.cpp +++ b/src/multiagenda/multiagendaview.cpp @@ -78,7 +78,7 @@ qCDebug(CALENDARVIEW_LOG) << QString( level*2, '-' ) << o ; } - foreach( QObject *child, o->children() ) { + for ( QObject *child : o->children() ) { printObject( child, level + 1 ); } } @@ -270,7 +270,7 @@ d->addView(d->mCollectionSelectionModels[i], d->mCustomColumnTitles[i]); } } else { - Q_FOREACH (const Akonadi::Collection &i, collectionSelection()->selectedCollections()) { + for (const Akonadi::Collection &i : collectionSelection()->selectedCollections()) { if (i.contentMimeTypes().contains(KCalCore::Event::eventMimeType())) { d->addView(i); } @@ -306,7 +306,7 @@ void MultiAgendaView::Private::deleteViews() { - Q_FOREACH (AgendaView *const i, mAgendaViews) { + for (AgendaView *const i : mAgendaViews) { KCheckableProxyModel *proxy = i->takeCustomCollectionSelectionProxyModel(); if (proxy && !mCollectionSelectionModels.contains(proxy)) { delete proxy; @@ -322,7 +322,7 @@ void MultiAgendaView::Private::setupViews() { - foreach (AgendaView *agenda, mAgendaViews) { + for (AgendaView *agenda : mAgendaViews) { q->connect(agenda, SIGNAL(newEventSignal()), q, SIGNAL(newEventSignal())); q->connect(agenda, SIGNAL(newEventSignal(QDate)), @@ -372,14 +372,14 @@ } AgendaView *lastView = mAgendaViews.last(); - foreach (AgendaView *agenda, mAgendaViews) { + for (AgendaView *agenda : mAgendaViews) { if (agenda != lastView) { connect(agenda->agenda()->verticalScrollBar(), &QAbstractSlider::valueChanged, lastView->agenda()->verticalScrollBar(), &QAbstractSlider::setValue); } } - foreach (AgendaView *agenda, mAgendaViews) { + for (AgendaView *agenda : mAgendaViews) { agenda->readSettings(); } } @@ -392,24 +392,24 @@ Akonadi::Item::List MultiAgendaView::selectedIncidences() const { Akonadi::Item::List list; - foreach (AgendaView *agendaView, d->mAgendaViews) { + for (AgendaView *agendaView : d->mAgendaViews) { list += agendaView->selectedIncidences(); } return list; } KCalCore::DateList MultiAgendaView::selectedIncidenceDates() const { KCalCore::DateList list; - foreach (AgendaView *agendaView, d->mAgendaViews) { + for (AgendaView *agendaView : d->mAgendaViews) { list += agendaView->selectedIncidenceDates(); } return list; } int MultiAgendaView::currentDateCount() const { - foreach (AgendaView *agendaView, d->mAgendaViews) { + for (AgendaView *agendaView : d->mAgendaViews) { return agendaView->currentDateCount(); } return 0; @@ -422,22 +422,22 @@ d->mEndDate = end; slotResizeScrollView(); d->mTimeLabelsZone->updateAll(); - foreach (AgendaView *agendaView, d->mAgendaViews) { + for (AgendaView *agendaView : d->mAgendaViews) { agendaView->showDates(start, end); } } void MultiAgendaView::showIncidences(const Akonadi::Item::List &incidenceList, const QDate &date) { - foreach (AgendaView *agendaView, d->mAgendaViews) { + for (AgendaView *agendaView : d->mAgendaViews) { agendaView->showIncidences(incidenceList, date); } } void MultiAgendaView::updateView() { recreateViews(); - foreach (AgendaView *agendaView, d->mAgendaViews) { + for (AgendaView *agendaView : d->mAgendaViews) { agendaView->updateView(); } } @@ -450,16 +450,16 @@ void MultiAgendaView::slotSelectionChanged() { - foreach (AgendaView *agenda, d->mAgendaViews) { + for (AgendaView *agenda : d->mAgendaViews) { if (agenda != sender()) { agenda->clearSelection(); } } } bool MultiAgendaView::eventDurationHint(QDateTime &startDt, QDateTime &endDt, bool &allDay) const { - foreach (AgendaView *agenda, d->mAgendaViews) { + for (AgendaView *agenda : d->mAgendaViews) { bool valid = agenda->eventDurationHint(startDt, endDt, allDay); if (valid) { return true; @@ -470,7 +470,7 @@ void MultiAgendaView::slotClearTimeSpanSelection() { - foreach (AgendaView *agenda, d->mAgendaViews) { + for (AgendaView *agenda : d->mAgendaViews) { if (agenda != sender()) { agenda->clearTimeSpanSelection(); } else { @@ -560,14 +560,14 @@ void MultiAgendaView::setIncidenceChanger(Akonadi::IncidenceChanger *changer) { EventView::setIncidenceChanger(changer); - foreach (AgendaView *agenda, d->mAgendaViews) { + for (AgendaView *agenda : d->mAgendaViews) { agenda->setIncidenceChanger(changer); } } void MultiAgendaView::setPreferences(const PrefsPtr &prefs) { - foreach (AgendaView *agenda, d->mAgendaViews) { + for (AgendaView *agenda : d->mAgendaViews) { agenda->setPreferences(prefs); } EventView::setPreferences(prefs); @@ -578,7 +578,7 @@ EventView::updateConfig(); d->mTimeLabelsZone->setPreferences(preferences()); d->mTimeLabelsZone->updateAll(); - foreach (AgendaView *agenda, d->mAgendaViews) { + for (AgendaView *agenda : d->mAgendaViews) { agenda->updateConfig(); } } @@ -593,7 +593,7 @@ if (!lastMovedSplitter) { lastMovedSplitter = d->mLeftSplitter; } - foreach (AgendaView *agenda, d->mAgendaViews) { + for (AgendaView *agenda : d->mAgendaViews) { if (agenda->splitter() == lastMovedSplitter) { continue; } @@ -620,7 +620,7 @@ } } - foreach (AgendaView *agenda, d->mAgendaViews) { + for (AgendaView *agenda : d->mAgendaViews) { agenda->zoomView(delta, pos, ori); } @@ -645,7 +645,7 @@ void MultiAgendaView::setChanges(Changes changes) { EventView::setChanges(changes); - foreach (AgendaView *agenda, d->mAgendaViews) { + for (AgendaView *agenda : d->mAgendaViews) { agenda->setChanges(changes); } } @@ -747,7 +747,7 @@ configGroup.writeEntry("CustomNumberOfColumns", d->mCustomNumberOfColumns); configGroup.writeEntry("ColumnTitles", d->mCustomColumnTitles); int idx = 0; - foreach (KCheckableProxyModel *checkableProxyModel, d->mCollectionSelectionModels) { + for (KCheckableProxyModel *checkableProxyModel : d->mCollectionSelectionModels) { const QString groupName = configGroup.name() + QLatin1String("_subView_") + QString::number( idx); KConfigGroup group = configGroup.config()->group(groupName); diff --git a/src/timeline/timelineview.cpp b/src/timeline/timelineview.cpp --- a/src/timeline/timelineview.cpp +++ b/src/timeline/timelineview.cpp @@ -358,7 +358,7 @@ events = calendar()->events(day, QTimeZone::systemTimeZone(), KCalCore::EventSortStartDate, KCalCore::SortDirectionAscending); - Q_FOREACH (const KCalCore::Event::Ptr &event, events) { + for (const KCalCore::Event::Ptr &event : events) { if (event->hasRecurrenceId()) { continue; } diff --git a/src/timeline/timelineview_p.cpp b/src/timeline/timelineview_p.cpp --- a/src/timeline/timelineview_p.cpp +++ b/src/timeline/timelineview_p.cpp @@ -164,7 +164,7 @@ if (events.contains(event)) { //PENDING(AKONADI_PORT) check if correct. also check the original if, //was inside the for loop (unnecessarily) - foreach (const KCalCore::Event::Ptr &i, events) { + for (const KCalCore::Event::Ptr &i : events) { Akonadi::Item item = q->calendar()->item(i); insertIncidence(item, day); } diff --git a/src/todo/incidencetreemodel.cpp b/src/todo/incidencetreemodel.cpp --- a/src/todo/incidencetreemodel.cpp +++ b/src/todo/incidencetreemodel.cpp @@ -32,7 +32,7 @@ { Q_ASSERT(node); node->depth = node->parentNode ? 1 + node->parentNode->depth : 0; - foreach (const Node::Ptr &child, node->directChilds) { + for (const Node::Ptr &child : node->directChilds) { calculateDepth(child); } } @@ -60,7 +60,7 @@ while (prenodeByUid.count() < count) { bool foundAtLeastOne = false; // this bool saves us from infinit looping if the parent doesn't exist - foreach (const PreNode::Ptr &node, remainingNodes) { + for (const PreNode::Ptr &node : remainingNodes) { Q_ASSERT(node); const QString uid = node->incidence->instanceIdentifier(); const QString parentUid = node->incidence->relatedTo(); @@ -323,7 +323,7 @@ PreNode::List sortedNodes = sortedPrenodes(nodes); - foreach (const PreNode::Ptr &node, sortedNodes) { + for (const PreNode::Ptr &node : sortedNodes) { insertNode(node); } @@ -411,7 +411,7 @@ m_waitingForParent.remove(node->uid); Q_ASSERT(!childs.isEmpty()); - foreach (const Node::Ptr &child, childs) { + for (const Node::Ptr &child : childs) { const int fromRow = m_toplevelNodeList.indexOf(child); Q_ASSERT(fromRow != -1); const QModelIndex toParent = indexForNode(node); @@ -447,7 +447,7 @@ } // Initialize depths - foreach (const Node::Ptr &topLevelNode, m_toplevelNodeList) { + for (const Node::Ptr &topLevelNode : m_toplevelNodeList) { calculateDepth(topLevelNode); } @@ -487,7 +487,7 @@ // We want to remove childs first, to avoid row moving Node::List nodesToRemoveSorted = sorted(nodesToRemove); - foreach (const Node::Ptr &node, nodesToRemoveSorted) { + for (const Node::Ptr &node : nodesToRemoveSorted) { // Go ahead and remove it now. We don't do it in ::onRowsRemoved(), because // while unparenting childs with moveRows() the view might call data() on the // item that is already removed from ETM. @@ -518,7 +518,7 @@ // /**toParent is root*/QModelIndex(), toRow ); q->beginResetModel(); node->directChilds.clear(); - foreach (const Node::Ptr &child, childs) { + for (const Node::Ptr &child : childs) { //qCDebug(CALENDARVIEW_LOG) << "Dealing with child: " << child.data() << child->uid; m_toplevelNodeList.append(child); child->parentNode = Node::Ptr(); @@ -916,7 +916,7 @@ << QStringLiteral(";id=") << node->id << QStringLiteral(";parentUid=") << node->parentUid << QStringLiteral(";parentNode=") << (void *)(node->parentNode.data()) << '\n'; - foreach (const Node::Ptr &child, node->directChilds) { + for (const Node::Ptr &child : node->directChilds) { s << child; } diff --git a/src/todo/todomodel.cpp b/src/todo/todomodel.cpp --- a/src/todo/todomodel.cpp +++ b/src/todo/todomodel.cpp @@ -182,7 +182,7 @@ Q_ASSERT(m_layoutChangePersistentIndexes.isEmpty()); Q_ASSERT(m_columns.isEmpty()); QModelIndexList persistentIndexes = q->persistentIndexList(); - foreach (const QPersistentModelIndex &persistentIndex, persistentIndexes) { + for (const QPersistentModelIndex &persistentIndex : persistentIndexes) { m_persistentIndexes << persistentIndex; // Stuff we have to update onLayoutChanged Q_ASSERT(persistentIndex.isValid()); QModelIndex index_col0 = q->createIndex(persistentIndex.row(), 0, diff --git a/src/todo/todoview.cpp b/src/todo/todoview.cpp --- a/src/todo/todoview.cpp +++ b/src/todo/todoview.cpp @@ -98,7 +98,7 @@ { const QString todoMimeType = QStringLiteral("application/x-vnd.akonadi.calendar.todo"); if (flat) { - foreach (TodoView *view, views) { + for (TodoView *view : views) { // In flatview dropping confuses users and it's very easy to drop into a child item view->mView->setDragDropMode(QAbstractItemView::DragOnly); view->setFlatView(flat, /**propagate=*/ false); // So other views update their toggle icon @@ -119,7 +119,7 @@ } else { delete todoTreeModel; todoTreeModel = new IncidenceTreeModel(QStringList() << todoMimeType, parent); - foreach (TodoView *view, views) { + for (TodoView *view : views) { QObject::connect(todoTreeModel, &IncidenceTreeModel::indexChangedParent, view, &TodoView::expandIndex); QObject::connect(todoTreeModel, &IncidenceTreeModel::batchInsertionFinished, view, @@ -133,7 +133,7 @@ todoFlatModel = nullptr; } - foreach (TodoView *view, views) { + for (TodoView *view : views) { view->mFlatViewButton->blockSignals(true); // We block signals to avoid recursion, we have two TodoViews and mFlatViewButton is synchronized view->mFlatViewButton->setChecked(flat); @@ -945,7 +945,7 @@ const QStringList checkedCategories = job->property("checkedCategories").toStringList(); QPointer menu = job->property("menu").value >(); if (menu) { - Q_FOREACH (const Akonadi::Tag &tag, fetchJob->tags()) { + for (const Akonadi::Tag &tag : fetchJob->tags()) { const QString name = tag.name(); QAction *action = menu->addAction(name); action->setCheckable(true); diff --git a/src/todo/todoviewview.cpp b/src/todo/todoviewview.cpp --- a/src/todo/todoviewview.cpp +++ b/src/todo/todoviewview.cpp @@ -73,7 +73,7 @@ connect(mHeaderPopup, &QMenu::triggered, this, &TodoViewView::toggleColumnHidden); } - foreach (QAction *action, mColumnActions) { + for (QAction *action : mColumnActions) { int column = action->data().toInt(); action->setChecked(!isColumnHidden(column)); } diff --git a/src/viewerapp/mainwindow.cpp b/src/viewerapp/mainwindow.cpp --- a/src/viewerapp/mainwindow.cpp +++ b/src/viewerapp/mainwindow.cpp @@ -115,7 +115,7 @@ mIncidenceChanger = new IncidenceChanger(this); mCalendar->setCollectionFilteringEnabled(false); - Q_FOREACH (const QString &viewName, mViewNames) { + for (const QString &viewName : mViewNames) { addView(viewName); } } diff --git a/src/whatsnext/whatsnextview.cpp b/src/whatsnext/whatsnextview.cpp --- a/src/whatsnext/whatsnextview.cpp +++ b/src/whatsnext/whatsnextview.cpp @@ -121,7 +121,7 @@ mText += QLatin1String("\" width=\"22\" height=\"22\">"); mText += i18n("Events:") + QLatin1String("\n"); mText += QLatin1String("\n"); - Q_FOREACH (const KCalCore::Event::Ptr &ev, events) { + for (const KCalCore::Event::Ptr &ev : events) { if (!ev->recurs()) { appendEvent(ev); } else { @@ -158,7 +158,7 @@ KCalCore::SortDirectionAscending); if (!todos.isEmpty()) { bool taskHeaderWasCreated = false; - Q_FOREACH (const KCalCore::Todo::Ptr &todo, todos) { + for (const KCalCore::Todo::Ptr &todo : todos) { if (!todo->isCompleted() && todo->hasDueDate() && todo->dtDue().date() <= mEndDate) { if (!taskHeaderWasCreated) { createTaskRow(kil); @@ -170,7 +170,7 @@ bool gotone = false; int priority = 1; while (!gotone && priority <= 9) { - Q_FOREACH (const KCalCore::Todo::Ptr &todo, todos) { + for (const KCalCore::Todo::Ptr &todo : todos) { if (!todo->isCompleted() && (todo->priority() == priority)) { if (!taskHeaderWasCreated) { createTaskRow(kil); @@ -191,7 +191,7 @@ int replies = 0; events = calendar()->events(QDate::currentDate(), QDate(2975, 12, 6), QTimeZone::systemTimeZone()); - Q_FOREACH (const KCalCore::Event::Ptr &ev, events) { + for (const KCalCore::Event::Ptr &ev : events) { KCalCore::Attendee::Ptr me = ev->attendeeByMails(myEmails); if (me != nullptr) { if (me->status() == KCalCore::Attendee::NeedsAction && me->RSVP()) { @@ -212,7 +212,7 @@ } } todos = calendar()->todos(); - Q_FOREACH (const KCalCore::Todo::Ptr &to, todos) { + for (const KCalCore::Todo::Ptr &to : todos) { KCalCore::Attendee::Ptr me = to->attendeeByMails(myEmails); if (me != nullptr) { if (me->status() == KCalCore::Attendee::NeedsAction && me->RSVP()) {