Commit e1a21557 authored by Laurent Montel's avatar Laurent Montel 😁

Port last foreach

parent 7675441f
......@@ -121,7 +121,8 @@ QString StandardContactFormatter::toHtml(HtmlForm form) const
// Phone Numbers
int counter = 0;
foreach (const KContacts::PhoneNumber &number, rawContact.phoneNumbers()) {
for (const KContacts::PhoneNumber &number : rawContact.phoneNumbers()) {
QString dispLabel = number.typeLabel().replace(QLatin1Char(' '), QStringLiteral(" "));
QString dispValue = QStringLiteral("<a href=\"phone:?index=%1\">%2</a>").arg(counter).arg(number.number().toHtmlEscaped());
......@@ -143,7 +144,7 @@ QString StandardContactFormatter::toHtml(HtmlForm form) const
}
// EMails
foreach (const QString &email, rawContact.emails()) {
for (const QString &email : rawContact.emails()) {
const QString type = i18nc("a contact's email address", "Email");
const QString fullEmail = QString::fromLatin1(QUrl::toPercentEncoding(rawContact.fullEmail(email)));
......@@ -172,7 +173,7 @@ QString StandardContactFormatter::toHtml(HtmlForm form) const
// Addresses
counter = 0;
foreach (const KContacts::Address &address, rawContact.addresses()) {
for (const KContacts::Address &address : rawContact.addresses()) {
QString formattedAddress;
if (address.label().isEmpty()) {
......@@ -254,7 +255,7 @@ QString StandardContactFormatter::toHtml(HtmlForm form) const
key = keyIt.value();
} else {
// check whether it is a custom local field
foreach (const QVariantMap &description, customFieldDescriptions()) {
for (const QVariantMap &description : customFieldDescriptions()) {
if (description.value(QStringLiteral("key")).toString() == key) {
key = description.value(QStringLiteral("title")).toString();
const QString descriptionType = description.value(QStringLiteral("type")).toString();
......
......@@ -59,7 +59,8 @@ QString StandardContactGroupFormatter::toHtml(HtmlForm form) const
ContactGroupExpandJob *job = new ContactGroupExpandJob(group);
if (job->exec()) {
group.removeAllContactData();
foreach (const KContacts::Addressee &contact, job->contacts()) {
const KContacts::Addressee::List listContact = job->contacts();
for (const KContacts::Addressee &contact : listContact) {
group.append(KContacts::ContactGroup::Data(contact.realName(), contact.preferredEmail()));
}
}
......@@ -101,7 +102,7 @@ QString StandardContactGroupFormatter::toHtml(HtmlForm form) const
}
}
foreach (const QVariantMap &map, additionalFields()) {
for (const QVariantMap &map : additionalFields()) {
strGroup.append(QStringLiteral("<tr><td colspan=\"2\">&nbsp;</td></tr><tr><td align=\"right\" width=\"30%\"><b><font color=\"grey\">%1</font></b></td>"
"<td valign=\"bottom\" align=\"left\" width=\"50%\"><font>%2</font></td></tr>")
.arg(map.value(QStringLiteral("title")).toString())
......
......@@ -34,7 +34,7 @@ int main(int argc, char **argv)
Akonadi::EmailAddressSelectionDialog dlg;
if (dlg.exec()) {
foreach (const Akonadi::EmailAddressSelection &selection, dlg.selectedAddresses()) {
for (const Akonadi::EmailAddressSelection &selection : dlg.selectedAddresses()) {
qDebug("%s: %s", qPrintable(selection.name()), qPrintable(selection.email()));
}
}
......
......@@ -62,7 +62,7 @@ void MainWidget::showSelection()
mInfo->append(QStringLiteral("===========================\n"));
mInfo->append(QStringLiteral("Current selection:\n"));
foreach (const Akonadi::EmailAddressSelection &selection, mAddressesWidget->selectedAddresses()) {
for (const Akonadi::EmailAddressSelection &selection : mAddressesWidget->selectedAddresses()) {
mInfo->append(QStringLiteral("%1: %2\n").arg(selection.name()).arg(selection.email()));
}
}
......
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