Commit 860b94df authored by Laurent Montel's avatar Laurent Montel 😁

Port some others Q_FOREACH

parent 02a5274e
......@@ -121,7 +121,7 @@ void MainWindow::slotFetchJobFinished(KGAPI2::Job *job)
/* Get all items the job has retrieved */
const KGAPI2::ObjectsList objects = fetchJob->items();
Q_FOREACH (const KGAPI2::ObjectPtr &object, objects) {
for (const KGAPI2::ObjectPtr &object : objects) {
const KGAPI2::ContactPtr contact = object.dynamicCast<KGAPI2::Contact>();
/* Convert the contact to QListWidget item */
......
......@@ -304,7 +304,7 @@ QVariant Post::Private::toJSON(const PostPtr &post)
}
if (!post->d->images.isEmpty()) {
QVariantList images;
Q_FOREACH (const QUrl &url, post->d->images) {
for (const QUrl &url : qAsConst(post->d->images)) {
QVariantMap image;
image[QStringLiteral("url")] = url.toString();
images << image;
......
......@@ -263,7 +263,7 @@ ObjectsList parseCalendarJSONFeed(const QByteArray& jsonFeed, FeedData& feedData
const QVariantList items = data.value(QStringLiteral("items")).toList();
list.reserve(items.size());
Q_FOREACH(const QVariant &i, items) {
for (const QVariant &i : items) {
list.append(Private::JSONToCalendar(i.toMap()));
}
......@@ -454,8 +454,8 @@ ObjectPtr Private::JSONToEvent(const QVariantMap& data, const QString &timezone)
event->setUseDefaultReminders(false);
}
QVariantList overrides = reminders.value(QStringLiteral("overrides")).toList();
Q_FOREACH(const QVariant & r, overrides) {
const QVariantList overrides = reminders.value(QStringLiteral("overrides")).toList();
for (const QVariant & r : overrides) {
QVariantMap override = r.toMap();
KCalCore::Alarm::Ptr alarm(new KCalCore::Alarm(static_cast<KCalCore::Incidence*>(event.data())));
alarm->setTime(event->dtStart());
......@@ -547,7 +547,7 @@ QByteArray eventToJSON(const EventPtr& event)
QStringList dates;
const auto rDates = event->recurrence()->rDates();
dates.reserve(rDates.size());
Q_FOREACH(const QDate & rDate, rDates) {
for (const QDate & rDate : rDates) {
dates << rDate.toString(QStringLiteral("yyyyMMdd"));
}
......@@ -558,7 +558,7 @@ QByteArray eventToJSON(const EventPtr& event)
dates.clear();
const auto exDates = event->recurrence()->exDates();
dates.reserve(exDates.size());
Q_FOREACH(const QDate & exDate, exDates) {
for (const QDate & exDate : exDates) {
dates << exDate.toString(QStringLiteral("yyyyMMdd"));
}
......@@ -720,7 +720,7 @@ ObjectsList parseEventJSONFeed(const QByteArray& jsonFeed, FeedData& feedData)
ObjectsList list;
const QVariantList items = data.value(QStringLiteral("items")).toList();
list.reserve(items.size());
Q_FOREACH(const QVariant &i, items) {
for (const QVariant &i : items) {
list.append(Private::JSONToEvent(i.toMap(), timezone));
}
......@@ -736,8 +736,8 @@ KCalCore::DateList Private::parseRDate(const QString& rule)
KTimeZone tz;
QString left = rule.left(rule.indexOf(QLatin1Char(':')));
QStringList params = left.split(QLatin1Char(';'));
Q_FOREACH(const QString & param, params) {
const QStringList params = left.split(QLatin1Char(';'));
for (const QString &param : params) {
if (param.startsWith(QLatin1String("VALUE"))) {
value = param.mid(param.indexOf(QLatin1Char('=')) + 1);
} else if (param.startsWith(QLatin1String("TZID"))) {
......@@ -1005,7 +1005,7 @@ QString Private::checkAndConverCDOTZID(const QString& tzid, const EventPtr& even
const QString vcard = format.toICalString(incidence);
const QStringList properties = vcard.split(QLatin1Char('\n'));
int CDOId = -1;
Q_FOREACH(const QString &property, properties) {
for (const QString &property : properties) {
if (property.startsWith(QStringLiteral("X-MICROSOFT-CDO-TZID"))) {
QStringList parsed = property.split(QLatin1Char(':'));
if (parsed.length() != 2) {
......
......@@ -50,7 +50,7 @@ EventDeleteJob::EventDeleteJob(const EventsList& events, const QString& calendar
DeleteJob(account, parent),
d(new Private)
{
Q_FOREACH(const EventPtr &event, events) {
for (const EventPtr &event : events) {
d->eventsIds << event->uid();
}
d->calendarId = calendarId;
......
......@@ -73,7 +73,7 @@ ContactsGroupDeleteJob::ContactsGroupDeleteJob(const ContactsGroupsList& groups,
d(new Private(this))
{
d->groupsIds.reserve(groups.size());
Q_FOREACH(const ContactsGroupPtr &group, groups) {
for(const ContactsGroupPtr &group : groups) {
d->groupsIds << group->id();
}
}
......
......@@ -164,7 +164,7 @@ typedef QList<PostPtr> PostsList;
template<class T>
ObjectsList operator<<(ObjectsList &objectsList, const QList< QSharedPointer<T> > &list)
{
Q_FOREACH (const QSharedPointer<T> &item, list) {
for (const QSharedPointer<T> &item : list) {
objectsList << item;
}
......
......@@ -476,7 +476,7 @@ AboutPtr About::fromJSON(const QByteArray &jsonData)
}
const QVariantList exportFormats = map.value(QStringLiteral("exportFormats")).toList();
Q_FOREACH (const QVariant &v, exportFormats) {
for (const QVariant &v : exportFormats) {
const QVariantMap exportFormat = v.toMap();
FormatPtr format(new Format());
format->d->source = exportFormat.value(QStringLiteral("source")).toString();
......@@ -486,13 +486,13 @@ AboutPtr About::fromJSON(const QByteArray &jsonData)
}
const QVariantList additionalRoleInfos = map.value(QStringLiteral("additionalRoleInfo")).toList();
Q_FOREACH (const QVariant &v, additionalRoleInfos) {
for (const QVariant &v : additionalRoleInfos) {
const QVariantMap additionalRoleInfo = v.toMap();
AdditionalRoleInfoPtr info(new AdditionalRoleInfo());
info->d->type = additionalRoleInfo.value(QStringLiteral("type")).toString();
const QVariantList roleSets = additionalRoleInfo.value(QStringLiteral("roleSets")).toList();
Q_FOREACH (const QVariant &vv, roleSets) {
for (const QVariant &vv : roleSets) {
const QVariantMap roleSetData = vv.toMap();
AdditionalRoleInfo::RoleSetPtr roleSet(new AdditionalRoleInfo::RoleSet());
roleSet->d->primaryRole = roleSetData.value(QStringLiteral("primaryRole")).toString();
......@@ -505,7 +505,7 @@ AboutPtr About::fromJSON(const QByteArray &jsonData)
}
const QVariantList features = map.value(QStringLiteral("features")).toList();
Q_FOREACH (const QVariant &v, features) {
for (const QVariant &v : features) {
const QVariantMap featureData = v.toMap();
FeaturePtr feature(new Feature());
feature->d->featureName = featureData.value(QStringLiteral("featureName")).toString();
......@@ -515,7 +515,7 @@ AboutPtr About::fromJSON(const QByteArray &jsonData)
}
const QVariantList maxUploadSizes = map.value(QStringLiteral("maxUploadSizes")).toList();
Q_FOREACH (const QVariant &v, maxUploadSizes) {
for (const QVariant &v : maxUploadSizes) {
const QVariantMap maxUploadSizeData = v.toMap();
MaxUploadSizePtr maxUploadSize(new MaxUploadSize());
maxUploadSize->d->type = maxUploadSizeData.value(QStringLiteral("type")).toString();
......
......@@ -78,7 +78,7 @@ ChildReferenceDeleteJob::ChildReferenceDeleteJob(const QString &folderId,
d(new Private)
{
d->folderId = folderId;
Q_FOREACH(const ChildReferencePtr & reference, references) {
for (const ChildReferencePtr & reference : references) {
d->childrenIds << reference->id();
}
}
......
......@@ -632,7 +632,7 @@ FilePtr File::Private::fromJSON(const QVariantMap &map)
file->d->shared = map[QStringLiteral("shared")].toBool();
const QVariantList ownersList = map[QStringLiteral("owners")].toList();
Q_FOREACH (const QVariant &owner, ownersList) {
for (const QVariant &owner : ownersList) {
file->d->owners << User::fromJSON(owner.toMap());
}
......
......@@ -104,7 +104,7 @@ PermissionPtr Permission::Private::fromJSON(const QVariantMap &map)
permission->d->role = Private::roleFromName(map[QStringLiteral("role")].toString());
const QStringList additionalRoles = map[QStringLiteral("additionalRoles")].toStringList();
Q_FOREACH(const QString & additionalRole, additionalRoles) {
for (const QString & additionalRole : additionalRoles) {
permission->d->additionalRoles << Private::roleFromName(additionalRole);
}
......@@ -262,7 +262,7 @@ PermissionsList Permission::fromJSONFeed(const QByteArray &jsonData)
PermissionsList permissions;
const QVariantList items = map[QStringLiteral("items")].toList();
Q_FOREACH(const QVariant & item, items) {
for (const QVariant & item : items) {
const PermissionPtr permission = Private::fromJSON(item.toMap());
if (!permission.isNull()) {
permissions << permission;
......
......@@ -94,7 +94,7 @@ ObjectsList parseLocationJSONFeed(const QByteArray & jsonFeed, FeedData & feedDa
const QVariantMap data = map.value(QStringLiteral("data")).toMap();
const QVariantList items = data.value(QStringLiteral("items")).toList();
output.reserve(items.size());
Q_FOREACH(const QVariant &c, items) {
for (const QVariant &c : items) {
QVariantMap location = c.toMap();
output << Private::parseLocation(location).dynamicCast<Object>();
}
......
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