diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2012-09-24 17:47:01 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2012-12-10 02:48:05 +0100 |
commit | 29e891b3b146540d69a6377f1a557b246e8b8c68 (patch) | |
tree | d5cff4e1d2ad4179013aab4dcaf366597f7702ca /src/history/historymodels.cpp | |
parent | setting a decent minimum size... (diff) | |
download | rekonq-29e891b3b146540d69a6377f1a557b246e8b8c68.tar.xz |
rekonq new tab page restored :)
Diffstat (limited to 'src/history/historymodels.cpp')
-rw-r--r-- | src/history/historymodels.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
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; +} |