From 29e891b3b146540d69a6377f1a557b246e8b8c68 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 24 Sep 2012 17:47:01 +0200 Subject: rekonq new tab page restored :) --- src/history/historymodels.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/history/historymodels.cpp') diff --git a/src/history/historymodels.cpp b/src/history/historymodels.cpp index 9ffc2643..48cdc78e 100644 --- a/src/history/historymodels.cpp +++ b/src/history/historymodels.cpp @@ -741,3 +741,35 @@ void HistoryTreeModel::sourceRowsRemoved(const QModelIndex &parent, int start, i endRemoveRows(); } } + + +// ---------------------------------------------------------------------------------------------------------- + + +UrlFilterProxyModel::UrlFilterProxyModel(QObject *parent) + : QSortFilterProxyModel(parent) +{ + setFilterCaseSensitivity(Qt::CaseInsensitive); +} + + +bool UrlFilterProxyModel::filterAcceptsRow(const int source_row, const QModelIndex &source_parent) const +{ + return recursiveMatch(sourceModel()->index(source_row, 0, source_parent)); +} + + +bool UrlFilterProxyModel::recursiveMatch(const QModelIndex &index) const +{ + if (index.data().toString().contains(filterRegExp())) + return true; + + int numChildren = sourceModel()->rowCount(index); + for (int childRow = 0; childRow < numChildren; ++childRow) + { + if (recursiveMatch(sourceModel()->index(childRow, 0, index))) + return true; + } + + return false; +} -- cgit v1.2.1