diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-11-18 11:16:39 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-11-18 11:16:39 +0100 |
commit | 7a55537201493fefdf076108e30b6be45c345719 (patch) | |
tree | abec39ef3393567652e06e3d77059a89dfe84cfa /src/bookmarkspanel/bookmarksproxy.cpp | |
parent | Activate Find with slash, too. (diff) | |
parent | made bookmarks searchable (diff) | |
download | rekonq-7a55537201493fefdf076108e30b6be45c345719.tar.xz |
Merge commit 'refs/merge-requests/2106' of git://gitorious.org/rekonq/mainline into dev04merge
Diffstat (limited to 'src/bookmarkspanel/bookmarksproxy.cpp')
-rw-r--r-- | src/bookmarkspanel/bookmarksproxy.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/bookmarkspanel/bookmarksproxy.cpp b/src/bookmarkspanel/bookmarksproxy.cpp new file mode 100644 index 00000000..87d1ce71 --- /dev/null +++ b/src/bookmarkspanel/bookmarksproxy.cpp @@ -0,0 +1,29 @@ +#include "bookmarksproxy.h" + +BookmarksProxy::BookmarksProxy( QObject *parent ): + QSortFilterProxyModel( parent ) +{ +} + +bool BookmarksProxy::filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const +{ + QModelIndex idx = sourceModel()->index( source_row, 0, source_parent ); + +// return idx.data().toString().contains( filterRegExp() ); + return recursiveMatch( idx ); +} + +bool BookmarksProxy::recursiveMatch( const QModelIndex &index ) const +{ + if( index.data().toString().contains( filterRegExp() ) ) { + return true; + } + + for( int childRow = 0; childRow < sourceModel()->rowCount( index ); ++childRow ) { + if( recursiveMatch( sourceModel()->index( childRow, 0, index ) ) ) { + return true; + } + } + + return false; +} |