Port some foreach to for(...:...)

wilder-work
Montel Laurent 9 years ago
parent c32f37d488
commit 08b61c48f3
  1. 8
      src/editor/kmcomposerwin.cpp
  2. 3
      src/folderarchive/folderarchiveagentcheckcollection.cpp
  3. 2
      src/job/createtaskjob.cpp
  4. 5
      src/tag/tagactionmanager.cpp

@ -2022,7 +2022,7 @@ bool KMComposerWin::insertFromMimeData(const QMimeData *source, bool forceAttach
Akonadi::Collection::List collections;
bool allLocalURLs = true;
foreach (const QUrl &url, urlList) {
for (const QUrl &url : urlList) {
if (!url.isLocalFile()) {
allLocalURLs = false;
}
@ -2039,7 +2039,7 @@ bool KMComposerWin::insertFromMimeData(const QMimeData *source, bool forceAttach
if (items.isEmpty() && collections.isEmpty()) {
if (allLocalURLs || forceAttachment) {
foreach (const QUrl &url, urlList) {
for (const QUrl &url : urlList) {
addAttachment(url, QString());
}
} else {
@ -2052,7 +2052,7 @@ bool KMComposerWin::insertFromMimeData(const QMimeData *source, bool forceAttach
if (selectedAction == addAsTextAction) {
insertUrls(source, urlList);
} else if (selectedAction == addAsAttachmentAction) {
foreach (const QUrl &url, urlList) {
for (const QUrl &url : urlList) {
if (url.isValid()) {
addAttachment(url, QString());
}
@ -2122,7 +2122,7 @@ void KMComposerWin::slotFetchJob(KJob *job)
KMCommand *command = new KMForwardAttachedCommand(this, items, identity, this);
command->start();
} else {
foreach (const Akonadi::Item &item, items) {
for (const Akonadi::Item &item : items) {
QString attachmentName = QStringLiteral("attachment");
if (item.hasPayload<KContacts::Addressee>()) {
const KContacts::Addressee contact = item.payload<KContacts::Addressee>();

@ -102,7 +102,8 @@ void FolderArchiveAgentCheckCollection::slotInitialCollectionFetchingFirstLevelD
Akonadi::CollectionFetchJob *fetchJob = qobject_cast<Akonadi::CollectionFetchJob *>(job);
foreach (const Akonadi::Collection &collection, fetchJob->collections()) {
const Akonadi::Collection::List cols = fetchJob->collections();
for (const Akonadi::Collection &collection : cols) {
if (collection.name() == folderName) {
Q_EMIT collectionIdFound(collection);
return;

@ -85,7 +85,7 @@ void CreateTaskJob::itemFetchJobDone(KJob *job)
}
Akonadi::Item::List itemsToModify;
foreach (const Akonadi::Item &it, lst) {
for (const Akonadi::Item &it : lst) {
//qCDebug(KMAIL_LOG)<<" item ::"<<tmpItem;
if (it.isValid()) {
bool myStatus;

@ -167,7 +167,8 @@ void TagActionManager::finishedTagListing(KJob *job)
qCWarning(KMAIL_LOG) << job->errorString();
}
Akonadi::TagFetchJob *fetchJob = static_cast<Akonadi::TagFetchJob *>(job);
foreach (const Akonadi::Tag &result, fetchJob->tags()) {
const Akonadi::Tag::List lstTags = fetchJob->tags();
for (const Akonadi::Tag &result : lstTags) {
mTags.append(MailCommon::Tag::fromAkonadi(result));
}
mTagFetchInProgress = false;
@ -193,7 +194,7 @@ void TagActionManager::createTagActions(const QList<MailCommon::Tag::Ptr> &tags)
bool needToAddMoreAction = false;
const int numberOfTag(tags.size());
//It is assumed the tags are sorted
foreach (const MailCommon::Tag::Ptr &tag, tags) {
for (const MailCommon::Tag::Ptr &tag : tags) {
if (i < s_numberMaxTag) {
createTagAction(tag, true);
} else {

Loading…
Cancel
Save