Commit 34db6b7c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

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

parent 54e63a49
......@@ -142,7 +142,7 @@ void Filter::setSearchString(const QString &search, QuickSearchLine::SearchOptio
const QStringList searchListTmp = mSearchString.split(QLatin1Char(' '), QString::SkipEmptyParts);
mSearchList.clear();
newStr.clear();
Q_FOREACH (const QString &text, searchListTmp) {
for (const QString &text : searchListTmp) {
if (text.size() >= 3) {
mSearchList << text;
if (!newStr.isEmpty()) {
......
......@@ -1077,7 +1077,7 @@ void Pane::writeConfig(bool restoreSession)
// Delete list before
const QStringList list = MessageList::MessageListSettings::self()->config()->groupList().filter(QRegularExpression(QStringLiteral("MessageListTab\\d+")));
foreach (const QString &group, list) {
for (const QString &group : list) {
MessageList::MessageListSettings::self()->config()->deleteGroup(group);
}
......
......@@ -2539,9 +2539,9 @@ void ViewerPrivate::slotAttachmentSaveAll()
void ViewerPrivate::slotAttachmentView()
{
auto contents = selectedContents();
const auto contents = selectedContents();
Q_FOREACH (KMime::Content *content, contents) {
for (KMime::Content *content : contents) {
attachmentView(content);
}
......@@ -2549,13 +2549,13 @@ void ViewerPrivate::slotAttachmentView()
void ViewerPrivate::slotAttachmentProperties()
{
auto contents = selectedContents();
const auto contents = selectedContents();
if (contents.isEmpty()) {
return;
}
Q_FOREACH (KMime::Content *content, contents) {
for (KMime::Content *content : contents) {
attachmentProperties(content);
}
}
......@@ -2582,7 +2582,7 @@ void ViewerPrivate::attachmentCopy(const KMime::Content::List &contents)
}
QList<QUrl> urls;
Q_FOREACH (KMime::Content *content, contents) {
for (KMime::Content *content : contents) {
auto url = QUrl::fromLocalFile(mNodeHelper->writeNodeToTempFile(content));
if (!url.isValid()) {
continue;
......@@ -2602,13 +2602,13 @@ void ViewerPrivate::attachmentCopy(const KMime::Content::List &contents)
void ViewerPrivate::slotAttachmentDelete()
{
auto contents = selectedContents();
const auto contents = selectedContents();
if (contents.isEmpty()) {
return;
}
bool showWarning = true;
Q_FOREACH (KMime::Content *content, contents) {
for (KMime::Content *content : contents) {
if (!deleteAttachment(content, showWarning)) {
return;
}
......@@ -2619,7 +2619,7 @@ void ViewerPrivate::slotAttachmentDelete()
void ViewerPrivate::slotAttachmentEdit()
{
auto contents = selectedContents();
const auto contents = selectedContents();
if (contents.isEmpty()) {
return;
}
......@@ -2631,7 +2631,7 @@ void ViewerPrivate::slotAttachmentEdit()
job->setMessage(mMessage);
bool showWarning = true;
Q_FOREACH (KMime::Content *content, contents) {
for (KMime::Content *content : contents) {
if (!job->addAttachment(content, showWarning)) {
break;
}
......
......@@ -81,8 +81,8 @@ void ViewerPluginToolManagerPrivate::refreshActionList()
void ViewerPluginToolManagerPrivate::createView()
{
QVector<MessageViewer::ViewerPlugin *> listPlugin = MessageViewer::ViewerPluginManager::self()->pluginsList();
Q_FOREACH (MessageViewer::ViewerPlugin *plugin, listPlugin) {
const QVector<MessageViewer::ViewerPlugin *> listPlugin = MessageViewer::ViewerPluginManager::self()->pluginsList();
for (MessageViewer::ViewerPlugin *plugin : listPlugin) {
if (plugin->isEnabled()) {
MessageViewer::ViewerPluginInterface *interface = plugin->createView(mParentWidget, mActionCollection);
q->connect(interface, &MessageViewer::ViewerPluginInterface::activatePlugin, q, &ViewerPluginToolManager::activatePlugin);
......
......@@ -57,8 +57,8 @@ QMimeType MimeTreeParser::Util::mimetype(const QString &name)
{
QMimeDatabase db;
// consider the filename if mimetype cannot be found by content-type
auto mimeTypes = db.mimeTypesForFileName(name);
foreach (const auto &mt, mimeTypes) {
const auto mimeTypes = db.mimeTypesForFileName(name);
for (const auto &mt : mimeTypes) {
if (mt.name() != QLatin1String("application/octet-stream")) {
return mt;
}
......@@ -132,4 +132,4 @@ QString MimeTreeParser::Util::iconNameForContent(KMime::Content *node)
mimeType = mimeType.toLower();
return iconNameForMimetype(QLatin1String(mimeType), node->contentDisposition()->filename(),
node->contentType()->name());
}
\ No newline at end of file
}
......@@ -850,11 +850,11 @@ void NodeHelper::cleanFromExtraNodes(KMime::Content *node)
if (!node) {
return;
}
QList<KMime::Content * > extraNodes = extraContents(node);
Q_FOREACH (KMime::Content *extra, extraNodes) {
const QList<KMime::Content * > extraNodes = extraContents(node);
for (KMime::Content *extra : extraNodes) {
QByteArray s = extra->encodedContent();
auto children = node->contents();
Q_FOREACH (KMime::Content *c, children) {
const auto children = node->contents();
for (KMime::Content *c : children) {
if (c->encodedContent() == s) {
node->removeContent(c);
}
......
......@@ -54,7 +54,7 @@ static const int PipeTimeout = 15 * 1000;
static QTextCodec *selectCharset(const QStringList &charsets, const QString &text)
{
foreach (const QString &name, charsets) {
for (const QString &name : charsets) {
// We use KCharsets::codecForName() instead of QTextCodec::codecForName() here, because
// the former knows us-ascii is latin1.
bool ok = true;
......@@ -1206,8 +1206,8 @@ void TemplateParser::addProcessedBodyToMessage(const QString &plainBody,
// Now, delete the old content and set the new content, which
// is either only the new text or the new text with some attachments.
auto parts = mMsg->contents();
foreach (KMime::Content *content, parts) {
const auto parts = mMsg->contents();
for (KMime::Content *content : parts) {
mMsg->removeContent(content, true/*delete*/);
}
......
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