1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

history: port foreach -> range-based for

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

View File

@ -148,7 +148,7 @@ void History::deleteHistoryEntry(const QList<int> &list)
QSqlDatabase db = SqlDatabase::instance()->database();
db.transaction();
foreach (int index, list) {
for (int index : list) {
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("SELECT count, date, url, title FROM history WHERE id=?");
query.addBindValue(index);

View File

@ -121,7 +121,7 @@ void HistoryMenu::aboutToShowMostVisited()
const QVector<HistoryEntry> mostVisited = mApp->history()->mostVisited(10);
foreach (const HistoryEntry &entry, mostVisited) {
for (const HistoryEntry &entry : mostVisited) {
Action* act = new Action(QzTools::truncatedText(entry.title, 40));
act->setData(entry.url);
act->setIcon(IconProvider::iconForUrl(entry.url));

View File

@ -236,7 +236,7 @@ HistoryItem* HistoryModel::itemFromIndex(const QModelIndex &index) const
void HistoryModel::removeTopLevelIndexes(const QList<QPersistentModelIndex> &indexes)
{
foreach (const QPersistentModelIndex &index, indexes) {
for (const QPersistentModelIndex &index : indexes) {
if (index.parent().isValid()) {
continue;
}
@ -321,7 +321,7 @@ void HistoryModel::fetchMore(const QModelIndex &parent)
beginInsertRows(parent, 0, list.size() - 1);
foreach (const HistoryEntry &entry, list) {
for (const HistoryEntry &entry : qAsConst(list)) {
HistoryItem* newItem = new HistoryItem(parentItem);
newItem->historyEntry = entry;
}

View File

@ -105,7 +105,8 @@ void HistoryTreeView::removeSelectedItems()
QList<QPersistentModelIndex> topLevelIndexes;
foreach (const QModelIndex &index, selectedIndexes()) {
const auto indexes = selectedIndexes();
for (const QModelIndex &index : indexes) {
if (index.column() > 0) {
continue;
}