summaryrefslogtreecommitdiff
path: root/src/bookmarkspanel/bookmarksproxy.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-11-18 11:16:39 +0100
committerAndrea Diamantini <adjam7@gmail.com>2009-11-18 11:16:39 +0100
commit7a55537201493fefdf076108e30b6be45c345719 (patch)
treeabec39ef3393567652e06e3d77059a89dfe84cfa /src/bookmarkspanel/bookmarksproxy.cpp
parentActivate Find with slash, too. (diff)
parentmade bookmarks searchable (diff)
downloadrekonq-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.cpp29
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;
+}