Commit f12f03a9 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

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

parent 017e6361
......@@ -123,7 +123,8 @@ bool FilterKMailArchive::importFolder(const KArchiveDirectory *folder, const QSt
int total = messageDir->entries().count();
int cur = 1;
foreach (const QString &entryName, messageDir->entries()) {
const QStringList lstEntries = messageDir->entries();
for (const QString &entryName : lstEntries) {
filterInfo()->setCurrent(cur * 100 / total);
filterInfo()->setOverall(d->mFilesDone * 100 / d->mTotalFiles);
const KArchiveEntry *const entry = messageDir->entry(entryName);
......@@ -153,7 +154,8 @@ bool FilterKMailArchive::importFolder(const KArchiveDirectory *folder, const QSt
bool FilterKMailArchive::importDirectory(const KArchiveDirectory *directory, const QString &folderPath)
{
qCDebug(MAILIMPORTER_LOG) << "Importing directory" << directory->name();
foreach (const QString &entryName, directory->entries()) {
const QStringList lstEntries = directory->entries();
for (const QString &entryName : lstEntries) {
const KArchiveEntry *const entry = directory->entry(entryName);
if (entry->isDirectory()) {
......@@ -188,7 +190,8 @@ bool FilterKMailArchive::importDirectory(const KArchiveDirectory *directory, con
int FilterKMailArchive::countFiles(const KArchiveDirectory *directory) const
{
int count = 0;
foreach (const QString &entryName, directory->entries()) {
const QStringList lstEntries = directory->entries();
for (const QString &entryName : lstEntries) {
const KArchiveEntry *const entry = directory->entry(entryName);
if (entry->isFile()) {
count++;
......
......@@ -165,7 +165,7 @@ void FilterMailApp::traverseDirectory(const QString &dirName)
dir.setFilter(QDir::Dirs | QDir::Files);
const QFileInfoList fileinfolist = dir.entryInfoList();
Q_FOREACH (const QFileInfo &fi, fileinfolist) {
for (const QFileInfo &fi : fileinfolist) {
const QString filename(fi.fileName());
if (filename == QLatin1String(".") || filename == QLatin1String("..")) {
continue;
......
......@@ -200,7 +200,7 @@ Akonadi::Collection Filter::parseFolderString(const QString &folderParseString)
Akonadi::Collection lastCollection;
// Create each folder on the folder list and add it the map.
foreach (const QString &folder, folderList) {
for (const QString &folder : folderList) {
if (isFirst) {
d->messageFolderCollectionMap[folder] = addSubCollection(d->filterInfo->rootCollection(), folder);
folderBuilder = folder;
......@@ -227,8 +227,8 @@ Akonadi::Collection Filter::addSubCollection(const Akonadi::Collection &baseColl
fetchJob->errorString()));
return Akonadi::Collection();
}
foreach (const Akonadi::Collection &subCollection, fetchJob->collections()) {
const Akonadi::Collection::List lstCols = fetchJob->collections();
for (const Akonadi::Collection &subCollection : lstCols) {
if (subCollection.name() == newCollectionPathName) {
return subCollection;
}
......@@ -275,7 +275,8 @@ bool Filter::checkForDuplicates(const QString &msgID,
d->filterInfo->addInfoLogEntry(i18n("<b>Warning:</b> Could not fetch mail in folder %1. Reason: %2"
" You may have duplicate messages.", messageFolder, job.errorString()));
} else {
foreach (const Akonadi::Item &messageItem, job.items()) {
const Akonadi::Item::List items = job.items();
for (const Akonadi::Item &messageItem : items) {
if (!messageItem.isValid()) {
d->filterInfo->addInfoLogEntry(i18n("<b>Warning:</b> Got an invalid message in folder %1.", messageFolder));
} else {
......
......@@ -87,7 +87,7 @@ QMap<QString, QString> FilterThunderbird::listProfile(QString &currentProfile, c
lstProfile.insert(name, path);
return lstProfile;
} else {
Q_FOREACH (const QString &profileName, profileList) {
for (const QString &profileName : profileList) {
KConfigGroup group = config.group(profileName);
const QString path = group.readEntry("Path");
const QString name = group.readEntry(QStringLiteral("Name"));
......
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