Commit 7333b547 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port some foreach

parent c2724fd0
Pipeline #76166 canceled with stage
...@@ -412,7 +412,8 @@ void ComposerViewBase::slotEmailAddressResolved(KJob *job) ...@@ -412,7 +412,8 @@ void ComposerViewBase::slotEmailAddressResolved(KJob *job)
} }
} else { // saved to draft, so keep the old values, not very nice. } else { // saved to draft, so keep the old values, not very nice.
mExpandedFrom = from(); mExpandedFrom = from();
foreach (const MessageComposer::Recipient::Ptr &r, m_recipientsEditor->recipients()) { const auto recipients{m_recipientsEditor->recipients()};
for (const MessageComposer::Recipient::Ptr &r : recipients) {
switch (r->type()) { switch (r->type()) {
case MessageComposer::Recipient::To: case MessageComposer::Recipient::To:
mExpandedTo << r->email(); mExpandedTo << r->email();
......
...@@ -198,8 +198,8 @@ void MessageComposer::RecipientsEditor::setRecentAddressConfig(KConfig *config) ...@@ -198,8 +198,8 @@ void MessageComposer::RecipientsEditor::setRecentAddressConfig(KConfig *config)
{ {
d->mRecentAddressConfig = config; d->mRecentAddressConfig = config;
if (config) { if (config) {
MultiplyingLine *line; const auto linesP{lines()};
foreach (line, lines()) { for (auto line : linesP) {
auto rec = qobject_cast<RecipientLineNG *>(line); auto rec = qobject_cast<RecipientLineNG *>(line);
if (rec) { if (rec) {
rec->setRecentAddressConfig(config); rec->setRecentAddressConfig(config);
...@@ -349,7 +349,8 @@ void RecipientsEditor::slotCalculateTotal() ...@@ -349,7 +349,8 @@ void RecipientsEditor::slotCalculateTotal()
addData(); addData();
} }
int count = 0; int count = 0;
foreach (line, lines()) { const auto linesP{lines()};
for (auto line : linesP) {
auto rec = qobject_cast<RecipientLineNG *>(line); auto rec = qobject_cast<RecipientLineNG *>(line);
if (rec) { if (rec) {
if (!rec->isEmpty()) { if (!rec->isEmpty()) {
......
...@@ -162,7 +162,8 @@ void MessageItemPrivate::invalidateAnnotationCache() ...@@ -162,7 +162,8 @@ void MessageItemPrivate::invalidateAnnotationCache()
const MessageItem::Tag *MessageItemPrivate::bestTag() const const MessageItem::Tag *MessageItemPrivate::bestTag() const
{ {
const MessageItem::Tag *best = nullptr; const MessageItem::Tag *best = nullptr;
foreach (const MessageItem::Tag *tag, getTagList()) { const auto tagList{getTagList()};
for (const MessageItem::Tag *tag : tagList) {
if (!best || tag->priority() < best->priority()) { if (!best || tag->priority() < best->priority()) {
best = tag; best = tag;
} }
...@@ -285,7 +286,8 @@ void MessageItem::editAnnotation(QWidget *parent) ...@@ -285,7 +286,8 @@ void MessageItem::editAnnotation(QWidget *parent)
const MessageItem::Tag *MessageItemPrivate::findTagInternal(const QString &szTagId) const const MessageItem::Tag *MessageItemPrivate::findTagInternal(const QString &szTagId) const
{ {
foreach (const MessageItem::Tag *tag, getTagList()) { const auto tagList{getTagList()};
for (const MessageItem::Tag *tag : tagList) {
if (tag->id() == szTagId) { if (tag->id() == szTagId) {
return tag; return tag;
} }
...@@ -723,7 +725,8 @@ void TagCache::onTagsFetched(KJob *job) ...@@ -723,7 +725,8 @@ void TagCache::onTagsFetched(KJob *job)
return; return;
} }
auto fetchJob = static_cast<Akonadi::TagFetchJob *>(job); auto fetchJob = static_cast<Akonadi::TagFetchJob *>(job);
Q_FOREACH (const Akonadi::Tag &tag, fetchJob->tags()) { const auto tags{fetchJob->tags()};
for (const Akonadi::Tag &tag : tags) {
mCache.insert(tag.id(), new Akonadi::Tag(tag)); mCache.insert(tag.id(), new Akonadi::Tag(tag));
} }
if (auto m = mRequests.take(fetchJob)) { if (auto m = mRequests.take(fetchJob)) {
......
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