Commit 71931ac3 authored by Laurent Montel's avatar Laurent Montel 😁

Port to for(...:...)

parent e5c26385
......@@ -276,7 +276,7 @@ void ConfigDialog::onEditButtonClicked()
void ConfigDialog::onOkClicked()
{
typedef QPair<QString, KDAV::Protocol> UrlPair;
foreach (const UrlPair &url, mRemovedUrls) {
for (const UrlPair &url : qAsConst(mRemovedUrls)) {
Settings::self()->removeUrlConfiguration(url.second, url.first);
}
......@@ -290,7 +290,7 @@ void ConfigDialog::onCancelClicked()
mRemovedUrls.clear();
typedef QPair<QString, KDAV::Protocol> UrlPair;
foreach (const UrlPair &url, mAddedUrls) {
for (const UrlPair &url : qAsConst(mAddedUrls)) {
Settings::self()->removeUrlConfiguration(url.second, url.first);
}
reject();
......
......@@ -105,7 +105,7 @@ void DavFreeBusyHandler::onPrincipalSearchJobFinished(KJob *job)
mRequestsTracker[email].handlingJobSuccessful = true;
foreach (const KDAV::DavPrincipalSearchJob::Result &result, results) {
for (const KDAV::DavPrincipalSearchJob::Result &result : qAsConst(results)) {
qCDebug(DAVRESOURCE_LOG) << result.value;
QUrl url(davJob->property("url").toString());
if (result.value.startsWith(QLatin1Char('/'))) {
......
......@@ -929,7 +929,7 @@ void DavGroupwareResource::onMultigetFinished(KJob *job)
item.setRemoteRevision(davItem.etag());
cache->setEtag(item.remoteId(), davItem.etag());
items << item;
foreach (const Akonadi::Item &extraItem, extraItems) {
for (const Akonadi::Item &extraItem : qAsConst(extraItems)) {
cache->setEtag(extraItem.remoteId(), davItem.etag());
items << extraItem;
}
......
......@@ -73,7 +73,7 @@ QByteArray DefaultReminderAttribute::serialized() const
QVariantList list;
list.reserve(m_reminders.count());
Q_FOREACH (const ReminderPtr &rem, m_reminders) {
for (const ReminderPtr &rem : qAsConst(m_reminders)) {
QVariantMap reminder;
if (rem->type() == KCalCore::Alarm::Display) {
......@@ -94,7 +94,7 @@ KCalCore::Alarm::List DefaultReminderAttribute::alarms(KCalCore::Incidence *inci
{
KCalCore::Alarm::List alarms;
alarms.reserve(m_reminders.count());
Q_FOREACH (const ReminderPtr &reminder, m_reminders) {
for (const ReminderPtr &reminder : qAsConst(m_reminders)) {
KCalCore::Alarm::Ptr alarm(new KCalCore::Alarm(incidence));
alarm->setType(reminder->type());
......
......@@ -113,7 +113,7 @@ void GoogleAccountManager::slotFolderUpdated(const QString &folder)
QStringList walletEntries = m_wallet->entryList();
Q_FOREACH (const AccountPtr &account, m_accounts) {
Q_FOREACH (const AccountPtr &account, m_accounts) { //no using foreach
AccountPtr changedAccount = findAccountInWallet(account->accountName());
if (changedAccount.isNull()) {
walletEntries.removeOne(account->accountName());
......@@ -132,7 +132,7 @@ void GoogleAccountManager::slotFolderUpdated(const QString &folder)
}
}
Q_FOREACH (const QString &accountName, walletEntries) {
for (const QString &accountName : qAsConst(walletEntries)) {
const AccountPtr newAccount = findAccountInWallet(accountName);
m_accounts[newAccount->accountName()] = newAccount;
......
......@@ -507,7 +507,7 @@ void ContactsResource::slotUpdatePhotoFinished(KGAPI2::Job *job, const ContactPt
job->setProperty("processedItems", processedItems);
emitPercent(job, processedItems, items.count());
foreach (Item item, items) {
for (Item item : qAsConst(items)) {
if (item.remoteId() == contact->uid()) {
item.setPayload<KContacts::Addressee>(*contact.dynamicCast<KContacts::Addressee>());
new ItemModifyJob(item, this);
......
......@@ -478,7 +478,7 @@ void KAlarmResource::doRetrieveItems(const Akonadi::Collection &collection)
// Retrieve events from the calendar
const KCalCore::Event::List events = calendar()->events();
Item::List items;
foreach (const KCalCore::Event::Ptr &kcalEvent, events) {
for (const KCalCore::Event::Ptr &kcalEvent : qAsConst(events)) {
if (kcalEvent->alarms().isEmpty()) {
qCWarning(KALARMRESOURCE_LOG) << "KCalCore::Event has no alarms:" << kcalEvent->uid();
continue; // ignore events without alarms
......
......@@ -248,7 +248,7 @@ bool Maildir::Private::accessIsPossible(bool createMissingFolders)
paths.prepend(path);
Q_FOREACH (const QString &p, paths) {
for (const QString &p : qAsConst(paths)) {
if (!QFileInfo::exists(p)) {
if (!createMissingFolders) {
lastError = i18n("Error opening %1; this folder is missing.", p);
......
......@@ -57,7 +57,7 @@ KMBox::MBoxEntry::List DeletedItemsAttribute::deletedItemEntries() const
{
KMBox::MBoxEntry::List entries;
entries.reserve(mDeletedItemOffsets.count());
foreach (quint64 offset, mDeletedItemOffsets) {
for (quint64 offset : qAsConst(mDeletedItemOffsets)) {
entries << KMBox::MBoxEntry(offset);
}
......
......@@ -456,7 +456,7 @@ FetchJob::FetchJob(POPSession *session)
void FetchJob::setFetchIds(const QList<int> &ids, const QList<int> &sizes)
{
mIdsPendingDownload = ids;
foreach (int size, sizes) {
for (int size : qAsConst(sizes)) {
mTotalBytesToDownload += size;
}
}
......
......@@ -83,7 +83,7 @@ QByteArray ImapQuotaAttribute::serialized() const
QByteArray result = "";
// First the roots list
foreach (const QByteArray &root, mRoots) {
for (const QByteArray &root : qAsConst(mRoots)) {
result += root + " % ";
}
result.chop(3);
......@@ -145,7 +145,7 @@ void ImapQuotaAttribute::deserialize(const QByteArray &data)
}
QStringList roots = members[0].trimmed().split(QStringLiteral(" % "));
foreach (const QString &root, roots) {
for (const QString &root : qAsConst(roots)) {
mRoots << root.trimmed().toUtf8();
}
......
......@@ -132,7 +132,7 @@ QByteArray O0BaseAuth::createQueryParameters(const QList<O0RequestParameter> &pa
{
QByteArray ret;
bool first = true;
foreach (O0RequestParameter h, parameters) {
for (const O0RequestParameter &h : qAsConst(parameters)) {
if (first) {
first = false;
} else {
......
......@@ -181,7 +181,7 @@ QByteArray O1::buildAuthorizationHeader(const QList<O0RequestParameter> &oauthPa
QByteArray ret("OAuth ");
QList<O0RequestParameter> headers(oauthParams);
qSort(headers);
foreach (const O0RequestParameter &h, headers) {
for (const O0RequestParameter &h : qAsConst(headers)) {
if (first) {
first = false;
} else {
......
......@@ -320,7 +320,7 @@ QByteArray O2::buildRequestBody(const QMap<QString, QString> &parameters)
{
QByteArray body;
bool first = true;
foreach (QString key, parameters.keys()) {
foreach (const QString &key, parameters.keys()) {
if (first) {
first = false;
} else {
......
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