mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-24 04:36:34 +01:00
navigation: port foreach -> range-based for
Signed-off-by: Juraj Oravec <sgd.orava@gmail.com>
This commit is contained in:
parent
aa039b8579
commit
991e0b952e
@ -279,7 +279,7 @@ int LocationCompleterDelegate::viewItemDrawText(QPainter *p, const QStyleOptionV
|
||||
// Look for longer parts first
|
||||
std::sort(searchStrings.begin(), searchStrings.end(), sizeBiggerThan);
|
||||
|
||||
foreach (const QString &string, searchStrings) {
|
||||
for (const QString &string : qAsConst(searchStrings)) {
|
||||
int delimiter = text.indexOf(string, 0, Qt::CaseInsensitive);
|
||||
|
||||
while (delimiter != -1) {
|
||||
|
@ -126,7 +126,7 @@ QSqlQuery LocationCompleterModel::createHistoryQuery(const QString &searchString
|
||||
sqlQuery.addBindValue(QString("%%1%").arg(searchString));
|
||||
}
|
||||
else {
|
||||
foreach (const QString &str, searchList) {
|
||||
for (const QString &str : qAsConst(searchList)) {
|
||||
sqlQuery.addBindValue(QString("%%1%").arg(str));
|
||||
sqlQuery.addBindValue(QString("%%1%").arg(str));
|
||||
}
|
||||
@ -150,7 +150,7 @@ void LocationCompleterModel::setTabPosition(QStandardItem* item) const
|
||||
const QUrl url = item->data(UrlRole).toUrl();
|
||||
const QList<BrowserWindow*> windows = mApp->windows();
|
||||
|
||||
foreach (BrowserWindow* window, windows) {
|
||||
for (BrowserWindow* window : windows) {
|
||||
QList<WebTab*> tabs = window->tabWidget()->allTabs();
|
||||
for (int i = 0; i < tabs.count(); ++i) {
|
||||
WebTab* tab = tabs.at(i);
|
||||
|
@ -100,7 +100,7 @@ void LocationCompleterRefreshJob::runJob()
|
||||
}
|
||||
|
||||
// Load all icons into QImage
|
||||
foreach (QStandardItem* item, m_items) {
|
||||
for (QStandardItem* item : qAsConst(m_items)) {
|
||||
if (m_jobCancelled) {
|
||||
return;
|
||||
}
|
||||
@ -151,9 +151,9 @@ void LocationCompleterRefreshJob::completeFromHistory()
|
||||
// Search in bookmarks
|
||||
if (showType == HistoryAndBookmarks || showType == Bookmarks) {
|
||||
const int bookmarksLimit = 10;
|
||||
QList<BookmarkItem*> bookmarks = mApp->bookmarks()->searchBookmarks(m_searchString, bookmarksLimit);
|
||||
const QList<BookmarkItem*> bookmarks = mApp->bookmarks()->searchBookmarks(m_searchString, bookmarksLimit);
|
||||
|
||||
foreach (BookmarkItem* bookmark, bookmarks) {
|
||||
for (BookmarkItem* bookmark : bookmarks) {
|
||||
Q_ASSERT(bookmark->isUrl());
|
||||
|
||||
// Keyword bookmark replaces visit/search item
|
||||
|
@ -112,7 +112,7 @@ void WebSearchBar::aboutToShowMenu()
|
||||
|
||||
m_window->weView()->page()->runJavaScript(Scripts::getOpenSearchLinks(), WebPage::SafeJsWorld, [this, menu](const QVariant &res) {
|
||||
const QVariantList &list = res.toList();
|
||||
Q_FOREACH (const QVariant &val, list) {
|
||||
for (const QVariant &val : list) {
|
||||
const QVariantMap &link = val.toMap();
|
||||
QUrl url = m_window->weView()->url().resolved(link.value(QSL("url")).toUrl());
|
||||
QString title = link.value(QSL("title")).toString();
|
||||
@ -174,7 +174,8 @@ void WebSearchBar::setupEngines()
|
||||
|
||||
m_boxSearchType->clearItems();
|
||||
|
||||
foreach (const SearchEngine &en, m_searchManager->allEngines()) {
|
||||
const auto engines = m_searchManager->allEngines();
|
||||
for (const SearchEngine &en : engines) {
|
||||
ButtonWithMenu::Item item;
|
||||
item.icon = en.icon;
|
||||
item.text = en.name;
|
||||
|
Loading…
Reference in New Issue
Block a user