Commit 02a5274e authored by Laurent Montel's avatar Laurent Montel 😁

Remove more q_foreach

parent d9d1c68d
......@@ -79,7 +79,7 @@ void CalendarModifyJob::start()
QStringList headers;
const auto rawHeaderList = request.rawHeaderList();
headers.reserve(rawHeaderList.size());
Q_FOREACH(const QByteArray &str, rawHeaderList) {
for (const QByteArray &str : qAsConst(rawHeaderList)) {
headers << QLatin1String(str) + QLatin1String(": ") + QLatin1String(request.rawHeader(str));
}
qCDebug(KGAPIRaw) << headers;
......
......@@ -95,7 +95,7 @@ EventMoveJob::EventMoveJob(const EventsList &events, const QString &sourceCalend
ModifyJob(account, parent),
d(new Private(this))
{
Q_FOREACH(const EventPtr &event, events) {
for (const EventPtr &event : events) {
d->eventsIds << event->uid();
}
d->source = sourceCalendarId;
......
......@@ -126,7 +126,7 @@ void FreeBusyQueryJob::handleReply(const QNetworkReply *reply, const QByteArray
setErrorString(tr("FreeBusy information is not available"));
} else {
const QVariantList busyList = cal[QStringLiteral("busy")].toList();
Q_FOREACH (const QVariant &busyV, busyList) {
for (const QVariant &busyV : busyList) {
const QVariantMap busy = busyV.toMap();
d->busy << BusyRange{
KDateTime::fromString(busy[QStringLiteral("start")].toString(), KDateTime::RFC3339Date).dateTime(),
......
......@@ -228,7 +228,7 @@ void Contact::setGroups(const QStringList &groups)
insertCustom(QStringLiteral("GCALENDAR"), QStringLiteral("groupMembershipInfo"), groups.join(QStringLiteral(",")));
d->groups.clear();
Q_FOREACH(const QString &group, groups) {
for (const QString &group : groups) {
d->groups.insert(group, false);
}
}
......@@ -240,8 +240,8 @@ QStringList Contact::groups() const
void Contact::clearGroups()
{
QStringList groups = d->groups.keys();
Q_FOREACH(const QString &group, groups) {
const QStringList groups = d->groups.keys();
for (const QString &group : groups) {
d->groups.insert(group, true);
}
}
......
......@@ -78,7 +78,7 @@ ContactDeleteJob::ContactDeleteJob(const ContactsList& contacts, const AccountPt
d(new Private(this))
{
d->contactIds.reserve(contacts.size());
Q_FOREACH(const ContactPtr &contact, contacts) {
for (const ContactPtr &contact : contacts) {
d->contactIds << contact->uid();
}
}
......
......@@ -79,7 +79,7 @@ ObjectsList parseJSONFeed(const QByteArray& jsonFeed, FeedData& feedData)
}
const QVariantList links = feed.value(QStringLiteral("link")).toList();
Q_FOREACH(const QVariant &l, links) {
for (const QVariant &l : links) {
const QVariantMap link = l.toMap();
if (link.value(QStringLiteral("rel")).toString() == QLatin1String("next")) {
feedData.nextPageUrl = QUrl(link.value(QStringLiteral("href")).toString());
......@@ -303,7 +303,7 @@ ObjectPtr Private::JSONToContact(const QVariantMap& data)
/* Store URL of the picture. The URL will be used later by PhotoJob to fetch the picture
* itself. */
const QVariantList links = data.value(QStringLiteral("link")).toList();
Q_FOREACH(const QVariant &link, links) {
for (const QVariant &link : links) {
const QVariantMap linkMap = link.toMap();
if (linkMap.value(QStringLiteral("rel")).toString() == QLatin1String("http://schemas.google.com/contacts/2008/rel#photo")) {
contact->setPhotoUrl(linkMap.value(QStringLiteral("href")).toString());
......@@ -376,7 +376,7 @@ ObjectPtr Private::JSONToContact(const QVariantMap& data)
/* Relationships */
if (data.contains(QStringLiteral("gContact$relation"))) {
const QVariantList relations = data.value(QStringLiteral("gContact$relation")).toList();
Q_FOREACH(const QVariant &r, relations) {
for (const QVariant &r : relations) {
const QVariantMap relation = r.toMap();
if (relation.value(QStringLiteral("rel")).toString() == QLatin1String("spouse")) {
contact->setSpousesName(relation.value(QStringLiteral("$t")).toString());
......@@ -411,7 +411,7 @@ ObjectPtr Private::JSONToContact(const QVariantMap& data)
/* Websites */
if (data.contains(QStringLiteral("gContact$website"))) {
const QVariantList websites = data.value(QStringLiteral("gContact$website")).toList();
Q_FOREACH(const QVariant &w, websites) {
for (const QVariant &w : websites) {
const QVariantMap web = w.toMap();
if (web.value(QStringLiteral("rel")).toString() == QLatin1String("home-page")) {
......@@ -430,7 +430,7 @@ ObjectPtr Private::JSONToContact(const QVariantMap& data)
/* Emails */
const QVariantList emails = data.value(QStringLiteral("gd$email")).toList();
Q_FOREACH(const QVariant & em, emails) {
for (const QVariant & em : emails) {
const QVariantMap email = em.toMap();
contact->insertEmail(email.value(QStringLiteral("address")).toString(),
email.value(QStringLiteral("primary")).toBool());
......@@ -733,8 +733,8 @@ QByteArray contactToXML(const ContactPtr& contact)
const QStringList groups = contact->custom(QStringLiteral("GCALENDAR"), QStringLiteral("groupMembershipInfo")).split(QLatin1Char(','));
qCDebug(KGAPIDebug) << groups;
if ((groups.length() > 0) && !groups.at(0).isEmpty()) {
Q_FOREACH(const QString & group, groups) {
if ((!groups.isEmpty()) && !groups.at(0).isEmpty()) {
for (const QString & group :groups) {
bool removed = contact->groupIsDeleted(group);
if (!removed)
output.append(QStringLiteral("<gContact:groupMembershipInfo deleted=\"false\" href=\"%2\" />").arg(group).toUtf8());
......@@ -745,7 +745,7 @@ QByteArray contactToXML(const ContactPtr& contact)
/* User-defined fields */
const QStringList customs = contact->customs();
const QString defined_str = QStringLiteral("<gContact:userDefinedField key=\"%1\" value=\"%2\" />");
Q_FOREACH(const QString &customStr, customs) {
for (const QString &customStr : customs) {
QString key = customStr.left(customStr.indexOf(QLatin1Char(':')));
if (!parsedCustoms.contains(key)) {
if (key.startsWith(QLatin1String("KADDRESSBOOK-"))) {
......
......@@ -55,7 +55,7 @@ void AccountInfoFetchJob::start()
QStringList headers;
const auto rawHeaderList = request.rawHeaderList();
headers.reserve(rawHeaderList.size());
Q_FOREACH(const QByteArray &str, rawHeaderList) {
for (const QByteArray &str : qAsConst(rawHeaderList)) {
headers << QLatin1String(str) + QLatin1String(": ") + QLatin1String(request.rawHeader(str));
}
qCDebug(KGAPIRaw) << headers;
......
......@@ -466,7 +466,7 @@ AboutPtr About::fromJSON(const QByteArray &jsonData)
about->d->isCurrentAppInstalled = map.value(QStringLiteral("isCurrentAppInstalled")).toBool();
const QVariantList importFormats = map.value(QStringLiteral("importFormats")).toList();
Q_FOREACH (const QVariant &v, importFormats) {
for (const QVariant &v : importFormats) {
const QVariantMap importFormat = v.toMap();
FormatPtr format(new Format());
format->d->source = importFormat.value(QStringLiteral("source")).toString();
......
......@@ -220,7 +220,7 @@ FileAbstractUploadJob::FileAbstractUploadJob(const FilesList &metadata,
d(new Private(this))
{
int i = 0;
Q_FOREACH (const FilePtr &file, metadata) {
for (const FilePtr &file : metadata) {
d->files.insert(QStringLiteral("?=%1").arg(i), file);
++i;
}
......@@ -254,7 +254,7 @@ FileAbstractUploadJob::FileAbstractUploadJob(const QStringList &filePaths,
FileAbstractDataJob(account, parent),
d(new Private(this))
{
Q_FOREACH(const QString & filePath, filePaths) {
for (const QString & filePath : filePaths) {
d->files.insert(filePath, FilePtr());
}
d->originalFilesCount = d->files.count();
......
......@@ -80,7 +80,7 @@ ParentReferenceDeleteJob::ParentReferenceDeleteJob(const QString &fileId,
d(new Private)
{
d->fileId = fileId;
Q_FOREACH(const ParentReferencePtr & reference, references) {
for (const ParentReferencePtr & reference : references) {
d->referencesIds << reference->id();
}
}
......
......@@ -85,7 +85,7 @@ TaskListDeleteJob::TaskListDeleteJob(const TaskListsList& taskLists,
d(new Private(this))
{
d->taskListsIds.reserve(taskLists.size());
Q_FOREACH(const TaskListPtr &taskList, taskLists) {
for (const TaskListPtr &taskList : taskLists) {
d->taskListsIds << taskList->uid();
}
}
......
......@@ -93,7 +93,7 @@ TaskMoveJob::TaskMoveJob(const TasksList& tasks, const QString& taskListId,
d(new Private(this))
{
d->tasksIds.reserve(tasks.size());
Q_FOREACH(const TaskPtr &task, tasks) {
for (const TaskPtr &task : tasks) {
d->tasksIds << task->uid();
}
d->taskListId = taskListId;
......
......@@ -281,7 +281,7 @@ ObjectsList Private::parseTaskListJSONFeed(const QVariantList &items)
{
ObjectsList list;
list.reserve(items.size());
Q_FOREACH(const QVariant &item, items) {
for (const QVariant &item : items) {
list.append(Private::JSONToTaskList(item.toMap()));
}
......@@ -292,7 +292,7 @@ ObjectsList Private::parseTasksJSONFeed(const QVariantList &items)
{
ObjectsList list;
list.reserve(items.size());
Q_FOREACH(const QVariant &item, items) {
for (const QVariant &item : items) {
list.append(Private::JSONToTask(item.toMap()));
}
......
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