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

preferences: port foreach -> range-based for

Signed-off-by: Juraj Oravec <sgd.orava@gmail.com>
This commit is contained in:
Juraj Oravec 2019-12-30 19:00:40 +01:00
parent 6c14547656
commit ea75f18c5b
No known key found for this signature in database
GPG Key ID: 63ACB65056BC8D07
5 changed files with 12 additions and 10 deletions

View File

@ -87,10 +87,10 @@ AcceptLanguage::AcceptLanguage(QWidget* parent)
Settings settings; Settings settings;
settings.beginGroup("Language"); settings.beginGroup("Language");
QStringList langs = settings.value("acceptLanguage", defaultLanguage()).toStringList(); const QStringList langs = settings.value("acceptLanguage", defaultLanguage()).toStringList();
settings.endGroup(); settings.endGroup();
foreach (const QString &code, langs) { for (const QString &code : langs) {
QString code_ = code; QString code_ = code;
QLocale loc = QLocale(code_.replace(QLatin1Char('-'), QLatin1Char('_'))); QLocale loc = QLocale(code_.replace(QLatin1Char('-'), QLatin1Char('_')));
QString label; QString label;

View File

@ -82,10 +82,10 @@ void AutoFillManager::loadPasswords()
ui->showPasswords->setText(tr("Show Passwords")); ui->showPasswords->setText(tr("Show Passwords"));
m_passwordsShown = false; m_passwordsShown = false;
QVector<PasswordEntry> allEntries = mApp->autoFill()->getAllFormData(); const QVector<PasswordEntry> allEntries = mApp->autoFill()->getAllFormData();
ui->treePass->clear(); ui->treePass->clear();
foreach (const PasswordEntry &entry, allEntries) { for (const PasswordEntry &entry : allEntries) {
QTreeWidgetItem* item = new QTreeWidgetItem(ui->treePass); QTreeWidgetItem* item = new QTreeWidgetItem(ui->treePass);
item->setText(0, entry.host); item->setText(0, entry.host);
item->setText(1, entry.username); item->setText(1, entry.username);

View File

@ -101,7 +101,7 @@ void PluginsManager::refresh()
const QList<Plugins::Plugin> &allPlugins = mApp->plugins()->availablePlugins(); const QList<Plugins::Plugin> &allPlugins = mApp->plugins()->availablePlugins();
foreach (const Plugins::Plugin &plugin, allPlugins) { for (const Plugins::Plugin &plugin : allPlugins) {
PluginSpec spec = plugin.pluginSpec; PluginSpec spec = plugin.pluginSpec;
QListWidgetItem* item = new QListWidgetItem(ui->list); QListWidgetItem* item = new QListWidgetItem(ui->list);

View File

@ -209,7 +209,8 @@ Preferences::Preferences(BrowserWindow* window)
ui->activeProfile->setText("<b>" + ProfileManager::currentProfile() + "</b>"); ui->activeProfile->setText("<b>" + ProfileManager::currentProfile() + "</b>");
ui->startProfile->addItem(startingProfile); ui->startProfile->addItem(startingProfile);
foreach (const QString &name, ProfileManager::availableProfiles()) { const auto names = ProfileManager::availableProfiles();
for (const QString &name : names) {
if (startingProfile != name) { if (startingProfile != name) {
ui->startProfile->addItem(name); ui->startProfile->addItem(name);
} }
@ -295,7 +296,8 @@ Preferences::Preferences(BrowserWindow* window)
ui->webRTCPublicIpOnly->setChecked(settings.value("WebRTCPublicIpOnly", true).toBool()); ui->webRTCPublicIpOnly->setChecked(settings.value("WebRTCPublicIpOnly", true).toBool());
ui->dnsPrefetch->setChecked(settings.value("DNSPrefetch", true).toBool()); ui->dnsPrefetch->setChecked(settings.value("DNSPrefetch", true).toBool());
foreach (int level, WebView::zoomLevels()) { const auto levels = WebView::zoomLevels();
for (int level : levels) {
ui->defaultZoomLevel->addItem(QString("%1%").arg(level)); ui->defaultZoomLevel->addItem(QString("%1%").arg(level));
} }
ui->defaultZoomLevel->setCurrentIndex(settings.value("DefaultZoomLevel", WebView::zoomLevels().indexOf(100)).toInt()); ui->defaultZoomLevel->setCurrentIndex(settings.value("DefaultZoomLevel", WebView::zoomLevels().indexOf(100)).toInt());

View File

@ -45,10 +45,10 @@ ThemeManager::ThemeManager(QWidget* parent, Preferences* preferences)
const QStringList themePaths = DataPaths::allPaths(DataPaths::Themes); const QStringList themePaths = DataPaths::allPaths(DataPaths::Themes);
foreach (const QString &path, themePaths) { for (const QString &path : themePaths) {
QDir dir(path); QDir dir(path);
QStringList list = dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot); const QStringList list = dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
foreach (const QString &name, list) { for (const QString &name : list) {
Theme themeInfo = parseTheme(dir.absoluteFilePath(name) + QLatin1Char('/'), name); Theme themeInfo = parseTheme(dir.absoluteFilePath(name) + QLatin1Char('/'), name);
if (!themeInfo.isValid) { if (!themeInfo.isValid) {
continue; continue;