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)
}
} else { // saved to draft, so keep the old values, not very nice.
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()) {
case MessageComposer::Recipient::To:
mExpandedTo << r->email();
......
......@@ -198,8 +198,8 @@ void MessageComposer::RecipientsEditor::setRecentAddressConfig(KConfig *config)
{
d->mRecentAddressConfig = config;
if (config) {
MultiplyingLine *line;
foreach (line, lines()) {
const auto linesP{lines()};
for (auto line : linesP) {
auto rec = qobject_cast<RecipientLineNG *>(line);
if (rec) {
rec->setRecentAddressConfig(config);
......@@ -349,7 +349,8 @@ void RecipientsEditor::slotCalculateTotal()
addData();
}
int count = 0;
foreach (line, lines()) {
const auto linesP{lines()};
for (auto line : linesP) {
auto rec = qobject_cast<RecipientLineNG *>(line);
if (rec) {
if (!rec->isEmpty()) {
......
......@@ -162,7 +162,8 @@ void MessageItemPrivate::invalidateAnnotationCache()
const MessageItem::Tag *MessageItemPrivate::bestTag() const
{
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()) {
best = tag;
}
......@@ -285,7 +286,8 @@ void MessageItem::editAnnotation(QWidget *parent)
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) {
return tag;
}
......@@ -723,7 +725,8 @@ void TagCache::onTagsFetched(KJob *job)
return;
}
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));
}
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