Commit 7c90fd64 authored by Laurent Montel's avatar Laurent Montel 😁

Port to for(... : ..)

parent 825adea9
......@@ -72,7 +72,7 @@ QHash<QString, QColor> CategoryConfig::readColors() const
QHash<QString, QColor> categoryColors;
KConfigGroup colorsConfig(d->config->config(), "Category Colors2");
const QStringList cats = customCategories();
Q_FOREACH (const QString &category, cats) {
for (const QString &category : cats) {
const QColor color = colorsConfig.readEntry(category, d->mDefaultCategoryColor);
if (color != d->mDefaultCategoryColor) {
categoryColors.insert(category, color);
......
......@@ -54,7 +54,7 @@ void CategoryHierarchyReader::read(const QStringList &categories)
// case insensitive sort
QMap<QString, QString> sortedCategories;
foreach (const QString &str, categories) {
for (const QString &str : categories) {
sortedCategories.insert(str.toLower(), str);
}
......
......@@ -74,7 +74,7 @@ Akonadi::Collection::List CollectionSelection::selectedCollections() const
Akonadi::Collection::List selected;
const QModelIndexList selectedIndexes = d->model->selectedIndexes();
selected.reserve(selectedIndexes.count());
Q_FOREACH (const QModelIndex &idx, selectedIndexes) {
for (const QModelIndex &idx : selectedIndexes) {
selected.append(collectionFromIndex(idx));
}
return selected;
......@@ -85,7 +85,7 @@ QList<Akonadi::Collection::Id> CollectionSelection::selectedCollectionIds() cons
QList<Akonadi::Collection::Id> selected;
const QModelIndexList selectedIndexes = d->model->selectedIndexes();
selected.reserve(selectedIndexes.count());
Q_FOREACH (const QModelIndex &idx, selectedIndexes) {
for (const QModelIndex &idx : selectedIndexes) {
selected.append(collectionIdFromIndex(idx));
}
return selected;
......@@ -98,10 +98,10 @@ void CollectionSelection::slotSelectionChanged(const QItemSelection &selectedInd
const Akonadi::Collection::List deselected = collectionsFromIndexes(deselIndexes.indexes());
Q_EMIT selectionChanged(selected, deselected);
Q_FOREACH (const Akonadi::Collection &c, deselected) {
for (const Akonadi::Collection &c : deselected) {
Q_EMIT collectionDeselected(c);
}
Q_FOREACH (const Akonadi::Collection &c, selected) {
for (const Akonadi::Collection &c : selected) {
Q_EMIT collectionSelected(c);
}
}
......@@ -107,7 +107,7 @@ KCalCore::Event::Ptr CalendarSupport::event(const KCalCore::Incidence::Ptr &inci
KCalCore::Incidence::List CalendarSupport::incidencesFromItems(const Akonadi::Item::List &items)
{
KCalCore::Incidence::List incidences;
Q_FOREACH (const Akonadi::Item &item, items) {
for (const Akonadi::Item &item : items) {
if (const KCalCore::Incidence::Ptr e = CalendarSupport::incidence(item)) {
incidences.push_back(e);
}
......@@ -203,7 +203,7 @@ QMimeData *CalendarSupport::createMimeData(const Akonadi::Item::List &items,
QList<QUrl> urls;
int incidencesFound = 0;
Q_FOREACH (const Akonadi::Item &item, items) {
for (const Akonadi::Item &item : items) {
const KCalCore::Incidence::Ptr incidence(CalendarSupport::incidence(item));
if (!incidence) {
continue;
......@@ -249,7 +249,7 @@ static QByteArray findMostCommonType(const Akonadi::Item::List &items)
return "Incidence";
}
Q_FOREACH (const Akonadi::Item &item, items) {
for (const Akonadi::Item &item : items) {
if (!CalendarSupport::hasIncidence(item)) {
continue;
}
......@@ -378,7 +378,7 @@ KCalCore::Todo::List CalendarSupport::todos(const QMimeData *mimeData,
if (cal) {
const KCalCore::Todo::List calTodos = cal->todos();
todos.reserve(calTodos.count());
Q_FOREACH (const KCalCore::Todo::Ptr &i, calTodos) {
for (const KCalCore::Todo::Ptr &i : calTodos) {
todos.push_back(KCalCore::Todo::Ptr(i->clone()));
}
}
......@@ -395,9 +395,9 @@ KCalCore::Incidence::List CalendarSupport::incidences(const QMimeData *mimeData,
#ifndef QT_NO_DRAGANDDROP
KCalCore::Calendar::Ptr cal(KCalUtils::DndFactory::createDropCalendar(mimeData, spec));
if (cal) {
KCalCore::Incidence::List calIncidences = cal->incidences();
const KCalCore::Incidence::List calIncidences = cal->incidences();
incidences.reserve(calIncidences.count());
Q_FOREACH (const KCalCore::Incidence::Ptr &i, calIncidences) {
for (const KCalCore::Incidence::Ptr &i : calIncidences) {
incidences.push_back(KCalCore::Incidence::Ptr(i->clone()));
}
}
......@@ -506,7 +506,7 @@ Akonadi::Collection::List CalendarSupport::collectionsFromIndexes(const QModelIn
{
Akonadi::Collection::List l;
l.reserve(indexes.count());
Q_FOREACH (const QModelIndex &idx, indexes) {
for (const QModelIndex &idx : indexes) {
l.push_back(collectionFromIndex(idx));
}
return l;
......@@ -767,10 +767,11 @@ QStringList CalendarSupport::categories(const KCalCore::Incidence::List &inciden
QStringList cats, thisCats;
// @TODO: For now just iterate over all incidences. In the future,
// the list of categories should be built when reading the file.
Q_FOREACH (const KCalCore::Incidence::Ptr &incidence, incidences) {
for (const KCalCore::Incidence::Ptr &incidence : incidences) {
thisCats = incidence->categories();
const QStringList::ConstIterator send(thisCats.constEnd());
for (QStringList::ConstIterator si = thisCats.constBegin();
si != thisCats.constEnd(); ++si) {
si != send; ++si) {
if (!cats.contains(*si)) {
cats.append(*si);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment