]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/settings/viewpropertiesdialog.cpp
Compile without foreach
[dolphin.git] / src / settings / viewpropertiesdialog.cpp
index 2f5d55523dc14b147f94cd28181fef5f22ab1e74..41893ce25a702bd750eaf5b4ee6e6a2f6fa87b1b 100644 (file)
@@ -1,22 +1,9 @@
-/***************************************************************************
- *   Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at>                  *
- *   Copyright (C) 2018 by Elvis Angelaccio <elvis.angelaccio@kde.org>     *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
- ***************************************************************************/
+/*
+ * SPDX-FileCopyrightText: 2006 Peter Penz <peter.penz@gmx.at>
+ * SPDX-FileCopyrightText: 2018 Elvis Angelaccio <elvis.angelaccio@kde.org>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
 
 #include "viewpropertiesdialog.h"
 
@@ -91,7 +78,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
 
     m_sorting = new QComboBox();
     const QList<KFileItemModel::RoleInfo> rolesInfo = KFileItemModel::rolesInformation();
-    foreach (const KFileItemModel::RoleInfo& info, rolesInfo) {
+    for (const KFileItemModel::RoleInfo& info : rolesInfo) {
         m_sorting->addItem(info.translation, info.role);
     }
 
@@ -129,7 +116,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
         connect(m_listWidget, &QListWidget::itemChanged, this, &ViewPropertiesDialog::slotItemChanged);
         m_listWidget->setSelectionMode(QAbstractItemView::NoSelection);
         const QList<KFileItemModel::RoleInfo> rolesInfo = KFileItemModel::rolesInformation();
-        foreach (const KFileItemModel::RoleInfo& info, rolesInfo) {
+        for (const KFileItemModel::RoleInfo& info : rolesInfo) {
             QListWidgetItem* item = new QListWidgetItem(info.translation, m_listWidget);
             item->setCheckState(visibleRoles.contains(info.role) ? Qt::Checked : Qt::Unchecked);
 
@@ -163,23 +150,11 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
     layout->addRow(QString(), m_showInGroups);
     layout->addRow(QString(), m_showHiddenFiles);
 
-#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     connect(m_viewMode, QOverload<int>::of(&QComboBox::currentIndexChanged),
-#else
-    connect(m_viewMode, QOverload<int, const QString &>::of(&QComboBox::currentIndexChanged),
-#endif
             this, &ViewPropertiesDialog::slotViewModeChanged);
-#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     connect(m_sorting, QOverload<int>::of(&QComboBox::currentIndexChanged),
-#else
-    connect(m_sorting, QOverload<int, const QString &>::of(&QComboBox::currentIndexChanged),
-#endif
             this, &ViewPropertiesDialog::slotSortingChanged);
-#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     connect(m_sortOrder, QOverload<int>::of(&QComboBox::currentIndexChanged),
-#else
-    connect(m_sortOrder, QOverload<int, const QString &>::of(&QComboBox::currentIndexChanged),
-#endif
             this, &ViewPropertiesDialog::slotSortOrderChanged);
     connect(m_sortFoldersFirst, &QCheckBox::clicked,
             this, &ViewPropertiesDialog::slotSortFoldersFirstChanged);
@@ -350,7 +325,7 @@ void ViewPropertiesDialog::applyViewProperties()
         QList<QByteArray> visibleRoles;
         int index = 0;
         const QList<KFileItemModel::RoleInfo> rolesInfo = KFileItemModel::rolesInformation();
-        foreach (const KFileItemModel::RoleInfo& info, rolesInfo) {
+        for (const KFileItemModel::RoleInfo& info : rolesInfo) {
             const QListWidgetItem* item = m_listWidget->item(index);
              if (item->checkState() == Qt::Checked) {
                 visibleRoles.append(info.role);