Commit 22b78f5c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port some foreach

parent 9f8120a1
Pipeline #81988 failed with stage
in 25 minutes and 56 seconds
......@@ -116,7 +116,8 @@ void ChangeCollectionTask::doStart(KIMAP::Session *session)
QMap<QByteArray, QByteArray> annotations = annotationsAttribute->annotations();
qCDebug(IMAPRESOURCE_LOG) << "All annotations: " << annotations;
foreach (const QByteArray &entry, annotations.keys()) { // krazy:exclude=foreach
const auto annotationKeys{annotations.keys()};
for (const QByteArray &entry : annotationKeys) {
auto job = new KIMAP::SetMetaDataJob(session);
if (serverCapabilities().contains(QLatin1String("METADATA"))) {
job->setServerCapability(KIMAP::MetaDataJobBase::Metadata);
......
......@@ -48,8 +48,8 @@ Akonadi::Item MessageHelper::createItemFromMessage(const KMime::Message::Ptr &me
i.setSize(size);
Akonadi::MessageFlags::copyMessageFlags(*message, i);
foreach (const QByteArray &flag, ResourceTask::toAkonadiFlags(flags)) {
const auto flagsLst = ResourceTask::toAkonadiFlags(flags);
for (const QByteArray &flag : flagsLst) {
i.setFlag(flag);
}
}
......
......@@ -98,7 +98,8 @@ void RetrieveItemTask::onMessagesReceived(const QMap<qint64, KIMAP::Message> &me
}
i.setMimeType(remoteItem.mimeType());
i.setPayload(remoteItem.payload<KMime::Message::Ptr>());
foreach (const QByteArray &flag, remoteItem.flags()) {
const auto flags{remoteItem.flags()};
for (const QByteArray &flag : flags) {
i.setFlag(flag);
}
......
......@@ -66,7 +66,7 @@ QList<QByteArray> ImapTestBase::defaultPoolConnectionScenario(const QList<QByteA
QList<QByteArray> scenario;
QByteArray caps = "S: * CAPABILITY IMAP4 IMAP4rev1 UIDPLUS IDLE";
Q_FOREACH (const QByteArray &cap, customCapabilities) {
for (const QByteArray &cap : customCapabilities) {
caps += " " + cap;
}
......@@ -105,7 +105,7 @@ Akonadi::Collection ImapTestBase::createCollectionChain(const QString &remoteId)
Akonadi::Collection collection = parent;
const QStringList collections = remoteId.split(separator, Qt::SkipEmptyParts);
Q_FOREACH (const QString &colId, collections) {
for (const QString &colId : collections) {
collection = Akonadi::Collection(id);
collection.setRemoteId(separator + colId);
collection.setParentCollection(parent);
......
......@@ -299,11 +299,11 @@ void CalendaringTest::testCalendar()
QFETCH(std::vector<Kolab::Event>, expectedResult);
Kolab::Calendaring::Calendar cal;
foreach (const Kolab::Event &event, inputevents) {
for (const Kolab::Event &event : std::as_const(inputevents)) {
cal.addEvent(event);
}
const std::vector<Kolab::Event> result = cal.getEvents(start, end, true);
foreach (const Kolab::Event &event, result) {
for (const Kolab::Event &event : result) {
qDebug() << QTest::toString(event.start()) << QTest::toString(event.end());
}
compareEvents(result, expectedResult);
......
......@@ -559,7 +559,8 @@ void KCalConversionTest::testContactConversion()
QCOMPARE(e.formattedName(), kcal.formattedName());
QCOMPARE(e.emails(), kcal.emails());
QCOMPARE(e.preferredEmail(), kcal.preferredEmail());
foreach (const QString &mail, e.emails()) {
const auto mails{e.emails()};
for (const QString &mail : mails) {
QCOMPARE(e.custom(QLatin1String("KOLAB"), QString::fromLatin1("EmailTypes%1").arg(mail)),
kcal.custom(QLatin1String("KOLAB"), QString::fromLatin1("EmailTypes%1").arg(mail)));
}
......
......@@ -84,7 +84,8 @@ KMime::Message::Ptr toNote(const Note &n)
note.setClassification(Akonadi::NoteUtils::NoteMessageWrapper::Public);
}
foreach (const Kolab::Attachment &a, n.attachments()) {
const auto attachments{n.attachments()};
for (const Kolab::Attachment &a : attachments) {
if (!a.uri().empty()) {
Akonadi::NoteUtils::Attachment attachment(QUrl(fromStdString(a.uri())), fromStdString(a.mimetype()));
attachment.setLabel(fromStdString(a.label()));
......
Supports Markdown
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