1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-13 10:32:11 +01:00

app: port foreach -> range-based for

Signed-off-by: Juraj Oravec <sgd.orava@gmail.com>
This commit is contained in:
Juraj Oravec 2019-12-30 21:29:24 +01:00
parent ef48b4725e
commit e34933b5d7
No known key found for this signature in database
GPG Key ID: 63ACB65056BC8D07
2 changed files with 10 additions and 7 deletions

View File

@ -229,7 +229,7 @@ BrowserWindow::~BrowserWindow()
{ {
mApp->plugins()->emitMainWindowDeleted(this); mApp->plugins()->emitMainWindowDeleted(this);
foreach (const QPointer<QWidget> &pointer, m_deleteOnCloseWidgets) { for (const QPointer<QWidget> &pointer : qAsConst(m_deleteOnCloseWidgets)) {
if (pointer) { if (pointer) {
pointer->deleteLater(); pointer->deleteLater();
} }
@ -527,7 +527,7 @@ void BrowserWindow::createEncodingSubMenu(const QString &name, QStringList &code
QActionGroup *group = new QActionGroup(subMenu); QActionGroup *group = new QActionGroup(subMenu);
foreach (const QString &codecName, codecNames) { for (const QString &codecName : qAsConst(codecNames)) {
QAction *act = createEncodingAction(codecName, activeCodecName, subMenu); QAction *act = createEncodingAction(codecName, activeCodecName, subMenu);
group->addAction(act); group->addAction(act);
subMenu->addAction(act); subMenu->addAction(act);
@ -1084,7 +1084,8 @@ void BrowserWindow::createEncodingMenu(QMenu* menu)
QStringList otherCodecs; QStringList otherCodecs;
QStringList allCodecs; QStringList allCodecs;
foreach (const int mib, QTextCodec::availableMibs()) { const auto mibs = QTextCodec::availableMibs();
for (const int mib : mibs) {
const QString codecName = QString::fromUtf8(QTextCodec::codecForMib(mib)->name()); const QString codecName = QString::fromUtf8(QTextCodec::codecForMib(mib)->name());
if (!allCodecs.contains(codecName)) if (!allCodecs.contains(codecName))
@ -1119,7 +1120,7 @@ void BrowserWindow::createEncodingMenu(QMenu* menu)
void BrowserWindow::removeActions(const QList<QAction *> &actions) void BrowserWindow::removeActions(const QList<QAction *> &actions)
{ {
foreach (QAction *action, actions) { for (QAction *action : actions) {
removeAction(action); removeAction(action);
} }
} }

View File

@ -155,7 +155,8 @@ MainApplication::MainApplication(int &argc, char** argv)
if (argc > 1) { if (argc > 1) {
CommandLineOptions cmd; CommandLineOptions cmd;
foreach (const CommandLineOptions::ActionPair &pair, cmd.getActions()) { const auto actions = cmd.getActions();
for (const CommandLineOptions::ActionPair &pair : actions) {
switch (pair.action) { switch (pair.action) {
case Qz::CL_StartWithoutAddons: case Qz::CL_StartWithoutAddons:
noAddons = true; noAddons = true;
@ -255,7 +256,7 @@ MainApplication::MainApplication(int &argc, char** argv)
if (isRunning()) { if (isRunning()) {
m_isClosing = true; m_isClosing = true;
foreach (const QString &message, messages) { for (const QString &message : qAsConst(messages)) {
sendMessage(message); sendMessage(message);
} }
return; return;
@ -457,7 +458,8 @@ void MainApplication::openSession(BrowserWindow* window, RestoreData &restoreDat
window->restoreWindow(restoreData.windows.takeAt(0)); window->restoreWindow(restoreData.windows.takeAt(0));
} }
foreach (const BrowserWindow::SavedWindow &data, restoreData.windows) { const auto restoreWindows = restoreData.windows;
for (const BrowserWindow::SavedWindow &data : restoreWindows) {
BrowserWindow* window = createWindow(Qz::BW_OtherRestoredWindow); BrowserWindow* window = createWindow(Qz::BW_OtherRestoredWindow);
window->restoreWindow(data); window->restoreWindow(data);
} }