Commit f43ebfec authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port some foreach

parent 53ee55c8
Pipeline #70020 passed with stage
in 40 minutes and 27 seconds
......@@ -156,7 +156,8 @@ void SkeletonMessageJobTest::testAddresses()
{
QVERIFY(message->to(false));
// qDebug() << "To:" << message->to()->asUnicodeString();
foreach (const auto &addr, message->to()->mailboxes()) {
const auto mailboxes{message->to()->mailboxes()};
for (const auto &addr : mailboxes) {
// qDebug() << addr.prettyAddress();
QVERIFY(to.contains(addr.prettyAddress()));
to.removeOne(addr.prettyAddress());
......@@ -167,7 +168,8 @@ void SkeletonMessageJobTest::testAddresses()
{
QVERIFY(message->cc(false));
// qDebug() << "Cc:" << message->cc()->asUnicodeString();
foreach (const auto &addr, message->cc()->mailboxes()) {
const auto mailboxes{message->cc()->mailboxes()};
for (const auto &addr : mailboxes) {
// qDebug() << addr.prettyAddress();
QVERIFY(cc.contains(addr.prettyAddress()));
cc.removeOne(addr.prettyAddress());
......@@ -178,7 +180,8 @@ void SkeletonMessageJobTest::testAddresses()
{
QVERIFY(message->bcc(false));
// qDebug() << "Bcc:" << message->bcc()->asUnicodeString();
foreach (const auto &addr, message->bcc()->mailboxes()) {
const auto mailboxes{message->bcc()->mailboxes()};
for (const auto &addr : mailboxes) {
// qDebug() << addr.prettyAddress();
QVERIFY(bcc.contains(addr.prettyAddress()));
bcc.removeOne(addr.prettyAddress());
......
......@@ -112,7 +112,8 @@ bool ComposerViewBase::isComposing() const
void ComposerViewBase::setMessage(const KMime::Message::Ptr &msg, bool allowDecryption)
{
if (m_attachmentModel) {
foreach (const MessageCore::AttachmentPart::Ptr &attachment, m_attachmentModel->attachments()) {
const auto attachments{m_attachmentModel->attachments()};
for (const MessageCore::AttachmentPart::Ptr &attachment : attachments) {
if (!m_attachmentModel->removeAttachment(attachment)) {
qCWarning(MESSAGECOMPOSER_LOG) << "Attachment not found.";
}
......@@ -174,10 +175,12 @@ void ComposerViewBase::setMessage(const KMime::Message::Ptr &msg, bool allowDecr
otp.parseObjectTree(msgContent);
// Load the attachments
foreach (const auto &att, otp.nodeHelper()->attachmentsOfExtraContents()) {
const auto attachmentsOfExtraContents{otp.nodeHelper()->attachmentsOfExtraContents()};
for (const auto &att : attachmentsOfExtraContents) {
addAttachmentPart(att);
}
foreach (const auto &att, msgContent->attachments()) {
const auto attachments{msgContent->attachments()};
for (const auto &att : attachments) {
addAttachmentPart(att);
}
......
......@@ -63,7 +63,7 @@ public:
@param recipient The recipient(s) you want to add.
@param type The recipient type.
*/
Q_REQUIRED_RESULT bool addRecipient(const QString &recipient, Recipient::Type type);
bool addRecipient(const QString &recipient, Recipient::Type type);
/** Removes the recipient provided it can be found and has the given type.
@param recipient The recipient(s) you want to remove.
......
......@@ -303,7 +303,8 @@ QString MessageItem::tagListDescription() const
{
QString ret;
foreach (const Tag *tag, tagList()) {
const auto tags{tagList()};
for (const Tag *tag : tags) {
if (!ret.isEmpty()) {
ret += QLatin1String(", ");
}
......
......@@ -225,7 +225,8 @@ void MessageList::Widget::slotTagsFetched(KJob *job)
QString());
QStringList tagFound;
foreach (const Akonadi::Tag &akonadiTag, fetchJob->tags()) {
const auto tags{fetchJob->tags()};
for (const Akonadi::Tag &akonadiTag : tags) {
if (tagSelectedLst.contains(akonadiTag.url().url())) {
tagFound.append(akonadiTag.url().url());
QString iconName = QStringLiteral("mail-tagged");
......
......@@ -898,7 +898,8 @@ void NodeHelper::mergeExtraNodes(KMime::Content *node)
node->addContent(c);
}
Q_FOREACH (KMime::Content *child, node->contents()) {
const auto contents{node->contents()};
for (KMime::Content *child : contents) {
mergeExtraNodes(child);
}
}
......@@ -918,7 +919,8 @@ void NodeHelper::cleanFromExtraNodes(KMime::Content *node)
}
}
}
Q_FOREACH (KMime::Content *child, node->contents()) {
const auto contents{node->contents()};
for (KMime::Content *child : contents) {
cleanFromExtraNodes(child);
}
}
......
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