1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

opensearch: port foreach -> range-based for

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

View File

@ -644,8 +644,10 @@ void OpenSearchEngine::suggestionsObtained()
QStringList out; QStringList out;
foreach (const QVariant &v, list.at(1).toList()) const auto items = list.at(1).toList();
for (const QVariant &v : items) {
out.append(v.toString()); out.append(v.toString());
}
emit suggestions(out); emit suggestions(out);
} }

View File

@ -221,7 +221,8 @@ void SearchEnginesDialog::reloadEngines()
ui->treeWidget->clear(); ui->treeWidget->clear();
const SearchEngine defaultEngine = mApp->searchEnginesManager()->defaultEngine(); const SearchEngine defaultEngine = mApp->searchEnginesManager()->defaultEngine();
foreach (const SearchEngine &en, m_manager->allEngines()) { const auto engines = m_manager->allEngines();
for (const SearchEngine &en : engines) {
QTreeWidgetItem* item = new QTreeWidgetItem(); QTreeWidgetItem* item = new QTreeWidgetItem();
setEngine(item, en); setEngine(item, en);
changeItemToDefault(item, en == defaultEngine); changeItemToDefault(item, en == defaultEngine);

View File

@ -119,7 +119,7 @@ SearchEngine SearchEnginesManager::engineForShortcut(const QString &shortcut)
return returnEngine; return returnEngine;
} }
foreach (const Engine &en, m_allEngines) { for (const Engine &en : qAsConst(m_allEngines)) {
if (en.shortcut == shortcut) { if (en.shortcut == shortcut) {
returnEngine = en; returnEngine = en;
break; break;
@ -217,7 +217,7 @@ void SearchEnginesManager::engineChangedImage()
return; return;
} }
foreach (Engine e, m_allEngines) { for (Engine e : qAsConst(m_allEngines)) {
if (e.name == engine->name() && if (e.name == engine->name() &&
e.url.contains(engine->searchUrl("%s").toString()) && e.url.contains(engine->searchUrl("%s").toString()) &&
!engine->image().isNull() !engine->image().isNull()
@ -280,7 +280,7 @@ void SearchEnginesManager::addEngineFromForm(const QVariantMap &formData, WebVie
query.addQueryItem(inputName, QSL("SEARCH")); query.addQueryItem(inputName, QSL("SEARCH"));
const QVariantList &inputs = formData.value(QSL("inputs")).toList(); const QVariantList &inputs = formData.value(QSL("inputs")).toList();
foreach (const QVariant &pair, inputs) { for (const QVariant &pair : inputs) {
const QVariantList &list = pair.toList(); const QVariantList &list = pair.toList();
if (list.size() != 2) if (list.size() != 2)
continue; continue;
@ -496,7 +496,7 @@ void SearchEnginesManager::saveSettings()
QSqlQuery query(SqlDatabase::instance()->database()); QSqlQuery query(SqlDatabase::instance()->database());
query.exec("DELETE FROM search_engines"); query.exec("DELETE FROM search_engines");
foreach (const Engine &en, m_allEngines) { for (const Engine &en : qAsConst(m_allEngines)) {
query.prepare("INSERT INTO search_engines (name, icon, url, shortcut, suggestionsUrl, suggestionsParameters, postData) VALUES (?, ?, ?, ?, ?, ?, ?)"); query.prepare("INSERT INTO search_engines (name, icon, url, shortcut, suggestionsUrl, suggestionsParameters, postData) VALUES (?, ?, ?, ?, ?, ?, ?)");
query.addBindValue(en.name); query.addBindValue(en.name);
query.addBindValue(iconToBase64(en.icon)); query.addBindValue(iconToBase64(en.icon));