diff options
author | nehlsen <nehlsen@gmail.com> | 2009-11-16 15:33:46 +0100 |
---|---|---|
committer | nehlsen <nehlsen@gmail.com> | 2009-11-16 15:33:46 +0100 |
commit | bb93f5de3c0528c8b5465a4cd706b8033f35a281 (patch) | |
tree | ef87f526918a1bd5ea8b6cfbc2bf163e08868c85 /src/bookmarkspanel/bookmarksproxy.cpp | |
parent | added bookmarks panel and model(read only atm) (diff) | |
download | rekonq-bb93f5de3c0528c8b5465a4cd706b8033f35a281.tar.xz |
made bookmarks searchable
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; +} |