Commit 9ea81dc2 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Remove some Q_FOREACH

parent 39eef7ac
......@@ -170,7 +170,8 @@ void AbstractImportExportJob::overwriteDirectory(const QString &path, const KArc
void AbstractImportExportJob::searchAllFiles(const KArchiveDirectory *dir, const QString &prefix, const QString &searchEntryName)
{
Q_FOREACH (const QString &entryName, dir->entries()) {
const QStringList lst = dir->entries();
for (const QString &entryName : lst) {
const KArchiveEntry *entry = dir->entry(entryName);
if (entry && entry->isDirectory()) {
const QString newPrefix = (prefix.isEmpty() ? prefix : prefix + QLatin1Char('/')) + entryName;
......@@ -185,7 +186,8 @@ void AbstractImportExportJob::searchAllFiles(const KArchiveDirectory *dir, const
void AbstractImportExportJob::storeArchiveInfoResources(const KArchiveDirectory *dir, const QString &prefix)
{
Q_FOREACH (const QString &entryName, dir->entries()) {
const QStringList lst = dir->entries();
for (const QString &entryName : lst) {
const KArchiveEntry *entry = dir->entry(entryName);
if (entry && entry->isDirectory()) {
const KArchiveDirectory *resourceDir = static_cast<const KArchiveDirectory *>(entry);
......@@ -453,7 +455,8 @@ void AbstractImportExportJob::extractZipFile(const KArchiveFile *file, const QSt
KZip *zip = Utils::openZip(source + QLatin1Char('/') + file->name(), errorMsg);
if (zip) {
const KArchiveDirectory *zipDir = zip->directory();
Q_FOREACH (const QString &entryName, zipDir->entries()) {
const QStringList lst = zipDir->entries();
for (const QString &entryName : lst) {
const KArchiveEntry *entry = zipDir->entry(entryName);
if (entry) {
if (entry->isDirectory()) {
......@@ -602,7 +605,8 @@ void AbstractImportExportJob::importDataSubdirectory(const QString &subdirectory
const KArchiveEntry *themeEntry = mArchiveDirectory->entry(Utils::dataPath() + subdirectoryRelativePath);
if (themeEntry && themeEntry->isDirectory()) {
const KArchiveDirectory *themeDir = static_cast<const KArchiveDirectory *>(themeEntry);
Q_FOREACH (const QString &entryName, themeDir->entries()) {
const QStringList lst = themeDir->entries();
for (const QString &entryName : lst) {
const KArchiveEntry *entry = themeDir->entry(entryName);
if (entry && entry->isDirectory()) {
QString subFolderName = entryName;
......
......@@ -223,7 +223,8 @@ void ImportAddressbookJob::importkaddressBookConfig(const KArchiveFile *file, co
const KArchiveEntry *csvtemplateEntry = mArchiveDirectory->entry(Utils::dataPath() + cvsTemplateDirName);
if (csvtemplateEntry && csvtemplateEntry->isDirectory()) {
const KArchiveDirectory *csvTemplateDir = static_cast<const KArchiveDirectory *>(csvtemplateEntry);
Q_FOREACH (const QString &entryName, csvTemplateDir->entries()) {
const QStringList lst = csvTemplateDir->entries();
for (const QString &entryName : lst) {
const KArchiveEntry *entry = csvTemplateDir->entry(entryName);
if (entry && entry->isFile()) {
const KArchiveFile *csvTemplateFile = static_cast<const KArchiveFile *>(entry);
......
......@@ -112,7 +112,8 @@ void ImportMailJob::slotNextStep()
void ImportMailJob::searchAllMailsFiles(const KArchiveDirectory *dir, const QString &prefix)
{
Q_FOREACH (const QString &entryName, dir->entries()) {
const QStringList lst = dir->entries();
for (const QString &entryName : lst) {
const KArchiveEntry *entry = dir->entry(entryName);
if (entry && entry->isDirectory()) {
const QString newPrefix = (prefix.isEmpty() ? prefix : prefix + QLatin1Char('/')) + entryName;
......@@ -130,7 +131,8 @@ void ImportMailJob::searchAllMailsFiles(const KArchiveDirectory *dir, const QStr
void ImportMailJob::storeMailArchiveResource(const KArchiveDirectory *dir, const QString &prefix)
{
Q_FOREACH (const QString &entryName, dir->entries()) {
const QStringList lst = dir->entries();
for (const QString &entryName : lst) {
const KArchiveEntry *entry = dir->entry(entryName);
if (entry && entry->isDirectory()) {
const KArchiveDirectory *resourceDir = static_cast<const KArchiveDirectory *>(entry);
......@@ -184,7 +186,7 @@ void ImportMailJob::restoreTransports()
}
const QStringList transportList = transportConfig->groupList().filter(QRegularExpression(QStringLiteral("Transport \\d+")));
Q_FOREACH (const QString &transport, transportList) {
for (const QString &transport : transportList) {
KConfigGroup group = transportConfig->group(transport);
const int transportId = group.readEntry(QStringLiteral("id"), -1);
MailTransport::Transport *mt = MailTransport::TransportManager::self()->createTransport();
......@@ -811,19 +813,19 @@ void ImportMailJob::restoreConfig()
restoreConfigFile(QStringLiteral("kwatchgnupgrc"));
restoreConfigFile(QStringLiteral("pimpluginsrc"));
//Restore notify file
QStringList lstNotify;
lstNotify << QStringLiteral("akonadi_mailfilter_agent.notifyrc")
<< QStringLiteral("akonadi_sendlater_agent.notifyrc")
<< QStringLiteral("akonadi_archivemail_agent.notifyrc")
<< QStringLiteral("kmail2.notifyrc")
<< QStringLiteral("akonadi_newmailnotifier_agent.notifyrc")
<< QStringLiteral("akonadi_maildispatcher_agent.notifyrc")
<< QStringLiteral("akonadi_followupreminder_agent.notifyrc")
<< QStringLiteral("messageviewer.notifyrc")
<< QStringLiteral("storageservicemanager.notifyrc");
const QStringList lstNotify = {
QStringLiteral("akonadi_mailfilter_agent.notifyrc"),
QStringLiteral("akonadi_sendlater_agent.notifyrc"),
QStringLiteral("akonadi_archivemail_agent.notifyrc"),
QStringLiteral("kmail2.notifyrc"),
QStringLiteral("akonadi_newmailnotifier_agent.notifyrc"),
QStringLiteral("akonadi_maildispatcher_agent.notifyrc"),
QStringLiteral("akonadi_followupreminder_agent.notifyrc"),
QStringLiteral("messageviewer.notifyrc"),
QStringLiteral("storageservicemanager.notifyrc") };
//We can't merge it.
Q_FOREACH (const QString &filename, lstNotify) {
for (const QString &filename : lstNotify) {
restoreConfigFile(filename);
}
......@@ -854,7 +856,8 @@ void ImportMailJob::importSimpleFilesInDirectory(const QString &relativePath)
const KArchiveEntry *autocorrectionEntry = mArchiveDirectory->entry(Utils::dataPath() + relativePath);
if (autocorrectionEntry && autocorrectionEntry->isDirectory()) {
const KArchiveDirectory *autoCorrectionDir = static_cast<const KArchiveDirectory *>(autocorrectionEntry);
Q_FOREACH (const QString &entryName, autoCorrectionDir->entries()) {
const QStringList lst = autoCorrectionDir->entries();
for (const QString &entryName : lst) {
const KArchiveEntry *entry = autoCorrectionDir->entry(entryName);
if (entry && entry->isFile()) {
const KArchiveFile *autocorrectionFile = static_cast<const KArchiveFile *>(entry);
......
......@@ -124,7 +124,8 @@ void ShowArchiveStructureDialog::addSubItems(QTreeWidgetItem *parent, const KArc
const KArchiveDirectory *dir = static_cast<const KArchiveDirectory *>(entry);
++indent;
const QString space = QString(indent * 2, QLatin1Char(' '));
Q_FOREACH (const QString &entryName, dir->entries()) {
const QStringList lst = dir->entries();
for (const QString &entryName : lst) {
const KArchiveEntry *entry = dir->entry(entryName);
if (entry) {
if (entry->isDirectory()) {
......
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