Commit 06d0d8a3 authored by Laurent Montel's avatar Laurent Montel 😁

Remove some Q_FOREACH

parent dea936fb
......@@ -146,7 +146,8 @@ QString GrantleeContactGroupFormatter::toHtml(HtmlForm form) const
Akonadi::ContactGroupExpandJob *job = new Akonadi::ContactGroupExpandJob(group);
if (job->exec()) {
group.removeAllContactData();
foreach (const KContacts::Addressee &contact, job->contacts()) {
const KContacts::Addressee::List lstContacts = job->contacts();
for (const KContacts::Addressee &contact : lstContacts) {
group.append(KContacts::ContactGroup::Data(contact.realName(), contact.preferredEmail()));
}
}
......
......@@ -137,7 +137,9 @@ QString ContactGrantleePrintObject::languages() const
{
QString result;
QStringList langList;
Q_FOREACH (const KContacts::Lang &lang, mAddress.langs()) {
const KContacts::Lang::List lstLangs = mAddress.langs();
langList.reserve(lstLangs.count());
for (const KContacts::Lang &lang : lstLangs) {
langList.append(lang.language());
}
if (!langList.isEmpty()) {
......@@ -149,7 +151,8 @@ QString ContactGrantleePrintObject::languages() const
QStringList ContactGrantleePrintObject::emails() const
{
QStringList emails;
Q_FOREACH (const QString &email, mAddress.emails()) {
const QStringList lstEmails(mAddress.emails());
for (const QString &email : lstEmails) {
const QString fullEmail = QString::fromLatin1(QUrl::toPercentEncoding(mAddress.fullEmail(email)));
const QString url = QStringLiteral("<a href=\"mailto:%1\">%2</a>")
......
......@@ -202,8 +202,8 @@ KAddressBookImportExport::KAddressBookImportExportContactList KAddressBookContac
if (!job->exec()) {
return contacts;
}
foreach (const Akonadi::Item &item, job->items()) {
const Akonadi::Item::List lstItems = job->items();
for (const Akonadi::Item &item : lstItems) {
if (item.isValid()) {
if (item.hasPayload<KContacts::Addressee>()) {
contacts.append(item.payload<KContacts::Addressee>());
......@@ -307,7 +307,8 @@ KAddressBookImportExport::KAddressBookImportExportContactList KAddressBookContac
return contacts;
}
foreach (const Akonadi::Item &item, job->items()) {
const Akonadi::Item::List lstItems = job->items();
for (const Akonadi::Item &item : lstItems) {
if (item.hasPayload<KContacts::Addressee>()) {
contacts.append(item.payload<KContacts::Addressee>());
}
......@@ -319,8 +320,8 @@ KAddressBookImportExport::KAddressBookImportExportContactList KAddressBookContac
if (!job->exec()) {
return contacts;
}
foreach (const Akonadi::Item &item, job->items()) {
const Akonadi::Item::List lstItems = job->items();
for (const Akonadi::Item &item : lstItems) {
if (item.hasPayload<KContacts::Addressee>()) {
contacts.append(item.payload<KContacts::Addressee>());
}
......
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