aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-05-10 06:54:36 +0200
committerMontel Laurent <[email protected]>2017-05-10 06:54:36 +0200
commitc74a1258682deb79192cfec59088e5d0dbe37929 (patch)
treee57a71fc7fac6cc649529722f0ebba96dfe2b15e
parent126cfb785c24ed08cb0e6ad6585f09625f3c5122 (diff)
Port some foreach
-rw-r--r--autotests/historytest.cpp4
-rw-r--r--autotests/incidencechangertest.cpp5
-rw-r--r--src/icalimporter.cpp4
-rw-r--r--src/incidencechanger_p.cpp2
4 files changed, 7 insertions, 8 deletions
diff --git a/autotests/historytest.cpp b/autotests/historytest.cpp
index b9ea6e7..6aee835 100644
--- a/autotests/historytest.cpp
+++ b/autotests/historytest.cpp
@@ -178,7 +178,7 @@ void HistoryTest::testDeletion()
waitForSignals();
// Check that it doesn't exist anymore
- foreach (const Akonadi::Item &item, items) {
+ for (const Akonadi::Item &item : qAsConst(items)) {
QVERIFY(Helper::confirmDoesntExist(item));
}
@@ -528,7 +528,7 @@ void HistoryTest::deleteFinished(int changeId,
qDebug() << "Error string is " << errorMessage;
} else {
QVERIFY(!deletedIds.isEmpty());
- foreach (Akonadi::Item::Id id, deletedIds) {
+ for (Akonadi::Item::Id id : qAsConst(deletedIds)) {
QVERIFY(id != -1);
}
}
diff --git a/autotests/incidencechangertest.cpp b/autotests/incidencechangertest.cpp
index f4767d2..3f3bc85 100644
--- a/autotests/incidencechangertest.cpp
+++ b/autotests/incidencechangertest.cpp
@@ -297,8 +297,7 @@ private Q_SLOTS:
if (expectedResultCode == IncidenceChanger::ResultCodeSuccess) {
// Check that the incidence was really deleted
- Item item;
- foreach (const Akonadi::Item &item, items) {
+ for (const Akonadi::Item &item : qAsConst(items)) {
ItemFetchJob *fetchJob = new ItemFetchJob(item, this);
fetchJob->fetchScope().fetchFullPayload();
QVERIFY(!fetchJob->exec());
@@ -1239,7 +1238,7 @@ public Q_SLOTS:
qDebug() << "Error string is " << errorMessage;
} else {
QVERIFY(!deletedIds.isEmpty());
- foreach (Akonadi::Item::Id id, deletedIds) {
+ for (Akonadi::Item::Id id : qAsConst(deletedIds)) {
QVERIFY(id != -1);
}
}
diff --git a/src/icalimporter.cpp b/src/icalimporter.cpp
index a67f1aa..38c0598 100644
--- a/src/icalimporter.cpp
+++ b/src/icalimporter.cpp
@@ -209,7 +209,7 @@ bool ICalImporter::importIntoExistingResource(const QUrl &url, Akonadi::Collecti
}
d->m_pendingRequests.clear();
- Incidence::List incidences = temporaryCalendar->incidences();
+ const Incidence::List incidences = temporaryCalendar->incidences();
if (incidences.isEmpty()) {
d->setErrorMessage(i18n("The ical file to merge is empty."));
@@ -232,7 +232,7 @@ bool ICalImporter::importIntoExistingResource(const QUrl &url, Akonadi::Collecti
const IncidenceChanger::DestinationPolicy policySaved = d->m_changer->destinationPolicy();
d->m_changer->startAtomicOperation(i18n("Merge ical file into existing calendar."));
d->m_changer->setDestinationPolicy(IncidenceChanger::DestinationPolicyNeverAsk);
- foreach (const Incidence::Ptr &incidence, incidences) {
+ for (const Incidence::Ptr &incidence : qAsConst(incidences)) {
Q_ASSERT(incidence);
if (!incidence) {
continue;
diff --git a/src/incidencechanger_p.cpp b/src/incidencechanger_p.cpp
index 5fd6e21..a02902c 100644
--- a/src/incidencechanger_p.cpp
+++ b/src/incidencechanger_p.cpp
@@ -91,7 +91,7 @@ void IncidenceChanger::Private::onCollectionsLoaded(KJob *job)
bool noAcl = false;
bool invalidCollection = false;
Collection collectionToUse;
- foreach (const Change::Ptr &change, mPendingCreations) {
+ foreach (const Change::Ptr &change, mPendingCreations) { //Don't use for(...:...) here.
mPendingCreations.removeAll(change);
if (canceled) {