Q_FOREACH porting.
This commit is contained in:
parent
78c4b09467
commit
e7ac5e5fa2
|
@ -165,7 +165,8 @@ QStringList EditMountPointDialogWidget::options() const
|
|||
{
|
||||
QStringList optList = m_Options.split(QStringLiteral(","), QString::SkipEmptyParts);
|
||||
|
||||
foreach(const auto &s, boxOptions().keys())
|
||||
const auto keys = boxOptions().keys();
|
||||
for (const auto &s : keys)
|
||||
if (boxOptions()[s]->isChecked())
|
||||
optList.append(s);
|
||||
|
||||
|
@ -265,7 +266,8 @@ bool EditMountPointDialogWidget::writeMountpoints(const QString& filename)
|
|||
qWarning() << "could not open output file " << newFilename;
|
||||
rval = false;
|
||||
} else {
|
||||
foreach(const auto &me, mountPoints())
|
||||
const auto mp = mountPoints();
|
||||
for (const auto &me : mp)
|
||||
writeEntry(out, me);
|
||||
|
||||
out.close();
|
||||
|
|
|
@ -755,7 +755,8 @@ void MainWindow::updateSeletedDeviceMenu()
|
|||
|
||||
devicesMenu->setEnabled(!operationStack().previewDevices().isEmpty());
|
||||
|
||||
foreach(auto const &d, operationStack().previewDevices()) {
|
||||
const auto previewDevices = operationStack().previewDevices();
|
||||
for (auto const &d : previewDevices) {
|
||||
QAction* action = new QAction(d->prettyName(), devicesMenu);
|
||||
action->setCheckable(true);
|
||||
action->setChecked(d->deviceNode() == pmWidget().selectedDevice()->deviceNode());
|
||||
|
@ -773,7 +774,8 @@ void MainWindow::onSelectedDeviceMenuTriggered(bool)
|
|||
if (action == nullptr || action->parent() != devicesMenu)
|
||||
return;
|
||||
|
||||
foreach(auto &entry, devicesMenu->findChildren<QAction*>())
|
||||
const auto children = devicesMenu->findChildren<QAction*>();
|
||||
for (auto &entry : children)
|
||||
entry->setChecked(entry == action);
|
||||
|
||||
listDevices().setSelectedDevice(action->data().toString());
|
||||
|
@ -783,7 +785,8 @@ void MainWindow::on_m_ListDevices_selectionChanged(const QString& device_node)
|
|||
{
|
||||
QMenu* devicesMenu = static_cast<QMenu*>(guiFactory()->container(QStringLiteral("selectedDevice"), this));
|
||||
|
||||
foreach(auto &entry, devicesMenu->findChildren<QAction*>())
|
||||
const auto children = devicesMenu->findChildren<QAction*>();
|
||||
for (auto &entry : children)
|
||||
entry->setChecked(entry->data().toString() == device_node);
|
||||
}
|
||||
|
||||
|
@ -804,7 +807,8 @@ void MainWindow::onApplyAllOperations()
|
|||
{
|
||||
QStringList opList;
|
||||
|
||||
foreach(const auto &op, operationStack().operations())
|
||||
const auto operations = operationStack().operations();
|
||||
for (const auto &op : operations)
|
||||
opList.append(op->description());
|
||||
|
||||
if (KMessageBox::warningContinueCancelList(this,
|
||||
|
@ -1283,7 +1287,8 @@ void MainWindow::checkFileSystemSupport()
|
|||
KLocalizedString supportList, supportInNode;
|
||||
bool missingSupportTools = false;
|
||||
|
||||
foreach(auto const &d, operationStack().previewDevices()) {
|
||||
const auto previewDevices = operationStack().previewDevices();
|
||||
for (auto const &d : previewDevices ) {
|
||||
supportInNode = checkSupportInNode(d->partitionTable());
|
||||
if (!supportInNode.isEmpty() && !supportList.isEmpty()) {
|
||||
missingSupportTools = true;
|
||||
|
|
|
@ -189,7 +189,8 @@ void PartitionManagerWidget::setSelectedDevice(const QString& deviceNode)
|
|||
{
|
||||
QReadLocker lockDevices(&operationStack().lock());
|
||||
|
||||
foreach(auto &d, operationStack().previewDevices()) {
|
||||
const auto previewDevices = operationStack().previewDevices();
|
||||
for (const auto &d : previewDevices) {
|
||||
if (d->deviceNode() == deviceNode) {
|
||||
setSelectedDevice(d);
|
||||
return;
|
||||
|
@ -266,10 +267,11 @@ void PartitionManagerWidget::updatePartitions()
|
|||
treePartitions().addTopLevelItem(deviceItem);
|
||||
|
||||
if (selectedDevice()->partitionTable() != nullptr) {
|
||||
foreach(auto const * p, selectedDevice()->partitionTable()->children()) {
|
||||
const auto children = selectedDevice()->partitionTable()->children();
|
||||
for (const auto * p : children) {
|
||||
QTreeWidgetItem* item = createTreeWidgetItem(*p);
|
||||
|
||||
for (auto const &child : p->children()) {
|
||||
for (const auto &child : p->children()) {
|
||||
QTreeWidgetItem* childItem = createTreeWidgetItem(*child);
|
||||
item->addChild(childItem);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ public:
|
|||
|
||||
m_PartWidget->setFileSystemColorCode(GuiHelpers::fileSystemColorCodesFromSettings());
|
||||
MainWindow* mw = nullptr;
|
||||
foreach( auto &widget, qApp->topLevelWidgets() )
|
||||
const auto widgets = qApp->topLevelWidgets();
|
||||
for (auto &widget : widgets)
|
||||
{
|
||||
mw = qobject_cast< MainWindow* >( widget );
|
||||
if ( mw )
|
||||
|
|
|
@ -71,7 +71,8 @@ void PartTableWidget::setPartitionTable(const PartitionTable* ptable)
|
|||
|
||||
PartWidget* PartTableWidget::activeWidget()
|
||||
{
|
||||
foreach(auto &pw, findChildren<PartWidget*>())
|
||||
const auto children = findChildren<PartWidget*>();
|
||||
for (auto &pw : children)
|
||||
if (pw->isActive())
|
||||
return pw;
|
||||
|
||||
|
@ -80,7 +81,8 @@ PartWidget* PartTableWidget::activeWidget()
|
|||
|
||||
const PartWidget* PartTableWidget::activeWidget() const
|
||||
{
|
||||
foreach(auto const &pw, findChildren<PartWidget*>())
|
||||
const auto children = findChildren<PartWidget*>();
|
||||
for (const auto &pw : children)
|
||||
if (pw->isActive())
|
||||
return pw;
|
||||
|
||||
|
@ -114,7 +116,8 @@ void PartTableWidget::setActivePartition(const Partition* p)
|
|||
if (isReadOnly())
|
||||
return;
|
||||
|
||||
foreach(auto &pw, findChildren<PartWidget*>()) {
|
||||
const auto children = findChildren<PartWidget*>();
|
||||
for (auto &pw : children) {
|
||||
if (pw->partition() == p) {
|
||||
setActiveWidget(pw);
|
||||
return;
|
||||
|
@ -135,7 +138,7 @@ void PartTableWidget::clear()
|
|||
// that its event handler is currently running. therefore, do not delete
|
||||
// the part widgets here but schedule them for deletion once the app
|
||||
// returns to the main loop (and the event handler has finished).
|
||||
foreach(auto &p, childWidgets()) {
|
||||
for (auto &p : childWidgets()) {
|
||||
p->setVisible(false);
|
||||
p->deleteLater();
|
||||
p->setParent(nullptr);
|
||||
|
|
|
@ -339,7 +339,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(const auto &box, dialogWidget().findChildren<QAbstractSpinBox*>() + detailsWidget().findChildren<QAbstractSpinBox*>())
|
||||
const auto children = dialogWidget().findChildren<QAbstractSpinBox*>() + detailsWidget().findChildren<QAbstractSpinBox*>();
|
||||
for (const auto &box : children)
|
||||
box->setKeyboardTracking(!align);
|
||||
|
||||
if (align) {
|
||||
|
|
Loading…
Reference in New Issue