Commit 7d76d821 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port some more foreach

parent e6118ac8
......@@ -337,7 +337,8 @@ KMime::Content *MessageComposer::Util::findTypeInMessage(KMime::Content *data, c
}
}
foreach (auto child, data->contents()) {
const auto contents = data->contents();
for (auto child : contents) {
if ((!child->contentType()->isEmpty()) && (mimeType == child->contentType()->mimeType()) && (subType == child->contentType()->subType())) {
return child;
}
......
......@@ -3663,7 +3663,7 @@ void ModelPrivate::printStatistics()
int totalThreads = 0;
if (!mGroupHeaderItemHash.isEmpty()) {
foreach (const GroupHeaderItem *groupHeader, mGroupHeaderItemHash) {
for (const GroupHeaderItem *groupHeader : qAsConst(mGroupHeaderItemHash)) {
totalThreads += groupHeader->childItemCount();
}
} else {
......
......@@ -1174,7 +1174,9 @@ void ViewerPrivate::setMessageItem(const Akonadi::Item &item, MimeTreeParser::Up
setHtmlLoadExtOverride(true);
}
foreach (const Akonadi::Item::Id monitoredId, mMonitor.itemsMonitoredEx()) {
const auto itemsMonitoredEx = mMonitor.itemsMonitoredEx();
for (const Akonadi::Item::Id monitoredId : itemsMonitoredEx) {
mMonitor.setItemMonitored(Akonadi::Item(monitoredId), false);
}
Q_ASSERT(mMonitor.itemsMonitoredEx().isEmpty());
......
......@@ -28,7 +28,8 @@ KMime::Content *MimeTreeParser::findTypeInDirectChilds(KMime::Content *content,
return content;
}
foreach (const auto child, content->contents()) {
const auto contents = content->contents();
for (const auto child : contents) {
if ((!child->contentType()->isEmpty()) && (mimeType == child->contentType(false)->mimeType())) {
return child;
}
......
......@@ -195,7 +195,8 @@ void MessagePart::parseInternal(KMime::Content *node, bool onlyOneMimePart)
QString MessagePart::renderInternalText() const
{
QString text;
foreach (const auto &mp, subParts()) {
const auto subPartsLst = subParts();
for (const auto &mp : subPartsLst) {
text += mp->text();
}
return text;
......@@ -203,7 +204,8 @@ QString MessagePart::renderInternalText() const
void MessagePart::fix() const
{
foreach (const auto &mp, subParts()) {
const auto subPartsLst = subParts();
for (const auto &mp : subPartsLst) {
const auto m = mp.dynamicCast<MessagePart>();
if (m) {
m->fix();
......
......@@ -1011,7 +1011,8 @@ bool NodeHelper::unencryptedMessage_helper(KMime::Content *node, QByteArray &res
resultingData += curNode->head() + '\n';
}
const QByteArray boundary = curNode->contentType()->boundary();
foreach (KMime::Content *child, curNode->contents()) {
const auto contents = curNode->contents();
for (KMime::Content *child : contents) {
resultingData += "\n--" + boundary + '\n';
const bool changed = unencryptedMessage_helper(child, resultingData, true, recursionLevel + 1);
if (changed) {
......
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