Convert some more for loops to ranged based loop.
This commit is contained in:
parent
a379c4ab31
commit
5267f9825a
|
@ -37,7 +37,7 @@ QString AdvancedPageWidget::backend() const
|
|||
{
|
||||
const KService::List services = CoreBackendManager::self()->list();
|
||||
|
||||
for (auto const &p : services)
|
||||
for (const auto &p : services)
|
||||
if (p->name() == comboBackend().currentText())
|
||||
return p->library();
|
||||
|
||||
|
@ -48,7 +48,7 @@ void AdvancedPageWidget::setBackend(const QString& name)
|
|||
{
|
||||
const KService::List services = CoreBackendManager::self()->list();
|
||||
|
||||
for (auto const &p : services)
|
||||
for (const auto &p : services)
|
||||
if (p->library() == name)
|
||||
comboBackend().setCurrentIndex(comboBackend().findText(p->name()));
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ void AdvancedPageWidget::setBackend(const QString& name)
|
|||
void AdvancedPageWidget::setupDialog()
|
||||
{
|
||||
const KService::List services = CoreBackendManager::self()->list();
|
||||
for (auto const &p : services)
|
||||
for (const auto &p : services)
|
||||
comboBackend().addItem(p->name());
|
||||
|
||||
setBackend(Config::backend());
|
||||
|
|
|
@ -47,13 +47,13 @@ void GeneralPageWidget::setDefaultFileSystem(FileSystem::Type t)
|
|||
void GeneralPageWidget::setupDialog()
|
||||
{
|
||||
QStringList fsNames;
|
||||
for (const FileSystem * fs : FileSystemFactory::map())
|
||||
for (const auto &fs : FileSystemFactory::map())
|
||||
if (fs->supportCreate() != FileSystem::cmdSupportNone && fs->type() != FileSystem::Extended && fs->type() != FileSystem::Luks)
|
||||
fsNames.append(fs->name());
|
||||
|
||||
qSort(fsNames.begin(), fsNames.end(), caseInsensitiveLessThan);
|
||||
|
||||
for (const QString & fsName : fsNames)
|
||||
for (const auto &fsName : fsNames)
|
||||
comboDefaultFileSystem().addItem(createFileSystemColor(FileSystem::typeForName(fsName), 8), fsName);
|
||||
|
||||
setDefaultFileSystem(GuiHelpers::defaultFileSystem());
|
||||
|
|
|
@ -58,7 +58,7 @@ QStringList EditMountOptionsDialog::options()
|
|||
{
|
||||
QStringList rval;
|
||||
const QStringList lines = widget().editOptions().toPlainText().split(QStringLiteral("\n"));
|
||||
for (auto const &line : lines)
|
||||
for (const auto &line : lines)
|
||||
rval.append(line.simplified().toLower());
|
||||
return rval;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,6 @@ EditMountOptionsDialogWidget::EditMountOptionsDialogWidget(QWidget* parent, cons
|
|||
{
|
||||
setupUi(this);
|
||||
|
||||
for (auto const &o : options)
|
||||
for (const auto &o : options)
|
||||
editOptions().appendPlainText(o);
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ void EditMountPointDialogWidget::setupOptions(const QStringList& options)
|
|||
{
|
||||
QStringList optTmpList;
|
||||
|
||||
for (auto const &o : options) {
|
||||
for (const auto &o : options) {
|
||||
if (boxOptions().find(o) != boxOptions().end())
|
||||
boxOptions()[o]->setChecked(true);
|
||||
else
|
||||
|
@ -162,11 +162,11 @@ void EditMountPointDialogWidget::buttonMoreClicked(bool)
|
|||
delete dlg;
|
||||
}
|
||||
|
||||
QStringList EditMountPointDialogWidget::options()
|
||||
QStringList EditMountPointDialogWidget::options() const
|
||||
{
|
||||
QStringList optList = m_Options.split(QStringLiteral(","), QString::SkipEmptyParts);
|
||||
|
||||
foreach(auto const &s, boxOptions().keys())
|
||||
foreach(const auto &s, boxOptions().keys())
|
||||
if (boxOptions()[s]->isChecked())
|
||||
optList.append(s);
|
||||
|
||||
|
@ -266,7 +266,7 @@ bool EditMountPointDialogWidget::writeMountpoints(const QString& filename)
|
|||
qWarning() << "could not open output file " << newFilename;
|
||||
rval = false;
|
||||
} else {
|
||||
foreach(auto const &me, mountPoints())
|
||||
foreach(const auto &me, mountPoints())
|
||||
writeEntry(out, me);
|
||||
|
||||
out.close();
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
QLabel& labelType() {
|
||||
return *m_LabelTypeValue;
|
||||
}
|
||||
QStringList options();
|
||||
QStringList options() const;
|
||||
QRadioButton& radioUUID() {
|
||||
return *m_RadioUUID;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ void FileSystemSupportDialog::setupDialog()
|
|||
|
||||
dialogWidget().tree().clear();
|
||||
|
||||
for (auto const &fs : FileSystemFactory::map()) {
|
||||
for (const auto &fs : FileSystemFactory::map()) {
|
||||
if (fs->type() == FileSystem::Unknown || fs->type() == FileSystem::Extended || fs->type() == FileSystem::Luks)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ void ListOperations::updateOperations(const OperationStack::Operations& ops)
|
|||
{
|
||||
listOperations().clear();
|
||||
|
||||
for (auto const &op : ops) {
|
||||
for (const auto &op : ops) {
|
||||
QListWidgetItem* item = new QListWidgetItem(QIcon::fromTheme(op->iconName()).pixmap(IconSize(KIconLoader::Small)), op->description());
|
||||
item->setToolTip(op->description());
|
||||
listOperations().addItem(item);
|
||||
|
|
|
@ -73,7 +73,7 @@ NewDialog::~NewDialog()
|
|||
void NewDialog::setupDialog()
|
||||
{
|
||||
QStringList fsNames;
|
||||
for (auto const &fs : FileSystemFactory::map()) {
|
||||
for (const auto &fs : FileSystemFactory::map()) {
|
||||
if (fs->supportCreate() != FileSystem::cmdSupportNone &&
|
||||
fs->type() != FileSystem::Extended &&
|
||||
fs->type() != FileSystem::Luks)
|
||||
|
@ -82,7 +82,7 @@ void NewDialog::setupDialog()
|
|||
|
||||
qSort(fsNames.begin(), fsNames.end(), caseInsensitiveLessThan);
|
||||
|
||||
foreach (auto const &fsName, fsNames)
|
||||
foreach (const auto &fsName, fsNames)
|
||||
dialogWidget().comboFileSystem().addItem(createFileSystemColor(FileSystem::typeForName(fsName), 8), fsName);
|
||||
|
||||
QString selected = FileSystem::nameForType(GuiHelpers::defaultFileSystem());
|
||||
|
|
|
@ -327,11 +327,11 @@ void PartitionManagerWidget::on_m_PartTableWidget_itemSelectionChanged(PartWidge
|
|||
if (p) {
|
||||
QList<QTreeWidgetItem*> findResult = treePartitions().findItems(p->deviceNode(), Qt::MatchFixedString | Qt::MatchRecursive, 0);
|
||||
|
||||
for (int idx = 0; idx < findResult.size(); idx++) {
|
||||
const PartitionTreeWidgetItem* ptwItem = dynamic_cast<PartitionTreeWidgetItem*>(findResult[idx]);
|
||||
for (const auto &item : findResult) {
|
||||
const PartitionTreeWidgetItem* ptwItem = dynamic_cast<PartitionTreeWidgetItem*>(item);
|
||||
|
||||
if (ptwItem && ptwItem->partition() == p) {
|
||||
treePartitions().setCurrentItem(findResult[idx]);
|
||||
treePartitions().setCurrentItem(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -280,7 +280,7 @@ void PartPropsDialog::setupFileSystemComboBox()
|
|||
QString selected;
|
||||
QStringList fsNames;
|
||||
|
||||
for(const FileSystem * fs : FileSystemFactory::map())
|
||||
for(const auto &fs : FileSystemFactory::map())
|
||||
{
|
||||
// If the partition isn't encrypted, skip the luks FS
|
||||
if (fs->type() == FileSystem::Luks && partition().fileSystem().type() != FileSystem::Luks)
|
||||
|
@ -312,7 +312,7 @@ void PartPropsDialog::setupFileSystemComboBox()
|
|||
|
||||
qSort(fsNames.begin(), fsNames.end(), caseInsensitiveLessThan);
|
||||
|
||||
for (const QString & fsName : fsNames)
|
||||
for (const auto &fsName : fsNames)
|
||||
dialogWidget().fileSystem().addItem(createFileSystemColor(FileSystem::typeForName(fsName), 8), fsName);
|
||||
|
||||
dialogWidget().fileSystem().setCurrentIndex(dialogWidget().fileSystem().findText(selected));
|
||||
|
|
|
@ -51,7 +51,7 @@ void PartTableWidget::setPartitionTable(const PartitionTable* ptable)
|
|||
m_PartitionTable = ptable;
|
||||
|
||||
if (partitionTable() != nullptr) {
|
||||
for (auto const &p : partitionTable()->children()) {
|
||||
for (const auto &p : partitionTable()->children()) {
|
||||
PartWidget* w = new PartWidget(this, p);
|
||||
w->setVisible(true);
|
||||
w->setFileSystemColorCode(GuiHelpers::fileSystemColorCodesFromSettings());
|
||||
|
|
|
@ -58,7 +58,7 @@ void ResizeVolumeDialog::setupDialog()
|
|||
{
|
||||
if (dialogWidget().volumeType().currentText() == QStringLiteral("LVM")) {
|
||||
dialogWidget().listPV().addPartitionList(device().deviceNodeList(), true);
|
||||
for (auto const &pvpath : FS::lvm2_pv::getFreePV()) {
|
||||
for (const auto &pvpath : FS::lvm2_pv::getFreePV()) {
|
||||
if (!LvmDevice::s_DirtyPVs.contains(pvpath)) {
|
||||
dialogWidget().listPV().addPartition(pvpath, false);
|
||||
}
|
||||
|
|
|
@ -337,9 +337,8 @@ void SizeDialogBase::onAlignToggled(bool align)
|
|||
dialogWidget().spinCapacity().setSingleStep(capacityStep);
|
||||
|
||||
// if align is on, turn off keyboard tracking for all spin boxes to avoid the two clashing
|
||||
foreach(auto &box, dialogWidget().findChildren<QAbstractSpinBox*>() +
|
||||
detailsWidget().findChildren<QAbstractSpinBox*>())
|
||||
box->setKeyboardTracking(!align);
|
||||
foreach(const auto &box, dialogWidget().findChildren<QAbstractSpinBox*>() + detailsWidget().findChildren<QAbstractSpinBox*>())
|
||||
box->setKeyboardTracking(!align);
|
||||
|
||||
if (align) {
|
||||
onSpinFirstSectorChanged(partition().firstSector());
|
||||
|
|
|
@ -115,7 +115,7 @@ void SmartDialog::setupDialog()
|
|||
|
||||
const QString st = QStringLiteral("<span style=\"font-family:%1;font-size:%2;\">").arg(f.family()).arg(size);
|
||||
|
||||
for (auto const &a : device().smartStatus().attributes()) {
|
||||
for (const auto &a : device().smartStatus().attributes()) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(
|
||||
QStringList()
|
||||
<< QLocale().toString(a.id())
|
||||
|
@ -180,7 +180,7 @@ QString SmartDialog::toHtml() const
|
|||
|
||||
s << "<table>\n";
|
||||
|
||||
for (auto const &a : device().smartStatus().attributes()) {
|
||||
for (const auto &a : device().smartStatus().attributes()) {
|
||||
s << "<tr>\n";
|
||||
|
||||
s << "<td>" << QLocale().toString(a.id()) << "</td>\n"
|
||||
|
|
|
@ -116,8 +116,8 @@ QString suCommand()
|
|||
const QString candidates[] = { QStringLiteral(CMAKE_INSTALL_FULL_LIBEXECDIR_KF5"/kdesu"), QStringLiteral("kdesu"), QStringLiteral("kdesudo"), QStringLiteral("gksudo"), QStringLiteral("gksu") };
|
||||
QString rval;
|
||||
|
||||
for (quint32 i = 0; i < sizeof(candidates) / sizeof(candidates[0]); i++) {
|
||||
rval = QStandardPaths::findExecutable(candidates[i]);
|
||||
for (const auto &candidate : candidates) {
|
||||
rval = QStandardPaths::findExecutable(candidate);
|
||||
if (QFileInfo(rval).isExecutable())
|
||||
return rval;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue